Summary of Contents for Analog Devices VisualDSP++ 3.5
Page 1
W 3.5 Linker and Utilities Manual for 16-Bit Processors Revision 1.0, October 2003 Part Number 82-000035-07 Analog Devices, Inc. One Technology Way Norwood, Mass. 02062-9106...
Analog Devices, Inc. Printed in the USA. Disclaimer Analog Devices, Inc. reserves the right to change this product without prior notice. Information furnished by Analog Devices is believed to be accurate and reliable. However, no responsibility is assumed by Analog Devices for its use;...
Online Technical Documentation ..........xxii From VisualDSP++ ............. xxii From Windows ..............xxiii From the Web ..............xxiii Printed Manuals ..............xxiv VisualDSP++ Documentation Set ........xxiv Hardware Manuals ............. xxiv Data Sheets ................ xxiv VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 4
Project Builds ................. 2-6 Expert Linker ................2-9 Linker Warning and Error Messages ........2-10 Link Target Description .............. 2-11 Representing Memory Architecture ........2-11 ADSP-BF535 Processor Memory Architecture Overview ..2-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 8
Efficient Packing ............3-35 Inefficient Packing: Null Bytes ........3-36 Overlay Packing Formats ..........3-37 Trivial Packing: No Reordering ........3-37 PAGE_INPUT() ..............3-37 PAGE_OUTPUT() ............... 3-38 PLIT{} .................. 3-38 PROCESSOR{} ..............3-39 viii VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 9
Mapping an Input Section to an Output Section ....4-14 Viewing Icons and Colors ............4-14 Sorting Objects ..............4-17 Memory Map Pane ..............4-18 Context Menu ............... 4-20 Tree View Memory Map Representation ......... 4-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 10
Managing Packing Properties ..........4-64 Managing Alignment and Fill Properties ........ 4-65 Managing Overlay Properties ..........4-67 Managing Stack and Heap in Processor Memory ....4-69 MEMORY OVERLAYS AND ADVANCED LDF COMMANDS Overview ..................5-2 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 11
Ungrouped Overlay Execution ........... 5-31 Grouped Overlay Execution ..........5-33 PLIT{} .................. 5-34 PLIT Syntax ..............5-34 Command Evaluation and Setup ........5-35 Allocating Space for PLITs ..........5-36 PLIT Example ..............5-37 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 12
Archiver Command-Line Reference ..........6-11 elfar Command Syntax ............6-11 Archiver Parameters and Switches .......... 6-12 Command-Line Constraints ..........6-14 Archiver Symbol Name Encryption ........6-15 FILE FORMATS Source Files .................. A-2 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 13
Disassembling a Library Member ..........B-3 Dumping Overlay Library Files ..........B-4 LDF PROGRAMMING EXAMPLES FOR BLACKFIN PROCESSORS Linking for a Single-Processor System ........... C-2 Linking Large Uninitialized or Zero-initialized Variables ....C-4 VisualDSP++ 3.5 Linker and Utilities Manual xiii for 16-Bit Processors...
Page 14
Linking a Simple C-Based Source File .......... D-9 Linking Overlay Memory for an ADSP-2191 System ....D-16 Linking an ADSP-219x MP System With Shared Memory ..D-19 Overlays Used With ADSP-218x DSPs ........D-23 INDEX VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Thank you for purchasing Analog Devices development software for digi- tal signal processors (DSPs). Purpose of This Manual The VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors contains information about the linker and utilities programs for 16-bit ® fixed-point Blackfin processors and ADSP-21xx DSPs.
Programmers who are unfamiliar with Analog Devices DSPs can use this manual but should supplement it with other texts, such as Hardware Reference and Instruction Set Reference manu- als, that describe your target architecture.
Loader/splitter information is now available in separate Loader manuals for appropriate target processor families. Refer to VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors for infor- mation on all new and updated features and other release information. VisualDSP++ 3.5 Linker and Utilities Manual...
• Phone questions to 1-800-ANALOGD • Contact your ADI local sales office or authorized distributor • Send questions by mail to: Analog Devices, Inc. One Technology Way P.O. Box 9106 Norwood, MA 02062-9106 xviii VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Preface Supported Processors Blackfin Processors The name “Blackfin” refers to a family of Analog Devices 16-bit, fixed-point embedded processors. VisualDSP++ currently supports the following processors: • ADSP-BF532 (formerly ADSP-21532) • ADSP-BF535 (formerly ADSP-21535) • ADSP-BF531 • ADSP-BF533 • ADSP-BF561 • AD6532 •...
MyAnalog.com is a free feature of the Analog Devices website that allows MyAnalog.com customization of a webpage to display only the latest information on products you are interested in. You can also choose to receive weekly e-mail notification containing updates to the webpages that meet your interests.
VisualDSP++ 3.5 User’s Guide for 16-Bit Processors VisualDSP++ 3.5 Assembler and Preprocessor Manual for Blackfin Processors VisualDSP++ 3.5 C Compiler and Library Manual for Blackfin Processors VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors VisualDSP++ 3.5 Assembler and Preprocessor Manual for ADSP-21xx DSPs VisualDSP++ 3.5 C Compiler and Library Manual for ADSP-218x DSPs...
• Access VisualDSP++ online Help from the Help menu’s Contents, Search, and Index commands. • Open online Help from context-sensitive user interface items (tool- bar buttons, menu commands, and windows). xxii VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
.CHM Using the Windows Start Button • Access the VisualDSP++ online Help by clicking the Start button and choosing Programs, Analog Devices, VisualDSP++, and VisualDSP++ Documentation. • Access the files by clicking the Start button and choosing .PDF Programs, Analog Devices,, VisualDSP++, Documentation for Printing, and the name of the book.
The manuals can be purchased only as a kit. For additional information, call 1-603-883-2430. If you do not have an account with Analog Devices, you will be referred to Analog Devices distributors. To get information on our distributors, log onto http://www.analog.com/salesdir/continent.asp...
Commands, directives, keywords, and feature names are in text with SECTION font. letter gothic Non-keyword placeholders appear in text with italic style format. filename VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 26
A caution, providing information about critical design or program- ming issues that influence operation of a product. In the online version of this book, the word Caution appears instead of this symbol. xxvi VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
“Linking” on page 1-6 Shows how linking fits into the DSP project development process. • “Loading and Splitting” on page 1-8 Shows how loading and splitting fit into the DSP project develop- ment process. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
) and overlay ( ) files, are processed to yield .OVL output file(s). For Blackfin processors, these are boot-loadable ) files or non-bootable PROM image files, which execute from the processor’s external memory. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
VisualDSP++ features. The linker maps each input section (via a corresponding output section in the executable) to a memory segment, a contiguous range of memory addresses on the target system. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
While processing the following code, the compiler stores the variable temp in the input section of the . file and also stores the code gen- ext_data erated from in an input section named func1 extern VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 31
{ int x = 1; } func2(void) { return 13; } /* New */ For information on compiler default section names, refer to the VisualDSP++ 3.5 C/C++ Compiler and Library Manual for appropriate target processors and “Placing Code on the Target” on page 2-26.
Linking enables your code to run efficiently in the target environment. Linking is described in detail in Chapter 2, “Linker”. When developing a new project, use the Expert Linker to generate the project’s file. See Chapter 4, “Expert Linker”. .LDF VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The compiler has it own preprocessor that allows you to use pre- processor commands within your C/C++ source. The compiler preprocessor automatically runs before the compiler. For more information, see the VisualDSP++ 3.5 C/C++ Compiler and Library Manual for the target processors. VisualDSP++ 3.5 Linker and Utilities Manual...
The file(s) may reside on another processor (host) or may be burned into a PROM. The VisualDSP++ 3.5 Loader Manual for 16-Bit Processors provides detailed descriptions of the processes and options to generate boot-load- able (loader) files for the approprate target processors.
Page 35
Figure 1-4) by the boot kernel. ADSP-21 EPROM EPROM Processor Boot Kernel Boot Kernel Internal Internal Memory Memory Instructions Instructions Data Data Figure 1-4. Booting from a Bootloadable (.LDR) File VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 36
Figure 1-5. Input Files for a Multiprocessor System This example has two executables that share memory. Overlays are also included. The resulting output is a compilation of all the inputs. 1-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
), another linker output, support applications that .OVL require more program instructions and data than the processor’s internal memory can accommodate. Refer to “Memory Management Using Over- lays” on page 5-4 for more information. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
LDF commands in a Linker Description File ( ) define the target .LDF memory map and the placement of program sections within processor memory. The text of these commands provides the information needed to link your code. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
• Each input section may contain multiple code items, but a code item may appear in one input section only. • More than one input section may be placed in an output section. • Each memory segment must have a specified width. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Because they exist in different namespaces, input section names can be the same as output section names. Refer to Chapter 3, “Linker Description File” for further information. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Help. Online Help provides powerful search capabilities. To obtain information on a code item, parameter, or error, select text in an VisualDSP++ IDDE editor window or Output window and press the keyboard’s F1 key. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 43
There are four sub-pages you can access—General, LDF Preprocessing, Elimination, and Processor. Almost every setting option has a corre- sponding compiler command-line switch described in “Linker Command-Line Switches” on page 2-34. The Additional options field in VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 44
DSPs and ADSP-219x DSPs provide different Link tab selection options. Use the VisualDSP++ context-sensitive online Help for each target archi- tecture to select information on linker options you can specify in VisualDSP++. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Fix this problem by reviewing the . file and specifying all sections that need placement. For more information, refer to the VisualDSP++ 3.5 User’s Manual for 16-Bit Processors or online Help. 2-10 VisualDSP++ 3.5 Linker and Utilities Manual...
• Memory Usage. List the ways your program uses memory in your system. Typical uses for memory segments include interrupt tables, initialization data, program code, data, heap space, and stack space. Refer to “Specifying the Memory Map” on page 2-18. VisualDSP++ 3.5 Linker and Utilities Manual 2-11 for 16-Bit Processors...
SRAMs (there are eight sub-banks in L2), such that simulta- neous accesses by the core and the DMA controller to different banks can occur in parallel. Figure 2-5 shows the ADSP-BF535 system block diagram. 2-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 49
BLOCK 0 BLOCK 7 EXTERNAL ACCESS BUS SRAM SRAM (EAB) MEMORY MEMORY EXTERNAL MASTERED BUS (EMB) EBIU PCI MEMORY ASYNCHRONOUS AND I/O SYNCHRONOUS MEMORY Figure 2-5. ADSP-BF535 System Block Diagram VisualDSP++ 3.5 Linker and Utilities Manual 2-13 for 16-Bit Processors...
Page 50
C/C++ Compiler and Library Manual for Blackfin Processors and the appro- priate Hardware Reference for information about cache configuration. See the Memory chapter in an appropriate Hardware Reference for information about your target processor’s memory organization. 2-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
A single external address bus (14 bits) and a single external data bus (24 bits) are extended off-chip; these buses can be used for either Program or Data Memory accesses. VisualDSP++ 3.5 Linker and Utilities Manual 2-15 for 16-Bit Processors...
Page 52
(A0). The ADSP-218x processors support memory-mapped peripherals with programmable wait state generation through a dedicated 2048 location I/O Memory space. 2-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
64K words of on-chip memory configured as 32K words (24-bit) of program RAM, and 32K words (16-bit) of data RAM. Power-down circuitry is also provided to reduce power consumption. VisualDSP++ 3.5 Linker and Utilities Manual 2-17 for 16-Bit Processors...
The produced file has a corresponding output section .DXE for each input section. Although programmers typically do not use output section labels, the labels are used by downstream tools. 2-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 55
Table 2-2. Section Mapping in the Default ADSP-2191 LDF Input Section Output Section Memory Segment program program_dxe mem_code data1 data1_dxe mem_data1 data2 data2_dxe mem_data2 sec_stack mem_stack sec_heap mem_heap VisualDSP++ 3.5 Linker and Utilities Manual 2-19 for 16-Bit Processors...
0xFFFF FFFF Figure 2-8 on page 2-22 shows the ADSP-BF535 processor memory archi- tecture. Other Blackfin processors have different memory architectures. Refer to Hardware References of target processors for appropriate information. 2-20 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 57
. Memory type is defined by two 0xFFFFFF characteristics: , and . Some portions of the DSP mem- ory are reserved. Refer to your DSP’s Hardware Reference for details. VisualDSP++ 3.5 Linker and Utilities Manual 2-21 for 16-Bit Processors...
Page 58
Link Target Description Figure 2-8. ADSP-BF535 Processor Memory Architecture 2-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 59
Each bank is selectable with the memory select pins (MS3–0) and has configurable page boundaries, wait states, and wait state modes. The 1K word of on-chip boot ROM populates the top of Page 255 while the VisualDSP++ 3.5 Linker and Utilities Manual 2-23 for 16-Bit Processors...
(Listing 2-1). Listing 2-1. Blackfin Processors -- MEMORY{} Command Code MEMORY /* Define/label system memory /* List of global Memory Segments */ MEM_L2 2-24 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 61
These example define the starting stack address, the highest possi- ble stack address, and the heap’s starting location and size. These newly created symbols are entered in the executable’s symbol table. VisualDSP++ 3.5 Linker and Utilities Manual 2-25 for 16-Bit Processors...
SECTIONS{} .LDF commands must appear within the context of SECTIONS{} command. PROCESSOR{} SHARED_MEMORY() Listing 2-3 presents a command that would work with the SECTIONS{} command in Listing 2-1. MEMORY{} 2-26 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 63
+ MEMORY_SIZEOF(MEM_STACK) - 4; } >MEM_SYSSTACK heap /* Allocate a heap for the application */ ldf_heap_space = .; ldf_heap_end = ldf_heap_space + MEMORY_SIZEOF(MEM_HEAP) - 1; ldf_heap_length = ldf_heap_end - ldf_heap_space; } >MEM_HEAP VisualDSP++ 3.5 Linker and Utilities Manual 2-27 for 16-Bit Processors...
Page 64
/* List of sections for processor P0 */ sec_rth {INPUT_SECTIONS ( $OBJECTS(rth))} > seg_rth sec_code {INPUT_SECTIONS ( $OBJECTS(code)} > seg_code sec_code2 {INPUT_SECTIONS ( $OBJECTS(y_input)} > seg_code sec_data1 {INPUT_SECTIONS ( $OBJECTS(data1))} > seg_data1 2-28 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
, and ldf_argv_space ldf_argv_length ldf_argv_end. Refer to the VisualDSP++ 3.5 User's Manual for 16-Bit Processors or online Help for information about the simulator and command-line arguments. Do not use command-line arguments for linked programs without first modifying the . file to allocate a buffer suitable for your application.
Link tab of the Project Options dialog box correspond to linker command-line switches. VisualDSP++ calls the linker with these switches when linking your code. For more information, refer to the VisualDSP++ 3.5 User's Manual for 16-Bit Processors and VisualDSP++ online Help. Linker Command-Line Syntax Run the linker by using one of the following normalized formats of the linker command line.
Special libraries are available from DSP algorithm vendors. For more information, see Chapter 6, “Archiver”. • An executable ( ) file to be linked against. Refer to .DXE “Built-In LDF Macros” on $COMMAND_LINE_LINK_AGAINST page 3-21. VisualDSP++ 3.5 Linker and Utilities Manual 2-31 for 16-Bit Processors...
Page 69
• Include the appropriate extension to each file. The linker opens existing files and verifies their type before processing. When the linker creates a file, it uses the file extension to determine the type of file to create. VisualDSP++ 3.5 Linker and Utilities Manual 2-33 for 16-Bit Processors...
The linker provides switches to select operations and modes. The standard switch syntax is: -switch [argument 2-34 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 71
-o program.dxe Specifies a name of the linked executable. Typing without any switches displays a summary of command-line linker options. Using no switches is the same as typing linker -help VisualDSP++ 3.5 Linker and Utilities Manual 2-35 for 16-Bit Processors...
Eliminates unused symbols verbosely. on page 2-41 Passes each comma-separated option to the Memi- on page 2-42 -flag-meminit nit utility. Passes each comma-separated option to the prepro- on page 2-42 -flag-pp cessor. 2-36 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 73
Specifies silicon revision of the specified processor. on page 2-46 -si-revision version Skips preprocessing. on page 2-48 Outputs the names of link objects. on page 2-48 — on page 2-48 Verbose Outputs status information. -verbose VisualDSP++ 3.5 Linker and Utilities Manual 2-37 for 16-Bit Processors...
(see ). This switch must be used if the specified file does not .LDF specify . Architectural inconsistency between this switch ARCHITECTURE() and the file causes an error. .LDF 2-38 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
(define macro) switch declares and assigns value -MDmacro[=def] to the preprocessor macro named . For example, exe- macro -MDTEST=BAR cutes the code following in the file (but not the #ifdef TEST==BAR .LDF code following #ifdef TEST==XXX VisualDSP++ 3.5 Linker and Utilities Manual 2-39 for 16-Bit Processors...
-Wwarn [number] (override error message) switch directs the linker to demote -Wwarn the specified error message to a warning. The argument specifies number the message to demote. 2-40 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
-flags-meminit -opt1[,-opt2... switch passes each comma-separated option to the -flags-meminit MemInit (Memory Initializer) utility. VisualDSP++ 3.5 Linker and Utilities Manual 2-41 for 16-Bit Processors...
The switch allows individual placement of a grouping of data in DSP memory to provide more efficient memory packing. switch works only with objects assembled using the assem- bler’s switch. 2-42 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
JUMP.X CALL CALL CALL CALL CALL or indirect CALL.X Refer to the Instruction Set Reference for target architecture for more infor- mation on jump and call instructions. VisualDSP++ 3.5 Linker and Utilities Manual 2-43 for 16-Bit Processors...
If is not specified, the linker filename outputs a file in the project’s current directory. Alternatively, use the .DXE command in the file to name the output file. OUTPUT() .LDF 2-44 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
There- fore, searches the file. For example, -proc Custom-xxx Custom-xxx.ini [proc] Architecture: ADSP-BF535 See also “-si-revision version” on page 2-46 for more information on silicon revision of the specified processor. VisualDSP++ 3.5 Linker and Utilities Manual 2-45 for 16-Bit Processors...
The number to the right of the point cannot exceed deci- mal 255. • A version value of is also supported to indicate that the linker none should not concern itself with silicon errata. 2-46 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 83
These pass-through rules apply to all situations in which one tool that accepts this switch invokes another that also accepts the switch. VisualDSP++ 3.5 Linker and Utilities Manual 2-47 for 16-Bit Processors...
-warnonce (single symbol warning) switch directs the linker to warn -warnonce only once for each undefined symbol, rather than once for each reference to that symbol. 2-48 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Linker -xref filename (external reference file) switch directs the linker to -xref filename produce a cross-reference file ( file). ProjectName.xrf VisualDSP++ 3.5 Linker and Utilities Manual 2-49 for 16-Bit Processors...
Page 86
Linker Command-Line Reference 2-50 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
“LDF Expressions” on page 3-13 • “LDF Keywords, Commands, and Operators” on page 3-14 • “LDF Operators” on page 3-16 • “LDF Macros” on page 3-20 • “LDF Commands” on page 3-23 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 88
Assembler section declarations in this document correspond to the Blackfin assembler’s directive. .SECTION Refer to example DSP programs shipped with VisualDSP++ for sample files supporting typical system models. .LDF VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The linker may output warning messages and error messages. You must resolve the error messages to enable the linker to produce valid output. See “Linker Warning and Error Messages” on page 2-10 for more information. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
.LDF VisualDSP++, in the command specifies the $OBJECTS SECTIONS() object files to be searched for specific input sections. As another example, expands to the VisualDSP++ home $ADI_DSP directory. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 94
(or segment length), and a memory width. These names occupy different namespaces from input section names and output section names. Thus, a memory segment and an output sec- VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 95
LDF. For example, in Listing 3-1, MEMORY two input sections ( ) are mapped into one mem- program data1 ory segment (L2), as shown below. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 96
The program sections appear in the same order as object files appear in the macro. $OBJECTS You may intersperse statements within an INPUT_SECTIONS() output section with other directives, including location counter information. 3-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
“Location Counter (.)” on page 3-19. Hexadecimal number (a 0x prefix) 0xnumber Decimal number (a number without a prefix) number number A decimal number multiplied by 1024 number number A binary number number VisualDSP++ 3.5 Linker and Utilities Manual 3-13 for 16-Bit Processors...
“-xref filename” on page 2-49. XREF For more information about other file keywords, see “LDF Opera- .LDF tors” on page 3-16, “LDF Macros” on page 3-20, and “LDF Commands” on page 3-23. VisualDSP++ 3.5 Linker and Utilities Manual 3-15 for 16-Bit Processors...
• A period, indicating the current location (see “Location Counter (.)” on page 3-19). The following statement, which defines the bottom of stack space in the LDF ldf_stack_space = .; 3-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
INPUT_SECTIONS( $OBJECTS(data1) $LIBRARIES(data1)) }> mem_L2 file may contain the command: .LDF ldf_start_L2 = ADDR(dxe_L2_code) The linker generates the constant and assigns it the start ldf_start_L2 address of the output section. dxe_L2 VisualDSP++ 3.5 Linker and Utilities Manual 3-17 for 16-Bit Processors...
• Use a period anywhere a symbol is allowed in an expression. • Assigning a value to the period operator moves the location counter and leaves voids or gaps in memory. • The location counter may not be decremented. VisualDSP++ 3.5 Linker and Utilities Manual 3-19 for 16-Bit Processors...
These macros facilitate text replacement, file inclusion, and conditional assembly and compilation. For example, the assembler’s preprocessor uses the command to define macros and symbolic constants. #define 3-20 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Linker Description File Refer to the VisualDSP++ 3.5 Compiler and Library Manual and the VisualDSP++ 3.5 Assembler and Preprocessor Manual for appro- priate target processors for more information. Built-In LDF Macros The linker provides the following built-in LDF macros. •...
• An . file that does not use command-line inputs produces a more specific LDF that can control complex linker features. 3-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
• “MPMEMORY{}” on page 3-32 • “OVERLAY_GROUP{}” on page 3-33 • “PACKING()” on page 3-33 • “PAGE_INPUT()” on page 3-37 • “PAGE_OUTPUT()” on page 3-38 • “PLIT{}” on page 3-38 VisualDSP++ 3.5 Linker and Utilities Manual 3-23 for 16-Bit Processors...
Page 110
.LDF The command’s syntax is: ARCHITECTURE(processor) command is case sensitive. For example, valid entries ARCHITECTURE() may be , etc. Thus, ADSP-BF535 ADSP-2189 ADSP-21990 ADSP-BF535 valid, but is not valid. adsp-BF535 3-24 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
. file. For the C and C++ run-time libraries to work properly, the follow- ing symbols should be retained with “KEEP()” (see on page 3-27): ___ctor_NULL_marker ___lib_end_of_heap_descriptions VisualDSP++ 3.5 Linker and Utilities Manual 3-25 for 16-Bit Processors...
Page 112
The linker fills holes created by commands with INPUT_SECTION_ALIGN() zeros (by default), or with the value specified with the preceding FILL command valid for the current scope. See under “SECTIONS{}” on FILL page 3-42. 3-26 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 113
KEEP(keepList) enabled, retaining the listed objects in the executable even when they are not called. The is a comma-delimited list of objects to be keepList retained. VisualDSP++ 3.5 Linker and Utilities Manual 3-27 for 16-Bit Processors...
• is a list of one or more executable ( executable_file_names .DXE or shared memory ( ) files. Separate multiple file names with white space. 3-28 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
MEMORY{} processor’s scope. There is no limit to the number of memory segments you can declare within each command. For more information, MEMORY{} see “Command Scoping” on page 3-12. VisualDSP++ 3.5 Linker and Utilities Manual 3-29 for 16-Bit Processors...
A segment declaration declares a memory segment on the target processor. Although an LDF may contain only one command that applies MEMORY{} to all scopes, there is no limit to the number of memory segments declared within a command. MEMORY{} 3-30 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 117
In addition, in ADSP-218x LDFs, the PM/DM declarator specifies the memory type; and in ADSP-219x LDFs, it is used only to distinguish between a 16-bit or 24-bit logical data width. VisualDSP++ 3.5 Linker and Utilities Manual 3-31 for 16-Bit Processors...
MPMEMORY{} linker uses the offsets during multiprocessor linking. Refer to “MPMEMORY{}” on page 5-28 for a detailed description of the command. MPMEMORY{} 3-32 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
) files, so they arrive at the target in the correct number, .DXE .OVL alignment, and sequence. To accomplish this task, the command must be informed of the size of the reordered group, the byte order within the VisualDSP++ 3.5 Linker and Utilities Manual 3-33 for 16-Bit Processors...
If the processor unpacks three 16-bit memory words to build two 24-bit instruction words, the following unpacked and storage orders could apply the requisite transfer order. The linker must reorder the bytes into their unpacked order. 3-34 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
For this reason, the ordering shown above is possible rather than obligatory. You can program the port to handle any reordering. VisualDSP++ 3.5 Linker and Utilities Manual 3-35 for 16-Bit Processors...
Hence, the byte count parameter (6) to the PACKING() command is the same. The byte designated as in the syntax acts as a place holder. PACKING() The linker sets that byte to zero in external memory. 3-36 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The register name is based on the type of memory selected for “run” and “live” space for the overlay. The page value is based on the description of the “live” space specified in the command. PAGE_INPUT() VisualDSP++ 3.5 Linker and Utilities Manual 3-37 for 16-Bit Processors...
“PLIT{}” on page 5-34 for a detailed description of the PLIT{} command. Refer to “Memory Management Using Overlays” on page 5-4 for a detailed description of overlay and PLIT functionality. 3-38 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
For more information, see “LDF Expressions” on page 3-13. • OUTPUT(file_name.DXE) Specifies the output file name for the executable ( .DXE command in a scope must appear before OUTPUT() command in that scope. SECTIONS{} VisualDSP++ 3.5 Linker and Utilities Manual 3-39 for 16-Bit Processors...
(. or . ) that contains the definition of the symbol. If the symbol is not located in the designated file, an error is issued. 3-40 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// $ADI_DSP is a predefined linker macro that expands // to the VDSP++ install directory. Search for objects // in directory Blackfin/lib relative to the install directory // and to the ABC\XYZ directory. VisualDSP++ 3.5 Linker and Utilities Manual 3-41 for 16-Bit Processors...
Though an . file may contain only command within each processor command scope, multi- SECTIONS{} ple output sections may be declared within each command. SECTIONS{} 3-42 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 129
C run-time library for run-time initialization. The section .MEMINIT should be placed in non-overlay memory. • – Specifies run-time initialization type (optional). init_qualifier The qualifiers are: VisualDSP++ 3.5 Linker and Utilities Manual 3-43 for 16-Bit Processors...
By omitting a memory segment assignment for a section, you direct the linker to generate the section in the executable, but prevent sec- tion content from appearing in the memory image of the executable file. 3-44 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 131
INPUT_SECTIONS(myLib.dlb [ foo.doj (program) ]) expression In a , an manipulates symbols or positions section_command expression the current location counter. See “LDF Expressions” on page 3-13 details. VisualDSP++ 3.5 Linker and Utilities Manual 3-45 for 16-Bit Processors...
(optional) determines whether the overlay_memory_segment overlay section is placed in an overlay memory segment. Some overlay sec- tions, such as those loaded from a host, need not be included in the 3-46 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 133
ALL_FIT , the linker tries to fit all the into a ALL_FIT OVERLAY_INPUT{} single overlay that can overlay into the output section’s run-time memory segment. – Not currently available. FIRST_FIT VisualDSP++ 3.5 Linker and Utilities Manual 3-47 for 16-Bit Processors...
Shared memory executable ( ) files reside in the shared memory of a multiprocessor system. The command is used to pro- SHARED_MEMORY{} duce files. For more information, see “SHARED_MEMORY{}” on page 5-38. 3-48 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Freeing up memory enables you to store other things like DSP code or data. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 137
Open in Expert Linker. • From the VisualDSP++ main menu, choose Tools -> Expert Linker -> Create LDF. The Expert Linker window appears. Figure 4-1. Expert Linker Window VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
This menu command is disabled when VisualDSP++ does not have a project opened or when the project’s processor-build target is not supported by Expert Linker. Press Next to run the wizard. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
C; if a file is in the project, the default is VDK, and so on. This set- VDK.H ting determines which template is used as a starting point. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Press Next. Step 2: Specifying System Information You must now choose whether the project is for a single-processor system or a multiprocessor (MP) system. Figure 4-4. Selecting System and Processor Types VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 141
(MMS) offsets which makes the use of MP commands much easier. This is an automatic replacement for the linker command used in the LDF source file. MPMEMORY VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 142
Figure 4-5. Processors and MMS Offset The MP address range is available only for processors that have MP memory space, such as ADSP-2192 DSPs or ADSP-BF561 processors. Press Next to advance to the Wizard Completed page. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The Expert Linker window appears and displays the con- tents of the new . file. Figure 4-6. Wizard Completed Page of the Create LDF Wizard VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Using drag-and-drop, you can map an input section to an output section in the memory map. Each memory segment may have one or more output sections under it. Input sections that have been mapped to an output sec- 4-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 145
For more information, refer “Input Sections Pane” on page 4-12 “Memory Map Pane” on page 4-18. Access various Expert Linker functions with your mouse. Right-click to display appropriate menus and make selections. VisualDSP++ 3.5 Linker and Utilities Manual 4-11 for 16-Bit Processors...
Figure 4-8. Figure 4-8. Input Sections Right-Click Menu The main menu functions include: • Sort by – Sorts objects by input sections or LDF macros. These selections are mutually exclusive. 4-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 147
(of the map file generated after linking the project) as well as access to various processor and setup information (see Figure 4-41 on page 4-51). VisualDSP++ 3.5 Linker and Utilities Manual 4-13 for 16-Bit Processors...
Use the Legend dialog box to displays all possible icons in the tree pane and a short description of each icon. (Figure 4-9) The red “x” on an icon indicates this object/file is not mapped. 4-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 149
DSP family. To change a color: 1. Double-click the color. You can also right-click on a color and select Properties. The system displays the Select a Color dialog box (Figure 4-11). VisualDSP++ 3.5 Linker and Utilities Manual 4-15 for 16-Bit Processors...
Page 150
2. Select a color and click OK. Click Other to select other colors from the advanced palette. Click Reset to reset all memory map colors to the default colors. Figure 4-11. Selecting Colors 4-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Other macros, object files, or libraries may appear under each macro. Under each object file are input sections contained in that object file. When the tree is sorted by LDF macros, only input sections can be dragged onto output sections. VisualDSP++ 3.5 Linker and Utilities Manual 4-17 for 16-Bit Processors...
ADSP-218x DSP is used this example. Figure 4-14. Expert Linker Window – Memory Map The combo box (located to the right of the Memory Map label) applies only to ADSP-218x DSPs. 4-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 153
Figure 4-9 on page 4-15). Move the mouse pointer over the icon and a tooltip displays a message describing why the segment is invalid. Figure 4-15. Memory Map With Invalid Memory Segments VisualDSP++ 3.5 Linker and Utilities Manual 4-19 for 16-Bit Processors...
The options are: Name, Overflow (name of output section to catch overflow), Packing, and Number of bytes (number of bytes to be reordered at one time. • Shared Memory – Adds a shared memory to the memory map. 4-20 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 155
The Colors page lists the colors used in the graphical memory map. You can customize each object’s color. See Figure 4-9 on page 4-15 Figure 4-10 on page 4-16. VisualDSP++ 3.5 Linker and Utilities Manual 4-21 for 16-Bit Processors...
The start address and size of the memory segments display in separate col- umns. If available, the start address and the size of each output section are displayed (for example, after you link the project). 4-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Object section names appear only when there is enough room to display them. • Addresses are listed in ascending order from top to bottom. VisualDSP++ 3.5 Linker and Utilities Manual 4-23 for 16-Bit Processors...
Page 158
If there is not enough room to display the memory map when zoomed in, horizontal and/or vertical scroll bars allow you to view the entire memory map (for more information, see “Zooming In and Out on the Memory Map” on page 4-28). 4-24 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 159
You can drag and drop any object except memory segments. See Figure 4-20. Select a memory segment to display its border. Drag the border to change the memory segment’s size. The size of the selected and adjacent memory segments change. VisualDSP++ 3.5 Linker and Utilities Manual 4-25 for 16-Bit Processors...
Page 160
4-28. If you move the mouse pointer over an object in the graphical memory map, a yellow tooltip dis- plays the information about the object (such as name, address, and size). 4-26 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
• To enable post-link view from the Memory Map pane, right-click and choose View and Link Results (Post-Link). Figure 4-24 on page 4-31 illustrates a memory map after linking is performed. VisualDSP++ 3.5 Linker and Utilities Manual 4-27 for 16-Bit Processors...
Horizontal and/or vertical scroll bars appear when there is not enough room to display a zoomed memory map in the Memory Map pane (see Figure 4-24 on page 4-31). 4-28 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 163
Expert Linker Figure 4-22. Memory Map Pane in Pre-Link View VisualDSP++ 3.5 Linker and Utilities Manual 4-29 for 16-Bit Processors...
Page 164
Memory Map Pane Figure 4-23. Memory Map Pane in Post-Link View 4-30 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
A gap may be inserted into a memory segment in the graphical memory map. To insert a gap: 1. Right-click on a memory segment. 2. Choose Insert gap. The Insert Gap dialog box appears, as shown in Figure 4-25. VisualDSP++ 3.5 Linker and Utilities Manual 4-31 for 16-Bit Processors...
Page 166
(of the gap). If the end is chosen, the End address of the gap is grayed out and you must enter a start address or size. 4-32 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The scroll bar next to an overlay in “run” space allows you to specify an overlay to be shown on top. You can drag the overlay on top to another output section to change the “run” space for an overlay. VisualDSP++ 3.5 Linker and Utilities Manual 4-33 for 16-Bit Processors...
Page 168
2. Choose New -> Overlay. 3. Select the “live” space from the Overlay Properties dialog box. The new overlay appears in the “run” and “live” spaces in two different colors in the memory map. 4-34 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
VisualDSP++. Multiple Section Contents dialog boxes may be dis- played. For example, Figure 4-28 shows Output Section contents in hex format. Figure 4-28. Output Section Contents in Hex Format VisualDSP++ 3.5 Linker and Utilities Manual 4-35 for 16-Bit Processors...
Page 170
• Select Format — Provides a list of formats: Hex, Hex and ASCII, and Hex and Assembly. Select a format type to specify the memory format. Figure 4-29 Figure 4-30 illustrate memory data formats available for the selected output section. 4-36 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 171
Expert Linker Figure 4-29. Output Section Contents in Hex and ASCII Format VisualDSP++ 3.5 Linker and Utilities Manual 4-37 for 16-Bit Processors...
Page 172
Memory Map Pane Figure 4-30. Output Section Contents in Hex and Assembly Format 4-38 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
2. Right-click and choose View Symbols. The View Symbols dialog box displays the selected item’s symbols. The symbol’s address, size, binding, file name, and section appear beside the symbol’s name. VisualDSP++ 3.5 Linker and Utilities Manual 4-39 for 16-Bit Processors...
Figure 4-32. General Page of the Global Properties Dialog Box Then build the project and load the program. After the program is loaded, Expert Linker sets up the profiling bins to collect the profiling information. 4-40 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 175
This indicates that it takes up less execution (seg_pmco) time than . The shading of fir.doj (seg_pmco) libc.dlb (seg_pmco) black, indicating that it takes up a negligible amount of the total execution time. VisualDSP++ 3.5 Linker and Utilities Manual 4-41 for 16-Bit Processors...
Page 176
Figure 4-34. PC Sample Count To view sample counts for functions located within an object section, double-click on the object section (Figure 4-35). Figure 4-35. Sample Count of Functions within Object Section 4-42 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 177
4-36). To view profile information, dou- ble-click on a function. Figure 4-36. Detailed Profile Information To view PC samples with percent of total samples, view the memory map tree (Figure 4-37). VisualDSP++ 3.5 Linker and Utilities Manual 4-43 for 16-Bit Processors...
Page 178
Memory Map Pane Figure 4-37. Percentage of Total PC Sample Count 4-44 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Refer to Engineer To Engineer Note EE-202 “ Using the Expert Linker for Multiprocessor LDF ” for detailed description and proce- dure. You can find this EE Note on Analog Devices website at http://www.analog.com/UploadedFiles/Application_Notes Figure 4-38. Multiprocessor LDF selection VisualDSP++ 3.5 Linker and Utilities Manual...
Page 180
In order for the linker to be able to correctly resolve these variables, the link against command should be used once again. Figure 4-39. Shared Memory Segment 4-46 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 181
LDF macro and then selecting Add/Object/Library File. The use of LDF macros becomes extremely useful in systems where there is more than one sorted by Input Sections instead of LDF VisualDSP++ 3.5 Linker and Utilities Manual 4-47 for 16-Bit Processors...
Page 182
Sections window (left pane) to their corresponding sections in the Memory Map window (right pane) have been automatically replaced during linking process with the actual object files (. used by the linker. 4-48 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 183
Expert Linker in a way absolutely transparent to the user. The complete project is now ready to be built. Once again, perform a Rebuild All and start debugging with the application code. VisualDSP++ 3.5 Linker and Utilities Manual 4-49 for 16-Bit Processors...
“Managing Packing Properties” on page 4-64 • “Managing Alignment and Fill Properties” on page 4-65 • “Managing Overlay Properties” on page 4-67 • “Managing Stack and Heap in Processor Memory” on page 4-69 4-50 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The Processor Properties dialog box appears. 2. Click the Processor tab (Figure 4-42). The Processor tab allows you to reconfigure the processor setup. Figure 4-42. Processor Page of the Processor Properties Dialog Box 4-52 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 187
A file name may include a rela- tive path, LDF macro, or both. Additionally, you can rename a processor by selecting the processor, right-clicking, choosing Rename Processor, and typing a new name. VisualDSP++ 3.5 Linker and Utilities Manual 4-53 for 16-Bit Processors...
1. Right-click in the Input Sections pane. 2. Choose Properties. The Global Properties dialog box appears. 3. Click the PLIT tab (Figure 4-43). Figure 4-43. PLIT Page of the Global Properties Dialog Box 4-54 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
When Verbose linker output of eliminated objects is selected, the elimi- nated objects are shown as linker output in the Output window’s Build page during linking. This check box is grayed out when the Enable elimi- VisualDSP++ 3.5 Linker and Utilities Manual 4-55 for 16-Bit Processors...
Page 190
If you right-click in this list box, a menu allows you • Add a symbol by typing in the new symbol name in the edit box at the end of the list • Remove the selected symbol 4-56 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The symbols can be resolved to an absolute address or to a program file ). When you right-click in the Symbols field, a menu enables you to add or remove symbols. VisualDSP++ 3.5 Linker and Utilities Manual 4-57 for 16-Bit Processors...
Page 192
When this button is active, click it to display the Browse Symbols dialog box, which shows a list of all the symbols. 4-58 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 193
Expert Linker Figure 4-46. Processor Properties Dialog Box – Symbols Tab Figure 4-47. Add Symbol to Resolve Dialog Box VisualDSP++ 3.5 Linker and Utilities Manual 4-59 for 16-Bit Processors...
Page 194
1. Click Browse to display the Symbols to resolve list in the Symbols pane (Figure 4-46). 2. Select the symbol you want to delete. 3. Right-click and choose Remove Symbol. 4-60 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
1. Right-click a memory segment (for example, PROGRAM MEM_CODE in the Memory Map pane. 2. Choose Properties. The selected segment properties are displayed. Figure 4-48. Memory Segment Properties Dialog Box VisualDSP++ 3.5 Linker and Utilities Manual 4-61 for 16-Bit Processors...
1. Right-click an output section (for example, PROGRAM_DXE ) in the Memory Map pane. CODE_DXE 2. Choose Properties (Figure 4-49) Figure 4-49. Output Section Properties Dialog Box – Output Section Tab 4-62 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 197
“Not available”. After linking is done, the box displays the output section’s actual address and size. Specify the Packing and Alignment (with Fill Value) properties as needed. VisualDSP++ 3.5 Linker and Utilities Manual 4-63 for 16-Bit Processors...
Based on the processor architecture, the Expert Linker determines the opcode for the instruction. The Fill value is either 0, a instruction, or a user-specified value (a hexadecimal value entered in the entry box). VisualDSP++ 3.5 Linker and Utilities Manual 4-65 for 16-Bit Processors...
The Live memory drop-down list contains all output sections or memory segments within one output section. The “ live ” memory is where the over- lay is stored before it is swapped into memory. VisualDSP++ 3.5 Linker and Utilities Manual 4-67 for 16-Bit Processors...
Page 202
Clicking Browse opens the Browse Sym- bols dialog box. You can choose the address for the symbol group or let the linker choose the address. 4-68 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Figure 4-53. Memory Map Window With Stack and Heap Sections Use the Global Properties dialog box to select Show stack/heap usage (Figure 4-54). This option graphically displays the stack/heap usage in memory (Figure 4-55). VisualDSP++ 3.5 Linker and Utilities Manual 4-69 for 16-Bit Processors...
Page 204
Use the graphical view (View Mode -> Graphical Memory Map) to dis- play stack and heap memory map blocks. Figure 4-55 shows a possible memory map after running a Blackfin processor project program. 4-70 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 205
Expert Linker Figure 4-55. Graphical Memory Map Showing Stack and Heap Usage VisualDSP++ 3.5 Linker and Utilities Manual 4-71 for 16-Bit Processors...
Page 206
Managing Object Properties 4-72 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
LDF commands used for memory management. This chapter includes: • “Overview” on page 5-2 Provides an overview of Analog Devices processor’s memory architecture • “Memory Management Using Overlays” on page 5-4 Describes memory management using the overlay functions •...
A data fetch from memory can thus be accomplished in a single memory cycle. Analog Devices DSPs possess a separate program and data memory for speed. For extra speed, data can be kept in program memory as well as in data memory, and there are instruc- tions to fetch data from both memories simultaneously.
Page 209
The linker uses Linker Description Files to control “what goes where.” At link time, the linker follows directions in the . file to place code and data at the proper addresses. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The linker supports the linking of executables for sys- tems with overlay memory. Applications notes on the Analog Devices Web site provide detailed descriptions of this technique; for example, •...
In this example, overlays 1 and 2 share the same run-time location within internal memory, and overlays 3, 4, and 5 also share a common run-time memory. When is required, the overlay manager loads overlay 2 to FUNC_B VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 212
Access (DMA) capability. The overlay manager can also handle advanced functionality, such as checking whether the requested overlay is already in run-time memory, executing another function while loading an overlay, and tracking recursive overlay function calls. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Blackfin processors must be developed by the user. Breakpoints on Overlays The debugger relies on the presence of the sym- __ov_start __ov_end bols to support breakpoints on overlays.The symbol manager will set a silent breakpoint at each symbol. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
.LDF This overlay declaration configures the two overlays to share a common run-time memory space. The syntax for the command is OVERLAY_INPUT{} described in “OVERLAY_GROUP{}” on page 3-33. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 215
Each overlay has a word size and an address, which is used by the overlay manager to determine where the overlay resides and where it is executed. One exception, , specifies the total size in bytes. _ov_size_# VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 216
(and where to jump to exe- cute the called overlay function). Listing 5-2. PLIT Definition in LDF PLIT R0.l = PLIT_SYMBOL_OVERLAYID; R1.h = PLIT_SYMBOL_ADDRESS; R1.l = PLIT_SYMBOL_ADDRESS; 5-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 217
. The linker replaces the constant name FUNC_A with the ID of the overlay containing PLIT_SYMBOL_OVERLAYID FUNC_A The linker also replaces the constant name with the PLIT_SYMBOL_ADDRESS run-time address of FUNC_A VisualDSP++ 3.5 Linker and Utilities Manual 5-11 for 16-Bit Processors...
These examples are for Blackfin processors. Listing 5-3. FFT Overlay Example 1 OVERLAY_INPUT ALGORITHM (ALL_FIT) OVERLAY_OUTPUT (fft_one.ovl) INPUT_SECTIONS ( Fft_1st_last.doj(program) ) } > ovl_code // Overlay to live in section ovl_code 5-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 219
/* If so, do not transfer it in. */ if CC jump skipped_DMA_setup; Finally, when the last function ( ) is referenced, fft_one overlay id=1 again transferred to internal memory for execution. VisualDSP++ 3.5 Linker and Utilities Manual 5-13 for 16-Bit Processors...
Page 220
Once the transfer is complete, the overlay manager sends the PC to the address of the refer- enced symbol stored in 5-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Each overlay has a word size and an address, which the overlay manager uses to determine where the overlay resides and where it is executed. These are the linker-generated constants. _ov_startaddress_1 = 0x00000000 _ov_startaddress_2 = 0x00000010 _ov_endaddress_1 = 0x0000000F _ov_endaddress_2 = 0x0000001F VisualDSP++ 3.5 Linker and Utilities Manual 5-15 for 16-Bit Processors...
If they are not equal, the value in is updated and the overlay is transferred into its ov_id_loaded internal run space via DMA. 5-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Instead of the core sitting idle while the overlay DMA transfer occurs, the core enables the DMA, and then begins executing another function. VisualDSP++ 3.5 Linker and Utilities Manual 5-17 for 16-Bit Processors...
Page 224
The overlay manager first determines whether the referenced symbol is in internal memory. If not, it sets up the DMA transfer. If the symbol is not in internal memory and the flag is set for execution, the core waits until 5-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 226
// Overlay to live in section ovl_code OVERLAY_INPUT ALGORITHM(ALL_FIT) OVERLAY_OUTPUT(fft_three.ovl) INPUT_SECTIONS( Fft_ovl.doj (program) ) } >ovl_code // Overlay to live in section ovl_code } > mem_code OVERLAY_MGR { INPUT_SECTIONS(ovly_mgr.doj(pm_code)) } > mem_code 5-20 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 227
If it is an execution call, the core is idle until the transfer is completed (if the transfer was necessary). The PC then jumps the run-time location of the function. VisualDSP++ 3.5 Linker and Utilities Manual 5-21 for 16-Bit Processors...
_ov_runtimestartaddress_# indicates the overlay number. Overlay numbers start at 1 (not 0) to avoid confusion when these elements are placed into an array or buffer used by an overlay manager. 5-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 229
, which are defined in over- main lay memory. Because the linker cannot resolve these functions locally, the linker replaces the symbols with . Unresolved .plit_X .plit_Y references to are resolved to .plit_X .plit_Y VisualDSP++ 3.5 Linker and Utilities Manual 5-23 for 16-Bit Processors...
When one processor calls into another processor’s overlay, the call increases the size of the section in the executable file that manages .plit the overlay. 5-24 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 231
Not putting global variables in overlays optimizes overlays. This action ensures that the proper overlay is loaded before a global is referenced. VisualDSP++ 3.5 Linker and Utilities Manual 5-25 for 16-Bit Processors...
Page 232
Processor P2 Overlay Storage P2 Overlay f o o ( ) {. . .} Processor P2 Overlay Memory // current overlay Figure 5-5. PLITs and Overlay Memory – Inter-Processor Calls 5-26 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
• “OVERLAY_GROUP{}” on page 5-29 • “PLIT{}” on page 5-34 • “SHARED_MEMORY{}” on page 5-38 For detailed information on other LDF commands, refer to “LDF Com- mands” on page 3-23. VisualDSP++ 3.5 Linker and Utilities Manual 5-27 for 16-Bit Processors...
Expert Linker makes the change automatically upon reading the .LDF file. Memory overlays support applications whose program instructions and data do not fit in the internal memory of the processor. VisualDSP++ 3.5 Linker and Utilities Manual 5-29 for 16-Bit Processors...
Page 236
(except to the DMA transfer that brings them in). Overlays are active only while being executed in run-time memory, which is located in the memory segment. program 5-30 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Declare which functions reside in which overlay. The overlays have been split into different segments in one file, or into different files. The overlays declared in this section (seg_pmco) will run in segment seg_pmco. VisualDSP++ 3.5 Linker and Utilities Manual 5-31 for 16-Bit Processors...
PLIT Syntax Figure 5-9 shows the general syntax of the command and indicates PLIT{} how the linker handles a symbol ( ) local to an overlay function. symbol 5-34 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
To help you write an overlay manager, the linker generates PLIT constants for each symbol in an overlay. Data can be overlaid, just like code. If an overlay-resident function calls for additional data overlays, include an instruction for finding them. VisualDSP++ 3.5 Linker and Utilities Manual 5-35 for 16-Bit Processors...
The linker stores each instance in the .PLIT output section, which becomes part of the program code’s memory segment. 5-36 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
PLIT instances according to that template, as it builds its executable. The linker may also save registers or stack context information. The linker does not accept a PLIT without arguments. VisualDSP++ 3.5 Linker and Utilities Manual 5-37 for 16-Bit Processors...
The command is used to produce SHARED_MEMORY{} files. If you do not specify the type of link with a PROCESSOR{} command, the linker cannot link your program. SHARED_MEMORY{} 5-38 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 245
SHARED_MEMORY{} SECTIONS{} command in that scope. • – Defines sections for placement within the shared SECTIONS() memory executable ( Figure 5-11 shows the scope of commands in the LDF. SHARED_MEMORY{} VisualDSP++ 3.5 Linker and Utilities Manual 5-39 for 16-Bit Processors...
Page 246
OUTPUT(shared.sm) SECTIONS my_shared_sections{ section_commands } > my_shared_ram PROCESSOR p0{ processor_commands with link against shared memory } PROCESSOR p1{ processor_commands with link against shared memory} Figure 5-11. LDF Scopes for SHARED_MEMORY{} 5-40 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Describes archiver operations by means of command-line switches You can run the archiver from a command line, or you can produce an archive file as the output of a VisualDSP++ project. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The archiver, which is sometimes called a librarian, is a general-purpose utility. It can combine and extract arbitrary files. This manual refers to DSP object files ( ) because they are relevant to DSP code .DOJ development. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Archive usage consists of two tasks: • Writing archive routines , functions that can be called from other programs • Accessing archive routines from your code VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
. You can extract an object file ( <projectname>.DLB .DOJ for example, to incorporate it in another project. • When creating executable or unlinked object files from Visu- alDSP++, archive them afterwards from the command elfar line. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Assuming that one or more library routines from are called filter.dlb from one or more of the object files, the linker searches the library, extracts the required routines, and links the routines into the executable. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
–c –t "Steve's sandbox Rev 1" lib.dlb *.doj To hold version information, the archiver creates an object file, , that have version information in the section. This __version.doj .strtab file is not made visible to the user. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
This file defines four version names: , and my_name my_location CVS_TAG . The value of ; the value of is “ other my_name other version value ”. can be many words; name is only one VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
6-12) causes the archiver to raise a warning if the ver- sion number is not in this form. The check ensures that the version number starts with a number in that format. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
–twc "1.2 new library" lib.dlb [Warning ar0081] Version number does not match num.num.num format Version 0.0.0 will be used. elfar –pv lib.dlb ::User Archive Version Info: 0.0.0 1.2 new library 6-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
– Creates a library file named -c my_lib.dlb my_lib.dlb – Places these object files in the fft.doj sin.doj cos.doj tan.doj library file Table 6-1 on page 6-3 lists typical file types, file names, and extensions. VisualDSP++ 3.5 Linker and Utilities Manual 6-11 for 16-Bit Processors...
-i filename filename obj_file(s) to add or modify in the specified lib_file .DLB Prints dependencies. Available only with the switch. Prints dependencies and creates the library. Available only with the switch. 6-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 259
–e lib.dlb * // extract all files from the archive elfar –d lib.dlb t*.doj // delete .doj files starting with 't' elfar –r lib.dlb *.doj // replace all .doj files VisualDSP++ 3.5 Linker and Utilities Manual 6-13 for 16-Bit Processors...
• Append the appropriate file extension to each file. The archiver assumes nothing, and will not do it for you. • Wildcard options are supported with the use of the wildcard char- acter “ ”). 6-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The following command line encrypts symbols in an existing archive file. elfar -s [-v] library_file in_library_file exclude_file type-letter where: – Selects the encryption operation. – Selects verbose mode, which provides statistics on the symbols that were encrypted. VisualDSP++ 3.5 Linker and Utilities Manual 6-15 for 16-Bit Processors...
Page 262
”. This part is called the .end root of the symbol name. Since only the root is encrypted, a name with a prefix or suffix having special meaning retains that special meaning after encryption. 6-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 263
If different libraries are encrypted with the same argument, unrelated external sym- type-letter bols of the same length may be encrypted identically. VisualDSP++ 3.5 Linker and Utilities Manual 6-17 for 16-Bit Processors...
Page 264
Archiver Command-Line Reference 6-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
“Build Files” on page A-5 • “Debugger Files” on page A-9 Most of the development tools use industry-standard file formats. Sources that describe these formats appear in “Format References” on page A-10. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
For information on using the C/C++ compiler and associated tools, as well as a definition of ADI extensions to ANSI C, see the VisualDSP++ 3.5 C/C++ Compiler and Library Manual for appropriate target architectures.
For all numeric bases, the assembler uses 16-bit words for data storage; 24-bit data is for the program code only. The largest word in the buffer determines the size for all words in the buffer. If you have some 8-bit data VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
For informa- tion on macros or other preprocessor commands, see the For information on the assembler and preprocessor, see the VisualDSP++ 3.5 Assembler and Preprocessor Manual for appropriate target architectures. Linker Description Files (.LDF) Linker Description Files (.
DSP program’s memory segments. The linker processes object files into an executable file ( ). For information on the object .DXE file’s ELF format, see the “Format References” on page A-10. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
8-bit-wide PROMs. The files are used with an industry-standard PROM programmer to program memory devices for a hardware system. One file contains data for the whole series of memory chips to be programmed. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 271
Start character Byte count (always 02) Address (always 0000) 0000 Record type Offset address 0000 Checksum Table A-3 shows the organization of an example data record. Table A-4 shows an end-of-file record. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
ASCII-format files are text representations of ROM memory images that you can use in post-processing. For more information, refer to no-boot mode information in the VisualDSP++ Loader Manual for 16-Bit Processors . VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Portable Formats Specification V1.1, Tools Interface Standards (TIS) Committee Go to: http://developer.intel.com/vtune/tis.htm • (1993) Debugging Information Format (DWARF) V1.1 from the Portable Formats Specification V1.1, UNIX International, Inc. Go to: http://developer.intel.com/vtune/tis.htm A-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Stabs to mdebug conversion Prints the file header Prints the library symbol table -arsym Prints every library member -arall Prints the list of elfdump switches to stdout -help Prints the program header table VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 276
If N is not in the range 1 to 32, 32 is used Dumps contents in hex, N bytes per group Dumps contents in hex, (MSB first order), N bytes per group Prints contents as list of disassembled machine instructions VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
To convert the object file to an assembly listing file with labels, use the following command line. elfdump elfdump -ns * fir.doj > fir.asm The output file is practically source code. Just remove the line numbers and opcodes. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
The following command allows you to view one of the library members CLONE2.ELF elfdump -all CLONE2.OVL(CLONE2.elf) The following commands extract and print its contents. CLONE2.ELF elfar -e CLONE2.ovl elfdump -all CLONE2.elf Switches for these commands are case sensitive. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 279
The development software includes a variety of preprocessor default files. These files provide an example for each .LDF .LDF processor’s internal memory architecture. The default files are .LDF in the directory: VisualDSP++ InstallPath>\Blackfin\ldf VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// Generate a MAP file // $ADI_DSP is a predefined linker macro that expands // to the VDSP install directory. Search for objects in // directory Blackfin/lib relative to the install directory VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 281
// The name of the output file MEMORY // Processor specific memory command { INCLUDE( “BF535_memory.ldf”) } SECTIONS // Specify the Output Sections { INCLUDE( “BF535_sections.ldf” } // end P0 sections // end P0 processor VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
.LDR nel to zero out the variable. This action reduces the loader’s output file size, but still requires execution time for the processor to ini- tialize the memory with zeros. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// Declare specific DSP Architecture here (for linker) ARCHITECTURE(ADSP-BF535) // LDF macro equals all object files in project command line $OBJECTS = $COMMAND_LINE_OBJECTS; // Describe the physical system memory below MEMORY{ VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 285
// Align L2 instruction segments on a 2-byte boundaries INPUT_SECTION_ALIGN(2) INPUT_SECTIONS($OBJECTS(program) $LIBRARIES(program)) // Align L2 data segments on 1-byte boundary INPUT_SECTION_ALIGN(INPUT_SECTIONS ($OBJECTS(data1) $LIBRARIES(data1)) >L2SRAM // end section // end processor P0 Figure C-1. Assembly-to-Memory Code Placement VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 287
// Assign start address of stack to 'ldf_stack_space' // variable using the LDF's current location counter "." ldf_stack_space = .; // Assign end address of stack to 'ldf_stack_end' variable ldf_stack_end = ldf_stack_space + MEMORY_SIZEOF(MemStack) - 4; VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 288
// Assign end address of heap to 'ldf_heap_length' variable ldf_heap_end = ldf_heap_space + MEMORY_SIZEOF(MemHeap) - 1; // Assign length of heap to 'ldf_heap_length' variable ldf_heap_length = ldf_heap_end - ldf_heap_space; }>MemHeap // end SECTIONS{} // end PROCESSOR p0{} C-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 289
("SDRAM_2") int page_buff3[0x08000000]; static section ("SDRAM_3") int page_buff4[0x08000000]; static section ("Data_BankA") int coeffs1[256]; static section ("Data_BankB") int input_array[0x2000]; int x, y, z; void main(void){ int i; x = 0x5555; VisualDSP++ 3.5 Linker and Utilities Manual C-11 for 16-Bit Processors...
Page 290
// 248KB of user code and data in L2 SRAM segment Mem_L2_SRAM {TYPE(RAM) START(0xF0000000) END(0xF003DFFF) WIDTH(8)} // 4KB for heap in L2 SRAM (for dynamic memory allocation) Mem_Heap {{TYPE(RAM) START(0xF003E000) END(0xF003EFFF) WIDTH(8)} C-12 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 291
// Align L1 data segments on a 1-byte boundary INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(Data_BankA) }>Mem_L1_BankA_SRAM // Input section declarations for L1 data bank B memory DXE_L1_BankB_SRAM{ // Align L1 data segments on a 1-byte boundary INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(Data_BankB) }>Mem_L1_BankB_SRAM VisualDSP++ 3.5 Linker and Utilities Manual C-13 for 16-Bit Processors...
Page 292
// (C++ only) INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(constdata) $LIBRARIES(constdata)) }>Mem_L2_SRAM DXE_SDRAM_0{ // Align external SDRAM data segments on a 1-byte boundary INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(SDRAM_0)) }>Mem_SDRAM_Bank0 DXE_SDRAM_1{ // Align external SDRAM data segments on a 1-byte boundary C-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 293
// Align external SDRAM data segments on a 1-byte boundary INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(SDRAM_2)) }>Mem_SDRAM_Bank2 DXE_SDRAM_3{ // Align external SDRAM data segments on a 1-byte boundary INPUT_SECTION_ALIGN(1) INPUT_SECTIONS($OBJECTS(SDRAM_3)) }>Mem_SDRAM_Bank3 // End Sections{} // End PROCESSOR p0{} VisualDSP++ 3.5 Linker and Utilities Manual C-15 for 16-Bit Processors...
Page 294
Linking for Complex C Source File – Example 2 Figure C-2. C-to-Memory Code Placement C-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 296
PROCESSOR P0 { $P0_OBJECTS = main.doj , manager.doj; OUTPUT(mgrovly.dxe) OUTPUT( $COMMAND_LINE_OUTPUT_FILE ) SECTIONS program // Align all code sections on 2 byte boundary INPUT_SECTION_ALIGN(2) INPUT_SECTIONS ( $OBJECTS(program) $LIBRARIES(program) ) INPUT_SECTION_ALIGN(1) C-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 297
/* Only take the code from the file overlay1.doj. If this code needs data, it must be either the INPUT of a data overlay or the INPUT to non-overlay data memory. */ VisualDSP++ 3.5 Linker and Utilities Manual C-19 for 16-Bit Processors...
Linking for Overlay Memory C-22 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 301
Each program includes an file. For working .LDF examples of the linking process, examine the files that come .LDF with the examples loacted in the following directories. <VisualDSP++ InstallPath>\218x\Examples <VisualDSP++ InstallPath>\219x\Examples VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 302
A variety of per-processor default files that come with the .LDF development software provide an example LDF for each processor’s internal memory architecture. Default LDFs are in the following directories. <VisualDSP++ InstallPath>\218x\ldf <VisualDSP++ InstallPath>\219x\ldf VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
MAP (SINGLE-PROCESSOR.MAP) // Generate a MAP file // $ADI_DSP is a predefined linker macro that expands // to the VDSP install directory. Search for objects in // directory 219x\lib relative to the install directory VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 304
// The name of the output file MEMORY // Processor-specific memory command { INCLUDE(“219x_memory.ldf”) } SECTIONS // Specify the output sections INCLUDE( “219x_sections.ldf” ) // end P0 sections // end P0 processor VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
.LDR nel to zero out the variable. This action reduces the loader’s output file size, but still requires execution time for the processor to ini- tialize the memory with zeros. VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// but if __USING_LIBSIM is defined libsim will be used. from the driver command line, use: "-flags-link -MD__USING_LIBSIM=1" in the IDDE, add -MD__USING_LIBSIM=1 to to the Additional options field of the Link page #ifdef __USING_LIBSIM VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// to 1 to match this placement of program data. All pages are // 64K words. MEMORY // The memory section where the reset vector resides mem_INT_RSTI { TYPE(PM RAM) START(0x000000) END(0x00001f) WIDTH(24) } D-10 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
{ TYPE(DM RAM) START(0x008000) END(0x00ffff) WIDTH(16) } // static memory segment for DM data segment mem_ovl1_liv_space { TYPE(PM RAM) START(0x200000) END(0x2000ff) WIDTH(24) } // live address range for overlay function #1 D-16 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 317
// jump to the overlay manager function SECTIONS{ dxe_seg_rth{ INPUT_SECTIONS("2191_ASM_Interrupt_Table.doj"(interrupts)) } >mem_seg_rth dxe_seg_code{ INPUT_SECTIONS("Main.doj"(seg_code) "DMA Overlay Manager.doj"(seg_code)) } >mem_seg_code .plit{}> mem_seg_plit // define the live address for the PLIT table in its own special memory segment VisualDSP++ 3.5 Linker and Utilities Manual D-17 for 16-Bit Processors...
Page 318
// Overlay to live in section ovl3_liv_space } >mem_seg_ovl // Overlays run in this memory segment dxe_seg_dm_data{ INPUT_SECTIONS("DM_Data.doj"(seg_data) "DMA Overlay Manager.doj"(seg_data)) } >mem_seg_dm_data // end SECTIONS // end PROCESSOR p0 D-18 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
// PROCESSOR could describe its own MEMORY { TYPE(PM RAM) START(0x00000) END(0x00004) WIDTH(24) } seg_itab { TYPE(PM RAM) START(0x000004) END(0x0000ff) WIDTH(24) } seg_code { TYPE(PM RAM) START(0x000100) END(0x00ffff) WIDTH(24) } VisualDSP++ 3.5 Linker and Utilities Manual D-19 for 16-Bit Processors...
Page 320
// The second link project is a DXE project. It will be linked // against the SHARED link project defined above. PROCESSOR PSH0 { $PSH0_OBJECTS = psh0.doj, 219x_hdr.doj; LINK_AGAINST(shared.sm) OUTPUT( psh0.dxe ) SECTIONS { dxe_pmco D-20 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 321
// the SHARED and the PSH0 DXE projects defined above. PROCESSOR PSH1 { $PSH1_OBJECTS = psh1.doj, 219x_hdr.doj; LINK_AGAINST(shared.sm, psh0.dxe) OUTPUT(psh1.dxe) SECTIONS { dxe_pmco {INPUT_SECTIONS( $PSH1_OBJECTS(seg_pmco) $LIBRARIES(seg_pmco)) } > seg_pmco dxe_pmda {INPUT_SECTIONS( $PSH1_OBJECTS(seg_pmda) $LIBRARIES(seg_pmda)) } > seg_pmda dxe_dmda VisualDSP++ 3.5 Linker and Utilities Manual D-21 for 16-Bit Processors...
= dm(THREE); // read value of memory mapped variable // that lives in internal non-overlay // DM memory region into ay0 pmovlay = 0; // jump to internal PM overlay region #0 VisualDSP++ 3.5 Linker and Utilities Manual D-23 for 16-Bit Processors...
Page 324
// Call the MULT function that resides // in internal PM overlay #5 DONE: idle; // wait here until an interrupt occurs jump DONE; // jump back to "idle" instruction after // returning from interrupt subroutine D-24 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 325
6-15 @filename linker command-line switch .DOJ files 2-32 2-38 about __SILICON_REVISION__ macro .DXE files 1-6, 2-32, 2-47 data extraction _ov_end breakpoint 5-7, linker _ov_endaddress_# 5-9, 5-22 .LDF files 2-32, VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Page 337
2-40 command-line switch 2-48 target processor special section name specifying 2-38 .MEMINIT 3-43 -tnv archiver command-line switch 6-13 .PLIT 3-43 tree view splitter memory map 4-22 ASCII-format files (.LDR) VisualDSP++ 3.5 Linker and Utilities Manual I-13 for 16-Bit Processors...
Page 338
2-49 version information built in with archiver viewing ZERO_INIT qualifier 3-44 .OVL file content archive files icons and colors 4-14 input sections 4-12 memory map 4-19 VisualDSP++ archiver I-14 VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors...
Need help?
Do you have a question about the VisualDSP++ 3.5 and is the answer not in the manual?
Questions and answers