Home

CodeWarrior™ Development Studio for ColdFire® Architectures v6

image

Contents

1. 184 Linker Options iaa Se ee a 194 A Using Debug Initialization Files 203 Common File Uses serment ae eee sant ed ee eee 203 Command Syntax 205 Command Reference sors tiens AE R Gia ace be rl wees 206 Delicia Hay on oe eee 206 ResetHalte ci aerate ren a ee eke Ble ew Bt AA 207 RESUME sake ahd wae ee eee es VS 207 SOD ee met aye erg Saag de A eid M ee sens 207 Writeaddressreg 22e bbe a NAS Ou ie eee 207 writecontrolred ito a Bee TEE be Moe Wels 208 Wiitedatares o ict sn a tek Aad ile tes 208 A EN 209 WHItEMEM Li a A a 209 8 ColdFire Architectures v6 0 Targeting Manual Table of Contents WILLE MEME WV Mesias AR E ON M teach ab 210 B Memory Configuration Files 211 Command Syntax ss se reii aia a es Rb aes Rees 211 Command Explanations 212 O ee Rethel that te ele ae terete etka eke kas 212 TOSCLVOd det thet e ds ts Me Ra e A RA or IA rs 213 TES CO A a traite en 213 Index 215 ColdFire Architectures v6 0 Targeting Manual 9 Table of Contents 10 ColdFire Architectures v6 0 Targeting Manual Introduction This manual explains how to use Code Warrior M development tools to develop applications for the Freescale ColdFire family of integrated microprocessors This chapter consists of these sections Read the Developer Notes e Features e CodeWarrior Editions About this M
2. button checkbox button Checked Catches and displays uses of the IRQ7 break button ColdFire Architectures v6 0 Targeting Manual Element Purpose Comments 8 Privilege Violation Clear Ignores privilege violations Default Checked checkbox Checked Catches and displays privilege violations 10 Unimplemented Clear Ignores unimplemented line A Default Checked Line A Opcode opcodes checkbox Checked Catches and displays unimplemented line A opcodes 11 Unimplemented Clear Ignores unimplemented line F Default Checked Line F Opcode opcodes checkbox Checked Catches and displays unimplemented line F opcodes 12 Non PC Clear Ignores non PC breakpoint Default Checked breakpoint debug debug interrupts interrupt checkbox Checked Catches and displays non PC breakpoint debug interrupts 13 PC breakpoint Clear Ignores PC breakpoint debug Default Clear debug interrupt interrupts checkbox Checked Catches and displays PC breakpoint debug interrupts 14 Format Error Clear Ignores format errors Default Checked checkbox Checked Catches and displays format errors 15 Uninitialized Clear Ignores uninitialized Default Checked Interrupt checkbox interrupts Checked Catches and displays uninitialized interrupts 24 Spurious Clear Ignores spurious interrupts Default Checked Interrupt checkbox Checked Catches and displays spurious
3. KEEP_SECTION sectionTypel sectionTypel Parameter sectionType Identifier for any user defined or predefined section MEMORY Starts the LCF memory segment which defines segments of target memory MEMORY memory_spec memory_spec Parameters memory_spec segmentName accessFlags ORIGIN address LENGTH length gt fileName ColdFire Architectures v6 0 Targeting Manual 97 ELF Linker and Command Language Commands Directives and Keywords segmentName Name for a new segment of target memory Consists of alphanumeric characters can include the underscore character accessFlags ELF access permission flags R read W write or X execute address A memory address such as 0x80000400 or an AFTER command The format of the AFTER command is AFTER name name this command specifies placement of the new memory segment at the end of the named segments length Size of the new memory segment a value greater than zero Optionally the value zero for autolength in which the linker allocates space for all the data and code of the segment Autolength cannot increase the amount of target memory so the feature can lead to overflow fileName Optional binary file destination The linker writes the segment to this binary file on disk instead of to an ELF program header The linker puts this binary file in the same folder as the ELF output file This option has two variants
4. Factory Settings Import Panel Export Panel DK Cancel Apply Table 9 1 lists additional panels that can affect debugging Table 9 1 Additional Settings Panels That May Affect Debugging Panel Impact See C C Warnings compiler warnings C Compilers Reference ColdFire Linker controls symbolics ColdFire Linker linker warnings ColdFire Processor optimizations ColdFire Processor Global Optimizations optimizations IDE User s Guide 120 ColdFire Architectures v6 0 Targeting Manual Debugging Target Settings for Debugging CF Debugger Settings Panel Use the CF Debugger Settings panel Figure 9 2 to select debugger hardware and control interaction with the target board Table 9 2 explains the elements of this panel Figure 9 2 CF Debugger Settings Panel CF Debugger Settings Target Processor 5213 X Target OS BareBoard v N Use Target Initialization File Project cfa M 5213EWB_PnE cfg Browse N Use Memory Configuration File Project cfo M 5213EVB mem Browse Program Download Options Initial Launch Successive Runs Verity Memory Writes Executable JV Executable Jv Constant Data wv Constant Data Y v Initialized Data Initialized Data Y Unitialized Data Unitialized Data 7 Table 9 2 CF Debugger Settings Panel Elements Element Purpose Comments Target Processor Specifies the target processor
5. Y mM View Memory As ColdFire Architectures v6 0 Targeting Manual 35 Application Tutorial Debug the Application b From this context menu select View Memory The View Memory window Figure 3 13 appears Figure 3 13 View Memory Window mM5213EYB Console Debug elf Memory 1 loj x Display main View Raw data y 20000500 20000510 20000520 20000530 20000540 20000550 20000560 20000570 20000580 Word Size 32 20002E2C 41F92000 4EB92000 OA6SC6OFE 20392000 56446612 20404E90 42692000 0558588F 2E1F4E75 53802300 20005648 0C004E90 20392000 S6B0670A 20404E90 20005260 2E884EB3 540441E3 00442E38 2F07598F 2E2F000C 20392000 S6ACE70A 56AC2E87 4EB92000 60142039 20005648 41F92000 56842070 S6AS6EDE 20392000 42B92000 56B04EB9 c Note that the View Memory window displays hexadecimal and ascii values for several addresses starting at the address ofmain d In the Display text box type a valid address in RAM or ROM e Press the Enter key Window contents change to display memory values starting at the address you entered NOTE You can edit the contents of the View Memory window This window also lets you disassemble a random part of memory f Close the View Memory window 36 ColdFire Architectures v6 0 Targeting Manual Application Tutorial Debug the Application 6 Run the application a From the main menu bar select Project gt Run or click the Run button of the Debu
6. Code Model Far 32 bit X Data Model Far 32 bit y Floating Point I Position Independent Code I Position Independent Data D PC Relative Strings o bytes Table 4 6 ColdFire Processor Panel Elements Element Target CPU list box Purpose Specifies the target ColdFire processor Comments Default MCF5282 Code Model list box Specifies access addressing for data and instructions in the object code Smart Relative 16 bit for function calls in the same segment otherwise absolute 32 bit Near 16 bit Relative for all function calls Far 32 bit Absolute for all function calls ColdFire Architectures v6 0 Targeting Manual Default Far 32 bit Far is useful if your source file generates more than 32K of code or if there is an out of range link error message Near requires adjusting the 1cf For 1cf information see LCF Structure Target Settings ColdFire Settings Panels Table 4 6 ColdFire Processor Panel Elements continued Element Purpose Comments Struct Alignment Specifies record and structure Default 68k 4 byte list box alignment in memory This panel element 68K 2 byte Aligns all fields on corresponds to the options 2 byte boundaries except for align pragma felgsot only byte Natural boundary alignment 68K 4 byte Aligns all fields on means 1 byte for a 1 byte 4 byte boundaries character 2 bytes fo
7. 154 bus dump ss near a oie AA ten Ne te 155 ARS VR O nn D here ne nn ein NN 156 IPSDAL rad oo ied eh Talent ta ino ed 156 Kani Sie ii ma mer AS es ded econ eed 3 nn Mers L 157 KTOMESIZE sa 6 ahs Re hd BE ae ee ne A NAG I es TN etc Besos 157 kromisvalids tartines de ory we Mur sim dE ae 158 Mb tia sang ae aos tata A A A ia it taa acl 158 Mbu s Multiple sesen e a Mae i ee 159 MEMORY a a a a Mie nabs Gea 159 A 160 Sample Configuration File 160 ColdFire Architectures v6 0 Targeting Manual 7 Table of Contents ISS LIMON ir bete Lae Be ane une bk Ha Be 161 11 Libraries and Runtime Code 163 MSL for ColdFire Development 163 Using MSL for ColdFire 163 Additional Aspects 165 Runtime Libraries ui ne des nn ae me net 167 Position Independent Code 168 Board Initialization Code 168 12 Using Hardware Tools 169 Flash Programmer nee A da Eee ets 169 Hardware Diagnostics 174 13 Command Line Tools 179 Command Line Executables 179 Environment Variables 179 Compiling and Linking 181 Assembler Options r 100 aa ia 183 Compiler Options
8. Files Link Order Targets Y a Source e 50 Linker Command Files e H Runtime FP C and UART 2 Support files El readme txt 17 files 4 Make sure that the target field immediately under the project window tab specifies M5213EVB Console Debug NOTE Files in the project data folder include information about the project file various target settings and object code Do not change the contents of this folder or the CodeWarrior IDE could lose project settings 5 This completes project creation You are ready to build the project per the procedure of the next section NOTE While your source file main c is open in the editor window you can use all editor features to work with your code If you wish you can use a third party editor to create and edit your code provided that this editor saves the file as plain text For information about the editor window touching files and file synchronization and removing adding text files see IDE User s Guide ColdFire Architectures v6 0 Targeting Manual 29 Application Tutorial Build the Project Build the Project This section shows how to select the linker set up remote debugging and build compile and link your project NOTE The stationery for this project includes a default setup for the linker specific to the application s target platform Follow these steps 1 Select the appropriate linker a Select Edit gt Target Settings where Target i
9. BDM Debugging Debugging ELF Files without Projects Special Debugger Features Target Settings for Debugging Several target settings panels control the way the debugger works CF Debugger Settings Panel e Remote Debugging Panel CF Exceptions Panel Debugger Settings Panel CF Interrupt Panel To access these panels select Edit gt Target Settings from the main menu bar Target is the current build target in the CodeWarrior project The Target Settings window Figure 9 1 appears ColdFire Architectures v6 0 Targeting Manual 119 Debugging Target Settings for Debugging Figure 9 1 Target Settings Window M5213E B Console Debug Settings Ax Q Target Settings Panels Debugger Settings Eoldh te Assembler r Location of Relocated Libraries and Code Resources S Code Generation ColdFire Processor Choose Global Optimizations E Linker N Stop on application launch BatchRunner Post A r BatchRunner PreLi Program entry point C Default language entry point ELF Disassembler Userspeciied am _ ColdFire Linker E Editor r Other Settings Custom Keywords mae A G Debugger J Auto target Libraries IV Cache symbolics between runs Debuager Settings IV Log System Messages IV Stop at Watchpoints Remote Debugging He CF Debugger Setti I Update data every 5 seconds Console Encoding None y CF Exceptions CF Interrupt Debugger PIC Setti
10. Drag the ELF file to the IDE the IDE opens a new project based on the ELF file Special Debugger Features This section explains debugger features that are unique to ColdFire platform targets ColdFire Menu To see the unique Coldfire debugger menu select Debug gt ColdFire Table 9 10 lists its selections Table 9 10 ColdFire Debug Menu Selection Explanation Reset Target Sends a reset signal to the target processor Not available unless the target processor supports this signal Save Memory Saves target board data to disk as a binary image file Load Memory Writes previously saved binary file data to target board memory Fill Memory Fills a specified area of memory with a specified value ColdFire Architectures v6 0 Targeting Manual 147 Debugging Special Debugger Features Table 9 10 ColdFire Debug Menu continued 148 Selection Explanation Save Registers Saves contents of specified register to a text fie Restore Registers Writes previously saved register contents back to the registers Watchpoint Type Specifies the type Read A read from the specified memory address stops execution Write A write to the specified memory address stops execution Read Write Either a read from or write to the specified memory address stops execution Not available unless the target processor and debug connection support watchpoints s this signal
11. Configures the KROM size krom_size size_parameter Parameter size_parameter Code number for the size per Table 10 3 ColdFire Architectures v6 0 Targeting Manual 157 Instruction Set Simulator ISS Configuration Commands Table 10 3 krom Size Parameter Conversion size_parameter Kilobytes size parameter Kilobytes 0 0 6 16 1 0 5 7 32 2 1 8 64 3 2 9 128 4 4 10 256 5 8 11 512 Example krom_size 11 krom_valid Controls KROM mapping to address 0 at boot up krom_valid switch Parameter switch Boolean value yes or true or no or false Example krom_valid true mbar Provides beginning address and offset enabling V2 core MBAR registers The V4 counterpart command is ipsbar mbar switch 158 ColdFire Architectures v6 0 Targeting Manual Instruction Set Simulator ISS Configuration Commands Parameter switch Boolean value yes or true or no or false Example mbar true mbus_multiplier For a V2 core processor multiplies the core clock speed mbus_multiplier value Parameter value Any integer between 1 and 10 Example mbus_multiplier 10 memory Configures sections of external memory memory start end wait_states line_wait_states Parameters start Starting address of the contiguous section of memory end Ending address of the contiguous section of memory wait_states Number of wait states inserted for norm
12. Handling of local variables and arguments depends on the level of inline assembly However for optimization level 1 or greater you can force variables to stay in a register by using the symbol Function Level The function level inline assembler lets you refer to local variables and function arguments yourself handles such references for you For your own references you must explicitly save and restore processor registers and local variables when entering and leaving your inline assembly function You cannot refer to the variables by name but you can refer to function arguments off the stack pointer For example this function moves its argument into d0 asm void alpha short n ColdFire Architectures v6 0 Targeting Manual 111 Inline Assembly Inline Assembly Syntax move w 4 sp d0 n To let the inline assembler handle references use the directives fralloc and frfree according to these steps 1 Declare your variables as you would in a normal C function 2 Use the fralloc directive It makes space on the stack for the local stack variables Additionally with the statement link x a6 this directive reserves registers for the local register variables 3 In your assembly you can refer to the local variables and variable arguments by name 4 Finally use the frfree directive to free the stack storage and restore the reserved registers It is somewhat easier to use a C wrapper and statement level assembly
13. Listing 8 3 is an example of using local variables and function arguments in function level inline assembly Listing 8 3 Function level Local Variables Function Arguments static asm short f short n register short a Declaring a as a register variable short b and b as a stack variable Note that you need semicolons after these statements fralloc Allocate space on stack reserve registers move w n a Using an argument and local var add w a a move w a D0O frfree Free space that fralloc allocated rts Statement Level Statement level inline assembly allows full access to local variables and function arguments without using the fralloc or frfree directives Listing 8 4 is an example of using local variables and function arguments in statement level inline assembly You may place statement level assembly code anywhere in a C C program 112 ColdFire Architectures v6 0 Targeting Manual Inline Assembly Inline Assembly Directives Listing 8 4 Statement Level Local Variables Function Arguments long square short a long result 0 asm move w a d0 fetch function argument a mulu w d0 d0 multiply move l d0 result store in local result variable return result Returning From a Routine Every inline assembly function not statement level should end with a return statement Use the rts statement for ordinary C functions as Listing 8 5 shows Listing 8 5 Assem
14. E68K_Support ms1 MSL_C MSL_E68 installation directory e MSL EC libraries in subdirectory installation directory E68K_Support ms1 MSL_EC MSL_1 k Lib of your CodeWarrior E68k Lib of your CodeWarrior ColdFire Architectures v6 0 Targeting Manual Table 11 2 MSL Files Libraries and Runtime Code MSL for ColdFire Development Category C Subcategory Coldfire C C_4i CF _MSL a C_4i_CF_StdABI_MSL a C_TRK_4i_CF_MSL a C_TRK_4i_CF_StdABI_MSL a ColdFire 54xx C C_4i_CF_FPU_MSL a C_4i_CF_FPU_StdABI_MSL a C_TRK_4i_CF_FPU_MSL a C_TRK_4i_CF_StdABI_FPU_MSL a ColdFire C C _4i_CF_MSL a C _4i_CF_StdABI_PI_MSL a C _4i_CF_PI_MSL a C _4i_CF_StdABI_MSL a ColdFire 54xx C C _4i_CF_FPU_MSL a C _4i_CF_FPU_StdABI_MSL a C _4i_CF_FPU_PI_MSL a C _4i_CF_FPU_StdABI_PI_MSL a EC ColdFire EC EC _4i_CF_MSL a EC _4i_CF_StdABI_MSL a ColdFire 54xx EC EC _4i_CF_FPU_MSL a EC _4i_CF_FPU_StdABI_MSL a Additional Aspects The next few subsections identify and explain subordinate and additional ways to use the MSL ColdFire Architectures v6 0 Targeting Manual 165 Libraries and Runtime Code MSL for ColdFire Development Serial 1 0 and UART Libraries The ColdFire Metrowerks Standard Libraries support console I O through the serial p
15. NOTE Itis possible to compile a single source file To do so select the filename in the project window then select Project gt Compile from the main menu bar Another useful option is compiling only the modified files of the build target select Project gt Bring Up To Date from the main menu bar Debugging To debug your application select Project gt Debug from the main menu bar The debugger window opens displaying your program code Run the application from within the debugger to observe results The debugger lets you set breakpoints to check register parameter and other values at specific points of code execution NOTE _ To debug code stored in Flash memory you first must program the Flash When your code executes correctly you are ready to add features to release the application to testers or to release the application to customers NOTE Another debugging feature of the CodeWarrior IDE is viewing preprocessor output This helps you track down bugs caused by macro expansions or another subtlety of the preprocessor To use this feature specify the output filename in the project window then select Project gt Preprocess from the main menu bar A new window opens to show the preprocessed file Disassembling To disassemble a compiled or ELF file of your project select the file s name in the project window then select Project gt Disassemble After disassembling the file the CodeWarrior IDE creates a dump file that
16. Targeting Manual Default Checked Target Settings ColdFire Settings Panels Table 4 4 ColdFire Assembler Panel Elements continued Element Purpose Comments Generate Listing File Clear Tells assembler to not Default Clear checkbox generate a listing file A listing file Checked Tells assembler to contains the file generate a listing file source along with line numbers relocation information and macro expansions Prefix File text box Specifies the name of the assembly Default None prefix file Useful for include files that define common constants global declarations and function names Otherwise the assembler s default prefix file suffices ELF Disassembler Use the ELF Disassembler panel Figure 4 7 to control settings for the disassembly view you see this view when you disassemble object files Table 4 5 explains the elements of this panel ColdFire Architectures v6 0 Targeting Manual 47 Target Settings ColdFire Settings Panels Figure 4 7 ELF Disassembler Panel ELF Disassembler Table 4 5 EL 48 M Show Headers N Show Code Modules Y Show Symbol and String Tables TT Verbose Info M Show Relocations M Use Extended Mnemonics M Show Addresses and Object Code M Show Source Code M Show Comments Show Data Modules I Disassemble Exception Tables M Show Debug Info Element Show Headers checkbox F
17. The two variants are e gt segmentName puts section contents at the beginning of memory segment segmentName e gt gt segmentName appends section contents to the end of memory segment segmentName Remarks For more information see the subsection Sections Segment Example Listing 6 25 is an example sections segment definition Listing 6 25 SECTIONS Directive Example nN ECTIONS 100 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords text _textSegmentStart alpha c text ALIGN 0x10 beta c text _textSegmentEnd data data bss bss COMMON SIZEOF Returns the size in bytes of the specified segment or section SIZEOF segmentName sectionName Parameters segmentName Name of a segment sectionName Name of a section SIZEOF_ ROM Returns the size in bytes that a segment occupies in ROM SIZEOF_ROM segmentName Parameter segmen tName Name of a ROM segment Remarks Always returns the value 0 until the ROM is built Accordingly you should use SIZEOF_ROM only within an expression inside a WRITEB WRITEH WRITEW or AT function ColdFire Architectures v6 0 Targeting Manual 101 ELF Linker and Command Language Commands Directives and Keywords Furthermore you need SIZEOF_ROM only if you use the COMPRESS option on the memory segment With
18. Working with Target Hardware To have the IDE work with target hardware use Debug menu selections Connect and Attach Connect This selection tells the IDE to read the contents of target board registers and memory these contents help you determine the state of the processor and target board You can use this selection in combination with the Load Save Memory and Fill Memory selections of the ColdFire menu to create a memory dump load memory contents or initialize memory with specific patterns of data You can have the IDE connect to a target board that uses ColdFire Abatron or ColdFire P amp E Micro protocols The Connect selection works with a remote connection that you define in a project 1 Bring forward the project you want to use The project must have at least one remote connection defined for the target hardware 2 Select Debug gt Connect a Thread window appears showing where the IDE stops program execution 3 Use the Thread window with other IDE windows to see register views and memory contents ColdFire Architectures v6 0 Targeting Manual Debugging Special Debugger Features Attach This selection gives the debugger control of the application running on the target hardware For example suppose that a large application is running on the target hardware using its project as the host Selecting Debug gt Attach to Process attaches the project to the running application The IDE loads the symbolics
19. Your stationery selection list box automatically makes this specification Target OS list box Specifies a real time operating system Default BareBoard for bare board development select If you have Professional Edition BareBoard software and install an RTOS that RTOS becomes a selection of this list box Special and Standard Edition software however does not support an RTOS ColdFire Architectures v6 0 Targeting Manual 121 Debugging Target Settings for Debugging Table 9 2 CF Debugger Settings Panel Elements continued Element Purpose Comments Use Target Clear Specifies not using a target Default checked Initialization File initialization file deactivates file The initialization file is in checkbox subordinate text box and Browse button subdirectory E68K_Support Initializatio Checked Tolls he debugger 19 bee n_Files of the CodeWarrior the specified target initialization file To f A installation directory or directory enter a pathname in the text box click that contains your project the Browse button then use the file z i select dialog box to specify the file Clear this checkbox if MON AIS using an Abatron based remote connection Make sure this checkbox is checked if you are using a P amp E Micro based remote connection Use Memory Clear Specifies not using a memory Default Unchecked Configuration File configuration file deactivates file The memo
20. e gt fileName writes the segment to a new binary file e gt gt fileName appends the segment to an existing binary file Remarks The LCF contains only one MEMORY directive but this directive can define as many memory segments as you wish For each memory segment the ORIGIN keyword introduces the starting address and the LENGTH keyword introduces the length value There is no overflow checking for the autolength feature To prevent overflow you should use the AFTER keyword to specify the segment s starting address If an AFTER keyword has multiple parameter values the linker uses the highest memory address For more information see the subsection Memory Segment Example Listing 6 24 is an example use of the MEMORY directive Listing 6 24 MEMORY Directive Example MEMORY 98 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords TEXT RX ORIGIN 0x00003000 LENGTH 0 DATA RW ORIGIN AFTER TEXT LENGTH 0 OBJECT Sections segment keyword that specifies a function Multiple OBJECT keywords control the order of functions in the output file OBJECT function sourcefile c Parameters function Name of a function sourcefile c Name of the C file that contains the function Remarks If an OBJECT keyword tells the linker to write an object to the output file the linker does not write the same
21. macl msacl move and movclr for the ColdFire EMAC unit The default value is OFF ColdFire Architectures v6 0 Targeting Manual 71 Compilers Pragmas explicit_zero_data Specifies storage area for zero initialized data pragma explicit_zero_data on off reset Remarks The default value OFF specifies storage in the sbss or bss section The value ON specifies storage in the data section The value reset specifies storage in the most recent previously specified section Example pragma explicit_zero_data on int in_data_section 0 pragma explicit_zero_data off int in_bss_ section 0 inline_intrinsics Controls support for inline intrinsic optimizations strcopy and strlen pragma inline _intrinsics on off reset Remarks In the strcopy optimization the system copies the string via a set of move immediate commands to the source address The system applies this optimization if the source is a string constant of fewer than 64 characters and optimizing is set for speed In the strlen optimization a move immediate of the length of the string to the result replaces the function call The system applies this optimization if the source is a string constant The default value is ON 72 ColdFire Architectures v6 0 Targeting Manual Compilers Pragmas interrupt Controls compilation for interrupt routine object code pragma interrupt on off reset Remarks For
22. main No Source C Program Files Metrowerks CW for ColdFire 6 0 MyProj Source main c File main c Purpose sample program a include lt stdio h gt ain printf Hell lush stdout while 1 Line 10 Col1 a Note the toolbar at the top of the window it includes command buttons Run Stop Kill Step Over Step Into and Step Out b Note the Stack pane at the upper left This pane shows the function calling stack c Note the Variables pane at the upper right This pane lists the names and values of any local variables d Note the Source pane the largest pane of the window This pane displays source code or assembly code ColdFire Architectures v6 0 Targeting Manual 33 Application Tutorial Debug the Application 3 Set a breakpoint In the Source pane find the line containing the open brace character b In the far left hand column of this line click the grey dash A red circle replaces the dash indicating that the debugger set a breakpoint at the location Figure 3 10 shows the red circle indicator Figure 3 10 Setting a breakpoint 10 x Ski dE TT 34 No Variables Live Value Location __files 020005404 0420005404 SIM Source C Program Files Metrowerks CW for ColdFire 6 0 MyProj Source main c je File main c Purpose sample program a x include lt stdio h gt int main e a Breakpoint printf He
23. opt level xxx Table 13 3 Command Line Compiler Options Category General Option Purpose help keyword Displays corresponding help information all All standard options group keyword All groups that include keyword no compatible Compatibility options no deprecated Deprecated options no ignored Ignored options no normal Only standard options no obsolete Obsolete options no spaces Inserts blank lines between options search keyword All options that include keyword tool keyword Options by tool all all options available for this tool both options available in all tools other skipped options passed to another tool this options this tool executes default usage Usage information maxerrors max Specifies the maximum number of error messages to print O the default means no maximum Not global maxwarnings max Specifies the maximum number of warnings to print O the default means no maximum Not global ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option msgstyle keyword Purpose Sets message style per keyword value gcc Use GCC like style IDE Use CodeWarrior IDE like style mpw Use MPW style parseable Use context free machine parseable style std Use standard style default no stderr Specifies separate stderr stdout streams i
24. s object files the linker has several extended functions for manipulating program code in different ways You can define variables during linking control the link order down to the level of single functions and change the alignment You access these functions through commands in the linker command file LCF The LCF syntax and structure are similar to those of a programming language the syntax includes keywords directives and expressions This chapter consists of these sections LCF Structure e LCF Syntax e Commands Directives and Keywords LCF Structure Linker command files consist of three kinds of segments which must be in this order A memory segment which begins with the MEMORY directive Optional closure segments which begin with the FORCE_ACTIVE KEEP_SECTION or REF_INCLUDE directives A sections segment which begins with the SECTIONS directive Memory Segment Use the memory segment to divide available memory into segments Listing 6 1 shows the pattern Listing 6 1 Example Memory Segment MEMORY segment_1 RWX ORIGIN 0x80001000 LENGTH 0x19000 ColdFire Architectures v6 0 Targeting Manual 77 ELF Linker and Command Language LCF Structure segment_2 RWX ORIGIN segment_x RWX ORIGIN and so on AFTER segment_1 LENGTH 0 memory address LENGTH segment size In this pattern The RWX portion consists of ELF access permission flags R re
25. see P amp E Microsystems Remote Connections Instruction Set Simulator ISS for V2 and V4e processor cores For more information see Remote Connections for Debugging and Instruction Set Simulator For previous processors of the ColdFire family support for the simple profiler For more information see Using the Simple Profiler and the Profiler User s Guide This profiler support is not available for CFM5213 CFM5211 or CFM5212 processors CodeWarrior Editions There are three editions of Code Warrior M Development Studio for ColdFire Architectures version 6 0 Table 1 1 shows their feature differences Table 1 1 CodeWarrior ColdFire 6 0 Edition Features ColdFire Architectures v6 0 Targeting Manual Feature Special Edition Standard Professional Edition Edition IDE Yes Yes Yes Compiles source code ASM and C ASM and C ASM C and C Code size restrictions 128KB None None Compiler optimization Unlimited Unlimited Unlimited levels 3rd party plug ins No RTOS No RTOS Unlimited RTOS plug ins CodeWarrior Debugger Yes Yes Yes Debugger hardware P amp E Parallel and P amp E Parallel and P amp E Parallel USB and connections USB USB Lightning Abatron serial and TCPAP V2 V4e simulator No Yes Yes Introduction About this Manual Table 1 1 CodeWarrior ColdFire 6 0 Edition Features continued Programmer 129 megabytes and Programmer and ColdFire Flasher Feature S
26. you must change all subsequent writes to MBAR relative locations writecontrolreg 0x0C0F 0x10000001 Set SRAMBAR to 0x20000001 SRAMBAR is an absolute CPU register the location of chip internal 4k of SRAM writecontrolreg 0x0C04 0x20000001 Set ACRO to 0x00000000 writecontrolreg 0x04 0x00000000 204 ColdFire Architectures v6 0 Targeting Manual Using Debug Initialization Files Command Syntax Set ACR1 to 0x00000000 writecontrolreg 0x05 0x00000000 2MB FLASH on CSO at OxFFE00000 writemem 1 0x10000040 OxFFE00201 writemem 1 0x10000044 OxFFE00014 CS7 4M byte SDRAM Unlike 5307 and 5407 Cadre 3 boards the 5272 uses CS7 to access SDRAM writemem 1 0x10000078 0x00000701 writemem 1 0x1000007C OxFFC0007C Set SDRAM timing and control registers SDCTR then SDCCR writemem 1 0x10000184 0x0000F539 writemem 1 0x10000180 0x00004211 Wait a bit delay 600 writemem 1 0x10000000 OxDEADBEEF Wait a bit more delay 600 Command Syntax The syntax rules for command s in a debug initialization file are The system ignores space characters and tabs The system ignores character case in commands Numbers may be in hexadecimal decimal or octal format Hexadecimal values must start with Ox as in 0x00002222 OxA or OxCAfeBeaD Decimal values must start with a numeral 1 through 9 as in 7 12 526 or 823643 ColdFire Architectures v6 0 Targeting Manual 205 Using Debug I
27. 0 Doe x e 2 Linker Command Files 0 Oe a w H Runtime FP C and UART lib 0 0 e CQ Support files 0 Do x v El readme txt n a n a 17 files NOTE Figure 2 2 shows a floating project window Alternatively you can dock the project window in the IDE main window or make the project window a child of the main window You can have multiple project windows open at the same time if the windows are docked their tabs let you control which one is at the front of the main window The Code Warrior IDE automatically handles dependencies among project files storing compiler and linker settings for each build target The IDE tracks which files have changed since your last build recompiling only those files during your next project build A CodeWarrior project is analogous to a collection of makefiles as the same project can contain multiple builds Examples are a debug version and release version of code both ColdFire Architectures v6 0 Targeting Manual 21 Getting Started CodeWarrior Development Process part of the same project As earlier text explained build targets are such different builds within a single project Editing Code The CodeWarrior text editor handles text files in MS DOS UNIX and MacOS formats To edit a source code file or any other editable project file double click its filename in the project window The IDE opens the file in the editor window Figure 2 3 This window lets you switch between related file
28. Purpose ColdFire no a6 Generate A6 stack frames for this tool Default abi keyword Specifies application binary interface per keyword value standard Standard MPW ABI Default register Register ABI compact Compact ABI align keyword Specifies structure array alignment per keyword value mc68k MC68K 2 bytes unless field is 1 byte Default mc68k4byte MC68K 4 byte 4 bytes unless field is smaller power pc Power PC align per field size array members Array align per array members fp soft hard Specifies floating point options soft the default means generate calls to the software FP emulation library hard means generate MC68881 FP instructions intsize 2 4 Specifies the number of bytes per integer Default is 2 mb on off Specifies generating MacsBug information Default is of f model keyword Specifies code and data model generation options per keyword value a 16 bit references to code and data Default 32 bit references to code and data nearCode farCode 16 bit references to code Default n arData 32 bit references to code 16 bit references to data Default farData marc ous cod smart 32 bit references to data 16 or 32 bit references to code according to called routine visibility from current scope or file pcrelstrings Specifies putting string constants into code generating PC relative references for function addresses Default is A5 or A4 register
29. Table for Runtime ROM Copy Locate ROM copy table into ROM after initialized data romp_at main ROM SIZEOF main data romp AT _romp_at __S_romp _romp_at WRITEW _main_ROM ROM start address WRITEW ADDR main_data RAM start address WRITEW SIZEOF main_data size WRITEW 0 WRITEW 0 WRITEW 0 __SP_INIT 0x4000 set stack to 16kb __heap_addr __SP_INIT heap grows opposite stack direction __heap_size 0x10000 set heap to 64kb end SECTIONS segment ColdFire Architectures v6 0 Targeting Manual 87 ELF Linker and Command Language LCF Syntax end LCF Writing Data Directly to Memory To write data directly to memory use appropriate WRITEx keywords in your LCF WRITEB writes a byte WRITEH writes a two byte halfword WRITEW writes a four byte word The system inserts the data at the section s current address Listing 6 14 shows an example Listing 6 14 Embedding Data Directly into Output example_data_section WRITEB 0x48 pe RE 7 WRITEB 0x69 8 Vu 7 WRITEB 0x21 PR mire To insert a complete binary file use the INCLUDE keyword as Listing 6 15 shows Listing 6 15 Embedding a Binary File into Output _musicStart INCLUDE music mid _musicEnd gt DATA You must include the binary file in your IDE project Additionally the File Mappings target settings panel must specify resource file for all f
30. all the compiler generates object code then the linker creates an executable file The Compile command applies only to selected files The Bring Up To Date command compiles all changed files without linking The Project window lets you view compiler progress or stop the build ColdFire Architectures v6 0 Targeting Manual 31 Application Tutorial Debug the Application 4 This completes building your project You are ready for the debugging procedure of the next section Debug the Application This section explains you how to test whether your application runs as you expect Topics include starting the debugger setting a breakpoint and viewing registers Follow these steps 1 Set debugger preferences a Select Edit gt Target Settings where Target is the name of the current build target The Target Settings window appears b From the Target Settings Panels list select CF Debugger Settings The CF Debugger Settings panel moves to the front of the window as Figure 3 8 shows Figure 3 8 The CF Debugger Settings Panel M5213E B Console Debug Settings 2 x Q Target Settings Panels CF Debugger Settings C C Preprocessor Target Processor 5213 y Target 05 BareBoard bs C C Warnings ColdFire Assembler MN Use Target Initialization File Code Generation e ColdFire Processor Project cfa M521 3EVB_PnE cfg Browse Li ke lobal Optimizations IV Use Memory Configuration File INK
31. bits 32 768 to 32 767 off in the ColdFire Processor panel 4 Byte Integers is 32 bits 2 147 483 648 to 2 147 483 647 on in the ColdFire Processor panel unsigned int 4 Byte Integers is 16 bits 0 to 65 535 off in the ColdFire Processor panel 4 Byte Integers is 32 bits 0 to 4 294 967 295 on in the ColdFire Processor panel 64 ColdFire Architectures v6 0 Targeting Manual Compilers Calling Conventions Table 5 2 ColdFire Integer Types continued Type Option Setting Size Range long n a 32 bits 2 147 483 648 to 2 147 483 647 unsigned n a 32 bits 0 to 4 294 967 295 long long long n a 64 bits 9 223 372 036 854 775 808 to 9 223 372 036 854 775 807 unsigned n a 64 bits 0 to 18 446 744 073 709 551 615 long long Calling Conventions For ColdFire development the calling conventions are e Standard the compiler uses the default amount of memory expanding everything to int size e Compact the compiler tries to minimize memory consumption e Register the compiler tries to use memory registers instead of the stack NOTE The corresponding levels for the supported calling conventions are standard_abi the default compact_abi and register_abi For more ABI information see ColdFire Processor Panel Elements The compiler passes parameters on the stack in reverse order It passes the return value in different locations depending on the nature of th
32. command 210 WRITEW linker command 102 writing to memory LCF 88 89 X XML file customizing 145 146 Z ZERO_FILLED_UNINITIALIZED linker command 103 ColdFire Architectures v6 0 Targeting Manual 221 222 ColdFire Architectures v6 0 Targeting Manual
33. directory You can start the ISS only from the CodeWarrior debugger This chapter consists of these sections e Features e Using the Simulator e ISS Configuration Commands Sample Configuration File ISS Limitations Features Your CodeWarrior software supports the Instruction Set Simulator ISS for V2 and V4e cores ColdFire V2 For V2 cores the ISS features are e Instruction set modeling only of the original ColdFire v2 instruction set without ISA support of the 5282 processor ColdFire Architectures v6 0 Targeting Manual 151 Instruction Set Simulator Features 152 MAC modeling of the MAC without the EMAC of the 5282 processor This affects register accesses Cache modeling of the original ColdFire v2 direct mapped instruction cache without modeling of the 5282 instruction and data cache Format exceptions not implemented IPSBAR Functionality 5282 Peripherals modeling of the IPSBAR register and Synchronous DRAM Controller SDRAMC module No modeling of other 5282 peripherals or related behavior IPSBAR register fields all implemented SDRAMC registers five present DCR DACRO DACRI DMRO DMRI DCR this model includes reads from and writes to this register but ignores all internal fields of this register DACRx this model includes reads from and writes to these fields The SDRAMC model covers functionality only of DACRx register fi
34. final executable Default None Post linking often includes object code format conversion If your project includes Flash programming select BatchRunner PostLinker For more information see BatchRunner PostLinker Output Directory text box Specifies the directory for the final linked output file To specify a non default directory click the Choose button To clear this text box click the Clear button Default Directory that contains the project file Save project entries using relative paths checkbox Clear Specifies minimal file searching each project file must have a unique name Checked Specifies relative file searching project may include two or more files that have the same name Default Clear ColdFire Architectures v6 0 Targeting Manual Target Settings ColdFire Settings Panels BatchRunner PreLinker The BatchRunner PreLinker settings panel Figure 4 3 lets you run a batch file before the IDE begins linking your project To specify such a batch file click the Choose button then use the subsequent dialog box to navigate to and select the file Clicking the OK button of the dialog box returns you to this panel filling in the name of the batch file Figure 4 3 BatchRunner PreLinker Panel N BatchRunner PreLinker Select the batch file that you wish to have run before a link Choose Clear BatchRunner PostLinker The BatchRunner PostLinker s
35. for an embedded target __BACKENDVERSION__ 3 __COLDFIRE__ hex id for chip __profile__ 1 if you enable the Generate Profiler Calls setting of the ColdFire Processor panel 0 if you disable this setting __STDABI__ 1 if you check the standard passing parameter checkbox of the ColdFire Processor panel 0 if you clear this checkbox __REGABI__ 1 if you select the passing parameter setting as register in the ColdFire Processor panel 0 if you deselect it ColdFire Architectures v6 0 Targeting Manual 75 Compilers Position Independent Code Position Independent Code If you specify position independent code the compiler generates code that is the same regardless of its load address Different processes of your application can share such code Listing 5 4 Position Independent Code int relocatableAlpha int alpha relocatableAlpha Follow these steps to enable the PIC compiler and runtime support 1 Adda picdynrel section to the linker command file See Position Independent Code and Data 2 Enable PIC generation in the processor settings panel See ColdFire Target 3 Customize and recompile the runtime to support your loading routine See Position Independent Code 76 ColdFire Architectures v6 0 Targeting Manual 6 ELF Linker and Command Language This chapter explains the CodeWarrior Executable and Linking Format ELF Linker Beyond making a program file from your project
36. mask stepping over such a statement can modify your settings in this panel ColdFire Architectures v6 0 Targeting Manual 133 Debugging Remote Connections for Debugging Remote Connections for Debugging To debug an application on the remote target system you must use a remote connection For Special and Standard Edition software the ColdFire debugger uses a plug in architecture to support the P amp E Microsystems Parallel and USB remote connection protocols For Professional Edition software the ColdFire debugger uses a plug in architecture to support any of these remote connection protocols Abatron Serial Abatron TCP IP e P amp E Microsystems Parallel e P amp E Microsystems USB e P amp E Microsystems Lightning e Simulator CCS SIM Before you debug a project you must configure or modify the settings of your remote connection protocol Follow these steps 1 From the main menu bar select Edit gt Target Settings The Target Settings window appears 2 Select Target Settings Panels gt Debugger gt Remote Debugging The Remote Debugging panel moves to the front of the window 3 Use the Connection list box to specify a remote connection 4 Click the Edit Connection button A corresponding remote connection dialog box appears 5 Use the dialog box to input communication settings according to text below Abatron Remote Connections Figure 9 9 shows the configuration dialog box for an Abatron s
37. of the embedded target boards NOTE For Special Edition software the Code Warrior flash programmer is limited to 128 kilobytes There is no such limitation for Standard Edition or Professional Edition software Each software edition also comes with an optional ColdFire flash programmer available in subdirectory bin Pugins Support Flash_ Programmer of the Code Warrior installation directory Follow these steps 1 Make sure to build the application you want to program into flash memory 2 From the IDE main menu bar select Tools gt Flash Programmer the Flash Programmer window Figure 12 1 appears ColdFire Architectures v6 0 Targeting Manual 169 Using Hardware Tools Flash Programmer Figure 12 1 Flash Programmer Window Target Configuration Panel Target Configuration Flash Configuration Program Verify Erase Blank Check Checksum Default Project MyProj mep Default Target M5213EWB Console Debug 1Dl x IS Target Configuration Use Custom Settings ction ABATRON_ SERIAL qT Use C Program Files Target Initialization IdFire 6 D4P werksiCw for Co m Target RAM Memory Buffer Target Memory Buffer Address Ox 00000000 Target Memory Buffer Size Ox foooosoo0 Options M Enable Logging D Verity Target Memory Writes Show Log Load Settings Save Settings Cancel 3 If the Target Configuration panel is not visible
38. relax_pointers Relaxes pointer type checking rules RTTI on off Specifies runtime typing information for C Default is on som Enables Apple s Direct to SOM implementation som_env_check ColdFire Architectures v6 0 Targeting Manual Enables automatic SOM environment and new allocation checking implies som 189 Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option stdkeywords on off Purpose Permits only standard keywords Default is off str ings keywora nojreuse no pool Specifies string constant options per keywords Reuse strings equivalent strings are same object Default Pool strings into a single data object strict on off Controls strict ANSI checking Default is off trigraphs on off Controls recognition of trigraphs Default is off Wchar_t on off Controls treating wchar_t as a built in C type Default is on Optimizer O Same as 02 O keyword DO PWN O Specifies optimization level per keyword values Same as opt off Same as opt level 1 Same as opt level 2 Same as opt level 3 Same as opt level 4 Same as opt speed Same as opt space You can combine options as in 04 p ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking Table
39. symbol assignment statement A symbol assignment is valid only at the start of an expression so a line such as this is not valid you cannot use something like this _syml _sym2 _sym3 When the system evaluates an expression and assigns it to a variable the expression receives the type value absolute or a relocatable e Absolute expression the symbol contains the value that it will have in the output file ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language LCF Syntax Relocatable expression the value expression is a fixed offset from the base of a section LCF syntax for expressions is very similar to the syntax of the C programming language All integer types are long orunsigned long Octal integers begin with a leading zero other digits are O through 7 as these symbol assignments show _octal_number 01374522 _octal_number2 032405 Decimal integers begin with any non zero digit other digits are O through 9 as these symbol assignments show _dec_num 99999999 _decimal_number 123245 _decvalfour 9011276 Hexadecimal integers begin with a zero and the letter x other digits are O through f as these symbol assignments show _hex_number 0x999999FF El _firstfactorspace 0X123245E _fifthhexval OxFFEE Negative integers begin with a minus sign _decimal_number 123456 Arithmetic Comment Operators Use standard C arithmetic and logical oper
40. the value ON the compiler generates special prologues and epilogues for the functions this pragma encapsulates The compiler saves or restores all modified registers both nonvolatile and scratch Functions return via RTE instead of RTS Y ou also can also use__ declspec interrupt to mark functions as interrupt routines for example __declspec interrupt void alpha enter code here opt_unroll_count Limits the number of times a loop can be unrolled fine tunes the loop unrolling optimization pragma opt_unroll count 0 127 reset Remarks The default value is 8 opt_unroll_instr_count Limits the number of pseudo instructions fine tunes the loop unrolling optimization pragma opt_unroll_instr count 0 127 reset Remarks There is not always a one to one mapping between pseudo instructions and actual ColdFire instructions The default value is 100 ColdFire Architectures v6 0 Targeting Manual 73 Compilers Pragmas profile Organizes object code for the profiler library and enables simple profiling pragma profile on off reset Remarks Corresponds to the Generate code for profiling checkbox of the ColdFire Processor settings panel readonly_strings Enables the compiler to place strings in the rodata section pragma readonly_strings on off reset Remarks The default value is ON For the OFF value the compiler puts strings in initialized da
41. v6 0 Targeting Manual 69 Compilers Pragmas ustr Optional ELF section name for uninitialized data assigned to this section Must begin with a period Default value is the istr value addrmode Optional any of these address mode values standard 32 bit absolute address default near_absolute 16 bit absolute address far_absolute 32 bit absolute address near_code 16 bit offset from the PC address far_code 32 bit offset from the PC address near_data 16 bit offset from the AS register address far_data 32 bit offset from the AS register address accmode Optional any of these letter combinations R readable RW readable and writable RX readable and executable RWX readable writable and executable default No other letter orders are valid WR XR or XRW would be an error Remarks The compiler predefines the common ColdFire sections that Table 5 5 lists Table 5 5 ColdFire Predefined Sections Applicability Definition Pragmas Absolute pragma define_section text text far_absolute RX Addressing Mode pragma define_section data data bss far_absolute RW pragma define_section sdata sdata sbss near_data RW pragma define_section const rodata far_absolute R C pragma define _ section exception exception far _ absolute R Regardless of Addressing pragma define _ section exceptlist exceptlist far_absolute R Mod
42. your changes leaving the Target Settings window open This lets you bring up a different settings panel OK Implements your changes closing the Target Settings window Use this button when you make the last of your settings changes e Revert Changes panel settings back to their most recently saved values Modifying any panel settings activates this button e Factory Settings Restores the original default values for the panel Import Panel Copies panel settings previously saved as an XML file Export Panel Saves settings of the current panel to an XML file ColdFire Settings Panels Table 4 1 lists the target settings panels specific to developing applications for the ColdFire target The following section describes these panels in detail 40 ColdFire Architectures v6 0 Targeting Manual Target Settings ColdFire Settings Panels Table 4 1 ColdFire Target Settings Panels Target Settings ColdFire Processor BatchRunner PreLinker ELF Disassembler BatchRunner PostLinker ColdFire Linker ColdFire Target Debugger PIC Settings ColdFire Assembler NOTE For debugger specific panels CF Debugger Setting CF Exceptions Debugger Settings and Remote Debugging see the Debugging chapter For information about the C C Language and C C Warnings panels see the C Compilers Reference manual For details on all other panels see the IDE User s Guide Target Settings Use the Target Sett
43. 0 FF87FFFF FF880000 FFSBFFFF FF8C0000 FF8FFFFF FF900000 FFS3FFFF FF940000 FF97FFFF FF980000 FFSBFFFF FF9CO000 FFSFFFFF Am29LV128M Am29LV160DB_M5249C3 Am29LV160DE_M5282EVE Am29PL160C8_M5235 Am29PL16008_M527103 Am29PL160C8_M5272C3 Am29PL160C8_M527503 Am29PL160C8_M5407C3 M5282_CFM MCF5211_CFM MCF5212 CFM MCF5213_CFM MT28F540J34 RC28F128K3C AC28F256K 3C E Show Log Load Settings Save Settings Cancel b Make sure that the Device list box specifies your target processor c Make sure that the Flash Memory Base Address text box specifies the appropriate base address d The Organization and Sector Address Map boxes display appropriate additional information ColdFire Architectures v6 0 Targeting Manual 171 Using Hardware Tools Flash Programmer 6 Erase the destination flash memory sectors a From the pane list at the left of the Flash Programmer window select Erase Blank Check the Erase Blank Check panel moves to the front of the window as Figure 12 3 shows Figure 12 3 Flash Programmer Window Erase Blank Check Flash Panel zox Target Configuration Flash Configuration Program Verify Erase Blank Check Checksum IV Erase Blank Check Sectors Individually FF808000 FF83FFFF FF840000 FFS7FFFF FF880000 FFEBFFFF FF8C0000 FFSFFFFF FF900000 FFS3FFFF FFS40000 FFO7FFFF FFS80000 FFSBFFFF FFSCO000 FFSFFFFF Status Details Erase Blank Check Show Log L
44. 113 118 linker 77 104 disassembling 23 documentation 14 15 compiler linker 61 62 ds inline assembly directive 114 115 E editing 22 editions 12 13 editor window 22 ELF disassembler panel 47 50 files customizing XML file 145 146 debugging 144 147 IDE preferences 144 145 linker command language 77 104 emac pragma 71 entry inline assembly directive 115 116 erase blank check flash panel 172 EXCEPTION linker command 92 93 exception tables LCF 85 executable files linker 107 explicit_zero_data pragma 72 EXPORTSTRTAB linker command 93 EXPORTSYMTAB linker command 94 expressions LCF 80 81 extensions language 62 63 F features 11 12 features simulator 151 153 file specification LCF 83 84 files debug initialization 203 210 ColdFire Architectures v6 0 Targeting Manual memory configuration 211 214 project 21 flash device configuration panel 171 flash programmer 169 174 flash programmer window 170 174 FORCE_ACTIVE linker command 95 formats integer 64 65 fralloc inline assembly directive 116 frfree inline assembly directive 116 function specification LCF 83 84 G getting started 17 23 global settings panel 145 H hardware diagnostics 174 177 hardware diagnostics window 175 177 hardware tools 169 177 flash programmer 169 174 hardware diagnostics 174 177 heap LCF 84 I IDE Code Warrior 18 preferences updating 144 145 IDE preferences window 127 IMPORTSTRTAB linker command 95 IMPORTSYMTAB linker
45. 13 3 Command Line Compiler Options continued Category Option opt keyword off none on all full no space no speed I evel num nolcse no commonsubs no deadcode no deadstore nollifetimes noloop invariants no propagation no strength no dead display dump ColdFire Architectures v6 0 Targeting Manual Purpose Specifies optimization level per keyword values Suppresses all optimizations Default Same as opt level 2 Same as opt speed level 4 Optimize for space Optimize for speed Optimize by num level value 0 no optimizations Default 1 global register allocation peephole deadcode elimination 2 1 plus common subexpression elimination copy propagation 3 2 plus loop transformations strength reduction loop invariant code motion 4 3 plus repeated common subexpression elimination in depth loop invariant code motion Eliminate common subexpressions Remove dead code Remove dead assignments Compute variable lifetimes Remove loop invariants Propagate constant and copy assignments Optimize by strength reduction using an index variable to change multiplication to addition Remove dead code and dead assignments Display complete list of active optimizations 191 Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option
46. 4 6 ColdFire Architectures v6 0 Targeting Manual Table of Contents Abatron Remote Connections 134 P amp E Microsystems Remote Connections 136 ISS Remote Connection 139 BDM De bugoimg s seat donne wa alah har ane bete 142 Connecting a P amp E Microsystems Wiggler 142 Connecting an Abatron BDI Device 143 Debugging ELF Files without Projects 144 Updating IDE Preferences 144 Customizing the Default XML Project File 145 Debugging an ELF File 146 Additional ELF Debugging Considerations 147 Special Debugger Features 147 ColdFire Menu 21 08 Meee bab en ee de tal Spade ahead 147 Working with Target Hardware 148 Using the Simple Profiler 149 10 Instruction Set Simulator 151 Features rie bin ts A eee eden Ce st RU SA 151 Cold Eee dre hee na 151 ColdBire VAS vocoder 152 Using the Simulator 153 Console Window 153 Viewing ISS Registers 154 ISS Configuration Commands
47. 4 Calling Conventions 65 Vartable Allocation 51 52 8 ste aa 66 Register Variables si oraaa bees a a E 67 A es Se Shee Shs AET EEE Dune ete an dees eee ees 67 COdeCOIdPites 28e En eue Etes BLA hE Rene Rede 69 Conste multiply aia Sweets ites AA be AE RE 69 define SECON a tt e amp aes sus a NN nee 69 MAC ao dune nn Bad bea aan eae dre Do ne men ne AS 71 explicit Zero data ies 72 mite 1NthiNSiCS lt 2 3432 3h so DE RE bis de ne dae ou at le 72 TN 73 opt nroll Count uta da 73 opt_unroll_ instr_count 73 profile 0d Di te a ew Re RP a eae AAA te 74 Teadonly SHINES he sedge eons era ne nn oe ne EA 74 SDS_debug_support 74 SECO sas rene en ire A pot in nant 74 Predefined Symbols 62 2 enr A Aie AE 75 Position Independent Code 76 6 ELF Linker and Command Language 77 ECE iS iC tur a3 sot ne gee mt Re AE E 711 Memory Semen topics a es Gets 77 Clos re S Sments ciete a il et RE te 78 4 ColdFire Architectures v6 0 Targeting Manual Table of Contents sections Segment singanini pu anr en eee a Len de De nie AT 79 LORI Mt simon LR Ne A DS E Mast eed eae hoe 80 Variables Expressions and Integrals 80 Arithmetic Comment Operators 81 ATI SMIMENE rire eae etek a eg gad ea Bee wg hada Ati ait 82 Specifying Files
48. 4 ColdFire Architectures v6 0 Targeting Manual Inline Assembly Inline Assembly Directives Parameters b Byte specifier Word specifier the default Longword specifier size Number of bytes words or longwords in the block Example This statement defines a block big enough for the structure DRVRHeader ds b sizeof DRVRHeader entry Defines an entry point into the current function Use the extern qualifier to declare a global entry point and use the static qualifier to declare a local entry point If you leave out the qualifier extern is assumed Listing 8 6 entry extern static name Parameters extern Specifier for a global entry point the default static Specifier for a local entry point name Name for the new entry point Example Listing 8 6 defines the new local entry point MyEnt ry for function MyFunc Listing 8 6 Entry Directive Example static long MyEntry void static asm long MyFunc void ColdFire Architectures v6 0 Targeting Manual 115 Inline Assembly Inline Assembly Directives move l a d0 bra s L1 entry static MyEntry move l b d0 Li rts fralloc Lets you declare local variables in an assembly function fralloc Parameter Optional ColdFire register control character Remarks This directive makes space on the stack for your local stack variables It also reserves registers for your local register variables with the statement link x a6 Witho
49. C compiler generates correct variable argument functions only with the header file that the MSL include e You may find that other implementations are also compatible ColdFire Architectures v6 0 Targeting Manual Libraries and Runtime Code Runtime Libraries e You may also need to modify the runtime to support a different standard C library you must include __ va_arg c e Other C libraries are not compatible NOTE Ifyou are working with any kind of embedded OS you may need to customize MSL to work properly with that OS Runtime Libraries Every ColdFire project must include a runtime library which provides basic runtime support basic initialization system startup and the jump to the main routine RAM based debug is the primary reason behind runtime library development for ColdFire boards so you probably must modify a library for your application Find your setup in Table 11 4 then include the appropriate runtime library file e For aC project use the file that starts with C_ e For a C project use the file that starts with Cpp_ e All these files are in folder E68K_Support Runtime Sources Table 11 4 C C Runtime Libraries Processor Std ABI IntSize Library ColdFire without no 4 byte C_4i_CF_Runtime a FPU or Cpp_4i_CF_Runti MCF54xx pp_41_ _kRuntime a yes 4 byte C_4i_CF_StdABI_Runtime a Cpp_4i_CF_StdABI_Runtime a ColdFire with no 4 byte C_4i_CF_FPU_Runtime a FPU or E F MCE54xx Cpp_4
50. CF5407_StdABI_MSL a 180 ColdFire Architectures v6 0 Targeting Manual Compiling and Linking Table 13 1 Typical Operations for Debugging Command Line Tools Compiling and Linking If you use the IDE you use preference panels to configure linker and project settings With the command line tools you configure these settings by including appropriate switches in the command line At the end of compiling the compiler automatically invokes the linker The link order is the order in which your command line lists files Remember that you still need a valid linker command file Table 13 1 lists the general options for compiling debug versions of ColdFire C applications Tool Option Purpose Assembler D DEBUG Defines DEBUG g Generates DWARF output proc MCF5485 Sets the processor Compiler abi compact Specifies compact mode fp soft Specifies software floating point g Generates DWARF output lang c Specifies C source model far Specifies 32 bit references opt level 0 Specifies no optimizations proc MCF5407 Sets the processor SE Requires prototypes RTTI off Turns off C runtime typing wchar_t off ColdFire Architectures v6 0 Targeting Manual Specifies no built in C type 181 Command Line Tools Compiling and Linking Table 13 1 Typical Operations for Debugging continued Tool Optio
51. Click OK The dialog box closes confirming your configuration changes NOTE Any changes you make using the Remote Debugging panel apply to all targets that use the specified connection CF Exceptions Panel The CF Exceptions panel Figure 9 6 is available only with P amp E Microsystems remote connections Use this panel to specify hardware exceptions that the debugger should catch Table 9 4 explains the elements of this panel Before you load and run the program the debugger inserts its own exception vector for each exception you check in this panel To use your own exception vectors instead you should clear the corresponding checkboxes If you check any boxes the debugger reads the Vector_Based_Register VBR finds the corresponding existing exception vector then writes a new vector at that register location The address of this new vector is offset 0x408 from the VBR address For example if the VBR address is 0x0000 0000 the new vector at address 0x0000 0408 covers the checked exceptions ColdFire Architectures v6 0 Targeting Manual Debugging Target Settings for Debugging The debugger writes a Halt instruction and a Return from Exception instruction at this same location NOTE If your exceptions are in Flash or ROM do not check any boxes of the CF Exceptions panel Abatron remote connections ignore this panel using instead the exception definitions in the Abatron firmware Figure 9 6 CF Exceptions Panel CF Excepti
52. CodeWarrior Development Studio for ColdFire Architectures v6 0 Targeting Manual x K z freescale Revised 30 June 2005 semiconductor Freescale and the Freescale logo are trademarks of Frrescale Semiconductor Inc Metrowerks the Metrowerks logo and CodeWarrior are trademarks or registered trademarks of Metrowerks Corporation in the United States and or other countries All other trade names and trademarks are the property of their respective owners Copyright 2003 2005 by Metrowerks a Freescale Semiconductor company All rights reserved No portion of this document may be reproduced or transmitted in any form or by any means electronic or me chanical without prior written permission from Metrowerks Use of this document and related materials is gov erned by the license agreement that accompanied the product to which this manual pertains This document may be printed for non commercial personal use only in accordance with the aforementioned license agreement If you do not have a copy of the license agreement contact your Metrowerks representative or call 1 800 377 5416 if outside the U S call 1 512 996 5300 Metrowerks reserves the right to make changes to any product described or referred to in this document without further notice Metrowerks makes no warranty representation or guarantee regarding the merchantability or fitness of its prod ucts for any particular purpose nor does Metrowerks assume any liabi
53. Disassembler Panel Elements Purpose Clear Keeps ELF header information out of the disassembled output Checked Puts ELF header information into the disassembled output Comments Default Checked Verbose Info checkbox Clear Uses minimum information in disassembled output Checked Puts additional information into the disassembled output Default Clear For the symtab section additional information includes numeric equivalents for descriptive constants For the line debug extab and extabindex sections additional information includes an unstructured hex dump Show Symbol and String Tables checkbox Clear Keeps symbol table out of the disassembled module Checked Puts symbol table into the disassembled module Default Checked ColdFire Architectures v6 0 Targeting Manual Table 4 5 ELF Disassembler Panel Elements continued Target Settings ColdFire Settings Panels Element Show Relocations checkbox Purpose Clear Keeps relocation information out of the disassembled module Checked Puts relocation information into the disassembled module Comments Default Checked Relocation information pertains to the real text and reala data sections Show Code Modules checkbox Clear Keeps any of the four types of ELF code sections outthe disassembled module disables the four subordinate checkbo
54. ET ELF Disassembler Projecthcfa M5213EVB mem Browse ColdFire Linker Editor Program Download Options gt Custom Keywords E I Verify Memory Writes Initial Launch Successive Runs Debugger Debugger Settings Executable Executable Y e Initialized Data Initialized Data Y CF Exceptions Unitialized Data Unitialized Data J CF Interrupt Debugger PIC Setti e Factory Settings Vv Constant Data Y Constant Data Y Vv r Import Panel Export Panel DK Cancel Apply Make sure that the Target Processor list box specifies 521x d Make sure that the Target OS list box specifies BareBoard e Click OK The IDE saves the debugger settings and the Target Settings window closes 32 ColdFire Architectures v6 0 Targeting Manual Application Tutorial Debug the Application NOTE The default target initialization and memory configuration files are in subdirectory E68K_Support Initialization_Files of the CodeWarrior installation directory 2 From the IDE main menu select Project gt Debug A progress bar appears as the system downloads the output file to the target The debugger starts the Debugger window Figure 3 9 appears NOTE For a ROM build target you must load the application to Flash memory before you can perform Step 2 Figure 3 9 Debugger Window 10 x SEX dd OT No Variables Live Value Location _ start 020004314 4 files 0x200054C4 Dx200054C4
55. F Files without Projects Figure 9 18 Global Settings Panel Global Settings Cache Edited Files Between Debug Sessions Maintain files in cache for fi days Purge Cache r Other Settings I Confirm invalid file modification dates when debugging I Automatically launch applications when opening a SYM file 4 Confirm Kill Process when closing or quitting the application M Select thread window when stopping task IV Do not step into runtime support code I Auto target libraries 5 Make sure that the Cache Edited Files Between Debug Sessions checkbox is clear 6 Close the IDE Preferences window 7 This completes updating IDE preference settings you are ready to customize the default XML project file Customizing the Default XML Project File Code Warrior software creates a new Code Warrior project for any ELF file that you open to debug To create the new project the software uses the target settings of the default XML project file bin plugins support CF_Default_Project xml For different target settings you must customize this default XML file Follow these steps 1 Import the default XML project file a Select File gt Import Project a file select dialog box appears b Navigate to subdirectory bin plugins support c Select file CF_Default_Project xml d Click OK a new project window appears for file CF_Default_Project xml 2 Change target settings of the new p
56. F_M5275EVB CF_M5282EVB CF_M5307C3 CF_M5407C3 3 Specify CF_M5213EVB C stationery a Click the CF M5213EVB expand control the tree structure displays the subordinate option C b Select C as Figure 3 4 shows Figure 3 4 New Project Dialog Box Selecting M5213 C Stationery New project x Select project stationery N Project Stationery F CF_M5206EC3 CF_M5213EVB CF_M5235EVB CF_M5249C3 CF_M5271EVB CF_M5272C3 CF_M5275E VB CF_M5282EVB CF_M5307C3 NOTE Many possible ColdFire target processors have an external bus so can use large external RAM devices for debugging applications during development But M521x processors do not have an external bus so must accommodate applications in on chip memory Although this on chip RAM accommodates CodeWarrior stationery it probably is too small for full development of your application Accordingly for an M521x processor you should locate your 28 ColdFire Architectures v6 0 Targeting Manual Application Tutorial Create a Project applications in flash memory The Flash Programmer subsection explains how to program a flash device c Click OK The CodeWarrior IDE creates a new project consisting of the folders and files header initialization common and so forth that the M5213 C stationery specifies The project window Figure 3 5 appears Figure 3 5 Project Window xl MyProj mcp M5213E VB Console Debug ay Y 5 gt
57. Full pathname of a file Semicolons must separate multiple pathname values NOTE Omit any quote marks from environment variable definitions that include spaces As Windows does not strip out quotes they can lead to warnings or error messages If you use Makefiles you can define the following as Makefile variables instead Listing 13 1 is a sample definition for the C C compiler environment variable MWCIncludes Using this variable would add all its constituent paths to the system path Listing 13 1 Example C C Compiler Variable Definition set MWCIncludes SMWDIR S E68K_Tools MetroTRK Transport M68k mot_sbc_5407_serial bin SMWDIR S E68K_Support Runtime Inc SMWDIR E68K_Support Ms1 Msl1_c MSL_Common Include SMWDIR S E68K_Support Ms1 Ms1_c MSL_Common Include oe Listing 13 2 is a sample definition for the linker environment variable MWLibraries Using this variable would add all its constituent paths to the system path Listing 13 2 Example Linker Variable Definition 1 set MWLibraries SMWDIR S E68K_Support Ms1 Msl_c Msl_E68k Lib SMWDIR S E68K_Support Ms1 Msl_c Msl_E68k Lib MWDIR S E68K_Support Runtime oe Listing 13 3 is a sample definition for the linker environment variable MWLibraryFiles Using this variable would add the named files to the end of the link order Listing 13 3 Example Linker Variable Definition 2 set MWLibraryFiles fp_coldfire o C_4i_CF5407_Runtime a C_4i_
58. I Working Mode dialog box Debugging ELF Files without Projects The CodeWarrior debugger can debug an ELF file that you created in a different environment But before you begin you must update IDE preferences and customize the default XML project file The CodeWarrior IDE uses the XML file to create a project with the same target settings for any ELF file that you open to debug Updating IDE Preferences Follow these steps 1 From the main menu bar select Edit gt Preferences The IDE Preferences window appears 2 From the IDE Preferences Panels pane select Build Settings The Build Settings panel Figure 9 17 moves to the front of the window Figure 9 17 Build Settings Panel 8 Build Settings Settings Build before running Never X V Save open files before build Show message after building up to date project Compiler thread stack kb 325 mI Use Local Project Data Storage Compiler Local_D ata_Storage Choose Used when the project data folder cannot be created on read only volumes 3 Make sure that the Build before running list box specifies Never NOTE Selecting Never prevents the IDE from building the newly created project which is useful if you prefer to use a different compiler 4 Select Edit gt Preferences gt Global Settings The Global Settings panel Figure 9 18 moves to the front of the window 144 ColdFire Architectures v6 0 Targeting Manual Debugging Debugging EL
59. Linker panel see the subsection ColdFire Linker e To disable deadstripping for individual sections of the linker command file use the KEEP_SECTION directive As code does not directly reference interrupt vector tables a common use for this directive is disabling deadstripping for these interrupt vector tables The subsection Closure Segments provides additional information about the KEEP_SECTION directive NOTE To deadstrip files from standalone assembler you must make each assembly functions start its own section for example a new text directive before functions and using an appropriate directive 106 ColdFire Architectures v6 0 Targeting Manual ColdFire Linker Notes Link Order Link Order To specify link order use the Link Order page of the Project window For certain targets the name of this page is Segments Regardless of the order that the Link Order page specifies the ColdFire linker always processes C C or assembler source files before it processes relocatable o files or archive a files This means that the linker uses a symbol definition from a source file rather than a library file definition for the same symbol There is an exception however if the source file defines a weak symbol the linker uses a global symbol definition from a library pragma overload creates weak symbols Well constructed projects usually do not have strong link order dependencies Executable files in Proj
60. R EXCEPTION __ exception table end__ Position Independent Code and Data For position independent code PIC and position independent data PID your LCF must include picdynrel and piddynrel sections These sections specify where to store the PIC and PID dynamic relocation tables In addition your LCF must define these six symbols _ START _PICTABLE _ END PICTABLE __PICTABLE SIZE START_PIDTABLE _ END PIDTABLE _ PIDTABLE_SIZI 3 Listing 6 11 is an example definition for PIC and PID ColdFire Architectures v6 0 Targeting Manual 85 ELF Linker and Command Language L CF Syntax Listing 6 11 PIC PID Section Definition pictables ___ START picdynrel PICTAB E_ SIZE ALIGN 0x8 PICTABLE __END_ PICTABLE __END_PICTABLE START __ piddynrel PIDTAB PIDTABLE _ END P E_ SIZE 7 7 IDTABLE F __END_PIDTABLE gt gt DATA __START_PICTABLE START_PIDTABLE ROM RAM Copying In embedded programming it is common that data or code of a program residing in ROM gets copied into RAM at runtime To indicate such data or code use the LCF to assign it two addresses The memory segment specifies the intended location in RAM The sections segment specifies the resident location in ROM via its AT address parameter For e
61. Runs Clear Does not download program initialized data sections for successive runs Checked Downloads program initialized data sections for successive runs ColdFire Architectures v6 0 Targeting Manual Default Checked Successive runs are debugging actions after initial launch Note that rebuilding the project returns you to the initial launch state 123 Debugging Target Settings for Debugging Table 9 2 CF Debugger Settings Panel Elements continued Element Purpose Comments Successive Runs Clear Does not download program Default Checked Uninitialized Data uninitialized data sections for successive Successive runs are debugging checkbox runs actions after initial launch Note that rebuilding the project returns you to Checked Downloads program the initial launch state uninitialized data sections for successive runs Verify Memory Clear Does not confirm that a section Default Clear Writes checkbox written to the target matches the original section Checked Confirms that any section written to the target matches the original section Remote Debugging Panel Use the Remote Debugging panel Figure 9 3 to set up connections for remote debugging Table 9 3 explains the elements of this panel Text following the figure and table provides more information about adding and changing remote connections NOTE Special and Standard Edition software s
62. Specifies C preprocessing endian lt little big gt Specifies target byte ordering gnu Specifies Gnu compatible assembly list lt filename gt Specifies the name or pathname for the listing file model Specifies the memory model abs bigpic pic pid nocase Specifies that indentifiers are not case sensitive nocode Specifies only a syntax check no code generation nocolons Permits labels that do not end in the colon character nodebug Suppresses debug information generation noperiod Permits directives that do not start with a period character nospace Prohibits space characters in operand fields o lt filename gt Specifies the name or pathname for the output file p lt hex longword gt Defines a longwords that specifies the processors preprocess Specifies only preprocessing macro expansions and conditionals ColdFire Architectures v6 0 Targeting Manual 183 Command Line Tools Compiling and Linking Table 13 2 Command Line Assembler Options CIC shared Specifies shared libraries w arnings Turns of notes and warnings error messages still appear Compiler Options Table 13 3 lists the options of the command line compiler The compiler passes all options to the linker except as the table notes NOTE Optimization keyword values except off on all space and speed are for backwards compatibility To supersede other optimization options use
63. Tools gt Hardware Diagnostics from the IDE main menu bar the Hardware Diagnostics window Figure 12 6 appears 174 ColdFire Architectures v6 0 Targeting Manual Using Hardware Tools Hardware Diagnostics Figure 12 6 Hardware Diagnostics window Configuration Panel 33 Hardware Diagnostics N Hardware Diagnostics Configuration Memory Read Write Default Project Scope Loop Ne Memory Tests Default Target 1152 B Console Debug IV Use Custom Settings Target Processor Generic v Connection ABATRON_SERIAL y Vv Use Target Initialization targetfiename Browse Show Log Load Settings Save Settings Cancel Figure 12 6 shows the Configuration panel Click any name in the list pane to bring the corresponding panel to the front of the window e Memory Read Write Test which Figure 12 7 shows Scope Loop Test which Figure 12 8 shows e Memory Tests which Figure 12 9 shows ColdFire Architectures v6 0 Targeting Manual 175 Using Hardware Tools Hardware Diagnostics Figure 12 7 Hardware Diagnostics window Memory Read Write Test Panel loxi N Hardware Diagnostics N Memory Read Write Test Configurati EE d Write T Access Type Access Size Scope Loop Read Byte Memory Tests C Word C Write C Long Word Target Address 0x 00100000 Value to Write tr J67 Status Detais Access Target Show Log L
64. YMTAB Remarks Table 6 6 shows the structure of the import symbol table The start of the import symbol table must be aligned on at least a four byte boundary Table 6 6 Import Symbol Table Structure Size in bytes of import table 4 bytes Index to library1 name in import string table 4 bytes Number of entries in library1 4 bytes Index to symbol1 name in import string table 4 bytes Address of symbolt vector in export string table 4 bytes Index to symbol2 name in import string table 4 bytes Address of symbol2 vector in export string table 4 bytes Index to ibrary2 name in import string table 4 bytes Number of entries in library2 4 bytes Example Listing 6 23 shows the code for creating an import symbol table Listing 6 23 Creating an Import Symbol Table expsym IMPORTSYMTAB gt EXPSYM 96 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords INCLUDE Include a specified binary file in the output file INCLUDE filename Parameter filename Name of a binary file in the project The File Mappings target settings panel must specify resource file for all files that have the same extension as this file Remarks For more information and an example see the subsection Writing Data Directly to Memory KEEP_SECTION Starts an optional LCF closure segment that specifies sections the linker should not deadstrip
65. _ absolute RX __declspec bss int Large_Array_in _Small_Data_Section 1000 __declspec mycode void Function _in MyCode _Section printf Hello from MyCode section n A declaration specifier may use any section whether pre defined or user defined For more information about pre defined and user defined sections see define_section A declaration specifier also can use an application binary interface ABD An ABI corresponds directly to the parameter passing option Standard Compact or Register that the ColdFire Processor Settings panel specifies For information about these ABIs see ColdFire Processor ColdFire Architectures v6 0 Targeting Manual 63 Compilers Integer Formats Integer Formats The ColdFire compiler lets you specify the number of bytes that the compiler allocates for an int Bring up the ColdFire Processor settings panel then use the 4 Byte Integers option Table 5 2 shows the size and range of the integer types available for ColdFire targets Table 5 2 ColdFire Integer Types Type Option Setting Size Range bool n a 8 bits true or false char Use Unsigned 8 bits 128 to 127 Chars is offin the C C Language panel Use Unsigned 8 bits 0 to 255 Chars is on in the C C Language panel signed char n a 8 bits 128 to 127 unsigned n a 8 bits 0 to 255 char short n a 16 bits 32 768 to 32 767 unsigned n a 16 bits 0 to 65 535 short int 4 Byte Integers is 16
66. a named group of files To do so use the GROUP keyword GROUP fileGroupl1 text GROUP fileGroup4 data These two lines would specify including the text sections from all i1eGroup1 files and the data sections from all ileGroup4 files ColdFire Architectures v6 0 Targeting Manual 83 ELF Linker and Command Language LCF Syntax For precise control over function placement within a section use the OBJECT keyword For example to place functions beta and alpha before anything else in a section your definition could be like Listing 6 7 Listing 6 7 Function Placement Example SECTIONS program_section OBJECT beta main c Function beta is 1st section item OBJECT alpha main c Function alpha is 2nd section_item text Remaining_items are text sections from all files gt ROOT NOTE For C you must specify functions by their mangled names If you use the OBJECT keyword to specify a function subsequently using wild card character does not specify that function a second time For more information about specifying files and functions see the explanations OBJECT and SECTIONS Stack and Heap Reserving space for the stack requires some arithmetic operations to set the symbol values used at runtime Listing 6 8 is a sections segment definition code fragment that shows this arithmetic Listing 6 8 Stack Setup Operations _stack_address __END_BSS _stack_address _stack_a
67. ad W write or X execute ORIGIN specifies the start address of the memory segment either an actual memory address or via the AFTER keyword the name of the preceding segment LENGTH specifies the size of the memory segment The value 0 means unlimited length The segment_2 line of Listing 6 1 shows how to use the AFTER and LENGTH commands to specify a memory segment even though you do not know the starting address or exact length The explanation of the MEMORY directive at MEMORY includes more information about the memory segment Closure Segments An important feature of the linker is deadstripping unused code and data At times however an output file should keep symbols even if there are no direct references to the symbols Linking for interrupt handlers for example usually is at special addresses without any explicit control transfer jumps Closure segments let you make symbols immune from deadstripping This closure is transitive so that closing a symbol also forces closure on all other referenced symbols For example suppose that e Symbol _abc references symbols _def and _ghi e Symbol _def references symbols _jk1 and _mno and e Symbol _ghi references symbol _pgr Specifying symbol _abc in a closure segment would force closure on all six of these symbols The three closure segment directives have specific uses FORCE_ACTIVE Use this directive to make the linker include a s
68. additional MSL files necessary for ColdFire projects The MSL libraries already are compiled for different languages processor types Applications Binary Interface ABI requirements I O requirements and integer sizes Table 11 1 lists strings in MSL filenames showing appropriate uses for the precompiled library files ColdFire Architectures v6 0 Targeting Manual 163 Libraries and Runtime Code MSL for ColdFire Development Table 11 1 MSL Suitability 164 Filename String Appropriate Use C applications C C applications ColdFire Any ColdFire processor EC EC applications NC Applications without I O PI Position independent code and data StdABI Standard ABI FPU Floating Point Unit in hardware NOTE ABI corresponds directly to the parameter passing setting of the ColdFire Processor Settings panel Standard Compact or Register Table 11 2 lists the MSL files by general category e MSL C libraries in subdirectory To use MSL you must use a version of the runtime libraries which subsection Runtime Libraries explains You should not modify any of the MSL source files if your memory configuration requires changes make the changes in the runtime libraries E68K_Support ms1 MSL_C MSL_E68k Lib of your Code Warrior installation directory There also are PIC PID versions of these files which include the filename string PI e MSL C libraries in subdirectory
69. al access for V2 ISS only line_wait_states Number of wait states inserted for line access for V2 ISS only ColdFire Architectures v6 0 Targeting Manual 159 Instruction Set Simulator Sample Configuration File Remarks There may be any number of MBUS memories each with different wait states settings You must provide wait_states and line_wait_states values for a V2 ISS but you should not provide these values for a V4 ISS Examples memory 0x00000000 OXOfffffff 0 0 memory 0x200000000 0x3000ffff 0 O sdram Configures SDRAM sdram bank_bits num bytes wait_states line wait_states Parameters bank_bits Number of bank bits used only two banks are allowed num_bytes Number of bytes allocated wait_states Number of wait states inserted for normal access for V2 ISS only line wait_states Number of wait states inserted for line access for V2 ISS only Example sdram 2 0x8000 0 0 Sample Configuration File Listing 10 1 shows configuration file ColdFire2 cfg Listing 10 1 ColdFire2 cfg File Example Example Configuration File memory 0x0000 0x7fff 0 0 160 ColdFire Architectures v6 0 Targeting Manual Instruction Set Simulator ISS Limitations kram_size 8 bus_dump on sdram 2 0x8000 0 0 ipsbar true ISS Limitations These limitations apply to the ISS e You cannot set hardware breakpoints because debugging is not happening on an actual hardware board e You cannot set watchpoints in s
70. ame2 c filename c bss then put bss section from filename c filename2 c bss then put bss section from filename2 c ALIGN 0x10 Align next section on 16 byte boundary gt segment_1 Map these contents to segment_1 next_section_name more content descriptions gt segment_x End of next_section name definition End of sections segment The explanation of the SECTIONS directive at SECTIONS includes more information about the sections segment ColdFire Architectures v6 0 Targeting Manual 79 ELF Linker and Command Language LCF Syntax LCF Syntax 80 This section explains LCF commands including practical ways to use them Subsections are e Variables Expressions and Integrals e Arithmetic Comment Operators Alignment e Specifying Files and Functions e Stack and Heap Static Initializers Exception Tables e Position Independent Code and Data ROM RAM Copying e Writing Data Directly to Memory Variables Expressions and Integrals In a linker command file all symbol names must start with the underscore character _ The other characters can be letters digits or underscores These valid lines for an LCF assign values to two symbols _dec_num 99999999 _hex_num_ 0x9011276 Use the standard assignment operator to create global symbols and assign their addresses according to the pattern _symbolicname some_expression NOTE There must be a semicolon at the end of a
71. and Functions 83 Stack and Heap ce So eaves eh ata nues 84 Static Initializets ss oe awe Fae Gee ee eS eas en uen 85 Exception Tables 2 244 2448 ua di be uen en 85 Position Independent Code and Data 85 ROM RAM Copying 86 Writing Data Directly to Memory 88 Commands Directives and Keywords 89 location counter 90 ADDR i ay tot e Hid ia Dem Re Re anse 90 ALIGN otra da A A A a 91 AEIGNAE E 0d AA A is 92 EXCEPTION 3 20 4 ue as a a e he es 92 EXPORTSTRTAB 000050 idad 93 EXPORTSYMTAB curia a ia dd 94 FORCE ACTIVE sn ee a dt 95 IMPORESTRTAB cas a chal ah ares 95 IMPORTSYMTAB 0 20 rad a 96 INCLUDE 2 o eS 97 KEEP SECTION Seeonee hirn a ae o eee 97 MEMORY cora e das aa 97 OBJECT sii otros 99 REF INCEUDE seccion ca Be eee aa ds 99 SECTIONS a a tad 100 SIZEOE asa aa na 101 SIZEOF ROM 000 tad els ta 101 WRITEB ot ue me A A 102 WRITE coi ds ad 102 WRITEW ie ans A A di st 102 WRITESOCOMMENT 103 ColdFire Architectures v6 0 Targeting Manual 5 Table of Contents ZERO FILL_UNINITIALIZED 103 7 ColdFire Linker Notes 105 Program Sections 2 2 ode dada e arce 105 D adstripping A A sad tr 106 Link Ord r rs pete teen a a 107 Executable fi
72. anel P amp E Microsystems Remote Connections Figure 9 11 Figure 9 12 and Figure 9 13 show the configuration dialog boxes for PE Micro remote connections Table 9 8 explains the elements of these dialog boxes 136 ColdFire Architectures v6 0 Targeting Manual Debugging Remote Connections for Debugging Figure 9 11 P amp E Micro Remote Connection Parallel x Name PE_pat new_ connection Debuager ColdFire PEMicro y Show in processes list Connection Type Parallel v Parallel Port ler X Speed fi J Log Communications Data to Log Window Figure 9 12 P amp E Micro Remote Connection USB x Name PE_USB_new_connectiorl Debugger ColdFire PEMicro I Show in processes list Connection T ype USE y USB Pot USBO x Speed o Log Communications Data to Log Window Figure 9 13 P amp E Micro Remote Connection Lightning x Name PE_Light_new_connection Debugger ColdFire PEMicro 7 Show in processes list m Connection T ype Lightring x PCI card slot fi Speed fi J Log Communications Data to Log Window ColdFire Architectures v6 0 Targeting Manual 137 Debugging Remote Connections for Debugging Table 9 8 P amp E Micro Dialog Box Elements Element Purpose Comments Name text box Identifies the remote connection For an existing connection already has a value Debugger list box Identifies the debugger For an existing connection already spec
73. anual Documentation Overview e Additional Information Resources Read the Developer Notes Before using the CodeWarrior IDE read the developer notes These notes contain important information about last minute changes bug fixes incompatible elements or other topics that may not be included in this manual NOTE The release notes for specific components of the CodeWarrior IDE are located at location CodeWarrior_Dir Release_Notes where CodeWarrior_Dir is the CodeWarrior installation directory If you are new to the CodeWarrior IDE read this chapter and the Getting Started chapter This chapter provides references to resources of interest to new users the Getting Started chapter helps you become familiar with the software features Features The CodeWarrior Development Studio for ColdFire Architectures includes these features Latest version of the CodeWarrior IDE which the IDE User s Guide explains e Support for the latest ColdFire processors CFM5213 and variants CFM5211 and CFM5212 ColdFire Architectures v6 0 Targeting Manual 11 Introduction CodeWarrior Editions Support for previous processors of the ColdFire family such as CFM547x 548x CFM5307 CFM523x CFM5282 CFM5275 and CFM5249 For more information see ColdFire Processor Flash programmer and hardware diagnostics support For more information see Using Hardware Tools USB debugging support through the P amp E Micro protocol For more information
74. area speeds data access but has ramifications for the hardware memory map The default settings specify not using the small data area 54 ColdFire Architectures v6 0 Targeting Manual ColdFire Linker Target Settings ColdFire Settings Panels Use the ColdFire Linker panel Figure 4 9 to control the final form of your object code Table 4 7 explains the elements of this panel Figure 4 9 ColdFire Linker Panel ColdFire Linker V Generate Symbolic Info M Store Full Path Names V Generate Link Map T List Unused Objects D Show Transitive Closure IV Generate S Record File I Generate Binary Image Entry Point Force Active Symbols Table 4 7 ColdFire Linker Panel Elements start Disable Deadstripping V Generate ELF Symbol Table Suppress Warming Messages Max S Record Length 22 EOL Character DOS Max Bin Record Length 1252 Checked Puts generated debugging information into the output ELF file Element Purpose Comments Generate Clear Does not generate Default Checked Symbolic Info debugging information in checkbox the output ELF file Store Full Path Names checkbox Clear In debugging information in the linked ELF file uses only names of source files Checked Includes source file paths in the debugging information in the linked ELF file ColdFire Architectures v6 0 Targeting Manual Default Checked Clearing this checkbox save
75. arrior IDE then select Help gt Online Manuals from the main menu bar e CodeWarrior online help information about using the IDE and understanding error messages To access this information start the Code Warrior IDE then select Help gt CodeWarrior Help from the main menu bar 14 ColdFire Architectures v6 0 Targeting Manual Introduction Additional Information Resources Additional Information Resources For general information about the CodeWarrior IDE and debugger see the IDE User s Guide e For information specific to the C C front end compiler see the C Compilers Reference For information about Metrowerks standard C C libraries see the MSL C Reference and the MSL C Reference e For instructions on programming in C C Java and Pascal all in one environment see the Discover Programming edition of CodeWarrior software For PDF format documentation about Freescale processors and cores go to the Freescale_Documentation subdirectory of your CodeWarrior installation directory For Freescale documentation and resources visit the Freescale Inc web site http www freescale com e For additional electronic design and embedded system resources visit the EG3 Communications Inc web site http www eg3 com For monthly and weekly forum information about programming embedded systems including source code examples visit the Embedded Systems Programming magazine web site http www embed
76. ated options Ignored options Only standard options Obsolete options Inserts blank lines between options All options that include keyword Usage information maxerrors max Specifies the maximum number of error messages to print 0 the default means no maximum Not global maxwarnings max Specifies the maximum number of warnings to print O the default means no maximum Not global msgstyle keyword Sets message style per keyword value gcc Use GCC like style IDE Use CodeWarrior IDE like style mpw Use MPW style parseable Use context free machine parseable style std Use standard style default progress Shows progress and version search Searches access paths for source object or library files that the command line specifies no stderr Specifies separate stderr stdout streams if nostderr is in effect stderr goes to stdout timing Collects timing statistics v erbose Specifies cumulative verbose information implies progress version Shows tool version configuration and build date no wraplines ColdFire Architectures v6 0 Targeting Manual Specifies message word wrapping 195 Command Line Tools Compiling and Linking Table 13 4 Command Line Linker Options continued Category Linker Option dis assemble Purpose Specifies disassembling object code without linking implies nostdlib L I path A
77. ation of Specifies the pathname of libraries or Default None Relocated Libraries other resources related to the project and Code Type the pathname into this text box Stop on application launch checkbox Clear Does not specify any debugging entry point deactivates the subordinate options buttons and text box Checked Specifies the debugging entry point via a subordinate option button Program entry point Default language entry point or User specified Default Checked with Default language entry point option button selected If you select the User specified option button type the entry point in the corresponding text box Auto target Libraries checkbox Clear Does not use auto target libraries Checked Uses auto target libraries Default Clear Log System Messages checkbox Clear Does not log system messages Checked Logs system messages Default Checked Update data every checkbox Clear Does not update data deactivates the subordinate text box Checked Regularly updates data enter the number of seconds in the subordinate text box Default Clear Cache symbolics between runs Clear Does not store symbolic values in cache memory between runs Default Checked checkbox Checked After each run stores symbolic values in cache memory Stop at Watchpoints Clear Does notstop at watchpoints Default Checked checkbox Checked S
78. ation panel 175 connections Abatron BDI 143 144 remote 126 128 wiggler 142 console window 37 const_multiply pragma 69 conventions calling 65 66 creating a project 25 29 215 D data auto alignment command line 200 201 dc inline assembly directive 114 deadstripping linker 106 debug initialization files 203 210 commands 206 210 Delay 206 207 ResetHalt 207 ResetRun 207 Stop 207 writeaddressreg 207 writecontrolreg 208 writedatareg 208 writemem b 209 writemem l 209 writemem w 210 syntax 205 uses 203 205 debugger PIC settings 59 debugger settings panel 131 132 debugger window 33 debugging 23 119 150 Abatron remote connections 134 136 an application 32 37 BDM debugging 142 144 connecting a wiggler 142 connecting Abatron BDI 143 144 ELF files 144 147 customizing XML file 145 146 IDE preferences 144 145 ISS remote connection 139 141 operations command line 181 183 P amp E Micro remote connections 136 139 remote connections 134 141 simple profiler 149 150 special features 147 150 target settings 119 133 CF debugger settings panel 121 124 CF exceptions panel 128 131 CF interrupt panel 133 debugger settings panel 131 132 remote connections 126 128 remote debugging panel 124 126 declaration specifiers 63 216 define_section pragma 69 71 Delay debug initialization command 206 207 development process Code Warrior 19 23 dialog boxes new 27 new connection 127 new project 28 directives inline assembly
79. ations as you define and use symbols in the LCF All operators are left associative Table 6 1 lists these operators in the order of precedence For additional information about these operators refer to the C Compiler Reference Table 6 1 LCF Arithmetic Operators Precedence Operators 1 a 2 1 3 4 gt gt lt lt ColdFire Architectures v6 0 Targeting Manual 81 ELF Linker and Command Language LCF Syntax Table 6 1 LCF Arithmetic Operators continued Precedence Operators 5 l gt lt lt gt 6 amp 7 8 amp amp 9 Il To add comments to your file use the pound character C style slash and asterisk characters or C style double slash characters in any of these formats This is a one line comment This is a multiline comment text This is a partial line comment Alignment To align data on a specific byte boundary use the ALIGN keyword or the ALIGNALL command Listing 6 4 and Listing 6 5 are examples for bumping the location counter to the next 16 byte boundary Listing 6 4 ALIGN Keyword Example file c text ALIGN 0x10 file c data aligned on 16 byte boundary Listing 6 5 ALIGNALL Command Example file c text ALIGNALL 0x10 everything past this point aligned on 16 byte boundary file c data NOTE If one segment entry imposes an alignment requirement that segment s sta
80. bly Function Return asm void f void add 1 d4 d5 Error no RTS statement asm void g void add 1 d4 d5 rts OK For statement level returns see return on page 118 and naked on page 117 Inline Assembly Directives Table 8 1 lists special assembler directives that the ColdFire inline assembler accepts Explanations follow the table Table 8 1 Inline Assembly Directives de ds entry fralloc frfree macine naked opword return ColdFire Architectures v6 0 Targeting Manual 113 Inline Assembly Inline Assembly Directives NOTE Except for dc and ds the inline assembly directives are available only for function routine level dc Defines blocks of constant expressions as initialized bytes words or longwords Useful for inventing new opcodes to be implemented via a loop dc b w 1 constexpr constexpr Parameters b Byte specifier which lets you specify any C or Pascal string constant w Word specifier the default which lets you specify any 16 bit relative offset to a local label 1 Longword specifier constexpr Name for block of constant expressions Example asm void alpha void x1 dc b Hello world n Creating a string x2 dc w 1 2 3 4 Creating an array x3 dc l 3000000000 Creating a number ds Defines a block of bytes words or longwords initialized with null characters Pushes labels outside the block ds b w 1 size 11
81. braries 163 167 MSL 163 167 ColdFire Architectures v6 0 Targeting Manual N naked inline assembly directive 117 new connection dialog box 127 new dialog box 27 new project dialog box 28 O OBJECT linker command 99 operators LCF 81 82 opt_unroll_ count pragma 73 opt_unroll_instr_count pragma 73 opword inline assembly directive 118 overview target settings 39 40 P P amp E Micro remote connections 136 139 panels batchrunner postlinker 43 batchrunner prelinker 43 build settings 144 CF debugger settings 32 121 124 CF exceptions 128 131 CF interrupt 133 checksum 174 ColdFire assembler 44 47 ColdFire linker 55 59 ColdFire processor 51 54 ColdFire settings 40 60 ColdFire target 44 configuration 175 debugger settings 131 132 ELF disassembler 47 50 erase blank check flash 172 flash device configuration 171 global settings 145 memory read write test 176 memory tests 177 program verify flash 173 remote connections 127 remote debugging 31 124 126 scope loop tests 176 target configuration 170 target setting 41 42 ColdFire Architectures v6 0 Targeting Manual target settings 30 pc relative strings 62 63 PIC 76 LCF 85 settings 59 PID LCF 85 position independent code 76 168 pragmas 67 75 codeColdFire 69 const_multiply 69 define_section 69 71 emac 71 explicit_zero_data 72 inline_intrinsics 72 interrupt 73 opt_unroll_count 73 opt_unroll_instr_count 73 profile 74 readonly_strings 74 SDS_debu
82. cable To target board JTAG connector Serial connector Serial cable to PC serial port Follow these steps 1 Connect the BDI device to your computer a Serial connection Connect a serial cable between the BDI serial connector and a serial port of the PC as Figure 9 16 shows b TCP IP connection Connect a TCP IP cable between the BDI TCP IP connector and an appropriate port of your PC 2 Connect the appropriate RCD cable between the BDI JTAG connector and the JTAG connector of your target board The board JTAG connector is a 26 pin Berg type connector NOTE Certain target boards such as the MCF5485 MCF5475 MCF5235 and MCF5271 require a different RCD cable than do other ColdFire boards To make sure that your cable is correct see the Abatron reference manual or visit http www abatron ch 3 Connect the power cable between the BDI power connector and a 5 volt 1 ampere power supply per the guidance of the Abatron user manual 4 This completes cable connections NOTE Before using an Abatron remote connection you must 1 Make sure that you have the correct drivers and configuration utility for your target board 2 Use Abatron software to configure the BDI device per the guidance of the Abatron user manual ColdFire Architectures v6 0 Targeting Manual 143 Debugging Debugging ELF Files without Projects Before you use the BDI for ROM Flash debugging you must check the Use Breakpoint Logic checkbox of the BD
83. command 96 INCLUDE linker command 97 inline assembly 109 118 directives 113 118 de 114 ds 114 115 entry 115 116 fralloc 116 frfree 116 machine 117 naked 117 opword 118 return 118 local variables arguments 111 113 ColdFire Architectures v6 0 Targeting Manual returning from routine 113 syntax 109 111 inline_intrinsics pragma 72 instruction set simulator 151 161 limitations 161 sample configuration file 160 integer formats 64 65 integrals LCF 80 81 interrupt pragma 73 introduction 11 15 ipsbar simulator configuration command 156 ISS configuration commands 154 160 bus_dump 155 cache_size 156 ipsbar 156 kram_size 157 krom_size 157 158 krom_valid 158 mbar 158 159 mbus_multiplier 159 memory 159 160 sdram 160 features 151 153 remote connection 139 141 K KEEP_SECTION linker command 97 keywords linker 77 104 kram_size simulator configuration command 157 krom_size simulator configuration command 157 158 krom_valid simulator configuration command 158 L language extensions 62 63 declaration specifiers 63 pc relative strings 62 63 language ELF linker and command 77 104 LCF alignment 82 83 arithmetic comment operators 81 82 closure segments 78 79 217 exception tables 85 expressions 80 81 file specification 83 84 function specification 83 84 heap stack 84 integrals 80 81 memory segment 77 78 position independent code data 85 ROM RAM copying 86 88 sections segment 79 specifying files fun
84. contains the disassembled file s object code in assembly format and debugging information in Debugging With Attribute Record Format DWARF The dump file s contents appear in a new window ColdFire Architectures v6 0 Targeting Manual 23 Getting Started CodeWarrior Development Process 24 ColdFire Architectures v6 0 Targeting Manual Application Tutorial This chapter takes you through the Code WarriorTM IDE programming environment This tutorial does not teach you programming It instead teaches you how to use the Code Warrior IDE to write and debug applications for a target platform Before you start the tutorial you must set up your target evaluation board EVB Typically this entails e Verifying all jumper header and switch settings e Connecting a serial cable between the EVB and your computer and Connecting EVB power NOTE For complete setup instructions see the EVB s own documentation This chapter consists of these sections e Create a Project e Build the Project Debug the Application Create a Project This section shows how to use stationery to create a new project for a ColdFire EVB and how to set up the project to make a standalone application Follow these steps ColdFire Architectures v6 0 Targeting Manual 25 Application Tutorial Create a Project 1 Select Programs gt Metrowerks CodeWarrior gt CodeWarrior for ColdFire V6 0 gt CodeWarrior IDE The CodeWarrior IDE starts and the
85. cord comments linker 107 stack LCF 84 starting 17 23 static initializers LCF 85 Stop debug initialization command 207 structure LCF 77 79 symbols predefined 75 syntax debug initialization files 205 220 inline assembly 109 111 LCF 80 89 memory configuration files 211 system requirements 17 18 T target configuration panel 170 target settings 39 60 debugging 119 133 overview 39 40 panel 41 42 window 40 120 target settings panel 30 target settings window 30 31 tools command line 179 201 flash programmer 169 174 hardware 169 177 hardware diagnostics 174 177 transitive closure sample code 58 59 tutorial 25 37 U UART libraries 166 uses for debug initialization files 203 205 using the simulator 153 154 V variables allocation 66 LCF 80 81 register 67 view memory window 36 W wiggler connection 142 windows console 37 debugger 33 editor 22 flash programmer 170 174 hardware diagnostics 175 177 IDE preferences 127 ColdFire Architectures v6 0 Targeting Manual main 26 project 21 29 register 35 154 target settings 30 31 40 120 view memory 36 WRITEOCOMMENT linker command 103 writeaddressreg debug initialization command 207 WRITEB linker command 102 writecontrolreg debug initialization command 208 writedatareg debug initialization command 208 WRITEH linker command 102 writemem b debug initialization command 209 writemem l debug initialization command 209 writemem w debug initialization
86. ctions 83 84 stack heap 84 static initializers 85 structure 77 79 syntax 80 89 variables 80 81 writing to memory 88 89 libraries 163 168 heaps 166 memory 166 Metrowerks standard 163 167 runtime 167 168 serial I O 166 UART 166 limitations simulator 161 link order linker 107 linker and command language ELF 77 104 commands ADDR 90 91 ALIGN 91 ALIGNALL 92 EXCEPTION 92 93 EXPORTSTRTAB 93 EXPORTSYMTAB 94 FORCE_ACTIVE 95 IMPORTSTRTAB 95 IMPORTSYMTAB 96 INCLUDE 97 KEEP_SECTION 97 location counter 90 MEMORY 97 99 OBJECT 99 REF_INCLUDE 99 218 SECTIONS 100 101 SIZEOF 101 SIZEOF_ROM 101 WRITEOCOMMENT 103 WRITEB 102 WRITEH 102 WRITEW 102 ZERO_FILLED_UNINITIALIZED 10 3 commands directives keywords 77 104 deadstripping 106 documentation 61 62 executable files 107 link order 107 notes ColdFire 105 107 options command line 194 199 program sections 105 S record comments 107 linking 22 23 local variables inline assembly 111 113 location counter linker command 90 M machine inline assembly directive 117 main window 26 mbar simulator configuration command 158 159 mbus_multiplier simulator configuration command 159 memory configuration files 211 214 commands 212 214 range 212 reserved 213 reservedchar 213 214 syntax 211 MEMORY linker command 97 99 memory read write test panel 176 memory segment LCF 77 78 memory simulator configuration command 159 160 memory tests panel 177 Metrowerks standard li
87. d argument warnings noJunused Controls unused variable warnings Controls unused arguments and unused noJextracomma variable warnings no comma Controls extra comma warnings no pedantic noJextended Controls pedantic error checking no hidevirtual warnings noJhidden virtual Controls hidden virtual function warnings noJimplicit conv Controls implicit arithmetic conversion noJnotinlined warnings Controls warnings about inline functions nollargeargs not inlined Controls warnings about passing large no structclass arguments to unprototyped functions Controls warnings about inconsistent class no padding struct use Controls warnings about padding added no notused between struct members Controls warnings about non use of a non noJunusedexpr void returning function Controls warnings about using expressions display dump as statements without side effects Displays list of active warnings Linker Options Table 13 4 lists the options of the command line linker 194 ColdFire Architectures v6 0 Targeting Manual Table 13 4 Command Line Linker Options Command Line Tools Compiling and Linking Category Option Purpose General help keyword Displays help information per keyword values all All standard options group keyword no compatible no deprecated no ignored no normal no obsolete no spaces search keyword usage All groups that include keyword Compatibility options Deprec
88. ddress amp 7 align top of stack by 8 __SP_INIT _stack_address 0x4000 set stack to 16KB The heap requires a similar space reservation which Listing 6 9 shows Note that the bottom address of the stack is the top address of the heap Listing 6 9 Heap Setup Operations heap_addr __SP_INIT heap grows opposite stack heap_size 0x50000 heap size set to 500KB 84 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language LCF Syntax Static Initializers You must invoke static initializers to initialize static data before the start of main To do so use the STATICINIT keyword to have the linker generate the static initializer sections In your linker command file use lines similar to these to tell the linker where to put the table of static initializers relative to the location counter sinit__ STATICINIT The program knows the symbol sinit__ atruntime So in startup code you can use corresponding lines such as these ifdef _ cplusplus call the c static initializers call_static_initializers endif Exception Tables You need exception tables only for C code To create one add the EXCEPTION command to the end of your code section Listing 6 10 is an example The program knows the two symbols _exception_ table start__ and __exception_table_end__ at runtime Listing 6 10 Creating an Exception Table __exception_ table _ start D
89. dds specified library search path Default is to search working directory then system directories Search paths have global scope over the command line searching follows path order in the command line Ir Adds a recursive library search path l file Adds a library before system libraries searching for 1ib lt file gt lt ext gt where lt ext gt is the typical library extension nodefaults Same as no stdlib Default no fail Specifies continuing importing or disassembling despite errors in earlier files no stdlib Specifies using system library access paths per 3MWLibraries environment variable adding system libraries per SMWLibrariesFiles environment variable Default Specifies disassembling and sending output to a file without linking Implies nostdlib ELF Linker no dead strip Controls deadstripping of unused code Default force_active symbol Specifies a list of symbols as undefined useful to force linking of static libraries keep local on off Controls keeping relocations and output segment names generated during the link as local symbols Default is on m ain symbol Sets the main entry point for the application or shared library Maximum symbol length is 63 characters The symbol value specifies no entry point ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling a
90. de additional information Board Initialization Code Your Code Warrior development tools come with several basic assembly language hardware initialization routines which may be useful in your programs You need not include this code when you are debugging as the debugger or debug kernel already performs the same board initialization You should have your program do as much initialization as possible minimizing the initializations that the configuration file performs This facilitates the transition from RAM based debugging to Flash ROM 168 ColdFire Architectures v6 0 Targeting Manual 12 Using Hardware Tools This chapter explains the Code Warrior IDE hardware tools which you can use board bring up test and analysis This chapter consists of these sections e Flash Programmer e Hardware Diagnostics Flash Programmer Use the Code Warrior flash programmer to program target board flash memory with code from any Code Warrior IDE project or with code from any individual executable files The Code Warrior debugger provides some flash programming features such as view modi fy memory register and save memory content to a file The Code Warrior flash programmer does not duplicate this functionality The flash programmer runs as a Code Warrior plug in using the Code Warrior debugger protocol API to communicate with the target boards The Code Warrior flash programmer lets you use the same IDE to program the flash of any
91. ded com ColdFire Architectures v6 0 Targeting Manual 15 Introduction Additional Information Resources 16 ColdFire Architectures v6 0 Targeting Manual Getting Started This chapter helps you install the Code Warrior TM Development Studio for ColdFire Architectures It also gives an overview of the CodeWarrior environment and tools This chapter consists of these sections System Requirements CodeWarrior IDE e CodeWarrior Development Process System Requirements Your host computer system and your target board must meet minimum requirements Host Requirements Your computer PC needs 800 MHz Pentium compatible microprocessor Windows 2000 or XP operating system 512 megabytes of RAM CD ROM drive 350 megabytes free memory space plus space for projects and source code e Serial port or Ethernet connector to connect your PC to the embedded target for debugging with an Abatron BDI device e Parallel port or P amp E Lightning board to use a wiggler to connect to BDM JTAG targets USB port P amp E Micro to use a USB device through the P amp E Micro Protocol Target Board Requirements Your functional embedded system needs e ColdFire evaluation board with a processor such as CFM5213 CFM5282 CFM5407 CFM5235 CFM5271 CFM5307 or CFM5485 ColdFire Architectures v6 0 Targeting Manual 17 Getting Started CodeWarrior IDE e Serial or null modem cables to connect the host co
92. dialect cplus enum min int Specifies minimum or int word size for enumeration types Default is int ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option inline keyword Purpose Specifies inline options per keyword onlsmart Turns on inlining for inline functions Default noneloff Turns off inlining auto Automatically inlines small functions even without inline specification noauto No auto inlining Default all Turns on aggressive inlining deferred Defers inlining until the end of compilation permits inlining in two directions level n Inlines functions to n levels 0 8 0 means inline on no mapcr Reverse maps for Macintosh MPW compatibility so that n 13 and r 10 msext on off Controls Microsoft VC extensions redefining macros XXX yyy syntax for method yyy of class XXX extra commas ignoring casts to same type treating as equal function types that have equivalent parameters lists but different types pointer integer conversions Default for non x86 targets is of f no multibyte aware Enables multi byte character encodings for source text comments and strings once Prevents processing header files a second time pragma Defines a pragma for the compiler r equireprotos Requires prototypes
93. dow then double click the project name Figure 4 1 shows this Target Settings window The Code Warrior IDE User s Guide explains all elements of this window Use the tree listing of panels in the Target Settings Panels pane to display any settings panel If necessary click the expand control to see a category s list of panels Clicking a panel name immediately puts that panel in the Target Settings pane ColdFire Architectures v6 0 Targeting Manual 39 Target Settings ColdFire Settings Panels Figure 4 1 Target Settings Window Q Target Settings Panels Debugger Settings ie Preprocessor r Location of Relocated Libraries and Code Resources C C Warnings ColdFire Assembler Choose Code Generation ColdFire Processor W Stop on application launch Global Optimizations E E Linker Program entry point C Default language entry point ELF Disassembler Userspeciied man _ ColdFire Linker oo r Other Settings Custom Keywords mae a Debugger FT Auto target Libraries IV Cache symbolics between runs Debugger Settings I Log System Messages FN Stop at Watchpoints Remote Debugging I Update data every 5 seconds Console Encoding None y CF Debugger Setti CF Exceptions CF Interrupt Debugger PIC Setti Factory Settings Import Panel Export Panel DK Cancel Apply Note these buttons at the bottom of the window Apply Implements
94. e include profiler h void main ColdFire Architectures v6 0 Targeting Manual 149 Debugging Special Debugger Features ProfilerInit collectDetailed bestTimeBase 5 10 ProfilerClear ProfilerSetStatus 1 function_to_be profiled ProfilerSetStatus 0 ProfilerDump profiledump ProfilerTerm The profiler libraries use the external function getTime to measure the actual execution time The source code file timer c shows a semi hosting example of the get Time function This file is in the subdirectory E68K_support Profiler Support of your Code Warrior installation directory 150 ColdFire Architectures v6 0 Targeting Manual 10 Instruction Set Simulator This chapter explains how to use the Instruction Set Simulator ISS Using the ISS with the Code Warrior M debugger you can debug code for a ColdFire target Additionally if you run the ISS on your host computer you can share target board access with remote users of the CodeWarrior debugger In the same way you can access the target board of any remote computer that is running the ISS provided that you know the IP address and ISS port number of that remote computer NOTE Special Edition software does not support the ISS to use the ISS you must have Standard or Professional Edition software Do not move the ISS folders or files from its location in subdirectory Bin Plugins Support Sim of your Code Warrior installation
95. e 70 ColdFire Architectures v6 0 Targeting Manual Compilers Pragmas Table 5 5 ColdFire Predefined Sections continued PID Addressing pragma define section text text far_absolute RX Mode pragma define section data data bss far_data RW pragma define section sdata sdata sbss near data RW pragma define _ section const rodata far_absolute R PIC Addressing pragma define section text text far code RX Mode pragma define section data data bss far_absolute RW pragma define section sdata sdata sbss near data RW pragma define _ section const rodata far_code R Another use for pragma define section is redefining the attributes of predefined sections To force 16 bit absolute addressing for all data use pragma define_section data data near_absolute To force 32 bit TP relative addressing for exception tables use pragma define_section exceptlist exceptlist far_code pragma define_section exception exception far_code You should put any such attribute redefinition pragmas a prefix file or other header that all your program s source files will include NOTE The ELF linker s Section Mappings settings panel must map any user defined compiler section to an appropriate segment emac Enables EMAC assembly instructions in inline assembly pragma emac on off reset Remarks Enables inline assembly instructions mac msac
96. e library code emulates floating point operations Hardware Processor hardware performs floating point operations only appropriate for processors that have floating point units Comments Default Software For software selection your project must include the appropriate FP_ColdFire C runtime library file Greyed out if your target processor lacks an FPU 4 Byte Integers Clear Specifies 2 byte integers Default Checked Code checkbox ANO Checked Specifies 4 byte integers Position Clear Generates relocatable Default Clear Independent code Checked Generates position independent code PIC that is non relocatable PIC is available with 16 and 32 bit addressing A6 Stack Frames Clear Disables call stack Default Checked checkbox tracing generates faster and Checking this checkbox smaller code corresponds to using the Checked Enables call stack a6frames pragma tracing each stack frame sets up Clearing this checkbox is and restores register A6 at appropriate if you will not use the debugger Position Clear Generates relocatable Default Clear Independent Data data PID is available with 16 and checkbox Checked Generates position independent data PID that is non relocatable 32 bit addressing Emit Macsbug Symbols checkbox Clear Does not generate Macsbug symbols Checked Generates Macsbug symbols in
97. e value and compiler settings Integer return value register DO Pointer return value register AO Any other return value temporary storage area For any non integer non pointer return type the calling routine reserves this area in its stack The calling routine passes a pointer to this area as its last argument The called function returns its value in this temporary storage area To have the compiler return pointer values in register DO use the pragma pointers_in_DO which the C Compiler reference guide explains To reset pointer returns use the pragma pointers_in_A0 ColdFire Architectures v6 0 Targeting Manual 65 Compilers Variable Allocation NOTE Ifyou use the pragma pointers_in_A0 be sure to use correct prototypes Otherwise the pragma may not perform reliably Figure 5 1 depicts the stack when you use the ColdFire compiler to call a C function Figure 5 1 Calling a C Function Stack Depiction Last Argument First Argument Pointer to Return Value if needed Stack Pointer Return Address Variable Allocation For a ColdFire target the compiler lets you declare structs and arrays to be any size but imposes a few limits on how you allocate their space Maximum bitfield size is 32 bits e There is no limit to local variable space for a function However access is twice as fast for frames that do not exceed 32 kilobytes To keep within this limit Dynamically allocate
98. e values of the two symbols 92 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords Example Listing 6 19 shows the code for creating an exception table Listing 6 19 Creating an Exception Table __ exception table _ start ase EXCEPTION __exception_table_end__ EXPORTSTRTAB Creates a string table from the names of exported symbols EXPORTSTRTAB Remarks Table 6 3 shows the structure of the export string table As with an ELF string table the system zero terminates the library and symbol names Table 6 3 Export String Table Structure 0x00 1 byte library name varies symbol name varies symbol2 name varies Example Listing 6 20 shows the code for creating an export string table Listing 6 20 Creating an Export String Table expstr EXPORTSTRTAB gt EXPSTR ColdFire Architectures v6 0 Targeting Manual 93 ELF Linker and Command Language Commands Directives and Keywords EXPORTSYMTAB Creates a jump table of the exported symbols EXPORTSYMTAB Remarks Table 6 4 shows the structure of the export symbol table The start of the export symbol table must be aligned on at least a four byte boundary Table 6 4 Export Symbol Table Structure Size in bytes of export table 4 bytes Index to library name in export string table 4 bytes Index to
99. ects It may be convenient to keep executable files in a project so that you can disassemble it later As the linker ignores executable files the IDE portrays them as out of date even after a successful build The IDE out of date indicator is a check mark in the touch column at the left side of the project window Dragging dropping the final elf and disassembling it is a useful way to view the absolute code S Record Comments You can insert one comment can at the beginning of an S Record file via the linker command file directive WRITESOCOMMENT Subsection WRITESOCOMMENT provides more information ColdFire Architectures v6 0 Targeting Manual 107 ColdFire Linker Notes S Record Comments 108 ColdFire Architectures v6 0 Targeting Manual Inline Assembly This chapter explains support for inline assembly language programming a feature of all CodeWarrior compilers The standalone assembler different software component is not a topic of this chapter For information on the stand alone assembler refer to the Assembler Guide This chapter consists of these sections Inline Assembly Syntax Inline Assembly Directives Inline Assembly Syntax Syntax explanation topics are Statements e Additional Syntax Rules e Preprocessor Features Local Variables and Arguments Returning From a Routine Statements All internal assembly statements must follow this syntax LocalLabel instruction directive
100. ed Shows checkbox is checked disassembler comments in sections that have comment columns Show Data Modules Clear Blocks output of Default Checked checkbox ELF data sections for the disassembled module disables the Disassemble Exception Tables checkbox Checked Outputs rodata bss or other such ELF data sections in the disassembled module Activates the Disassemble Exception Tables checkbox Disassemble Clear Keeps C Default Clear Exception Tables exception tables out of the checkbox disassembled module This checkbox is active only if the Show Data Modules Checked Includes C checkbox is checked exception tables in the disassembled module Show Debug Info Clear Keeps DWARF Default Clear checkbox symbolics out of the disassembled module Checked Includes DWARF symbolics in the disassembled module 50 ColdFire Architectures v6 0 Targeting Manual Target Settings ColdFire Settings Panels ColdFire Processor Use the ColdFire Processor panel Figure 4 8 to control code generation settings Table 4 6 explains the elements of this panel Figure 4 8 ColdFire Processor Panel ColdFire Processor Target CPU CFM5213 1X Struct Alignment 58K z Parameter Passing Compact IV 4 Byte Integers I A6 Stack Frames Emit Macsbug Symbols Generate Code for Profiling r Use sdata sbss for All data All data smaller than
101. efault function is in file ColdFire__startup c It sets up the ColdFire EABI environment before code execution Its final task is calling main Force Active Symbols text box Specifies symbols to be included in the output file even if not referenced makes such symbols immune from deadstripping Default None Use spaces to separate multiples symbols Listing 4 1 and Listing 4 2 show the effect of the Show Transitive Closure checkbox Listing 4 1 Sample Code for Transitive Closure void alphal int a 1001 void alpha int b 1002 alphal int main void alpha 58 ColdFire Architectures v6 0 Targeting Manual Target Settings ColdFire Settings Panels return 1 If you checked the Show Transitive Closure checkbox of the ColdFire Linker panel and compiled the source files The linker would generate a link map file and The link map file would include text such as that of Listing 4 2 Listing 4 2 Link Map Effects of Show Transitive Closure Link map of __start 1 __start func global found in C_4i_CF_Runtime a E68k_startup o 2 _ main func global found in main c 3 _ alpha func global found in main c 41 _ alphal func global found in main c Debugger PIC Settings Use the Debugger PIC Settings panel Figure 4 10 to specify an alternate address where you want your ELF image downloaded on the target Figure 4 10 Debugger PIC Settings Pa
102. elds BA and CBM ignoring other fields DMRx this model includes reads from and writes to these fields The SDRAMC model covers functionality only of DMRx register fields BAM and V ignoring other fields KRAM KROM support as much as 512 kilobytes of memory Memory wait states supported A line exceptions not generated as this model includes MAC NOTE The V2 ISS has pipeline delays that can lead to debugger defects ColdFire V4e For V4e cores the ISS features are e Instruction set modeling for all instructions EMAC modeling of the EMAC e FPU not supported ColdFire Architectures v6 0 Targeting Manual Instruction Set Simulator Using the Simulator Cache modeling of the ColdFire V4e four way set associative instruction and data caches Caches always are physically tagged and physically addressed e MMU model partially supported e WDEBUG instruction not supported as the model does not support the WDEBUG module e WDDATA instruction not supported as the model does not support the WDDATA module e PULSE instruction not supported as the model does not support the PULSE debug module IPSBAR Functionality 5282 Peripherals modeling of the IPSBAR register No modeling of other peripherals or related behavior e A line exceptions not generated as this model includes EMAC e F line exceptions not generated as this model includes an FPU e Cloc
103. elect Remote Connections The Remote Connections panel moves to the front of the IDE Preferences window Figure 9 4 shows the IDE Preferences window at this point 126 ColdFire Architectures v6 0 Targeting Manual Debugging Target Settings for Debugging Figure 9 4 IDE Preferences Window Remote Connections Panel BIDE Preferences N IDE Preference Panels General Build Settings IDE Extras Plugin Settings Shielded Folders Source Trees Editor Code Completion ABATRON_SERIAL Serial ABATRON_TCP IP TCP IP CCS SIM PEMICRO_LIGHTNING PEMICRO_PARALLEL Lightning Parallel PEMICRO_USB USB CCS Remote Connection Code Formatting Editor Settings Font amp Tabs Text Colors Debugger Display Settings Window Settings Global Settings Remote Connections RAD Tools Remove Add Change Import Panel Export Panel OK Cancel Apply Factory Settings 3 Click the Add button The New Connection dialog box Figure 9 5 appears Figure 9 5 New Connection Dialog Box x Name Newconnectin ss Debugaer ColdFie Abaton m Connection T ype Serial y I Show in processes list Port COM y Rate f1 15200 y Data Bits e y Parity None ES Stop Bits 1 y Flow Control None Log Communications Data to Log Window 4 Inthe Name text box enter a name for the new connection Use the Debugger list box to specify the debugger for the new remo
104. erial remote connection Figure 9 10 show the configuration dialog box for an Abatron TCP IP remote connection Table 9 6 explains the elements of these dialog boxes 134 ColdFire Architectures v6 0 Targeting Manual Debugging Remote Connections for Debugging Figure 9 9 Serial Abatron Remote Connection Dialog Box x Name AB_serial_new_connection Debugger ColdFire Abatron y Show in processes list Connection Type Serial y Port COM1 v Parity N one X Rate fi 15200 v Stop Bits 1 v Data Bits 8 kA Flow Control None ba Log Communications Data to Log Window Figure 9 10 TCP IP Abatron Remote Connection Dialog Box x Name A8_TCPLnew_connection Debugger ColdFire Abatron y J Show in processes list Connection Type TCP IP IP Address Enter an IP address in the format of 127 0 0 1 1000 or host domain com 1000 Log Communications Data to Log Window Table 9 7 Abatron Dialog Box Elements Element Purpose Comments Name text box Identifies the remote connection For an existing connection already has a value Debugger list box Identifies the debugger For an existing connection already specifies ColdFire Abatron Show in processes Clear Leaves the connection off the Default Clear list checkbox official list Checked Adds connection to the official list select View gt Systems gt List also adds connection to the pop up list for debugging certa
105. ettings panel Figure 4 4 lets you run a batch file after the IDE builds your project To specify such a batch file click the Choose button then use the subsequent dialog box to navigate to and select the file Clicking the OK button of the dialog box returns you to this panel filling in the name of the batch file Figure 4 4 BatchRunner PostLinker Panel q BatchRunner PostLinker Select the batch file that you wish to have run after a successful link Choose Clear Pass linker output file as 1 parameter to batch file To pass the name of the output file as a parameter to the batch file check the Pass linker output file as 1 parameter to batch file checkbox ColdFire Architectures v6 0 Targeting Manual 43 Target Settings ColdFire Settings Panels ColdFire Target Use the ColdFire Target panel Figure 4 5 to specify the type of project file and to name your final output file Table 4 3 explains the elements of this panel To create alternative builds compiling for different targets use the __ option pre processor function with conditional compilation Figure 4 5 ColdFire Target Panel Coldfire Target m Project Type Application y File Name M521 3EWB Console Debug elf Table 4 3 ColdFire Target Panel Elements 44 Element Purpose Comments Project Type list box Specifies the kind of project Default Application Application executable project Library static library Shared L
106. f nostderr is in effect stderr goes to stdout no wraplines Specifies message word wrapping Precompiling and Input File Control progress Shows progress and version search Searches access paths for source object or library files that the command line specifies timing Collects timing statistics v erbose Specifies cumulative verbose information implies progress version Shows tool version configuration and build date Preprocessing C Specifies compiling only without linking no codegen Specifies object code generation no convertpaths Interprets include filepaths of other operating systems Characters and separate directories so cannot be in filenames cwd keyword Specifies searching priority per keyword explicit No implicit directories only I ir paths include Start in directory of referencing file proj Start in current working directory default source Start in source file directory Not global D d efine Defines symbol name to value 1 or to name value specified value Not global no defaults ColdFire Architectures v6 0 Targeting Manual Specifies passing to linker default same as no stdinc 185 Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option dis assemble Purpose Specifies passing to all tools di
107. f you optimize for speed the compiler gives preference to variables in loops The ColdFire back end compiler gives preference to variables declared register but does not automatically assign them to registers For example if the compiler must choose between an inner loop variable and a variable declared register the compiler places the inner loop variable in the register Pragmas For ColdFire development the compiler supports the standard pragmas that Table 5 3 lists The C Compilers Reference explains these pragmas including their syntax Table 5 3 Standard Pragmas for ColdFire Development a frames auto_inline align_array_members align ARM_conform cpp_extensions bool dont_reuse_strings cplusplus exceptions direct_destruction far_data enumsalwaysints force_active extended_errorcheck ignore_oldstyle ColdFire Architectures v6 0 Targeting Manual 67 Compilers Pragmas Table 5 3 Standard Pragmas for ColdFire Development continued far_vtables lib_export IEEEdoubles macsbug oldstyle_symbols inline _ depth mpwc_newline longlong once mark optimize for _size mpwc_relax pcrelstrings only_std_keywords pointers_in DO parameter precompile_target pointers_in_A0 require _prototypes pool_strings segment profile static_inlines RTTI unsigned_char unused warn_emptydecl warn_hidevirtual warn_illpragma warn_unusedarg ANSI_strict The compile
108. for a connection to go through before trying the connection again ColdFire Architectures v6 0 Targeting Manual 141 Debugging BDM Debugging BDM Debugging This section explains connections for Background Debugging Mode BDM debugging of a ColdFire target board Connecting a P amp E Microsystems Wiggler Figure 9 15 depicts connections for a P amp E wiggler Figure 9 15 P amp E Wiggler Connections Wiggler BDM connector A Parallel cable to PC parallel port Target board Follow these steps 1 Plug the wiggler onto the target board BDM connector 2 Connect the parallel cable to the wiggler 3 Connect the other end of the parallel cable to a parallel port of your PC 4 This completes wiggler connection The wiggler automatically installs a default set of drivers and interface dlls on your PC NOTE You must have the correct wiggler for your target If necessary contact P amp E Microsystems for assistance The drivers and interface dlls for P amp E Microsystems wigglers are available as well in subdirectory bin Plugins Support ColdFire pemicro of your Code Warrior installation directory 142 ColdFire Architectures v6 0 Targeting Manual Debugging BDM Debugging Connecting an Abatron BDI Device Figure 9 16 depicts connections for an Abatron BDI device Figure 9 16 Abatron BDI Connections JTAG connector Power connector on end of BDI TCP IP connector RCD cable Power
109. g_support 74 section 74 75 predefined symbols 75 profile pragma 74 profiler 149 150 program sections linker 105 program verify flash panel 173 project building 30 32 creating 25 29 debugging 32 37 files 21 window 21 project window 29 R range memory configuration command 212 readonly_strings pragma 74 REF_INCLUDE linker command 99 register variables 67 registers window 35 154 remote connections 126 128 debugging 134 141 panel 127 remote debugging panel 31 124 126 219 requirements system 17 18 reserved memory configuration command 213 reservedchar memory configuration command 213 214 ResetHalt debug initialization command 207 ResetRun debug initialization command 207 return inline assembly directive 118 returning from a routine inline assembly 113 ROM RAM copying LCF 86 88 runtime code 163 168 runtime libraries 167 168 S sample code transitive closure 58 59 sample ISS configuration file 160 scope loop tests panel 176 sdram simulator configuration command 160 SDS_debug_support pragma 74 section pragma 74 75 SECTIONS linker command 100 101 sections segment LCF 79 serial I O libraries 166 settings panels 40 60 target 39 60 target debugging 119 133 simple profiler 149 150 simulator 151 161 simulator configuration commands 154 160 simulator using 153 154 SIZEOF linker command 101 SIZEOF_ROM linker command 101 software editions 12 13 special features debugging 147 150 S re
110. gger window A console window Figure 3 14 appears displaying the Hello World message result of the application Figure 3 14 Console Window inix Hello World MW in C Al b Click the Kill button x of the Debugger window The debugger stops the application the IDE stops the debugger and the Debugger widow closes c This completes the procedure you have created and debugged a simple application You may close any open windows ColdFire Architectures v6 0 Targeting Manual 37 Application Tutorial Debug the Application 38 ColdFire Architectures v6 0 Targeting Manual Target Settings This chapter explains the settings panels specific to ColdFire software development Use the elements of these panels to control assembling compiling linking and other aspects of code generation This chapter consists of these sections e Target Settings Overview e ColdFire Settings Panels Target Settings Overview In a Code Warrior project each build target has its own settings for compiling linking and other parts of code generation Your controls for these settings are the target settings panels that you access through the Target Settings window To open this window select Edit gt Target Settings from the main window menu bar Target is a target name such as CF_Simulator within your Code Warrior project An alternate way to brig up the Target Settings window is to bring the Targets page to the front of the project win
111. ging Figure 9 14 ISS Remote Connection Name Sim_new_connection 0S Debugger CaldFire CCS y m Connection Type ccs Remote Connection Server IP Address fi 27 0 0 1 I Use Remote CCS Port D Show in processes list x IF Specify CCS Executable T Multi Core Debugging JTAG Configuration File CCS Timeout eo seconds NOTE Revert Pane Cancel OK To use the ISS for V2 and V4e cores create a CCS remote connection Alternatively use the default CCS SIM connection from the Remote Connection panel list Table 9 9 ISS Dialog Box Elements Elements Name text box Purpose Identifies the remote connection Comments For an existing connection already has a value Debugger list box Identifies the debugger For an existing connection already specifies ColdFire CSS Show in processes list checkbox Clear Leaves the connection off the official list Checked Adds connection to the official list select View gt Systems gt List also adds connection to the pop up list for debugging certain kinds of file ColdFire Architectures v6 0 Targeting Manual Default Clear Table 9 9 ISS Dialog Box Elements continued Debugging Remote Connections for Debugging Elements Connection Type list box Purpose Specifies CSS Remote Connection Comments Changing this value c
112. h Clear Does not download program Default Checked Initialized Data initialized data sections for initial launch Initial launch is the first time you cheCKDOX Checked Downloads program Ah HR he me initialized data sections for initial launch 99 i Initial Launch Clear Does not download program Default Clear Uninitialized Data uninitialized data sections for initial Initial launch is the first time you checkbox launch debug the project after you start the debugger from the IDE Executable checkbox Successive Runs Clear Does not download program executable code or text sections for successive runs Checked Downloads program executable code and text sections for successive runs Default Clear Successive runs are debugging actions after initial launch Note that rebuilding the project returns you to the initial launch state Constant Data checkbox Successive Runs Clear Does not download program constant data sections for successive runs Checked Downloads program constant data sections for successive runs Default Clear Successive runs are debugging actions after initial launch Note that rebuilding the project returns you to the initial launch state NOTE If you check this checkbox avoid cycling board power Doing so can prevent application rebuilding and code reloading making debugging unnecessarily difficult Initialized Data checkbox Successive
113. hanges other elements of the dialog box Use Remote CCS checkbox Clear Launches the CSS locally Checked Starts debug code on a remote target activates Server IP Address text box ISS must be running and connected to a remote target device Server IP Address text box Specifies IP address of the remote machine in format 127 0 0 1 1000 or host domain com 1000 Available only if you check the Use Remote CCS checkbox Port text box Specifies the port number the CSS uses Use only 40969 the number of the port pre wired for the simulator Specify CCS Executable checkbox Clear Uses the default CSS executable file Checked Lets you specify a different CCS executable file activating the text box and Choose button To do so click the Choose button then use the subordinate dialog box to select the executable file Clicking OK puts the pathname in the text box Does not pertain to the simulator Multi Core Debugging checkbox Clear Does not debug code on a multicore target Checked Lets you specify the JTAG chain for debugging on a multicore target activating the text box and Choose button To do so click the Choose button then use the subordinate dialog box to select the executable file Clicking OK puts the pathname in the text box Does not apply to the simulator CCS Timeout text box Specifies the number of seconds the CSS should wait
114. his chapter explains some of the linker capabilities This chapter consists of these sections e Program Sections e Deadstripping Link Order Executable files in Projects S Record Comments Program Sections Object files contain code and data that the linker must store in program sections of target memory The default arrangement is that linker puts all program code into the text program section but you can use pragma section to specify storage A program section is a logical grouping for a type of program code that the compiler produces Table 7 1 lists several code types Table 7 1 Code Section Type Section Type Contents text Executable code data sdata Initialized data bss sbss Uninitialized but reserved data At the start of program execution the runtime code clears segments of these types to zero rodata Read only data The system stores sdata and sbss types in the small data section Access to the small data section is faster than access to other sections but involves consequences for the memory map Addressing for sbss and sdata sections always is 16 bit A5 relative The ColdFire Processor panel lets you specify the maximum size for variables to be ColdFire Architectures v6 0 Targeting Manual 105 ColdFire Linker Notes Deadstripping stored in the small data section Thee ColdFire Reference Manual gives more information about near data a term for the contents of
115. i_CF_FPU_Runtime a yes 4 bytes C_4i_CF_FPU_StdABI_Runtime a Cpp_4i_CF_FPU_StdABI_Runtime a NOTE ABI corresponds directly to the parameter passing setting of the ColdFire Processor Settings panel Standard Compact or Register If your target supports floating points you should use an FPU enabled runtime library file ColdFire Architectures v6 0 Targeting Manual 167 Libraries and Runtime Code Runtime Libraries Position Independent Code To use position independent code or position independent data in your program you must customize the runtime library Follow these steps 1 Load project file MSL_RuntimeCF mcp from the folder E68K_Support runtime 2 Modify runtime functions Open file E68K_startup c b As appropriate for your application change or remove runtime function __block_copy_ section This function relocates the PIC PID sections in the absence of an operating system c As appropriate for your application change or remove runtime function __ fix addr_references This function creates the relocation tables 3 Change the prefix file a Open the C C preference panel for your target b Make sure this panel specifies prefix file PICPIDRuntimePrefix h 4 Recompile the runtime library for your target Once you complete this procedure you are ready to use the modified runtime library in your PIC PID project Source file comments and runtime library release notes may provi
116. ibrary shared library File Name text box Specifies the name of your final Default None linked output file Cotes extension elf for an application 1ibor a for a library ColdFire Assembler Use the ColdFire Assembler panel Figure 4 6 to control the source format or syntax for the Code Warrior assembler and to specify the target processor for which you are generating code Table 4 4 explains the elements of this panel ColdFire Architectures v6 0 Targeting Manual Figure 4 6 ColdFire Assembler Panel ColdFire Assembler Processor Processor has MAC IV Processor has EMAC N Processor has FPU Source Format IV Labels Must End With M Directives Begin With M Case Sensitive Identifiers MV Allow Space In Operand Field Target Settings ColdFire Settings Panels I Generate Listing File Prefix File lr Table 4 4 ColdFire Assembler Panel Elements Element Processor list box Purpose Specifies the target processor Comments Default MCF52xx Processor has MAC checkbox Clear Tells assembler that the target processor does not have a multiply accumulator MAC unit Checked Tells assembler that the target processor does have a MAC Default Clear You can check both the MAC and EMAC checkboxes Processor has EMAC checkbox Clear Tells assembler that the target processor does not have an enhanced multiply accumu
117. ich on which your code will execute Build Target The group of settings and files that determine what your code is as well as controlling the process of compiling and linking The CodeWarrior IDE lets you specify multiple build targets For example a project can contain one build target for debugging and another build target optimized for a particular operating system platform target These build targets can share project files even though each build target uses its own settings After you debug the program the only actions necessary to generate a final version are selecting the project s optimized build target and using a single make command The CodeWarrior IDE s extensible architecture uses plug in compilers and linkers to target various operating systems and microprocessors For example the IDE internally calls a C translator compiler and linker Most features of the CodeWarrior IDE apply to several hosts languages and build targets However each build target has its own unique features This manual explains the features unique to the CodeWarrior IDE for Freescale ColdFire processors ColdFire Architectures v6 0 Targeting Manual Getting Started CodeWarrior Development Process For comprehensive information about the CodeWarrior IDE see the Code Warrior IDE User s Guide CodeWarrior Development Process The CodeWarrior IDE helps you manage your development work more effectively than you can with a traditiona
118. ifies ColdFire P amp E Micro Show in processes list checkbox Clear Leaves the connection off the official list Checked Adds connection to the official list select View gt Systems gt List also adds connection to the pop up list for debugging certain kinds of file Default Clear Connection Type list box Specifies Parallel USB or Lightning Changing this value changes the subordinate elements of the dialog box as Figure 9 11 Figure 9 12 and Figure 9 13 show Parallel Port list box Specifies the parallel port LPT1 LPT2 LPT3 or LPT4 Default LPT1 Speed text box in parallel dialog box Integer that modifies the data stream transfer rate O specifies the fastest rate The greater the integer the slower the rate For a parallel remote connection there is no firm mathematical relationship so you may need to experiment to find the best transfer rate In case of problems try value 25 USB Port list box Specifies the USB port USB 0 USB 1 USB 2 or USB 4 Default USB 0 Speed text box in USB dialog box Integer N that specifies the data stream transfer rate per the expression 1000000 N 1 hertz 0 specifies 1000000 hertz or 1 megahertz 1 the default specifies 0 5 megahertz 31 specifies the slowest transfer rate 0 031 megahertz PCI card slot list box Specifies PCI slot that the board uses Default 1 Speed text box in Ligh
119. ify button the flash programmer compares the data now in flash sectors to the image file on disk ColdFire Architectures v6 0 Targeting Manual 173 Using Hardware Tools Hardware Diagnostics 8 Optional For an additional test of programmed flash sectors run a checksum a From the pane list at the left of the Flash Programmer window select Checksum the Checksum panel moves to the front of the window as Figure 12 5 shows Figure 12 5 Flash Programmer Window Checksum Panel inix 8 Flash Programmer IS Checksum Target Configuration Flash Configuration Program Verify File on Target Blank Check um m Compute Checksum Over Address Range Start Op Size Ox JOD FFFFF File on Host Memory Range on Target Entire Flash Status Detail Calculate Checksum Show Log Load Settings Save Settings Cancel b In the Compute Checksum Over area select the appropriate option button File on Target File on Host Memory Range on Target or Entire Flash c If this selection activates the Address Range text boxes enter the appropriate Start and Size values d Click the Calculate Checksum button the flash programmer runs the checksum calculation a message tells you the result 9 This completes flash programming Hardware Diagnostics Use the CodeWarrior hardware diagnostics tool to obtain several kinds of information about the target board Select
120. iles that have the same extension as the binary file Figure 6 1 shows how to make this type designation 88 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords Figure 6 1 Marking a Binary File Type as a Resource File N File Mappings File Type TEXT CC Metrowerks C C TEXT cp Metrowerks C C TEXT cpp Metrowerks C C TEXT ch Metrowerks C C TEXT ms Asm MPW MB8K ELF TEXT pch Metrowerks C C TEXT pch Metrowerks C C r Mapping Info File Type TEXT Choose Extension ic Flags Y Compiler Tet see Edit Langua aunchable ade Ea ee Precompiled Factory Settir Ignored by Make Import Panel Export Panel Commands Directives and Keywords The rest of this chapter consists of explanations of all valid LCF functions keywords directives and commands in alphabetic order Table 6 2 LCF Functions Keywords Directives and Commands location counter ADDR ALIGN ALIGNALL EXCEPTION EXPORTSTRTAB EXPORTSYMTAB FORCE_ACTIVE IMPORTSTRTAB IMPORTSYMTAB INCLUDE KEEP_SECTION MEMORY OBJECT REF_INCLUDE SECTIONS SIZEOF SIZEOF_ROM WRITEB WRITEH WRITEW WRITESOCOMMENT ZERO_FILL_UNINITIALIZED ColdFire Architectures v6 0 Targeting Manual 89 ELF Linker and Command Language Commands Directives and Keywords location counter Denotes the current output locati
121. in kinds of file ColdFire Architectures v6 0 Targeting Manual 135 Debugging Remote Connections for Debugging Table 9 7 Abatron Dialog Box Elements continued Connection Type list box Specifies serial or TCP IP Changing this value changes the subordinate elements of the dialog box as Figure 9 9 and Figure 9 10 show Port list box Specifies the serial port COM1 COM2 Default COM1 COMB or COM256 Rate list box Specifies transfer speed 300 1200 Default 38 400 baud 2400 9600 9 200 38 400 57 600 115 200 or 230 400 baud Data Bits list box Specifies number of data bits per character 4 5 6 7 or 8 Default 8 Parity list box Specifies parity type None Odd or Even Default None Stop Bits list box Specifies number of stop bits 1 1 5 or 2 Default 1 Flow Control list box Specifies flow control type None Hardware RTS CTS or Software XONN XOFF Default None Log Communications Data to Log Window Clear Does not copy communications in log window Checked Copies communications in log window Default Clear IP Address text box Specifies IP address Must be in format 127 0 0 1 1000 or in format host domain com 1000 NOTE For an Abatron remote connection be sure to clear the checkboxes Use Target Initialization File and Use Memory Configuration File of the CF Debugger Settings p
122. information from the host application allowing source level debugging of the application running on the target hardware Using the Simple Profiler You can use the IDE profiling tool to analyze your code Follow these steps 1 Specify profiling in one of these ways In the ColdFire Processor panel check the Generate code for profiling checkbox Use the pragma profile on directive before the function definition and use the pragma profile off directive after the function definition Use the profile option or the pragma directives with the command line compiler 2 Tf you use the pragma directives add the profiler libraries to your project These libraries are in subdirectory E68K_Support Profiler of your Code Warrior installation directory 3 In your source code use the include directive to include header file Profiler h This file is in subdirectory E68K_Support Profiler include of your Code Warrior installation directory 4 You are ready to use the profiler via these calls a b c d e ProfilerInit initializes the profiler ProfilerClear removes existing profiling data ProfilerSetStatus turns profiling on 1 or off 0 ProfilerDump filename dumps the profile data to a profiler window or to the specified file ProfilerTerm exits the profiler Listing 9 1 shows an example of using these calls in source code Listing 9 1 Using the Profiler in Source Cod
123. ing Manual 177 Using Hardware Tools Hardware Diagnostics 178 ColdFire Architectures v6 0 Targeting Manual 13 Command Line Tools Your Code Warrior software includes a command line compiler assembler and linker This chapter describes how to use these tools to build applications This chapter consists of these sections Command Line Executables Environment Variables e Compiling and Linking Command Line Executables Command line tools let you do anything that you can do with IDE hosted tools but the command line implementation is different For example you use a makefile instead of an IDE project you use command line switches instead of IDE settings panels to specify options However you can script the IDE so that the automation environment and the GUI share common files The command line tools are a set of executable files e mwccmcf exe the ColdFire compiler mwasmmcf exe the ColdFire assembler e mwldmcf exe the ColdFire linker disassembler These files are in folder E68K_Tools Command_ Line Tools Environment Variables Use environment variables to store pathnames to the libraries you commonly use This shortens the command lines for many tasks The syntax for defining an environment variable is set EV_Name pathname pathname where EV_Name Name of the new environment variable ColdFire Architectures v6 0 Targeting Manual 179 Command Line Tools Environment Variables pathname
124. ing Panel Elements continued Element Purpose Comments Launch remote Clear Prevents the IDE from starting Default Clear host application a host application on the remote checkbox computer Checked IDE starts a host application on the remote computer Also enables the corresponding text box for the absolute path to the remote host application This option does not apply to bareboard development Download OS Clear Prevents downloading a Default Clear checkbox bootable image to the target system Checked Downloads the specified bootable image to the target system Also enables the Connection list box and OS Image Path text box Connection list box Specifies the remote connection type Disabled if the Download OS for downloading the bootable image to checkbox is clear the target board Lists only the remote connections you add via the Remote Connections panel OS Image path Specifies the host side path of the Disabled if the Download OS bootable image to be downloaded to the checkbox is clear target board Adding Remote Connections NOTE Special and Standard Edition software support only P amp E Microsystems USB remote connection For any other type of remote connection you must have Professional Edition software To add a remote connection use the Remote Connections panel 1 Select Edit gt Preferences The IDE Preferences window appears 2 From the IDE Preferences Panels list s
125. ings panel Figure 4 2 to define the build target and select the appropriate linker Table 4 2 explains the elements of this panel NOTE You must use this settings panel to select a linker before you can specify the compiler linker settings or any other project details Figure 4 2 Target Settings Panel Target Settings Target Name M5213EVB Console Debug Linker Embedded ColdFire Linker w Pre linker None Post linker Noe x Output Directory a 5 Choose Project bin Clear Save project entries using relative paths ColdFire Architectures v6 0 Targeting Manual 41 Target Settings ColdFire Settings Panels Table 4 2 Target Settings Panel Elements 42 Element Target Name text box Purpose Specifies the name of the build target this name appears subsequently on the Targets page of the project window Comments Default None This build target name is not the name of your final output file Linker list box Specifies the linker Select ColdFire Default ColdFire Controls visibility of other relevant panels Pre linker list box Specifies the pre linker that performs work on object code before linking Default None If your project includes Flash programming select BatchRunner PreLinker For more information see BatchRunner PreLinker Post linker list box Specifies the post linker that performs additional work on the
126. interrupts 31 IRQ7 break Clear Ignores use of the IRQ7 break Default Checked Debugging Target Settings for Debugging Table 9 4 CF Exceptions Panel Elements continued Element Purpose Comments 46 TRAP 14 for Clear Ignores trap 14 for console I Default Clear Console I O O checkbox Checked Catches and displays uses of trap 14 for console I O 61 Unsupported Clear Ignores unsupported Default Clear instruction instructions checkbox Checked Catches and displays unsupported instructions Debugger Settings Panel Use the Debugger Settings panel Figure 9 7 to select and control the debug agent Table 9 5 explains the elements of this panel Figure 9 7 Debugger Settings Panel Debugger Settings rm Location of Relocated Libraries and Code Resources Choose Stop on application launch Program entry point Default language entry point User specified main m Other Settings I Auto target Libraries IV Cache symbolics between runs M Log System Messages IV Stop at Watchpoints J Update data every 5 seconds Console Encoding None y ColdFire Architectures v6 0 Targeting Manual 131 Debugging Target Settings for Debugging Table 9 5 Debugger Settings Panel Elements Resources text box Alternatively click the Choose button then use the subsequent dialog box to specify the pathname Element Purpose Comments Loc
127. is text box is 252 Default 80 This text box is active only if the Generate S Record File checkbox is checked NOTE Many embedded systems limit S record lines to 24 or 26 bytes A value of 20 to 30 bytes lets you see the S record on a single page EOL Character list box Specifies the end of line character for the S record file by operating system DOS UNIX or MAC ColdFire Architectures v6 0 Targeting Manual Default DOS This text box is active only if the Generate S Record File checkbox is checked Target Settings ColdFire Settings Panels Table 4 7 ColdFire Linker Panel Elements continued Element Generate Binary Image checkbox Purpose Clear Does not create a binary version of the S record file Checked Saves a binary version of the S record file to the project folder The binary file has the b filename extension Activates the Max Bin Record Length text box Comments Default Clear Binary file format is address 2 bytes byte count 2 bytes and data bytes variable length Max Bin Record Length text box Specifies data byte length for each binary record The maximum value is 252 Default None This text box is active only if the Generate Binary Image checkbox is checked Entry Point text box Specifies the program Starting point the first function the debugger uses upon program start Default __ start This d
128. izes assembly language functions However to maintain integrity of all registers the compiler notes which registers inline assembly uses 110 ColdFire Architectures v6 0 Targeting Manual Inline Assembly Inline Assembly Syntax Additional Syntax Rules These rules pertain to labels comments structures and global variables Each label must end with a colon labels may contain the character For example x1 and x2 would be valid labels but x3 would not it lacks a colon e Comments must use C C syntax either starting with double slash characters or enclosed by slash and asterisk characters To refer to a field in a structure use the struct construct struct structTypeName fieldName structAddress For example suppose that AO points to structure WindowRecord This instruction moves the structure s refCon field to DO move l struct WindowRecord refCon A0 DO e To refer to a global variable merely use its name as in the statement move w x d0 Move x into d0 Preprocessor Features You can use all preprocessor features such as comments and macros in the inline assembler But when you write a macro definition remember to End each assembly statement with a semicolon the preprocessor ignores newline characters e Use the character instead of to denote immediate data the preprocessor uses as a concatenate operator Local Variables and Arguments
129. k multiplier not supported Memory wait states not supported NOTE Pipeline delay can lead to appearance problems in the debugger variable viewer Using the Simulator When you use a local ISS connection for debugging the IDE starts the ISS automatically the ISS icon __ appears on the taskbar Right click the icon to access the ISS pop up menu Its selection are Configure opens the ISS configuration options dialog box Show console displays the ISS console window Another way to open this console window is double clicking the ISS icon Hide console hides the ISS console window About CCSSIM2 displays version information Quit CCS stops the ISS Console Window Use the ISS console window to view and change server connection options You may type commands at the command line or select them from the menu bar ColdFire Architectures v6 0 Targeting Manual 153 Instruction Set Simulator ISS Configuration Commands NOTE Do not use the console window to modify settings during a debug session This would affect the debug state Viewing ISS Registers To view the ISS registers select View gt Registers the Registers window Figure 10 1 appears Figure 10 1 Register Window ISS Register Values ETT alo x N Register Value ISS Registers INSTCNT 8689 KE D CYCLCNT 22986 You may edit the ISS register values that this window shows INSTCNT Instruction Count i
130. l command line environment Figure 2 1 depicts application development using the IDE ColdFire Architectures v6 0 Targeting Manual 19 Getting Started CodeWarrior Development Process Figure 2 1 CodeWarrior IDE Application Development Create Manage Project 7 Manage Files 1 4 Specify Target Settings 2 Notes meer 1 Use any combination stationery Edit Files 3 template files library files or your own source files 2 Compiler linker debugger settings target specification Build Make Project L optimizations 3 Edit source and resource files Compile Froject 4 Possible corrections adding a file changing settings or editing a file no yes Link Project po Debug Project yes Release Y 20 ColdFire Architectures v6 0 Targeting Manual Getting Started CodeWarrior Development Process Project Files A CodeWarrior project consists of source code library and other files The project window Figure 2 2 lists all files of a project letting you Add files e Remove files e Specify the link order e Assign files to build targets Have the IDE generate debug information for files Figure 2 2 Project Window 3 M5213EWB Intemal ROM m y Y 5 gt Files Link Order Targets File Code Date Aj E Source D De mel g EA main c
131. lains Instruction Set Simulator Instruction Set Simulator including configuration for your requirements Libraries and Runtime Code Libraries for ColdFire targets Using Hardware Tools Flash programmer and hardware diagnostics tools Command Line Tools Command line compiler assembler linker and debugger Using Debug Initialization Debug initialization files Files Memory Configuration Files Defining access for areas of memory Documentation Overview Documentation for your Code Warrior tools comes in three formats PDF manuals in subdirectory Help PDF of your installation directory The Target Settings and Debugging chapters of this Targeting Manual are extensions of the IDE User s Guide The Compilers and Inline Assembly chapters of this Targeting Manual are extensions of the C Compilers Reference The Libraries and Runtime Code chapter of this Targeting Manual is an extension of the MSL C Reference and the MSL C Reference NOTE For complete information about a particular topic you may need to look in this Targeting manual and in the corresponding generic CodeWarrior manual To view any PDF document you need Adobe Acrobat Reader software which you can download from http www adobe com acrobat e CHM help files information in Microsoft HTML Help CHM format in folder Help of the Code Warrior installation directory To view this information start the Code W
132. large variables or Declare large variables to be static provided that this does not exceed the 32 kilobyte limit on global variables Maximum declaration size for a global variable is 32 kilobytes unless you use far data You must do one of the following Dynamically allocate the variable Use the far qualifier when declaring the variable Select the Far 32 bit option from the Code and Data model in the ColdFire Processor settings panel Listing 5 3 shows how to declare a large struct or array Keep in mind that declaring large static arrays works only if the device has enough physical memory Listing 5 3 Declaring a large structure int i 50000 Wrong with ColdFire compiler and the Far Data option in the Processor settings panel is off far int j 50000 ALWAYS OK 66 ColdFire Architectures v6 0 Targeting Manual Compilers Register Variables int k k malloc 50000 sizeof int ALWAYS OK Register Variables The ColdFire back end compiler automatically allocates local variables and parameters to registers according to frequently of use and how many registers are available The ColdFire compiler can use these registers for local variables A2 through A5 for pointers D3 through D7 for integers and pointers FP3 through FP7 for 64 bit floating point numbers provided that you select Hardware in the Floating Point list box of the ColdFire Processor panel I
133. lator EMAC unit For more information see the reference manual at CodeWarrior_Dir Freescale_Documentation Checked Tells assembler that the target processor does have EMAC ColdFire Architectures v6 0 Targeting Manual Default Clear You can check both the MAC and EMAC checkboxes Target Settings ColdFire Settings Panels Table 4 4 ColdFire Assembler Panel Elements continued Element Processor has FPU checkbox Purpose Clear Tells assembler that the target processor does not have a floating point unit FPU Checked Tells assembler that the target processor does have an FPU Comments Default Clear Labels Must End With checkbox Clear System does not require labels to end with colons Checked System does require labels to end with colons Default Checked Directives Begin With checkbox Clear System does not require directives to start with periods Checked System does require directives to start with periods Default Checked Case Sensitive Identifiers checkbox Clear Tells assembler to ignore case in identifiers Checked Tells assembler to consider case in identifiers Default Checked Allow Space In Operand Field checkbox 46 Clear Tells assembler to not allow spaces in operand fields Checked Tells assembler to allow spaces in operand fields ColdFire Architectures v6 0
134. les in Projects 107 S Record Comments 107 8 Inline Assembly 109 Inline Assembly Syntax 109 State Ments os ed phn al seg E a asada en A A datos 109 Additional Syntax Rules 111 Preprocessor Features ica et an eae DA 111 Local Variables and Arguments 111 Returning From a Routine 113 Inline Assembly Directives 113 de mines A A AA Bee SS ie VAE eet 114 RE chi tus fy Gassercasecmy onets carts sour anh pie gues ene A 114 TIDY Sb sis cia died weed dee a tia eee Sched eee A ate ie ae dl a 115 frallocs e cineca eet en tantos as 116 A sical oe kt seein pire Rasen pee A See cS 116 machine at pie wih eh arses et Er ot srs 117 pakedo a ar A A ia 117 O 54 sn en ot ne Se pra Net A a ee na en 118 TETUN ss pea NON 118 9 Debugging 119 Target Settings for Debugging 119 CF Debugger Settings Panel 121 Remote Debugging Panel 124 CF Exceptions Panel 128 Debugger Settings Panel 131 CF Interrupt Padel unio ii te ua A oe 133 Remote Connections for Debugging 13
135. lity arising out of the application or use of any product described herein and specifically disclaims any and all liability Metrowerks software is not authorized for and has not been designed tested manufactured or intended for use in developing applications where the fail ure malfunction or any inaccuracy of the application carries a risk of death serious bodily injury or damage to tangible property including but not limited to use in factory control systems medical devices or facilities nuclear facilities aircraft navigation or communication emergency systems or other applications with a similar degree of potential hazard How to Contact Metrowerks Corporate Headquarters Metrowerks Corporation 7700 West Parmer Lane Austin TX 78729 U S A World Wide Web http www freescale com codewarrior Technical Support http www freescale com support Table of Contents 1 Introduction 11 Read the Developer Notes 11 Features A OE da A 11 CodeWarrior Editions 12 About this Manual 13 Documentation Overview 14 Additional Information Resources 15 2 Getting Started 17 System Requirements da dep pau ete 17 Host Requirements 17 Target Board Requiremen
136. ll f lush std while 1 Line 10 Col1 Source 4 View registers a From the main menu bar select View gt Registers The Registers window Figure 3 11 appears b Use the expand controls to drill down through register categories to individual registers when you reach individual registers their values appear at the right side of the window You may edit register values directly in the Registers window d Close the Registers window ColdFire Architectures v6 0 Targeting Manual Figure 3 11 Registers Window M5213EVB Console Debug elf H Thread oxo General Purpose Registers bo D1 D2 D3 D4 os D6 07 AO AL A2 A3 Ad AS AG A7 PC SR H supervisor Registers Iss Registers 5 View memory oxooo000000 oxooo00000 oxooo00000 oxooo00000 0 00000000 0x 00000000 0x 00000000 0 00000000 0x00000000 0x20005644 0x00000000 0x00000000 0x 00000000 Ox200056A4 Ox20007FFC Ox20007FFO ox20000500 Ox2704 Application Tutorial Debug the Application a In the Source pane of the Debugger window right click on main The view memory context menu Figure 3 12 appears Figure 3 12 View Memory Context Menu Find and Open File Go to function definition of maint Preprocess Set Software Breakpoint Set Thread Specific Breakpoint Set Clear Watchpoint Enable Disable Watchpoint View As View Variable
137. lobal data segment This configuration corresponds to a clear PC Relative Strings checkbox of the ColdFire Processor panel But to keep the global data segment smaller you can check the PC Relative Strings checkbox Configuring PC relative strings means that the compiler e Stores local scope string constants in the code segment e Uses PC relative instructions to address these strings The PC Relative Strings checkbox corresponds to the pragma pcrelstrings To check whether this pragma is in effect use__ option pcrelstrings Listing 5 1 shows an example of the pragma use Listing 5 1 Using PC relative strings pragma pragma pcrelstrings on int f char int bar return f World World allocated in code segment 62 ColdFire Architectures v6 0 Targeting Manual Compilers Language Extensions pc relative pragma pcrelstrings reset Declaration Specifiers A declaration specifier tells the compiler to override a default storage location regardless of the object s size or initialization The syntax is __declspec sectionName dataType objectName where sectionName Identifies the storage section for the object dataType Specifies the data type of the object objectName Is the name of the variable object to be stored Listing 5 2 shows examples Listing 5 2 Using the __declspec declaration specifier create a user defined section mycode pragma define section mycode mycode far
138. lue aligned on a specified boundary ALIGN alignValue Parameter alignValue Alignment boundary specifier must be a power of two Remarks The ALIGN function does not update the location counter it only performs arithmetic Updating the location counter requires an assignment such as ALIGN 0x10 update location counter to 16 byte alignment ColdFire Architectures v6 0 Targeting Manual 91 ELF Linker and Command Language Commands Directives and Keywords ALIGNALL Forces minimum alignment for all objects in the current segment to the specified value ALIGNALL alignValue Parameter alignValue Alignment value specifier must be a power of two Remarks ALIGNALL is the command version of the ALIGN function It updates the location counter as each object is written to the output Example Listing 6 18 is an example use for ALIGNALL command Listing 6 18 ALIGNALL Example code ALIGNALL 16 Align code on 16 byte boundary init he text ALIGNALL 64 align data on 64 byte boundary rodata gt text EXCEPTION Creates the exception table index in the output file EXCEPTION Remarks Only C code requires exception tables To create an exception table add the EXCEPTION command with symbols __ exception_table_start__ and __exception_ table _end_ to the end of your code section segment just as Listing 6 19 shows At runtime the system knows th
139. m stack mulu w d0 d0 multiply TES return from function result in DO ColdFire Architectures v6 0 Targeting Manual 117 Inline Assembly Inline Assembly Directives opword Writes machine instruction constants directly into the executable file without any error checking opword constant constant Parameter constant Any appropriate machine code value Example opword 0x7C0802A6 which is equivalent to the instruction mflr ro return Inserts a compiler generated sequence of stackframe cleanup and return instructions Counterpart to the naked directive return instruction instruction Parameter instruction Any appropriate C instruction 118 ColdFire Architectures v6 0 Targeting Manual Debugging This chapter explains aspects of debugging that are specific to the ColdFire architectures For more general information about the Code Warrior debugger see the IDE User s Guide To start the CodeWarrior debugger select Project gt Debug The debugger window appears the debugger loads the image file that the current build target produces You can use the debugger to control program execution insert breakpoints and examine memory and registers NOTE The automatic loading of the previous paragraph depends on the load options you specify and on whether your application code is in ROM or Flash memory This chapter consists of these sections e Target Settings for Debugging Remote Connections for Debugging
140. main window Figure 3 1 appears Figure 3 1 CodeWarrior IDE Main Window Metrowerks CodeWarrior 10 x File Edit View Search Project Debug Tools Window Help BSS EOexXRRRARU ERLE BR 26 ColdFire Architectures v6 0 Targeting Manual Application Tutorial Create a Project 2 From the main menu bar select File gt New The New dialog box Figure 3 2 appears Figure 3 2 New Dialog Box New x Project File Object 2 ColdFire Stationery Project name HB Empty Project M Proj H Extemal Build Wizard Location C Program Files Metrowerks C Set NH Add to Project Project a Select ColdFire Stationery b In the Project name text box type MyProj NOTE The default project location is the Code Warrior installation directory For example if the project name is abc and the installation directory is CodeWarrior_Dir the default location is CodeWarrior_Dir abc For a different location click the Set button then use the subsequent dialog box to specify the location Clicking OK returns you to the New dialog box which shows the specified location in the Location text box ColdFire Architectures v6 0 Targeting Manual 27 Application Tutorial Create a Project c Click OK The New Project dialog box Figure 3 3 appears Figure 3 3 New Project Dialog Box x Select project stationery N Project Stationery CF_M5206EC3 CF_M5213EVB CF_M5235EVB CF_M5249C3 CF_M5271EVB CF_M5272C3 C
141. map all show the effect of this checkbox objects that main references Disable Clear Lets linker remove Default Clear Deadstripping unused code and data checkbox Checked Prevents the linker from removing unused code or data ColdFire Architectures v6 0 Targeting Manual Table 4 7 ColdFire Linker Panel Elements continued Target Settings ColdFire Settings Panels Element Generate ELF Purpose Clear Omits the ELF Comments Default Checked Symbol Table symbol table and relocation checkbox list from the ELF output file Checked Includes an ELF symbol table and relocation list in the ELF output file Suppress Clear Reports all linker Default Clear Warning warnings Messages Checked Reports only checkbox fatal warning messages does not affect display of messages from other parts of the IDE Generate S Clear Does not generate Default Checked Record File an S record file The era has ihe cama checkbox Checked Generates an S3 type S record file suitable for printing or transportation to another computer system Activates the Max S Record text box and the EOL character list box filename as the executable file but with extension S19 S3 records include code data and their 4 byte addresses Max S Record Length text box Specifies maximum number of bytes in S record lines that the linker generates The maximum value for th
142. mp switch bus_dump switch Parameter switch Boolean value yes or true or no or false Remarks If environment variable CF_REG_DUMP is set a yes or true switch value for this command also dumps the CPU register values to the processor reg_ dump file Example bus_dump true ColdFire Architectures v6 0 Targeting Manual 155 Instruction Set Simulator ISS Configuration Commands cache_size Configures the cache size cache_size size parameter Parameter size_parameter Default value 0 off or another code number for the size per Table 10 1 Table 10 1 Cache Size Parameter Conversion size parameter Kilobytes size parameter Kilobytes Example cache_size 7 ipsbar 156 Provides beginning address and offset enabling V4 core IPSBAR registers The V4 counterpart command is mbar ipsbar switch Parameter switch Boolean value yes or true or no or false Example ipsbar true ColdFire Architectures v6 0 Targeting Manual Instruction Set Simulator ISS Configuration Commands kram_ size Configures the KRAM size kram_size size_parameter Parameter size_parameter Code number for the size per Table 10 2 Table 10 2 kram Size Parameter Conversion size_parameter Kilobytes size_parameter Kilobytes 0 0 6 16 1 0 5 7 32 2 1 8 64 3 2 9 128 4 4 10 256 5 8 11 512 Example kram_size 7 krom_ size
143. mputer and target board your target board determines the specific cables you need For a BDM JTAG connection parallel cables to connect the computer to a wiggler Appropriate power supply for the target board CodeWarrior IDE 18 The Code Warrior IDE consists of a project manager a graphical user interface compilers linkers a debugger a source code browser and editing tools You can edit navigate examine compile link and debug code within the one Code Warrior environment The Code Warrior IDE lets you configure options for code generation debugging and navigation of your project Unlike command line development tools the CodeWarrior IDE organizes all files related to your project You can see your project at a glance so organization of your source code files is easy Navigation among those files is easy too When you use the CodeWarrior IDE there is no need for complicated build scripts or makefiles To add or delete source code files from a project you use your mouse and keyboard instead of tediously editing a build script For any project you can create and manage several configurations for use on different computer platforms The platform on which you run the CodeWarrior IDE is called the host From the host you can use the CodeWarrior IDE to develop code to target various platforms Note the two meanings of the term target Platform Target The operating system processor or microcontroller in wh
144. n Purpose Linker application Specifies full application not a library dis Generates disassembly g Generates DWARF output map Generates link file map 0 a out Specifies output filename srec Creates S record file sreceol dos Specifies n EOL separators sreclength 80 Specifies 80 character record length warnings on Turns warnings on For more real world uses of the command line tools examine any of the examples in folder Examples ColdFire ColdFire_Command_Line_Tools For information about the parameters of these options use the help option to cite the option in this format help opt optionname where optionname The option for which you are seeking further information This help line for example requests the possible values for the proc keyword that is the list of possible target processors mwccmcf help opt proc The system response is a list such as MCF5213 MCF548x MCF5206e MCF5249 MCF5272 MCF5280 MCF5282 182 ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking MCF5307 MCF5407 The following is a complete list of command line switches for each tool component e Assembler Options Compiler Options Linker Options Assembler Options Table 13 2 lists the options of the command line assembler Table 13 2 Command Line Assembler Options Option Purpose b1_16 Sets bra 1 to 16 bits default is 32 bits c_preprocess
145. nd Linking Table 13 4 Command Line Linker Options continued Category Option Purpose map keyword Specifies generating a link map file per keyword values closure Calculates symbol closures unused Lists unused symbols srec Specifies generating an S record file The linker ignores this option if it generates static libraries sreceol keyword Sets the end of line separator style for the S record file per the keyword value a Macintosh r es DOS r n Default unix A Unix n This option implies srec sreclength length Specifies the length of S records Length value range is 8 252 but must be a multiple of 4 Default length is 64 0 file Specifies name of the output file ColdFire application Specifies generating an application Default library Specifies generating a static library no pic Specifies generating position independent code references no pid Specifies generating position independent data references Default proc essor keyword Specifies target processor by keyword Values are 68020 68328 68349 CPU32 MCF5206e MCF5307 MCF5407 MCF5272 and MCF457x _shared ColdFire Architectures v6 0 Targeting Manual Specifies generating a shared library 197 Command Line Tools Compiling and Linking Table 13 4 Command Line Linker Options continued Category Option Purpose Debugging Control g S
146. ne Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option MM Purpose Specifies scanning source files for dependencies and emitting a makefile Does not list system include files does not generate object code MMD Specifies scanning source files for dependencies writing a dependency map to a file then generating object code Does not list system include files nofail Specifies that work continue despite errors in earlier files nolink Specifies compiling only no linking noprecompile Prevents precompiling based on filename extensions nosyspath Specifies searching both user and system path lists so that include lt gt is like tinclude o file dir Specifies the filename or directory for output files or text If the linker is called specifies the output filename for the linker P Specifies preprocessing and sending the output to a file without generating code precompile file dir Specifies generating a precompiled header from the source writing the header to the specified file or putting the header in the specified directory If this option does not specify a file or directory the system derives a header filename from the source filename The alternative argument specifies writing the header to the location that the source specifies preprocess Specifies prepr
147. nel Debugger PIC Settings IT Alternate Load Address Usually Position Independent Code PIC is linked in such a way that the entire image starts at address 0x00000000 To specify a different target address for loading the PIC module 1 Check the Alternate Load Address checkbox this activates the text box 2 Enter the address in the text box At download time the debugger downloads your ELF file to this new address of the target NOTE The debugger does not verify that your code can execute at the new address However the PIC generation settings of the compiler and linker and the ColdFire Architectures v6 0 Targeting Manual 59 Target Settings ColdFire Settings Panels startup routines of your code correctly set any base registers and perform any appropriate relocations 60 ColdFire Architectures v6 0 Targeting Manual Compilers This chapter explains issues of C and C code generation for the ColdFire target NOTE Special Edition software compiles assembly and C code but the code size must not exceed 128 kilobytes Standard Edition software compiles assembly and C code without any size restriction Professional Edition software compiles assembly C and C code without any size restriction This chapter consists of these sections Language Extensions e Integer Formats e Calling Conventions e Variable Allocation e Register Variables e Pragmas e Predefined Symbols e Position Independe
148. ng do not use these character sequences which are reserved for LCF comments JE Example This example shows that multi line SO comments are valid WRITESOCOMMENT Line 1 comment Line 2 comment ZERO_FILL_UNINITIALIZED Forces the linker to put zeroed data into the binary file for uninitialized variables ZERO_FILL_UNINITIALIZED ColdFire Architectures v6 0 Targeting Manual 103 ELF Linker and Command Language Commands Directives and Keywords Remarks This directive must be between directives MEMORY and SECTIONS placing it anywhere else would be a syntax error Using linker configuration files and the define_section pragma you can mix uninitialized and initialized data As the linker does not normally write uninitialized data to the binary file forcing explicit zeroing of uninitialized data can help with proper placement Example The code of Listing 6 26 tells the linker to write uninitialized data to the binary files as zero S Listing 6 26 ZERO_FILL_UNINITIALIZED Example MEMORY TEXT DATA N ERO_FI RX ORIGIN RW ORIGIN LL_UNINITIALIZED 0x00030000 LENGTH 0 AFTER TEXT LENGTH 0 SECTIONS main_application text ALIGN 0x8 rodata ALIGN 0x8 gt TEXT 104 ColdFire Architectures v6 0 Targeting Manual ColdFire Linker Notes The ColdFire linker converts a set of relocatable object files into a single object file T
149. nitialization Files Command Reference Octal values must start with a zero as in 0123 or 0456 e Start comments with a colon or pound sign Comments end at the end of the line Command Reference This section explains the commands valid for debug initialization files Delay ResetHalt e ResetRun e Stop e writeaddressreg e writecontrolreg e writedatareg e writemem b e writemem writemem w NOTE Old data initialization files that worked with a Macraigor interface may not work with a P amp E interface because command writereg SPRnn changed to writecontrolreg OxNNNN Please update files accordingly Delay Delays execution of the debug initialization file for the specified time Delay lt time gt Parameter time Number of milliseconds to delay 206 ColdFire Architectures v6 0 Targeting Manual Using Debug Initialization Files Command Reference Example This example creates a half second pause in execution of the debug initialization file Delay 500 ResetHalt Resets the target putting the target in debug state ResetHalt ResetRun Resets the target letting the target execute from memory ResetRun Stop Stops program execution putting the target in a debug state stop writeaddressreg Writes the specified value to the specified address register writeaddressreg lt registerNumber gt lt value gt Parameters registerNumber Any integer 0 through 7 represen
150. nt Code Table 5 1 lists additional documents or chapters that provide information about code generation Table 5 1 Additional CodeWarrior Compiler and Linker Documentation Topic Reference CodeWarrior implementation of C C C Compilers Reference C C Language and C C Warnings C Compilers Reference chapter Setting C settings panels C Compiler Options Controlling C code size C Compilers Reference chapter C and Embedded Systems Using compiler pragmas C Compilers Reference chapter Pragmas and Symbols ColdFire Architectures v6 0 Targeting Manual 61 Compilers Language Extensions Table 5 1 Additional CodeWarrior Compiler and Linker Documentation continued Topic Reference Meeting EC specifications C Compilers Reference Initiating a build controlling which files are IDE User Guide chapter Compiling and compiled handling error reports Linking Explanation of error messages Error Reference Inline assembly Inline Assembly chapter of this Targeting Manual Standalone assembler Assembler Reference Language Extensions This section explains the ColdFire specific extensions to the standards of the Code Warrior C C compiler You can disable some of these extensions by using options of the C C Language panel which the C Compilers Reference manual explains PC Relative Strings The default compiler configuration is to store all string constants in the g
151. oad Settings Save Settings crea Figure 12 8 Hardware Diagnostics window Scope Loop Test Panel 5 Hardware Diagnostics N Hardware Diagnostics IS Scope Loop Test Configuration Memory Read Write Access Type Access Size Scope Loop Read Byte Memory Tests C Word C wite C Long Word Target Address x 00100000 Value to Write iy Speed 1000 tT gts LE Begin Scope Loop Show Log Load Settings Save Settings ceea 176 ColdFire Architectures v6 0 Targeting Manual Using Hardware Tools Hardware Diagnostics Figure 12 9 Hardware Diagnostics window Memory Tests Panel 33 Hardware Diagnostics Hardware Diagnostics IS Memory Tests Configuration Tests toR Memory Read Write LAURE Scope Loop Walking 1 s M Bus Noise Memory Tests FN Address r Address Range Access Size Start Ox 00000010 Byte C Word End Ox O00000FF Cong ord Passes fi it Use Target CPU Scratch Memory Start 04100000100 Scratch Memory End Dx JooooFFFF Status Details Begin Test Show Log Load Settings Save Settings coca The Hardware Diagnostics window lists global options for the hardware diagnostic tools these preferences apply to every open project file For more information about each hardware diagnostics panel see the IDE User s Guide Target ColdFire Architectures v6 0 Target
152. oad Settings Save Settings Cancel b In the panel s list box select the sectors you want to erase To select them all check the All Sectors checkbox Click the Erase button the flash programmer erases the sectors d Optional To confirm erasure select the same sectors then click the Blank Check button a message reports the status of the sectors 172 ColdFire Architectures v6 0 Targeting Manual Using Hardware Tools Flash Programmer 7 Flash your application a From the pane list at the left of the Flash Programmer window select Program Verify the Program Verify Flash panel moves to the front of the window as Figure 12 4 shows Figure 12 4 Flash Programmer Window Program Verify Flash Panel 35 Flash Programmer o x 8 Flash Programmer IS Program Verify Flash mT Use Selected File File Type Auto Detect y WW Restrict Address Range m Apply Address Offset Target Configuration Flash Configuration Erase Blank Check Checksum Start Ox FF800000 End Ox FFFFFFFF Flash Base Address Ox sas Da Program Verify Show Log Load Settings Save Settings Cancel b Make sure that the Use Selected File checkbox is clear c Click the Program button the flash programmer programs your application into the target sectors of flash memory d Optional To confirm programming click the Ver
153. oard connections by this point 2 Set Up Remote Debugging a From the Target Settings Panels list select Remote Debugging The Remote Debugging settings panel moves to the front of the Target Settings window as Figure 3 7 shows Figure 3 7 Target Settings Window Remote Debugging Panel M5213E B Console Debug Settings 2 x N Target Settings Panels Build Extras Runtime Settings N Remote Debugging r Connection Settings File Mappings Connection SE NN X Edit Connection Source Trees Coldfire Target Remote download path Launch remote host application o ColdFire Processor Global Optimizations E Linker ELF Disassembler ColdFire Linker E Editor Custom Keywords E Debugger Debugger Settings I Download OS Remote Debugging Connection ABATRON_SERIAL Edit Connection CF Debugger Setti CF Exceptions OS Image Path CF Interrupt Factory Settings Revert Import Panel Export Panel OK Cancel Apply b Use the Connection list box to specify CCS SIM c Click OK The IDE completes the remote debugging setup and the Target Settings window closes 3 From the main menu bar select Project gt Make The IDE updates all files links code into the finished application and displays any error messages or warnings in the Errors amp Warnings window NOTE The Make command applies to all source files the IDE opens them
154. object again in response to either the GROUP keyword or the wildcard character REF_INCLUDE Starts an optional LCF closure segment that specifies sections the linker should not deadstrip if program code references the files that contain these sections REF_INCLUDE sectionTypel sectionTypel Parameter sectionType Identifier for any user defined or predefined section Remarks Useful if you want to include version information from your source file components ColdFire Architectures v6 0 Targeting Manual 99 ELF Linker and Command Language Commands Directives and Keywords SECTIONS Starts the LCF sections segment which defines the contents of target memory sections Also defines global symbols to be used in the output file SECTIONS section_spec section_spec Parameters section_spec sectionName AT loadAddress contents gt segmentName sectionName Name for the output section such as mysection Must start with a period AT loadAddress Optional specifier for the load address of the section The default value is the relocation address contents Statements that assign a value to a symbol or specify section placement including input sections Subsections Arithmetic Comment Operators Specifying Files and Functions Alignment and location counter explain possible contents statements segmentName Predefined memory segment destination for the contents of the section
155. ocessing source files prefix file Specifies prefixing the specified text file or precompiled header onto all source files S Specifies passing to all tools disassembling ColdFire Architectures v6 0 Targeting Manual and sending output to a file 187 Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option no stdinc Purpose Specifies standard system include paths per SMWCIncludes environment variable adding them after all system I paths Default U u ndefine name Undefines the specified symbol Front End C C Language ansi keyword off on relaxed strict Specifies ANSI conformance per keyword Same as stdkeywords on enum min and strict off Default Same as stdkeywords off enum min and strict on Same as stdkeywords off enum int and strict on ARM on off Specifies checking code for ARM conformance Default is off bool on off Enables the C bool type true and false constants Default is of char signed unsigned Specifies sign of chars Default is unsigned Cpp_exceptions onloff Enables or disables C exceptions Default is on dialectl lang keyword Specifies source language treatment per keyword Always treat source as C Always treat source as C Generate warnings for C features outside embedded C subset implies
156. offsets 192 ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued ColdFire Architectures v6 0 Targeting Manual Category Option Purpose no pic Specifies generating position independent code references no pid Specifies generating position independent data references proc essor keyword Specifies target processor by keyword Values are 68020 68328 68349 CPU32 MCF5206e MCF5307 MCF5407 MCF5272 MCF457x and MCF5213 sdata size Specifies placing objects smaller than size bytes in the small data sdata section Default size value in 0 193 Command Line Tools Compiling and Linking Table 13 3 Command Line Compiler Options continued Category Option Purpose C C Warnings w arn ings keywora Specifies warnings per keyword value off on Passes to all tools turns off warnings no emdline Passes to all tools turns on most warnings Passes to all tools command line driver noJerr or parser warnings no iserr or Passes to all tools treats warnings as errors all no pragmas Turns on all warnings requires prototypes nolillpragmas Controls inappropriate pragma warnings noJempty decl no possible Controls empty declaration warnings noJunwanted Controls warnings about possible unwanted noJunusedarg side effects no unusedvar Controls unuse
157. on Remarks The period always refers to a location in a sections segment so is valid only in a sections section definition Within such a definition may appear anywhere a symbol is valid Assigning a new greater value to causes the location counter to advance But it is not possible to decrease the location counter value so it is not possible to assign a new lesser value to You can use this effect to create empty space in an output section as the Listing 6 16 example does Example The code of Listing 6 16 moves the location counter to a position 0x10000 bytes past the symbol __start Listing 6 16 Moving the Location Counter data data bss COMMON _ Start _ start 0x10000 __end gt DATA ADDR Returns the address of the named section or memory segment ADDR sectionName segmentName Parameters sectionName Identifier for a file section 90 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords segmentName Identifier for a memory segment Example The code of Listing 6 17 uses the ADDR function to assign the address of ROOT to the symbol __ rootbasecode Listing 6 17 ADDR Function MEMORY ROOT RWX ORIGIN 0x80000400 LENGTH T Il o SECTIONS code __rootbasecode ADDR ROOT text gt ROOT ALIGN Returns the location counter va
158. ons Exception Handling checked exceptions will have their vectors overwritten to allow a debugger break when they occur M 2 Access Error V 12 Non PC breakpoint debug interrupt M 3 Address Error T 13 PC breakpoint debug interrupt M 4 Illegal Instruction IV 14 Format Error IV 5 Divide by zero M 15 Uninitialized Interrupt IV 8 Privilege Violation IV 24 Spurious Interrupt M 9Trace Y 31 IRQ break button N 10 Unimplemented Line 4 Opcode IV 46 TRAP 14 for Console 1 0 MN 11 Unimplemented Line F Dpcode 61 Unsupported instruction f unselected these may effect the debuggers ability to control the target Table 9 4 CF Exceptions Panel Elements Element Purpose Comments 2 Access Error checkbox Clear Ignores access errors Checked Catches and displays access errors Default Checked 3 Address Error checkbox Clear Ignores address errors Checked Catches and displays address errors Default Checked 4 Illegal Instruction checkbox Clear Ignores invalid instructions Checked Catches and displays invalid instructions Default Checked 5 Divide by zero checkbox Clear Ignores an attempt to divide by zero Checked Catches and displays any attempt to divide by zero ColdFire Architectures v6 0 Targeting Manual Default Checked 129 Debugging Target Settings for Debugging Table 9 4 CF Exceptions Panel Elements continued
159. operands Other rules for statements are The assembly instructions are the standard ColdFire instruction mnemonics Each instruction must end with a newline character or a semicolon Hexadecimal constants must be in C style OxABCDEF is a valid constant but SABCDEF is not e Assembler directives instructions and registers are not case sensitive To the inline assembler these statements are the same move 1 b DO MOVE L b do ColdFire Architectures v6 0 Targeting Manual 109 Inline Assembly Inline Assembly Syntax e To specify assembly language interpretation for a block of code in your file use the asm keyword NOTE To make sure that the C C compiler recognizes the asm keyword you must clear the ANSI Keywords Only checkbox of the C C Language panel Listing 8 1 and Listing 8 2 are valid examples of inline assembly code Listing 8 1 Function Level Sample long int b struct mystruct long int a ka static asm long f void Legal asm qualifier move 1l struct mystruct a A0 DO Accessing a struct add 1 b DO Using a global variable put return value in DO rts Return from the function result mystruct a b Listing 8 2 Statement Level Sample long square short a asm move w a d0 fetch function argument a mulu w d0 d0 multiply return return from function result is in DO NOTE Regardless of its settings the compiler never optim
160. ort This support includes e Standard C library I O All functions that do not require disk I O Memory functions malloc and free To use C or C libraries for console I O you must include a special serial UART driver library in your project These driver library files are in folder E68K_Tools MetroTRK Transport m68k Table 11 3 lists target boards and corresponding UART library files Table 11 3 Serial I O UART Libraries 166 Board Filename CF5206e SBC mot_sbc_5206e_serial Bin UART_SBC_5206e_Aux a CF5206e LITE mot_5206e_lite_serial Bin UART_5206e_lite_Aux a CF5307 SBC mot_sbc_5307_serial Bin UART_SBC_5307_Aux a CF5407 SBC mot_sbc_5407_serial Bin UART_SBC_5407_Aux a CF5249 SBC mot_sbc_5249_serial Bin UART_SBC_5249_Aux a Memory Heaps and Other Libraries The heap you create in your linker command file becomes the default heap so it does not need initialization Additional memory and heap points are To have the system link memory management code into your code call malloc ornew e Initialize multiple memory pools to form a large heap e To create each memory pool call init_alloc You do not need to initialize the memory pool for the default heap You may be able to use another standard C library with CodeWarrior projects You should check the stdarg h file in this other standard library and in your runtime libraries Additional points are The CodeWarrior ColdFire C
161. ource code e You cannot use the Attach feature while you use the ISS The Run Without Debugger button does not work if you use the ISS to run your application ColdFire Architectures v6 0 Targeting Manual 161 Instruction Set Simulator ISS Limitations 162 ColdFire Architectures v6 0 Targeting Manual 11 Libraries and Runtime Code The CodeWarrior development environment includes a variety of libraries ANSI standard libraries for C and C runtime libraries and other code This chapter explains how to use these libraries for ColdFire development This chapter consists of these sections MSL for ColdFire Development Runtime Libraries NOTE With respect to the Metrowerks Standard Libraries MSL for C and C this chapter is an extension of the MSL C Reference and the MSL C Reference Consult those manuals for general information MSL for ColdFire Development In addition to compiled binaries the CodeWarrior development tools include source and project files for MSL This lets you modify libraries if necessary Using MSL for ColdFire Your CodeWarrior installation CD includes the Metrowerks Standard Libraries MSL a complete C and C library that you can use in your embedded projects The CD includes all the source files necessary to build MSL as well as project files for different MSL configurations NOTE If an MSL version already is on your computer the CodeWarrior installer installs only the
162. out compression there is no difference between the return values Of SIZEOF_ROM and SIZEOF WRITEB Inserts a byte of data at the current address of a section WRITEB expression Parameter expression Any expression that returns a value 0x00 to OxFF WRITEH Inserts a halfword of data at the current address of a section WRITEH expression Parameter expression Any expression that returns a value 0x0000 to OxFFFF WRITEW Inserts a word of data at the current address of a section WRITEW expression Parameter expression Any expression that returns a value 0x00000000 to OxFFFFFFFF 102 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords WRITESOCOMMENT Inserts an SO comment record into an S record file WRITESOCOMMENT comment Parameter comment Comment text a string of alphanumerical characters 0 9 A Z and a z plus space underscore and dash characters Double quotes must enclose the comment string If you omit the closing double quote character the linker tries to put the entire LCF into the SO comment Remarks This command valid only in an LCF sections segment creates an SO record of the form S0aa0000bbbbbbbbbbbbbbbbdd e aa hexadecimal number of bytes that follow bb ASCII equivalent of comment e dd the checksum This command does not null terminate the ASCII string Within a comment stri
163. pecial Edition Standard Professional Edition Edition Flash programmers CodeWarrior Flash CodeWarrior Flash CodeWarrior Flash Programmer and ColdFire Flasher standalone plug in ColdFire Flasher standalone plug in standalone plug in evaluation board Real time operating Not available Not available Plug ins available system RTOS Availability Free with Available through Available through all channels all channels 30 day evaluation copy also available About this Manual Table 1 2 lists the contents of this manual Table 1 2 Chapter Appendix Contents Chapter Appendix Introduction Explains New features contents of this manual technical support further documentation Getting Started System requirements overview of CodeWarrior development tools Application Tutorial Tutorial for writing and debugging programs Target Settings Controlling the compiler and linker Compilers ColdFire specific compiler informationColdFire ELF Linker and Command Language Linker and linker command file information ColdFire Linker Notes Linker capabilities Inline Assembly Compiler support for inline assembly Debugging Debugger settings panels remote debugging connections ColdFire Architectures v6 0 Targeting Manual 13 Introduction Documentation Overview Table 1 2 Chapter Appendix Contents continued Chapter Appendix Exp
164. pecifies generating debugging information same as sym on sym keywora Specifies debugging options per keyword values off Do not generate debugging information Default on Generate debugging information 198 ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking Table 13 4 Command Line Linker Options continued Category Warning Option w arn ings keywora off on no emdline noJerr or no iserr or display dump Purpose Specifies warnings per keyword value Turns off warnings Turns on all warnings Controls command line parser warnings Treats warnings as errors Displays list of active warnings ELF Disassembler show keywora only none all no code no text no comments noJextended no data no debug no sym noJexceptions no headers no hex no names no relocs no source no xtables no verbose Specifies disassembly options per keyword values Restricts display as in show only code Prevents display Displays everything Default Controls display of code of code or text sections Controls display of comment field in code implies show code Controls display of extended mnemonics implies show code Controls display of data with show verbose shows hex dumps of sections Controls display of symbolics information Default Controls display of exception tables im
165. plies show data Controls display of ELF headers Controls display of addresses and opcodes in code disassembly implies show code Controls display of symbol table Default Controls display of resolved relocations in code and relocation tables Default Controls display of 4 source lines around each function in disassembly implies show code Default With show verbose controls display of entire source file in output Controls display of exception tables Controls display of verbose information including hex dump of program segments in applications Default ColdFire Architectures v6 0 Targeting Manual 199 Command Line Tools Compiling and Linking Data Auto Alignment If you assemble with alignment enabled the assembler automatically aligns data items on a natural boundary for the data size and for the target processor family The ColdFire assembler follows this scheme e 8 bit items byte directive No alignment needed e 16 bit items word directive Aligned to a16 bit even address boundary e 32 bit items such as the long directive Also aligned to 16 bit boundary The ColdFire assembler is unusual using a 16 bit natural boundary for 32 bit quantities This is for compatibility with the inherited 680x0 interpretation Consider the Listing 13 4 example Listing 13 4 Auto Alignment Example b1 VE b2 12 data globl b1 11 b2 12 byte Oxab long 0x12345678 by
166. r a 16 PowerPC 1 byte Aligns each bit integer Andes on field on its natural boundary NOTE When you compile and link alignment should be the same for all files and libraries Data Model list Specifies global data storage and Default Far 32 bit box reference F This panel element Far 32 bit Storage in far data corresponds the far_data space available memory is the pragma only size limit Near 16 bit Storage in near data space size limit is 64K Parameter Specifies parameter passing Default Compact Rassinglist box level These levels correspond to Compact Passes on even the compact_abi sized boundary for parameters standard_abi and smaller than int 2 for short and register_abi pragmas cnan NOTE Be sure that all called Standard Like compact but functions have prototypes always padded to 4 bytes When you compile and link parameter passing should be the same for all files and libraries Register Passes in scratch registers DO D2 for integers AO A1 for pointers and fp0 fp1 when FPU codegen is selected this can speed up programs that have many small functions 52 ColdFire Architectures v6 0 Targeting Manual Table 4 6 ColdFire Processor Panel Elements continued Target Settings ColdFire Settings Panels Element Floating Point list box Purpose Specifies handling method for floating point operations Software C runtim
167. r also supports pragmas that are new or have new definitions for ColdFire development Table 5 4 lists these new pragmas following text explains them Table 5 4 New Pragmas for ColdFire Development codeColdFire const_multiply define_section emac explicit_zero_data interrupt opt_unroll_count opt_unroll_instr_count Predefined Symbols readonly_strings SDS_debug_ support section 68 ColdFire Architectures v6 0 Targeting Manual Compilers Pragmas codeColdFire Controls organization and generation of ColdFire object code pragma codeColdFire processor Parameter processor Any of these specifier values MCF521x MCF5206e MCF5249 MCF5272 MCF5282 MCF5307 MCF5407 MCF547x MCF548x or reset which specifies the default processor const_multiply Enables support for constant multiplies using shifts and add subtracts pragma const_multiply on off reset Remarks The default value is on define_section Specifies a predefined section or defines a new section for compiled object code pragma define_section sname istr ustr addrmode accmode Parameters sname Identifier for source references to this user defined section istr Section name string for initialized data assigned to this section Double quotes must surround this parameter value which must begin with a period Also applies to uninitialized data if there is no ustr value ColdFire Architectures
168. rgeting Manual Memory Configuration Files Command Explanations reserved Reserves a range of memory preventing reads or writes reserved lt loAddr gt lt hiAddr gt Parameters loAddr Starting address of reserved memory range hiAddr Ending address of reserved memory range Remarks If the debugger tries to write to any address in the reserved range no write takes place If the debugger tries to read from any address in the reserved range the system fills the memory buffer with the reserved character Command reservedchar defines this reserved character Example This command prevents reads or writes in the range Ox FF00024 0xFF00002F reserved 0xFF000024 OxFF00002F reservedchar Specifies a reserved character for the memory configuration file reservedchar lt char gt Parameter char Any one byte character Remarks If an inappropriate read occurs the debugger fills the memory buffer with this reserved character ColdFire Architectures v6 0 Targeting Manual 213 Memory Configuration Files Command Explanations Example reservedchar OxBA 214 ColdFire Architectures v6 0 Targeting Manual Index Symbols location counter linker command 90 A Abatron BDI connection 143 144 remote connections 134 136 ADDR linker command 90 91 ALIGN linker command 91 ALIGNALL linker command 92 alignment LCF 82 83 allocation variable 66 application development diagram 20 applica
169. rior subdirectory E68K_Tools Initialization_Files Other uses and guidance items are Sample files are specific to processor debug agents such as wigglers and in some cases evaluation board Use the samples templates for your own files e Use a debug initialization file only to initialize memory setup Trying to use such a file for additional initialization such as for on board peripherals or setup ports would prevent these other initializations during normal execution As the program does not use BDM in normal execution it would not initialize such peripherals so the program could fail to execute properly Put non memory and non exception setup initialization instructions in the init_hardware function of processor startup code instead of in a debug initialization file Another valid place for such instructions is your own start routine These methods take care of initialization even if you run your program without the wiggler Once debugging is done your startup code must initialize the memory management unit setting up the memory appropriately for non debugger program execution e Listing A 1 is a sample BDM initialization file for the MCF5272C3 board Listing A 1 Sample BDM Initialization file Set VBR to start of future SDRAM VBR is an absolute CPU register SDRAM is at 0x00000000 0x0400000 writecontrolreg 0x0801 0x00000000 Set MBAR to 0x10000001 MBAR is an absolute CPU register so if you move MBAR
170. roject Select Edit gt Target Settings the Target Settings window appears b From the Target Settings Panels pane select any panel that panel moves to the front of the window c Review update panel settings ColdFire Architectures v6 0 Targeting Manual 145 Debugging Debugging ELF Files without Projects d Repeat substeps b and c for all other appropriate panels e When all settings are correct click OK the Target Settings window closes the system updates project settings 3 Close the project window 4 Export the modified target settings Select File gt Export Project a file select dialog box appears a b Navigate to subdirectory bin plugins support o Select the file you just modified CF_Default_Project xml e Click OK the system saves your modified file CF_Default_Project xml over the old file 5 This completes XML file customization the new CF_Default_Project xml file includes your target settings changes you are ready to debug an ELF file Debugging an ELF File Once you have updated IDE preferences and customized the default XML file you are ready to debug an ELF file that includes symbolics information Follow these steps 1 Confirm that a remote connection exists for the ColdFire target 2 Open Windows Explorer 3 Navigate to the ELF file 4 Drag the ELF file to the IDE main window the IDE uses the default XML file to create a new project opening a ne
171. rsion 4 core 0x1000 The assembler has extra flags for ColdFire MAC and EMAC extensions MAC instructions 0x100000 e EMAC instructions 0x200000 Other flag issues are e You can combine flag values so that 0x100800 denotes a version 3 core with MAC instructions e For ColdFire processor numbers the second digit indicates the core number so that 5307 has a version 3 core An alternative to command line processor specification is using the option directive in the source file option processor AAA where AAA is name of processor such as MCF5282 MCF5307 MCF5407 or MCF547x This is a friendlier wrapping for the numeric processor flags The system internally maps each processor name to one of the version v2 v3 or v4 cores ColdFire Architectures v6 0 Targeting Manual 201 Command Line Tools Compiling and Linking 202 ColdFire Architectures v6 0 Targeting Manual A Using Debug Initialization Files This appendix explains background debugging mode BDM support for the ColdFire reference boards BDM controls the processor accessing both memory and I O devices via a simple serial wiggler interface BDM can be very useful during initial debugging of control system hardware and software it also can simplify production line testing and end product configuration Specifically this appendix explains how to use debug initialization files with the PRE Micro wiggler Debug initialization files contain commands
172. rting address must conform to that requirement Otherwise there could be 82 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language LCF Syntax conflicting section alignment in the code the linker produces In general the instructions for data alignment should be lust before the end of the section For more alignment information see ALIGN and ALIGNALL Specifying Files and Functions Defining the contents of a sections segment includes specifying the source file of each section The standard method is merely listing the files as Listing 6 6 shows Listing 6 6 Standard Source File Specification SECTIONS example_ section main c text file2 c text file3 c text and so forth For a large project however such a list can be very long To shorten it you can use the asterisk wild card character which represents the filenames of every file in your project The line 7 text in a section definition tells the system to include the text section from each file Furthermore the wildcard does not duplicate sections already specified you need not replace existing lines of the code In Listing 6 6 replacing the and so forth comment line with text would add the text sections from all other project files without duplicating the text sections from files main c file2 c or file3 c Another possibility as you define a sections segment is specifying sections from
173. ry configuration file is in checkbox subordinate text box and Browse button subdirectory E68K_Support Initializatio Checked F Tells Wie debugger 10 URO n_Files of the CodeWarrior the specified memory configuration file a installation directory or directory To enter a pathname in the text box that contains your project click the Browse button then use the Ba file select dialog box to specify the file Do not checkihiseheckboxnifyou are using a Abatron based remote connection Check this checkbox if you are using a P amp E Micro based remote connection Initial Launch Clear Does not download program Default Checked Executable executable code or text sections for Initial launch is the first time you checkbox initial launch debug the project after you start the Checked Downloads program debugger trom the IDE executable code and text sections for initial launch Initial Launch Clear Does not download program Default Checked Constant Data constant data sections for initial launch Initial launch is the first time you Gheckbox Checked Downloads program pe you star the constant data sections for initial launch 122 ColdFire Architectures v6 0 Targeting Manual Debugging Target Settings for Debugging Table 9 2 CF Debugger Settings Panel Elements continued Checked Downloads program uninitialized data sections for initial launch Element Purpose Comments Initial Launc
174. s locate particular functions mark locations within a file or go to a specific line of code Figure 2 3 Editor Window inix b M 3 Ol Path C Program Files Metrowerks CW for ColdFire 6 0 MyProj main c lt gt ji al File ain c File main c Purpose sample program x oy include lt stdio h gt int main printf Hello World MW in C n r f lush stdout while 1 1 Idle Line 1 Colt 4f NOTE Figure 2 3 shows a floating editor window Alternatively you can dock the project window in the IDE main window or make the project window a child of the main window Building Compiling and Linking For the Code Warrior IDE building includes both compiling and linking To start building you select Project gt Make from the IDE main menu bar The IDE compiler e Generates an object code file from each source code file of the build target incorporating appropriate optimizations 22 ColdFire Architectures v6 0 Targeting Manual Getting Started CodeWarrior Development Process Updates other files of the build target as appropriate e Incase of errors issues appropriate messages and halts When compilation is done building moves on to linking The IDE linker e Links the object files into one executable file in the link order you specify e Incase of errors issues appropriate error messages and halts When linking is done you are ready to test and debug your application
175. s target memory but increases the time the debugger needs to find the source files Target Settings ColdFire Settings Panels Table 4 7 ColdFire Linker Panel Elements continued Element Generate Link Purpose Clear Does not generate Comments Default Checked MAP chee Pox alinkmap A link map includes addresses of all Checked Does generate objects and functions a memory a link map a text file that map of sections and values of identifies definition files for symbols the linker generates A link each object and function of map has the same filename as the your output file activates output file but with extension the List Unused Objects and XMAP Show Transitive Closure checkboxes List Unused Clear Does not include Default Clear Objects unusediobjects ir the link This checkbox is active only if the checkbox map Checked Does include unused objects in the link map Generate Link Map checkbox is checked NOTE The linker never deadstrips unused assembler relocatables or relocatables built with a non CodeWarrior compiler But checking this checkbox gives you a list of such unused items you can use this list to remove the symbols Show Transitive Clear Does not include Default Checked 56 os eee eee a thal This checkbox is active only if the Generate Link Map checkbox is Checked Recursively checked Listings after this table lists in the link
176. s the name of the current build target The Target Settings window Figure 3 6 appears Figure 3 6 Target Settings Window Target Settings Panel 8M5213EYB Console Debug Settings 2 x Q Target Settings Panels Target Settings S Target Target Settings Target Name M521 3EVB Console Debug Build Extras Linker Fa Eee Ne Runtime Settings Pre inker None BA File Mappings Sn Source Trees Postlinker None y Access Paths Coldfire Target Dutput Directory E Language Settings Choose C C Language Project bin C C Preprocessor 7 St E mu C C Warnings ColdFire Assembler TF Save project entries using relative paths Code Generation ColdFire Processor Global Optimizations Linker ELF Disassembler w Factory Settings Import Panel Export Panel DK Cancel b From the Target Settings Panels list select Target Settings The Target Settings panel moves to the front of the window Use the Linker list box to specify the Embedded ColdFire Linker d Click Apply The IDE saves the new linker setting for the build target NOTE This linker change applies only to the current build target To use a different build target you must specify its appropriate linker 30 ColdFire Architectures v6 0 Targeting Manual Application Tutorial Build the Project For an actual target board instead of the simulator you would need to make b
177. s the number of instructions executed in a debug session e CYCLCNT Cycle Count is the number of elapsed clock cycles in a debug session NOTE These registers are unique to ISS projects other projects do not have these registers ISS Configuration Commands 154 The ISS reads configuration information from configuration files ColdFire2 cfg V2 core and ColdFire4 cfg V4e core Both files are in subdirectory Bin Plugins Support Sim ccssim2 bin of your CodeWarrior installation directory NOTE Do not change the location of the configuration files or the ISS may not work properly If you cannot use the ISS to start a debug session you probably must reduce the memory that file ColdFire2 cfg or ColdFire4 cfg defines And for an MCF5282 or other processor core that had IPSBAR you must use the ipsbar command to configure the settings ColdFire Architectures v6 0 Targeting Manual Instruction Set Simulator ISS Configuration Commands The configuration files consist of text commands each on a single line Some argument values are numerical Possible boolean argument values are true or yes and false or no Comment lines must start with the character The rest of this section consists of explanations for the ISS configuration commands bus_dump cache_size ipsbar kram_size krom_size krom_valid mbar mbus_multiplier memory sdram bus_dump Controls dumping bus signals to the processor bus_dump file bus_du
178. sassembled files to stdout Specifies preprocessing source files Specifies preprocessing and stripping out line directives ext extension Specifies extension for generated object files maximum 14 characters A leading period character specifies appending this extension no leading period specifies replacing the source file extension gccinc ludes Specifies GCC include semantics adds I paths to the system list if I is not specified includes search starts in referencing file directory Same as cwd include Changes target for I access paths to the system list implies cwd explicit Double quote characters include specify searching user paths then system paths Angle characters include lt gt specify searching only system paths l i path Appends access path to the current include list ir path Appends a recursive access path to the current include list no keepobj ects Keeps object files generated after invoking the linker Without this option the system always deletes temporary intermediate object files after the link stage M make Specifies scanning source files for dependencies and emitting a makefile does not generate object code MD Specifies scanning source files for dependencies writing a dependency map toa file then generating object code ColdFire Architectures v6 0 Targeting Manual Command Li
179. select if from the list at the left the panel moves to the front of the Flash Programmer window Verify Target Configuration settings If the Default Project field specifies your project skip ahead to substep c specify your project c Ifthe Default Target field specifies the correct Flash target skip ahead to substep d specify the correct Flash target Otherwise from the main menu bar select Project gt Set as default project to Otherwise from the main menu bar select Project gt Set as default target to e Make sure that the Use Custom Settings checkbox is clear f Click the Load Settings button the system updates other settings for the default project and target ColdFire Architectures v6 0 Targeting Manual Using Hardware Tools Flash Programmer 5 Configure the flash device a From the pane list at the left of the Flash Programmer window select Flash Configuration the Flash Configuration panel moves to the front of the window as Figure 12 2 shows Figure 12 2 Flash Programmer Window Flash Device Configuration Panel zox 8 Flash Programmer IS Flash Device Configuration Target Configuration Flash Configuration E Ox FF800000 Program Verify Flash Memory Base Address Ox Erase Blank Check Checksum Device Organization Sector Address Map Am2SLVOO4BT_M5206E Am2SLVO004BT_M5307C3 FF800000 FF803FFF FF804000 FF805FFF FF806000 FF807FFF FF808000 FFB3FFFF FF84000
180. side code after RTS statements ColdFire Architectures v6 0 Targeting Manual Default Clear A Macsbug symbol is the routine name appended after the routine in Pascal format These symbols are appropriate only for older debuggers Target Settings ColdFire Settings Panels Table 4 6 ColdFire Processor Panel Elements continued Element PC Relative Strings checkbox Purpose Clear Does not use program counter relative addressing for storage of function local strings Checked Does use program counter relative addressing for storage of function local strings Comments Default Clear Checking this box corresponds to using the pcrelstrings pragma Generate code for profiling Checked Has the processor generate code for use with a profiling tool Clear Prevents the processor from generating code for use with a profiling tool Default Clear Checking this box corresponds to using the command line option profile Clearing this checkbox is equivalent to using the command line option noprofile Use sdata sbss for area All data Select this option button to store all data items in the small data address space All data smaller than Select this option button to specify the maximum size for items stored in the small data address space enter the maximum size in the text box Default All data smaller than 0 Using the small data
181. specified longword value to the specified address in memory writemem l lt address gt lt value gt Parameters address Four byte memory address value Any four byte value Example This example writes hexadecimal 00112233 to memory hexadecimal address 00010000 writemem 1 0x00010000 0x00112233 ColdFire Architectures v6 0 Targeting Manual 209 Using Debug Initialization Files Command Reference writemem w Writes the specified word value to the specified address in memory writemem w lt address gt lt value gt Parameters address Two byte memory address value Any two byte value Example This example writes hexadecimal 12ac to memory hexadecimal address 00010001 writemem w 0x00010001 0Ox12ac 210 ColdFire Architectures v6 0 Targeting Manual B Memory Configuration Files In your overall memory map there can be gaps or holes between physical memory devices If the debugger tries a read or write to an address in such a hole the system would issue an error message and debugging might not even be possible To prevent such developments use a memory configuration file MCF An MCF identifies valid memory address ranges to the debugger and even specifies valid access types A sample memory configuration file is E68K_Support Initialization_Files MCF5485EVB mem of the CodeWarrior installation directory This appendix consists of these sections e Command Syntax Command Explana
182. symbol1 name in export string table 4 bytes Address of symbol1 4 bytes A5 value for symbol1 4 bytes Index to symbol2 name in export string table 4 bytes Address of symbolf2 4 bytes A5 value for symbol2 4 bytes Example Listing 6 21 shows the code for creating an export symbol table Listing 6 21 Creating an Export Symbol Table eXpsym EXPORTSYMTAB gt EXPSYM 94 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language Commands Directives and Keywords FORCE_ACTIVE Starts an optional LCF closure segment that specifies symbols the linker should not deadstrip FORCE_ACTIVE symbol symbol Parameter symbol Any defined symbol IMPORTSTRTAB Creates a string table from the names of imported symbols IMPORTSTRTAB Remarks Table 6 5 shows the structure of the import string table As with an ELF string table the system zero terminates the library and symbol names Table 6 5 Import String Table Structure 0x00 1 byte library name varies symbol name varies symbol2 name varies Example Listing 6 22 shows the code for creating an import string table Listing 6 22 Creating an Import String Table impstr IMPORTSTRTAB gt IMPSTR ColdFire Architectures v6 0 Targeting Manual 95 ELF Linker and Command Language Commands Directives and Keywords IMPORTSYMTAB Creates a jump table of the imported symbols IMPORTS
183. ta sections data or sdata according to the string size SDS_debug_support Tries to make the DWARF output file compatible with the Software Development System SDS debugger The default value is OFF pragma SDS_debug_support on off reset section Activates or deactivates a user defined or predefined section pragma section sname begin end Parameters sname Identifier for a user defined or predefined section 74 ColdFire Architectures v6 0 Targeting Manual Compilers Predefined Symbols begin Activates the specified section from this point in program execution end Deactivates the specified section from this point in program execution the section returns to its default state Remarks Each call to this pragma must include a begin parameter or an end parameter but not both You may use this pragma with tpragma push and pragma pop to ease complex or frequent changes to section settings NOTE A simpler alternative to pragma sectionisthe__declspec declaration specifier For more details see Declaration Specifiers Predefined Symbols Metrowerks C and C include several preprocessor symbols that give information about the compile time environment For information on these symbols see the C Compilers Reference Table 5 6 lists additional predefined symbols for ColdFire development Table 5 6 Predefined Symbols Macro Definition __embedded__ 1 if you compile code
184. te Oxcd lt label 12 on different line to directive long 0x87654321 200 This assembles to this sequence of bytes 0x00000000 ab 00 0x00000002 12 34 0x00000004 56 79 0x00000006 cd 00 0x00000008 87 65 0x0000000a 43 21 in which the two 0x00 bytes are padding the assembler added to make sure that the 32 bit Long items are at even addresses The example also demonstrates an important subtlety shown by the addresses of the symbols created for the labels b1 0x00000000 FTI 0x00000002 b2 0x00000006 12 0x00000007 As the example code had the labels b1 11 and b2 on the same line as their data directives these labels are directly attached to the data items This means that the auto alignment also applies to the labels Accordingly the symbol 11 refers to the address of the 32 bit data item after the 0x00 padding byte ColdFire Architectures v6 0 Targeting Manual Command Line Tools Compiling and Linking But the example code had label 12 on a line by itself so it is not attached to the data item given by the next line s directive So the symbol 12 is attached to the value of the location counter before auto alignment of the following item 12 refers to the address of the 0x00 padding byte The assembler does not use unique flags for each processor some flag values specify versions of the core Examples are e ColdFire version 2 core 0x400 e ColdFire version 3 core 0x800 e ColdFire ve
185. te connection ColdFire Abatron ColdFire P amp E Micro or ColdFire CCS the simulator 6 Check the Show in processes list checkbox to add this new connection to the official list To see this list of processes select View gt Systems gt List Checking this ColdFire Architectures v6 0 Targeting Manual 127 Debugging Target Settings for Debugging 128 checkbox also adds this new connection to the remote connection list that pops up when you debug certain kinds of files 7 Use the Connection Type list box to specify the type the remaining fields of the dialog box change appropriately 8 Use the remaining fields of the New Connection dialog box to make any appropriate changes to the default values for connection type port rate and so forth 9 Click OK The dialog box closes the Remote Connections panel window displays the new connection 10 This completes adding the new connection You may close the IDE Preferences window Changing Remote Connections To change to an already configured remote connection use the Remote Debugging panel Figure 9 3 1 Click the arrow symbol of the Connection list box The list of connections appears 2 Select another connection The list collapses the list box displays your selection 3 Click the Edit Connections button A dialog box appears showing the configuration of the remote connection 4 Use the dialog box to make any appropriate configuration changes 5
186. that initialize the target board to write the program to memory once the debugger starts the program Each time you start the debugger and each time you select Debug gt Reset Target the system processes a debug initialization file Such a file perform such functions as initializing registers and memory in targets that do not yet have initialization code in ROM This appendix consists of these sections Common File Uses e Command Syntax Command Reference You specify whether to use a debug initialization file and which to use via the ColdFire Target Settings panel Common File Uses The most common use for debug initialization files is configuring the essential set of memory control registers so that downloads and other memory operations are possible This is appropriate if your target system or evaluation board does not yet have initialization code in target ROM It also can be an appropriate way to override an existing initialization after a reset To create this section of the debug initialization file you mirror the values that the processor chip select pin assignment and other memory control registers should have after execution of initialization code However the set of registers that need initialization ColdFire Architectures v6 0 Targeting Manual 203 Using Debug Initialization Files Common File Uses varies by processor For details see your processor data book as well as the sample files in the Code War
187. the small data section Deadstripping As the ColdFire linker links object files into one executable file it recognizes portions of code that execution cannot possibly reach Deadstripping is removing such unreachable code that is not including the portions in the executable fie The Code Warrior linker performs this deadstripping on a per function basis The Code Warrior linker deadstrips unused code and data from only object files that a Code Warrior C C compiler generates The linker never deadstrips assembler relocatable files or C C object files from a different compiler Deadstripping is particularly useful for C programs or for linking to large general purpose libraries Libraries archives built with the Code Warrior C C compiler only contribute the used objects to the linked program If a library has assembly or other C C compiler built files only those files that have at least one referenced object contribute to the linked program The linker always ignores unreferenced object files Well constructed projects probably do not contain unused data or code Accordingly you can reduce the time linking takes by disabling deadstripping e To disable deadstripping completely check the Disable Deadstripping checkbox of the ColdFire Linker panel e To disable deadstripping for particular symbols enter the symbol names in the Force Active Symbols text box of the ColdFire Linker Panel For more information on ColdFire
188. ting address register AO through A7 value Any appropriate register value ColdFire Architectures v6 0 Targeting Manual 207 Using Debug Initialization Files Command Reference Example This example writes hexadecimal ff to register A4 writeaddressreg 4 Oxff writecontrolreg Writes the specified value to the address of a control register writecontrolreg lt address gt lt value gt address is the address of the control register Parameters address Address of any control register value Any appropriate value Example This example writes hexadecimal cO to control register address 20000001 writecontrolreg 0xc0f 0x20000001 writedatareg 208 Writes the specified value to the specified data register writedatareg lt registerNumber gt lt value gt Parameters registerNumber Any integer 0 through 7 representing data register DO through D7 value Any appropriate register value Example This example writes hexadecimal to register D3 writedatareg 3 Oxff ColdFire Architectures v6 0 Targeting Manual Using Debug Initialization Files Command Reference writemem b Writes the specified byte value to the specified address in memory writemem b lt address gt lt value gt Parameters address One byte memory address value Any one byte value Example This example writes decimal 255 to memory decimal address 2345 writemem b 2345 255 writemem l Writes the
189. tion tutorial 25 37 arguments inline assembly 111 113 arithmetic operators LCF 81 82 assembler options command line 183 assembly inline 109 118 B batchrunner postlinker settings panel 43 batchrunner prelinker settings panel 43 BDM debugging 142 144 board independent code 168 build settings panel 144 building 22 23 building a project 30 32 bus_dump simulator configuration command 155 C cache_size simulator configuration command 156 calling conventions 65 66 CF debugger settings panel 32 121 124 exceptions panel 128 131 interrupt panel 133 checksum panel 174 closure segments LCF 78 79 code board independent 168 ColdFire Architectures v6 0 Targeting Manual position independent 168 codeColdFire pragma 69 CodeWarrior development process 19 23 IDE 18 ColdFire assembler panel 44 47 linker notes 105 107 linker panel 55 59 processor panel 51 54 settings panels 40 60 target panel 44 command line tools 179 201 assembler options 183 compiler options 184 194 data auto alignment 200 201 debugging operations 181 183 environment variables 179 180 executables 179 linker options 194 199 commands debug initialization files 206 210 linker 77 104 memory configuration files 212 214 simulator configuration 154 160 comment operators LCF 81 82 compiler documentation 61 62 compiler options command line 184 194 compilers 61 76 compiling 22 23 configuration files memory 211 214 configur
190. tions Command Syntax The syntax rules for commands in a memory configuration file are The system ignores space characters and tabs The system ignores character case in commands e Numbers may be in hexadecimal decimal or octal format Hexadecimal values must start with Ox as in 0x00002222 OxA or OxCAfeBeaD Decimal values must start with a numeral 1 through 9 as in 7 12 526 or 823643 Octal values must start with a zero as in 0123 or 0456 Comments can be in standard C or C format ColdFire Architectures v6 0 Targeting Manual 211 Memory Configuration Files Command Explanations Command Explanations This section explains the commands you can use in a memory configuration file range e reserved e reservedchar range Specifies a memory range for reading or writing range lt loAddr gt lt hiAddr gt lt sizeCode gt lt access gt Parameters loAddr Starting address of memory range hiAddr Ending address of memory range sizeCode Size in bytes for memory accesses by the debug monitor or emulator access Read Write or ReadWrite Example These range commands specify three adjacent ranges the first read only with 4 byte access the second write only with 2 byte access and the third read write with 1 byte access range OxFF000000 OxFFOOOOFF 4 Read range OxFF000100 OxFFO001FF 2 Write range 0xFF000200 OxFFFFFFFF 1 ReadWrite 212 ColdFire Architectures v6 0 Ta
191. tning dialog box 138 Integer N that specifies the data stream transfer rate per the expression 33000000 2 N 5 hertz 0 specifies 6600000 hertz or 6 6 megahertz 1 the default specifies 4 7 megahertz 31 specifies the slowest transfer rate 0 49 megahertz ColdFire Architectures v6 0 Targeting Manual Table 9 8 P amp E Micro Dialog Box Elements continued Debugging Remote Connections for Debugging Flow Control list box Specifies flow control type None Hardware RTS CTS or Software XONN XOFF Default None Log Clear Does not copy Default Clear Communications communications in log window Data to Log Checked Copies communications in Window log window IP Address text box Specifies IP address Must be in format 127 0 0 1 1000 or in format host domain com 1000 NOTE ISS Remote Connection NOTE For a P amp E Micro remote connection be sure to check the checkboxes Use Target Initialization File and Use Memory Configuration File of the CF Debugger Settings panel Special Edition software does not support the ISS To use the ISS you must have Standard or Professional Edition software Figure 9 14 shows the configuration dialog box for ColdFire Instruction Set Simulator ISS remote connections Table 9 9 explains the elements of this dialog box ColdFire Architectures v6 0 Targeting Manual 139 Debugging Remote Connections for Debug
192. tops at watchpoints Console Encoding list box Specifies the type of console encoding Default None ColdFire Architectures v6 0 Targeting Manual CF Interrupt Panel Debugging an application involves single stepping through code But if you do not modify interrupts that are part of normal code execution the debugger could jump to interrupt handler code instead of stepping to the next instruction Debugging Target Settings for Debugging So before you start debugging you must mask some interrupt levels according to your processor To do so use the CF Interrupt panel Figure 9 8 Table 9 6 explains the elements of this panel Figure 9 8 CF Interrupt Panel VW Mask Interrupts Interrupt Level Table 9 6 CF Interrupt Panel Elements CF Interrupt Element Mask Interrupts checkbox Purpose Clear Ignores interrupts Checked Masks interrupts of the specified and lower levels but allows higher level interrupts Comments Default Clear box Interrupt Level list Specifies the interrupt level from O low to 7 high Default O NOTE The exact definitions of interrupt levels are different for each target processor and masking all interrupts can cause inappropriate processor behavior This means that finding the best interrupt level to mask can involve trial and error Be alert for any code statements that change the interrupt
193. ts 17 Code Warrior IDE li E oa ee A 18 CodeWarrior Development Process 19 Project Piles sist fate sue ale eta Gy ean nd eae a 21 Editing Cod sige ne oe a ee a ete Hence A ee 22 Building Compiling and Linking 22 Debus ping A A ts rte 23 Disassembling ree edit raies eee aie weeds da 23 3 Application Tutorial 25 Create a Project cc shined hb s 0 4 Side ee a DR a edu bes 25 Build th Project ies poi A eed 30 Debug the Application 32 4 Target Settings 39 Target Settings Overview 39 ColdFire Settings Panels 40 Target Settings sens a aa shreds cbs ht a a 41 BatchRunner PreLinker 43 BatchRunner PostLinker 43 ColdFire Target acia 44 ColdFire Architectures v6 0 Targeting Manual 3 Table of Contents ColdFire Assemblers droit a dar ci id 44 ELF Disassembler sr res a a a 47 ColdFire Processor meiosis 51 ColdFir Linker aida ti ds ld ade ie ntm a 55 Debugger PIC Settings ni 4 5 dur a di 59 5 Compilers 61 Language Extensions 62 PC Relative Stings 5 sks a a 62 Declaration Specifiers 63 Integer Formats pia ane ee ae E On oe 6
194. upport only P amp E Microsystems parallel and USB remote connections For any other type of remote connection you must have Professional Edition software 124 ColdFire Architectures v6 0 Targeting Manual Figure 9 3 Remote Debugging Panel Debugging Target Settings for Debugging Remote Debugging Connection Settings Connection CCS SIM i Edit Connection r Remote download path peee MMMM IF Launch remote host application o o Download OS Connection J4BATRON_SERIAL Table 9 3 Remote Debugging Panel Elements Element Purpose Connection list box Specifies the remote connection type the remote debugger along with its default settings Comments Possible remote connections include Abatron Serial or TCP IP CCS SIM and P amp E Microsystems Parallel USB and Lightning However you must add any such additional connection before it is available in this list box Edit Connection button Starts process of adding a remote connection or changing settings of an existing remote connection For instructions see text after this table Remote download text box Specifies the absolute path to the directory in which to store downloaded files This option does not apply to bareboard development ColdFire Architectures v6 0 Targeting Manual Default None 125 Debugging Target Settings for Debugging Table 9 3 Remote Debugg
195. ut the control character this directive pushes modified registers onto the stack With the control character this directive pushes all register arguments into their ColdFire registers Counterpart to the frfree directive frfree Frees the stack storage area also restores the registers with the statement unlk a6 that fralloc reserved frfree 116 ColdFire Architectures v6 0 Targeting Manual Inline Assembly Inline Assembly Directives machine Specifies the CPU for which the compiler generates its inline assembly instructions machine processor Parameter processor MCF547x MCF5249 MCF5272 MCF5280 MCF5282 MCF5307 MCF5407 MCF5213 or MCF5206e Remarks If you use this directive to specify a target processor additional inline assembler instructions become available instructions that pertain only to that processor For more information see the Freescale processor user s manual naked Suppresses the compiler generated stackframe setup cleanup and return code naked Remarks Functions with this directive cannot access local variables by name They should not contain C code that implicitly or explicitly uses local variables or memory Counterpart to the return directive Example Listing 8 7 is an example use of this directive Listing 8 7 Naked Directive Example long square short asm naked no stackframe or compiler generated rts move w 4 sp d0 fetch function argument fro
196. w project window NOTE As ELF file DWARF information does not include full pathnames for assembly s files the IDE cannot find these files when it creates the project But when you debug the project the IDE does find the assembly files that reside in a directory that is a project access path If any assembly files still lack full pathnames you can add their directory to the project manually so that the IDE finds the directory whenever you open the project 5 Select Project gt Debug the IDE starts the debugger the debugger window appears 6 Begin debugging 146 ColdFire Architectures v6 0 Targeting Manual Debugging Special Debugger Features Additional ELF Debugging Considerations Any of these points may make your debugging more efficient Once the IDE creates a mcp project for your ELF file you can open that project instead of dropping your ELF file onto the IDE To delete an old access path that no longer applies to the ELF file use either of two methods Use the Access Path target settings panel to remove the access path from the project manually Delete the existing project for the ELF file then drag the ELF file to the IDE to recreate a project e To have the project include only the current files you must manually delete project files that no longer apply to the ELF To recreate a project from an ELF file If the project is open close it Delete the project mcp file
197. xample suppose that we want to copy all initialized data into RAM at runtime At runtime the system loads the main_data section containing the initialized data to RAM address 0x80000 but until runtime this section remains in ROM Listing 6 12 shows part of the corresponding LCF Listing 6 12 Partial LCF for ROM to RAM Copy ROM location RAM location M nN For clarity EMORY TEXT RX DATA RW ECTIONS main text rodata gt TEXT 86 address 0x0 address 0x800000 no alignment directives in this listing ORIGIN ORIGIN 0x0 L 0x800000 ENGTH 0 LENGTH 0 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language LCF Syntax Locate initialized data in ROM area at end of main main_data AT ADDR main SIZEOF main data sdata sbss gt DATA uninitialized_ data SCOMMON bss COMMON gt gt DATA For program execution to copy the section from ROM to RAM a copy table such as Listing 6 13 must supply the information that the program needs at runtime This copy table which the symbol __ S_romp identifies contains a sequence of three word values per entry ROM start address e RAM start address e size The last entry in this table must be all zeros this is the reason for the three lines WRITEW 0 before the table closing brace character Listing 6 13 LCF Copy
198. xes Checked Activates the four subordinate checkboxes For each checked subordinate checkbox puts ELF code section into the disassembled module Default Checked Use Extended Mnemonics checkbox Clear Keeps extended mnemonics out of the disassembled module Checked Puts instruction extended mnemonics into the disassembled module Default Checked This checkbox is active only if the Show Code Modules checkbox is checked Show Source Code checkbox Clear Keeps source code out of the disassembled module Checked Lists source code in the disassembled module Display is mixed mode with line number information from original C source code ColdFire Architectures v6 0 Targeting Manual Default Checked This checkbox is active only if the Show Code Modules checkbox is checked Target Settings ColdFire Settings Panels Table 4 5 ELF Disassembler Panel Elements continued Element Purpose Comments Show Addresses and Clear Keeps addresses Default Checked Object Code checkbox and object code out of the disassembled module This checkbox is active only if the Show Code Modules Checked Lists addresses checkbox is checked and object code in the disassembled module Show Comments Clear Keeps Default Checked checkbox disassembler comments out f the disassembled module This checkbox is active only if the Show Code Modules Check
199. ymbol that it otherwise would not include KEEP_SECTION Use this directive to keep a section in the link particularly a user defined section 78 ColdFire Architectures v6 0 Targeting Manual ELF Linker and Command Language LCF Structure REF_INCLUDE Use this directive to keep a section in the link provided that there is a reference to the file that contains the section This is a useful way to include version numbers Listing 6 2 shows an example of each directive Listing 6 2 Example Closure Sections 1st closure segment keeps 3 symbols in link FORCE_ACTIVE break_handler interrupt_handler my_function 2nd closure segment keeps 2 sections in link KEEP_SECTION interruptl interrupt2 3rd closure segment keeps file dependent section in link REF_INCLUDE version Sections Segment Use the sections segment to define the contents of memory sections and to define any global symbols that you want to use in your output file Listing 6 3 shows the format of a sections segment Listing 6 3 Example Sections Segment n ECTIONS section_ name The section name for your reference must begin with a period filename c text Put text section from filename c filename2 c text then put text section from filename2 c filename c data then put data section from filename c filename2 c data then put data section from filen

Download Pdf Manuals

image

Related Search

Related Contents

Kennedy III - ekomedical.pl  Troponine T à haute sensibilité, quels  TI-36X ý  Instalando a impressora em uma rede sem fio  YASKAWA AC Drive-V1000 Option CompoNet Installation Manual  MB-Resize - User Manual  Edge-Core WA6202AM WLAN access point    Semaine - Université de Savoie  

Copyright © All rights reserved.
Failed to retrieve file