TMS320C28x Assembly Language Tools
v6.1
User's Guide
Literature Number: SPRU513E
April 2012
Contents
Preface ...................................................................................................................................... 10
1 Introduction to the Software Development Tools ................................................................... 13
1.1 Software Development Tools Overview ................................................................................ 14
1.2 Tools Descriptions ......................................................................................................... 15
2 Introduction to Object Modules ........................................................................................... 17
2.1 Sections ..................................................................................................................... 18
2.2 How the Assembler Handles Sections .................................................................................. 19
2.2.1 Uninitialized Sections ............................................................................................ 19
2.2.2 Initialized Sections ................................................................................................ 20
2.2.3 Named Sections .................................................................................................. 21
2.2.4 Subsections ....................................................................................................... 21
2.2.5 Section Program Counters ...................................................................................... 22
2.2.6 Using Sections Directives ....................................................................................... 22
2.3 How the Linker Handles Sections ....................................................................................... 24
2.3.1 Default Memory Allocation ...................................................................................... 25
2.3.2 Placing Sections in the Memory Map .......................................................................... 26
2.4 Relocation .................................................................................................................. 26
2.5 Run-Time Relocation ...................................................................................................... 27
2.6 Loading a Program ........................................................................................................ 27
2.7 Symbols in an Object File ................................................................................................ 28
2.7.1 External Symbols ................................................................................................. 28
2.7.2 The Symbol Table ................................................................................................ 28
3 Assembler Description ....................................................................................................... 29
3.1 Assembler Overview ...................................................................................................... 30
3.2 The Assembler's Role in the Software Development Flow .......................................................... 31
3.3 Invoking the Assembler ................................................................................................... 32
3.4 Naming Alternate Directories for Assembler Input .................................................................... 33
3.4.1 Using the --include_path Assembler Option .................................................................. 34
3.4.2 Using the C2000_A_DIR Environment Variable .............................................................. 34
3.5 Source Statement Format ................................................................................................ 35
3.5.1 Label Field ......................................................................................................... 36
3.5.2 Mnemonic Field ................................................................................................... 36
3.5.3 Operand Field ..................................................................................................... 37
3.5.4 Comment Field .................................................................................................... 37
3.6 Constants ................................................................................................................... 38
3.6.1 Binary Integers .................................................................................................... 38
3.6.2 Octal Integers ..................................................................................................... 38
3.6.3 Decimal Integers .................................................................................................. 39
3.6.4 Hexadecimal Integers ............................................................................................ 39
3.6.5 Character Constants ............................................................................................. 39
3.6.6 Assembly-Time Constants ...................................................................................... 39
3.6.7 Floating-Point Constants ........................................................................................ 40
3.7 Character Strings .......................................................................................................... 40
3.8 Symbols ..................................................................................................................... 40
3.8.1 Labels .............................................................................................................. 40
2
Contents SPRU513E–April 2012
Submit Documentation Feedback
Copyright © 2012, Texas Instruments Incorporated
www.ti.com
3.8.2 Local Labels ....................................................................................................... 41
3.8.3 Symbolic Constants .............................................................................................. 43
3.8.4 Defining Symbolic Constants (--asm_define Option) ........................................................ 43
3.8.5 Predefined Symbolic Constants ................................................................................ 44
3.8.6 Substitution Symbols ............................................................................................. 45
3.9 Expressions ................................................................................................................ 47
3.9.1 Operators .......................................................................................................... 47
3.9.2 Expression Overflow and Underflow ........................................................................... 48
3.9.3 Well-Defined Expressions ....................................................................................... 48
3.9.4 Conditional Expressions ......................................................................................... 48
3.9.5 Legal Expressions ................................................................................................ 48
3.10 Built-in Functions .......................................................................................................... 49
3.11 Specifying Assembler Fill Values (--asm_code_fill and --asm_data_fill) ........................................... 50
3.12 TMS320C28x Assembler Modes ........................................................................................ 51
3.12.1 C27x Object Mode .............................................................................................. 51
3.12.2 C28x Object Mode .............................................................................................. 52
3.12.3 C28x Object - Accept C27x Syntax Mode ................................................................... 52
3.12.4 C28x Object - Accept C2xlp Syntax Mode ................................................................... 52
3.12.5 C28x FPU32 and FPU64 Object Modes ..................................................................... 53
3.12.6 C28x CLA Object Mode ........................................................................................ 54
3.13 Source Listings ............................................................................................................ 54
3.14 Debugging Assembly Source ............................................................................................ 56
3.15 C-Type Symbolic Debugging for Assembly Variables (--cdebug_asm_data Option) ............................. 57
3.16 Cross-Reference Listings ................................................................................................. 58
3.17 Smart Encoding ............................................................................................................ 59
3.18 Pipeline Conflict Detection ............................................................................................... 60
3.18.1 Protected and Unprotected Pipeline Instructions ............................................................ 60
3.18.2 Pipeline Conflict Prevention and Detection .................................................................. 60
3.18.3 Pipeline Conflicts Detected ..................................................................................... 61
4 Assembler Directives ......................................................................................................... 62
4.1 Directives Summary ....................................................................................................... 63
4.2 Compatibility With the TMS320C1x/C2x/C2xx/C5x Assembler Directives ......................................... 67
4.3 Directives That Define Sections ......................................................................................... 67
4.4 Directives That Initialize Constants ..................................................................................... 69
4.5 Directives That Perform Alignment and Reserve Space ............................................................. 70
4.6 Directives That Format the Output Listings ............................................................................ 72
4.7 Directives That Reference Other Files .................................................................................. 74
4.8 Directives That Enable Conditional Assembly ......................................................................... 74
4.9 Directives That Define Union or Structure Types ..................................................................... 75
4.10 Directives That Define Enumerated Types ............................................................................. 75
4.11 Directives That Define Symbols at Assembly Time ................................................................... 75
4.12 Directives That Override the Assembler Mode ........................................................................ 76
4.13 Miscellaneous Directives ................................................................................................. 76
4.14 Directives Reference ...................................................................................................... 77
5 Macro Description ............................................................................................................ 133
5.1 Using Macros ............................................................................................................. 134
5.2 Defining Macros .......................................................................................................... 134
5.3 Macro Parameters/Substitution Symbols ............................................................................. 136
5.3.1 Directives That Define Substitution Symbols ................................................................ 137
5.3.2 Built-In Substitution Symbol Functions ....................................................................... 138
5.3.3 Recursive Substitution Symbols .............................................................................. 139
5.3.4 Forced Substitution ............................................................................................. 139
5.3.5 Accessing Individual Characters of Subscripted Substitution Symbols .................................. 140
3
SPRU513E–April 2012 Contents
Submit Documentation Feedback
Copyright © 2012, Texas Instruments Incorporated
www.ti.com
5.3.6 Substitution Symbols as Local Variables in Macros ........................................................ 141
5.4 Macro Libraries ........................................................................................................... 141
5.5 Using Conditional Assembly in Macros ............................................................................... 142
5.6 Using Labels in Macros ................................................................................................. 144
5.7 Producing Messages in Macros ........................................................................................ 145
5.8 Using Directives to Format the Output Listing ....................................................................... 146
5.9 Using Recursive and Nested Macros ................................................................................. 147
5.10 Macro Directives Summary ............................................................................................. 148
6 Archiver Description ........................................................................................................ 149
6.1 Archiver Overview ........................................................................................................ 150
6.2 The Archiver's Role in the Software Development Flow ............................................................ 151
6.3 Invoking the Archiver .................................................................................................... 152
6.4 Archiver Examples ....................................................................................................... 153
6.5 Library Information Archiver Description .............................................................................. 155
6.5.1 Invoking the Library Information Archiver .................................................................... 155
6.5.2 Library Information Archiver Example ........................................................................ 155
6.5.3 Listing the Contents of an Index Library ..................................................................... 156
6.5.4 Requirements .................................................................................................... 156
7 Linker Description ........................................................................................................... 157
7.1 Linker Overview .......................................................................................................... 158
7.2 The Linker's Role in the Software Development Flow .............................................................. 159
7.3 Invoking the Linker ....................................................................................................... 160
7.4 Linker Options ............................................................................................................ 161
7.4.1 Wild Cards in File, Section, and Symbol Patterns .......................................................... 163
7.4.2 Relocation Capabilities (--absolute_exe and --relocatable Options) ..................................... 163
7.4.3 Allocate Memory for Use by the Loader to Pass Arguments (--arg_size Option) ...................... 164
7.4.4 Control Linker Diagnostics ..................................................................................... 165
7.4.5 Disable Automatic Library Selection (--disable_auto_rts Option) ......................................... 165
7.4.6 Disable Conditional Linking (--disable_clink Option) ....................................................... 165
7.4.7 Link Command File Preprocessing (--disable_pp, --define and --undefine Options) ................... 166
7.4.8 Define an Entry Point (--entry_point Option) ................................................................ 167
7.4.9 Define Far Heap Size (--farheap Option) .................................................................... 167
7.4.10 Set Default Fill Value (--fill_value Option) .................................................................. 167
7.4.11 Define Heap Size (--heap_size Option) ..................................................................... 167
7.4.12 Hiding Symbols ................................................................................................. 168
7.4.13 Alter the Library Search Algorithm (--library Option, --search_path Option, and C2000_C_DIR
Environment Variable) .......................................................................................... 168
7.4.14 Change Symbol Localization ................................................................................. 171
7.4.15 Create a Map File (--map_file Option) ...................................................................... 172
7.4.16 Managing Map File Contents (--mapfile_contents Option) ............................................... 173
7.4.17 Disable Name Demangling (--no_demangle) .............................................................. 173
7.4.18 Disable Merge of Symbolic Debugging Information (--no_sym_merge Option) ....................... 174
7.4.19 Strip Symbolic Information (--no_symtable Option) ....................................................... 174
7.4.20 Name an Output Module (--output_file Option) ............................................................ 175
7.4.21 C Language Options (--ram_model and --rom_model Options) ......................................... 175
7.4.22 Create an Absolute Listing File (--run_abs Option) ........................................................ 175
7.4.23 Scan All Libraries for Duplicate Symbol Definitions (--scan_libraries) .................................. 175
7.4.24 Define Stack Size (--stack_size Option) .................................................................... 175
7.4.25 Enforce Strict Compatibility (--strict_compatibility Option) ................................................ 175
7.4.26 Mapping of Symbols (--symbol_map Option) .............................................................. 176
7.4.27 Introduce an Unresolved Symbol (--undef_sym Option) .................................................. 176
7.4.28 Display a Message When an Undefined Output Section Is Created (--warn_sections Option) ..... 176
7.4.29 Generate XML Link Information File (--xml_link_info Option) ............................................ 176
4
Contents SPRU513E–April 2012
Submit Documentation Feedback
Copyright © 2012, Texas Instruments Incorporated
www.ti.com
7.5 Linker Command Files .................................................................................................. 177
7.5.1 Reserved Names in Linker Command Files ................................................................. 178
7.5.2 Constants in Linker Command Files ......................................................................... 178
7.5.3 The MEMORY Directive ........................................................................................ 179
7.5.4 The SECTIONS Directive ...................................................................................... 183
7.5.5 Specifying a Section's Run-Time Address ................................................................... 197
7.5.6 Using UNION and GROUP Statements ...................................................................... 199
7.5.7 Overlaying Pages ............................................................................................... 203
7.5.8 Special Section Types (DSECT, COPY, and NOLOAD) .................................................. 205
7.5.9 Assigning Symbols at Link Time .............................................................................. 206
7.5.10 Creating and Filling Holes .................................................................................... 212
7.6 Object Libraries ........................................................................................................... 215
7.7 Default Allocation Algorithm ............................................................................................ 216
7.7.1 How the Allocation Algorithm Creates Output Sections ................................................... 216
7.7.2 Reducing Memory Fragmentation ............................................................................ 217
7.8 Linker-Generated Copy Tables ........................................................................................ 217
7.8.1 A Current Boot-Loaded Application Development Process ............................................... 217
7.8.2 An Alternative Approach ....................................................................................... 218
7.8.3 Overlay Management Example ............................................................................... 218
7.8.4 Generating Copy Tables Automatically With the Linker ................................................... 219
7.8.5 The table() Operator ............................................................................................ 221
7.8.6 Boot-Time Copy Tables ........................................................................................ 221
7.8.7 Using the table() Operator to Manage Object Components ............................................... 221
7.8.8 Copy Table Contents ........................................................................................... 222
7.8.9 General Purpose Copy Routine ............................................................................... 224
7.8.10 Linker-Generated Copy Table Sections and Symbols .................................................... 225
7.8.11 Splitting Object Components and Overlay Management ................................................. 226
7.9 Linker-Generated CRC Tables ......................................................................................... 228
7.9.1 The crc_table() Operator ....................................................................................... 228
7.9.2 Restrictions ...................................................................................................... 228
7.9.3 Examples ......................................................................................................... 229
7.9.4 Interface .......................................................................................................... 230
7.9.5 A Special Note Regarding 16-Bit char ....................................................................... 233
7.10 Partial (Incremental) Linking ............................................................................................ 235
7.11 Linking C/C++ Code ..................................................................................................... 236
7.11.1 Run-Time Initialization ......................................................................................... 236
7.11.2 Object Libraries and Run-Time Support .................................................................... 236
7.11.3 Setting the Size of the Stack and Heap Sections ......................................................... 236
7.11.4 Autoinitialization of Variables at Run Time ................................................................. 237
7.11.5 Initialization of Variables at Load Time ...................................................................... 237
7.11.6 The --rom_model and --ram_model Linker Options ....................................................... 238
7.12 Linker Example ........................................................................................................... 239
8 Absolute Lister Description ............................................................................................... 243
8.1 Producing an Absolute Listing .......................................................................................... 244
8.2 Invoking the Absolute Lister ............................................................................................ 245
8.3 Absolute Lister Example ................................................................................................ 246
9 Cross-Reference Lister Description ................................................................................... 249
9.1 Producing a Cross-Reference Listing ................................................................................. 250
9.2 Invoking the Cross-Reference Lister .................................................................................. 251
9.3 Cross-Reference Listing Example ..................................................................................... 252
10 Object File Utilities ........................................................................................................... 254
10.1 Invoking the Object File Display Utility ................................................................................ 255
10.2 Invoking the Disassembler .............................................................................................. 256
5
SPRU513E–April 2012 Contents
Submit Documentation Feedback
Copyright © 2012, Texas Instruments Incorporated
评论0