Home
Target Settings
Contents
1. sortbyaddr sort S records by address implies srec srec generate an S record file ignored when generating static libraries sreceol keyword set end of line separator for S record file implies srec mac Macintosh r dos DOS r n default unix Unix n sreclength length specify length of S records should be a multiple of 4 implies srec for length range 8 252 default is 64 usebyteaddr use byte address in S record file implies srec o file specify output filename DSP M56800E Project Options application global generate an application default library global generate a static library DSP M56800E CodeGen Options ldata largedata data space not limited to 64K Linker C C Support Options Cpp_exceptions on off dialect lang keyword C Targeting DSP56800E enable or disable C exceptions default is on specify source language treat source as C unless its extension is E hy OL pea default treat source as C always DSP 305 ELF Linker and Command Language DSP56800E Command Line Tools 9 global cased generate debugging information same as sym full sym keyword global specify debugging options off do not generate debugging information default on turn on debugging information ful1 path store full paths to source files w arn ings keyword o
2. Browse T Use Memory Configuration File Factory Settings Revert Import Panel Export Panel OK Cancel Apply The Remote Debug Options panel are e Program Download Options The code types are determined by the flags RWX assigned to a section as defined in the linker command file The section types are Executable Program code that is contained in sections specified with an X flag Constant Data Program data that is contained in sections in which the X and W flags are not specified Initialized Data Targeting DSP56800E DSP 73 Target Settings DSP56800E Specific Target Settings Panels Program data that is contained in sections in which the W flag is specified and the X flag is not specified Itis data that has been set with initial values Uninitialized Data Program data that is contained in sections in which the W flag is specified and the X flag is not specified Itis data that has not been set with initial values For the different section types you can enable Download or Verify on Initial Launch and on Successive Runs Initial Launch If Download is checked the corresponding section is downloaded on the initial launch of the debugger If Verify is also checked the data written is read back to verify that the data was corectly written Successive Runs The Download and Verify checkboxes in Successive Runs have the same meaning as tho
3. _mod_initint16 Definition Prototype Initialize modulo buffer pointer with integer data The __mod_initint16 function behaves similarly to the __mod_init function except that word addresses are used to initialize the modulo pointer register void __mod_initint16 int lt mod_desc gt int lt addr_expr gt int lt mod_sz gt Example Initialize an integer modulo buffer pointer with a buffer size of 10 mod aAinitint16 0 amp int_buf 9 10 __ mod start Definition Write the modulo control register The __mod_start function simply writes the modulo control register M01 for each modulo pointer register which has been previously initialized The values written to M01 depends on the size of the modulo buffer and which pointers have been initialized Prototype void __mod_start void __ mod_access DSP 160 Definition Prototype Example Retrieve the modulo pointer The __mod_access function returns the modulo pointer value specified by lt mod_desc gt in the R2 register as per calling conventions The value returned is a byte address The data in the modulo buffer may be read or written by a cast and dereference of the resulting pointer void __mod_access int lt mod_desc gt Assign a value to the modulo buffer at the current pointer Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions char _ mod_access 0 char i __mo
4. e h hexadecimal file e b binary file Table 7 22 shows examples of the load command Debugging Command Examples load Example Description load des mcp Loads a project named des mcp load des eld Creates a default project from the des e1d object file and loads the project Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Example Description load h dat lod Loads the contents of the hexadecimal file dat 1od into memory load b dat lod p 20 Loads the contents of the binary file dat lod into program memory beginning at 20 log Use the log debugging command to log either the commands that you enter during a debugging session or the entire session all display entries during a debugging session The syntax for the log command follows lo g off c s file name Table 7 23 shows examples of the Log command Table 7 23 Debugging Command Examples log Example Description log This example displays a list of currently opened log files log s session log This example logs all display entries to a file named session log log c command log This example logs the commands that you enter during the debugging session to a file named command log log off This example ends command logging log off This example ends all logging in the command line debugging window Targeting DSP56800E DSP 235 Debugging for DSP56800E Command Line Debuggin
5. e Generate S Record File The Generate S Record File option controls whether the linker generates an S record file based on the application object image The S record files have the extension s In the case of the DSP56800E the linker generates three different S record files Their contents are output file name s S record file containing both P and X memory contents output file name p S record file containing P memory contents only DSP 68 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels NOTE Targeting DSP56800E output file name x S record file containing X memory contents only The linker places the S record files in the output folder which is a sub folder of the project folder The linker generates the following S3 type S records Sort by Address This option enables the compiler to sort S records generated by the linker using byte address This option is not available unless you enable the Generate S Record File option Generate Byte Addresses This option enables the linker to generate S records in bytes This option is not available unless you enable the Generate S Record File option Max Record Length The Max Record Length field specifies the maximum length of the S record generated by the linker This field is available only if the Generate S Record File option is enabled The maximum value for an S record length is 256 bytes Most programs t
6. result ffs_1 11 Expected value of result 1 DSP 143 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support norm_ DSP 144 Definition Note Prototype Example Computes the number of left shifts required to normalize a 32 bit value returning a 16 bit result Returns a shift count of 0 for an input of 0x00000000 Does not actually normalize the value This operation is NOT optimal on the DSP56800E because of the case of returning 0 for an input of 0x00000000 See the intrinsic ffs 1 which is more optimal but generates a different value for the case where the input 0x0000 Word16 norm_1 Word32 lsrc long 11 0x20000000 25 short result result norm_1 11 Expected value of result 1 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Rounding Click on the following link to jump to the corresponding intrinsic function e round round Definition Assumptions Prototype Example Rounds a 32 bit fractional value into a 16 bit result When an accumulator is the destination zeroes out the LSP portion OMR s R bit was set to 1 at least 3 cycles before this code that is 2 s complement rounding not convergent rounding OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 round Word32 lvarl long 1 0x12348002 if low 16b
7. 44 o amp www Project Files versus Makefiles 00a aa 1 Editing Code 4 oa a a a amp a amp en e e eH 8 Compiling Linking a a me a oe a ahs Debugging 0 Viewing Preprocessor Output 2 4 Target Settings Target Settings Overview a 4 a a a a e A Target Setting Panels 204 a ae a a Changing Target Settings a a a a a a aa Exporting and Importing Panel Opio to XML Files Exporting Panel Options to XML File Targeting DSP56800 15 Pane o 17 ee 19 19 gt 19 20 20 p ai 29 24 27 29 29 30 30 y 30 30 4 31 i tee SO 31 z w WBZ 32 y 34 34 34 35 ees 36 E anO 38 DSP 3 Table of Contents Importing Panel Options from XML File 38 Saving New Target Settings in Stationery 38 Restoring Target Settings 4 cs ma 39 CodeWarrior IDE Target Settings Panels er ei ae eS 40 DSP56800E Specific Target Settings Panels 2 2 41 Target SOUS ea gtk Ge He ee A ae Se Ge A 41 M56800E Target a a oh ae Gi tg oh a e C C Language Bok AAA pra ae ESCESWONISS s a a A A E eB 51 M56800E Assembler a ete AR A 55 ELF Disassembler aaa 58 M56800E Processor inte sete go le OU The M56800E Processor Sere options AET o Be a 62 M56800E Linker 264 54 a Ske 8 BOR Mn cp ra 1109 Remote Debugging 442 404 es ge Ge A oe ae ee 70 Remo
8. ELF Linker and Command Language Linker Command File Syntax Linker Command File Syntax This section explains some practical ways in which to use the commands of the linker command file to perform common tasks Alignment To align data on a specific byte boundary use the ALIGN and ALIGNALL commands to bump the location counter to the preferred boundary For example the following fragment uses ALIGN to bump the location counter to the next 16 byte boundary An example is given in Listing 9 6 Listing 9 6 Sample ALIGN Command Usage file c text ALIGN 0x10 file c data aligned on a 16 byte boundary You can also align data on a specific byte boundary with ALIGNALL as shown in Listing 9 7 Listing 9 7 Sample ALIGNALL Command Usage file c text ALIGNALL 0x10 everything past this point aligned on 16 bytes file c data Targeting DSP56800E DSP 273 ELF Linker and Command Language Linker Command File Syntax Table 9 1 Listing 9 8 Arithmetic Operations Standard C arithmetic and logical operations may be used to define and use symbols in the linker command file Table 9 1 shows the order of precedence for each operator All operators are left associative Arithmetic Operators Precedence Operators highest 1 7 I 2 E 5 3 4 gt gt lt lt 5 la gt lt lt gt 6 amp 7 8 amp amp 9 Comments Comments may
9. Figure 6 2 Targeting DSP56800E This section includes the following sub sections e An Overview of Modulo Addressing e Modulo Addressing Intrinsic Functions Definitions and Examples e Caveats on Using the Modulo Buffer API e Error Code Documentation An Overview of Modulo Addressing A modulo buffer is a region of memory or a buffer in which the pointer to the buffer data loops back to the beginning of the buffer if the pointer exceeds some specified limit For example in Figure 6 2 the address loops to the initial buffer address after the specified modulo buffer limit is reached For this example the modulo buffer limit is six Example of a Modulo Buffer Address Data 0x100 0 68 0x101 0 73 0x102 0 81 0x103 0 86 0x104 0 90 0x105 0 95 In order to efficiently implement modulo buffers in C the DSP56800E C compiler uses intrinsic functions to create and manipulate modulo buffers in C Normally a modulo operation that is the operator in C requires a runtime function call to the arithmetic library to perform the binary operation which results in a a large execution time overhead for normally timed critical DSP loops However with our implementation of modulo buffers in C the runtime call to perform the modulo operation has been eliminated and replaced with an efficient implementation of circular DSP 157 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic
10. amp x amp y Returns 6 DSP 116 Calling Pure Assembly Language Functions In order for your assembly language files to be called from C code you need to specify a SECTION mapping for your code so that it is linked appropriately You must also specify a memory space location Code is usually specified to program memory P space with the ORG directive When defining an assembly language function use the GLOBAL directive to specify the list of symbols within the current section that needs to be accessible by any of the other sections You can then define the assembly language function An example of a complete assembly language function is shown in Listing 6 9 In this function two 16 bit integers are written to program memory A separate function is needed to write to P Targeting DSP56800E Inline Assembly Language and Intrinsics Calling Assembly Language Functions from C Code memory because C pointer variables cannot be employed C pointer values only allow access to X data memory The first parameter is a short value and the second parameter is the 16 bit address where the first parameter is written Listing 6 9 Sample Code Creating an Assembly Language Function my_asm asm SECTION user map to user defined section in CODE ORG P put the following program in P memory GLOBAL Fpmemwrite This symbol is defined within the Current section and should be accessible by all sections
11. long result 1 0xE0000000 0 25 Ef result L _negate sl Expected value of result 0x20000000 0 25 DSP 125 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Addition Subtraction Click any of the following links to jump to the corresponding intrinsic functions e add e sub e L add add Definition Addition of two 16 bit integer or fractional values returning a 16 bit result Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 add Word16 src_dst Word16 src2 Example short sl 0x4000 0 5 short s2 0x2000 0 25 short result result add s1 s2 Expected value of result 0x6000 0 75 DSP 126 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support sub Definition Subtraction of two 16 bit integer or fractional values returning a 16 bit result Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 sub Word16 src_dst Word16 src2 Example short s1 0x4000 0 5 pale short s2 OxE000 0 25 short result result sub s1 s2 Expected value of result 0x6000 0 75 L_add Definition Addition of two 32 bit integer or fractional values returning a 32 bit Assumptions Prototype Example Targeting DSP56800E
12. 237 restart o s a E u a A 239 TUM 4 0 Ss IA a 239 SAVE 20 Ua Se Ela ads bia Beale en ce de a 240 STEP WAP ee Ms Fe Ge ae AA 241 BOD le Eur E e A AA MOE UA i 242 Targeting DSP56800 Table of Contents switchtarget system view wait watchpoint System Level Connect n5 Debugging in the Flash Memory Flash Memory Commands set_hfmclkd lt value gt set_hfm_base lt address gt set_hfm_config_base lt address gt add_hfm_unit lt startAddr gt lt endAddr gt pS lt numSectors gt lt pageSize gt a lt boot gt lt interleaved gt set_hfm_erase_mode units pages all set_hfm_verify_erase 110 set_hfm_verify_program 110 Unlock Flash Security Features Notes for Debugging on Hardware 8 High Speed Simultaneous Transfer Targeting DSP56800 Host Side Client Interface hsst_open hsst_close hsst_read hsst_write hsst_size i hsst_block_mode hsst_noblock_mode hsst_attach_listener hsst_detach_listener hsst_set_log_dir HSST Host Program Example Target Library Interface HSST_open HSST_close HSST_setvbuf y 24O 243 244 244 245 245 246 246 246 247 247 247 248 248 248 248 248 251 251 252 s e252 253 254 255 O 206 2200 z n29 y ao 258 259 260 260 260 DSP 11 Table of Contents HS STE WELES Ala g Sy ey Me he la a ita Se Bes de Aus ot GE oe ZOOL HSST read a Ze du ae Oy
13. C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimization Linker ELF Disassembler M56800E Linker Editor Custom Keywords Debugger Other Executables Debugger Settings Remote Debugging M56800E Target Remote Debug Options DSP 36 Targeting DSP56800E Target Settings Target Settings Overview Changing Target Settings To change target settings 1 Select Edit gt Target Name Settings Target is the name of the current build target in the CodeWarrior project After you select this menu item the CodeWarrior IDE displays the Target Settings window Figure 4 1 Figure 4 1 Target Settings Window Target Settings Panels Target Settings Target Settings Target Name Simulator Access Paths Linker Build Extras in er M56800 Linker y Runtime Settings Predinker None y File Mappings PI Sauce Tress Postlinker None y M56800E Target Dutput Directory G Language Settings Choose C C Language Project Clear C C Warnings MS56800E Assembler E Code Generation MS56800E Processor Global Optimizations Linker ELF Disassembler M56800E Linker Tl Save project entries using relative paths Factory Settings Revert Import Panel Export Panel OK Cancel Apply The left side of the Target Settings window contains a list of target settings panels that
14. CodeWarrior bin Plugins Com Sample HSST Host Program include CodeWarriorCommands h include HSSTInterface h include lt cstdio gt include lt cstdlib gt unsigned __stdcall HSSTClientMain void pArguments define buf _ size 1000 Data size DSP 258 Targeting DSP56800E High Speed Simultaneous Transfer Target Library Interface Assigning name for Plugin and Menu Title extern const CWPluginID kToolbarTestPluginID HSST_host_sample extern const wchar_t MenuTitle L HSST_host_sample unsigned __stdcall HSSTClientMain void pArguments IMWHSST_Client pHSST IMWHSST_Client pArguments long data buf_size size_t channel_1 channel 2 read_items written_items Opening channel 1 and 2 from HOST side HRESULT hr_1 pHSST gt hsst_open channel_1 amp channel_ 1 HRESULT hr_2 pHSST gt hsst_open channel_2 amp channel 2 HOST reading data from channel 1 pHSST gt hsst_read data sizeof long buf_size Channel_1 amp read_items HOST writing data to channel 2 pHSST gt hsst_write data sizeof long buf_size channel_2 amp written_items return 0 Target Library Interface This section describes the API calls for using High Speed Simultaneous Transfer HSST from your target application At the end of this section an example of a HSST target program is given Listing 8 2 on page 266 Targeting DSP56800E DSP 259 High
15. DSP 140 fractional result Saturates only for the case of 0x8000 x 0x8000 OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_mult Word16 sinpl Word16 sinp2 short sl 0x2000 0 25 short s2 0x2000 0 25 long result result L_mult sl s2 Expected value of result 0 625 0x08000000 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_mult_ls Definition Multiply one 32 bit and one 16 bit fractional value generating a signed 32 bit fractional result Saturates only for the case of 0x80000000 x 0x8000 Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_mult_ls Word32 linpl Word16 sinp2 Example long 11 0x20000000 0 25 short s2 0x2000 0 25 long result result L_mult 11 s2 Expected value of result 0 625 0x08000000 Targeting DSP56800E DSP 141 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Normalization Click any of the following links to jump to the corresponding intrinsic functions e ffs s e norm s e ffs e norm 1 ffs_s Definition Note Prototype Example DSP 142 Computes the number of left shifts required to normalize a 16 bit value returning a 16 bit result finds 1st sign bit Returns a shift count of 31
16. EOnCE Debugger Features Figure 7 12 Contents of Trace Buffer a Trace Buffer O Ep qa A xi 2 Trace Butter al T address P 0x00000000 veCtOE C line de address P 0x00000000 wector c line 42 r Fr ab i M Of Path CASDK dsp56838em_Snos confighvector c amp finclude configdefines h E fundef CFG_SECTION_ ISR DECLARATION i Llsr archStart oe SPs 0500 3 RESET jer SDE Interruptl JP 0 02 3 COP Reset E jer SDE_illegal e P 0e04 3 Illegal In jer SDE Interrupt 3 e P 0e06 3 Software I jer SDE HWSOvert low e P 0e06 3 Hardware 5 Line 43 Cold a Hz To clear triggers set with the Trace Buffer Setup panel Figure 7 11 1 From the menu bar select EOnCE gt Clear Triggers The Trace Buffer Setup panel options are e Capture Events Select this set of checkboxes to specify which instructions get captured by the trace buffer Change of flow not taken Select this checkbox to capture target addresses of conditional branches and jumps that are not taken Interrupt Select this checkbox to capture addresses of interrupt vector fetches and target addresses of RTI instructions Targeting DSP56800E DSP 189 Debugging for DSP56800E EOnCE Debugger Features Subroutine Select this checkbox to capture target addresses of JSR BSR and RTS instructions Forward branches and JCC Backward branches Select this checkbox to capture target addresses of
17. Intrinsic Functions for Math Support Deposit Extract Click any of the following links to jump to the corresponding intrinsic functions e extract h e extract l e L deposit h e L deposit extract_h Definition Prototype Example Extracts the 16 MSBs of a 32 bit integer or fractional value Returns a 16 bit value Does not perform saturation When an accumulator is the destination zeroes out the LSP portion Corresponds to truncation when applied to fractional values Word16 extract_h Word32 lsrc long 1 0x87654321 short result result extract_h 1 Expected value of result 0x8765 extract_ Definition Prototype Example Extracts the 16 LSBs of a 32 bit integer or fractional value Returns a 16 bit value Does not perform saturation When an accumulator is the destination zeroes out the LSP portion Word16 extract_1l Word32 lsrc long 1 0x87654321 short result result extract_l 1 Expected value of result 0x4321 Targeting DSP56800E DSP 132 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_deposit_h Definition Deposits the 16 bit integer or fractional value into the upper 16 bits of a 32 bit value and zeroes out the lower 16 bits of a 32 bit value Prototype Word32 L_deposit_h Word16 ssrc Example short sl Ox3FFF long result result L_deposit_h s1 Expected value of result 0x3fff0000 L_deposit_ Definition Deposits
18. P 0000100E A421 eye float2str 0x2df 01030 P 0000100F SABSFFES adda 24 SP R2 P 00001011 B17A move X SP 6 B Col 1 4 Targeting DSP56800E DSP 205 Debugging for DSP56800E Register Details Window e Source Figure 7 25 Figure 7 25 View P Memory Source Window mM56800E elf Memory 1 break case f case F _format if frac_digits dec exp dec sig length 1 lt 0 frac_digits 0 if frac digits gt format precision round_decimal Sdec dec sig length frac_digits Line 1350 Col3 4 e Mixed Figure 7 26 Figure 7 26 View P Memory Mixed Window Pe O Display 0 1 000 View Mixed y Source C Program FilesiMetrowerksiCodeWarrior_56800E_1 14M56800E Suppor y case f case F _format if frac_digits dec exp dec sig length 1 lt 0 DOOOOFF adda 24 SP R DOOOOFES MOVE W X RO 1 B OOODOFFA neg B 00000FFB adda 24 SP RO 00000FFD moveu b X R0 4 A 00000FFE A YO 00000FFF B YO 00001000 i YO A Os Line 1350 Col3 DSP 206 Targeting DSP56800E Debugging for DSP56800E Loading a elf File without a Project Loading a elf File without a Project NOTE NOTE Targeting DSP56800E You can load and debug a el f file without an associated project To load a el f file for debugging without an associated project Launch the Code Warrior IDE Choose File gt Open and specify the file to load
19. no speed 1 Level num Targeting DSP56800E e HE HEHEHE HEHEHE HEHE HEHEHE HHO H H same as 02 cased control optimization you may combine options as in 04 p 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 specify optimization options suppress all optimizations default same as opt level 2 same as opt speed level 4 optimize for space optimize for speed set optimization level level 0 no optimizations DSP 301 ELF Linker and Command Language DSP56800E Command Line Tools level 1 global register allocation peephole dead code elimination level 2 adds common subexpression elimination and copy propagation level 3 adds loop transformations strength reduction loop invariant code motion level 4 adds repeated common subexpression elimination and loop invariant code motion for num range 0 4 default is 0 no cse common subexpression elimination no commonsubs no deadcode no deadstore no lifetimes no loop invariants no prop agation no strength removal of dead code removal of dead assignments computation of variable lifetimes removal of loop invariants propagation of constant and copy assignments strength reduction reducing multiplication by an index variable into addition same as opt no deadcode and opt no deadstore
20. option is enabled Show Source Code The Show Source Code option determines whether the disassembler lists the source code for the current module Source code is displayed in mixed mode with line number information from the original C source This option is available only if the Show Code Modules option is enabled DSP 59 Target Settings DSP56800E Specific Target Settings Panels Show Comments The Show Comments option displays comments produced by the disassembler in sections where comment columns are provided This option is available only if the Show Code Modules option is enabled e Show Data Modules The Show Data Modules option determines whether or not the disassembler outputs any ELF data sections such as data and bss for the disassembled module Disassemble Exception Tables The Disassemble Exception Tables option determines whether or not the disassembler outputs any C exception tables for the disassembled module This option is available when you select Show Data Modules NOTE Disassemble Exception Tables is not available for DSP56800E since it does not support C e Show Debug Info The Show Debug Info option directs the disassembler to include DWARF symbol information in the disassembled output DSP 60 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels M56800E Processor The M56800E Processor settings panel Figure 4 8 determines the kind of co
21. type but is to be calculated as a fractional type Data in a memory location or register can be interpreted as fractional or integer depending on the needs of a user s program All intrinsic functions that generate multiply and divide instructions DIV MPY MAC MPYR and MACR perform fractional arithmetic on implied fractional values The following equation shows the relationship between a 16 bit integer and a fractional value Fractional Value Integer Value 2 Similarly the equation for converting a 32 bit integer to a fractional value is as follows Fractional Value Long Integer Value 2 shows how both 16 and 32 bit values can be interpreted as either fractional or integer values Table 6 1 Interpretation of 16 and 32 bit Values Type Hex Integer Value Fixed point Value short int 0x2000 8192 0 25 short int 0xE000 8192 0 25 long int 0x20000000 536870912 0 25 long int 0xE0000000 536870912 0 25 Macros Used with Intrinsics These macros are used in intrinsic functions e Word16 A macro for signed short e Word32 A macro for signed long DSP 122 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Intrinsic Functions for Math Support The intrinsic functions for math support supported by the DSP56800E are shown in Figure 6 1 and the intrinsic functions for modulo addressing are given in Modulo Addressing Intrinsic Functions
22. used by the routine The routine returns with an RTS Routines with pragma interrupt enabled in this mode are safe to be called by ISRs default This is the mode when no mode is specified In this mode the routine preserves register values by saving and restoring the registers that are used by the routine The routine returns with an RTI on off reset on Enables the option to compile all C routines as interrupt routines off Disables the option to compile all C routines as interrupt routines reset Restores the option to its previous setting NOTE Use on or off to change the pragma setting and then use reset to restore the previous pragma setting DSP 100 Targeting DSP56800E C for DSP56800E Pragma Directives for DSP56800E Listing 5 2 Sample Code pragma interrupt on off reset pragma interrupt off To be used as default value Non ISR code pragma interrupt on void ISR_1 void ISR_1 code goes here void ISR_2 void ISR_2 code goes here pragma interrupt reset If the pragma is inside a function block compile the current routine as an interrupt routine If the pragma is not inside a function block compile the next routine as an interrupt routine To disable the pragma use pragma interrupt offafter pragma interrupt Listing 5 3 Listing 5 3 Sample Code pragma interrupt and function block Non ISR code void ISR_1 void pragma interrupt ISR_1 code goes
23. 150 shr_r 151 shrtNs 152 signed char size ordinal type 80 Simulator 193 sizeof 291 sizeofw 291 small memory model 62 DSP 353 Index source files editing 28 Source Trees settings panel 40 special counters 186 S record 68 69 S Record EOL Character list box 69 S Record Max Record Length field 69 stack alignment 87 stack frame for DSP56800E 86 stack pointer register 86 stack size 281 statement level inline assembly 112 stationery saving new target settings 38 stop intrinsic function 129 storage of code and data for DSP56800E 89 Store Full Path Names checkbox 66 sub 127 support web page 33 Suppress Warning Messages checkbox 68 symbols in linker command files 275 syntax inline assembly language 112 system requirements Windows 19 system level connect 245 T target and debugging panels 169 Target Name field 42 Target Settings panel options Linker list box 42 Output Directory field 42 Post Linker list box 42 Pre Linker list box 42 Target Name field 42 Target Settings panels Access Paths 40 Build Extras 40 C C Language 45 C C Warnings 51 Custom Keywords 40 Debugger Settings 40 File Mappings 40 Global Optimizations 40 M56800E Linker 65 M56800E Processor 61 M56800E Target 43 Other Executables 40 Runtime Settings 40 DSP 354 Source Trees 40 Target Settings window 37 This 15 trace buffer 187 Trace Buffer Capture Options 342 Trace Buffer Full Options 343 Trace Buffer Setup panel 188 turn_off_conv_r
24. 2 s complement rounding not convergent rounding Word16 msu_r Word32 laccum Word16 sinpl Wordl16 sinp2 short sl 0xC000 short s2 0x4000 short result long Acc 0x20000000 O45 Ef Ob result msu_r Acc sl1 s2 Expected value of result 0x4000 mult Definition Assumptions Prototype Example DSP 138 Multiply two 16 bit fractional values and truncate into a 16 bit fractional result Saturates only for the case of 0x8000 x 0x8000 When an accumulator is the destination zeroes out the LSP portion OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 mult Word16 sinpl Word16 sinp2 short sl 0x2000 0 25 short s2 0x2000 0 25 short result result mult s1 s2 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Expected value of result 0 625 0x0800 mult_r Definition Assumptions Multiply two 16 bit fractional values round into a 16 bit fractional result Saturates only for the case of 0x8000 x 0x8000 When an accumulator is the destination zeroes out the LSP portion OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled OMR s R bit was set to 1 at least 3 cycles before this code that is 2 s complement rounding not convergent rounding Prototype Word16 mult_r
25. 24 bit addressing modes Data pointers are treated as 24 bit quantities and you may store them in 2 words of memory Absolute addressing occurs as 24 bit absolute addresses Thus you may access the entire 24 bit data memory and choose to locate data objects anywhere in memory You are not required to change C source code to take advantage of the large data memory model Examples in DSP56800E assembly code of extended data addressing are Examples Extended Data Addressing move w x 0x123456 A1 tst l x RO 0x123456 move l r0 x RO cmpa r0 rl move int using 24 bit absolute address test a global long for zero using 24 bit pointer indexed addressing r0 stored as 32 bit quantity compare pointer registers as 24 bit quantities DSP 92 While the large data memory model is convenient because you can place data objects anywhere in the 24 bit data memory map it is inefficient because extended data addressing requires more program memory and execution cycles Many target applications entire global and static data will reside comfortably within the 64 KB word memory boundary With this in mind you can use the Globals live in lower memory option see Figure 5 2 on page 91 to provide the flexibility of the large data memory model with the efficiency of the small data model access to globals and statics Targeting DSP56800E C for DSP56800E Large Data Model Support NOTE Table 5 5 The Globals live in l
26. CCS Remote Connection Plugin Settings Simulator Simulator Shielded Folders Source Trees Editor Code Completion Editor Settings Font amp Tabs Text Colors Debugger Display Settings Windowing Global Settings Remote Connections RAD Tools Layout Editor y Add Change Remove Revert Import Panel Export Panel OK Cancel Apply To Add a New Remote Connection Factory Settings To add a new remote connection 1 Click the Add button The New Connection window appears as shown in Figure 7 5 Targeting DSP56800E DSP 175 Debugging for DSP56800E Command Converter Server Figure 7 5 New Connection Window New Connection x Name Remote Conmnectiorl Debugger CCs 56800E Protocol Plugin y Show in processes list Connection Type ccs Remote Connection y Use Remote CCS Server IP Address f 27 0 0 1 Port ja 475 7 Specify CCS Executable M Multi Core Debugging JTAG Configuration File ee ooo Factory Settings Revert Panel Cancel DK 2 Inthe Name edit box type in the connection name Check Use Remote CCS checkbox Select this checkbox to specify that the CodeWarrior IDE is connected to a remote command converter server Otherwise the IDE starts the command converter server locally 4 Enter the Server IP address or host machine name Use this text box to specify the IP address where
27. Commands The following is a list of flash memory commands that can be included in your initialization file set _hfmclkd lt value gt This command writes the value which represents the clock divider for the flash memory to the hfmclkd register The value for the set_hfmclkd command depends on the frequency of the clock If you are using a supported EVM this value should not be changed from the value provided in the default Targeting DSP56800E Debugging for DSP56800E Debugging in the Flash Memory NOTE NOTE NOTE Targeting DSP56800E initialization file However if you are using an unsupported board and the clock frequency is different from that of the supported EVM a new value must be calculated as described in the user s manual of the particular processor that you are using The set_hfmclkd set_hfm_base and at least one add_hfm_unit command must exist to enable flash programming All other flash memory commands are optional set_hfm_base lt address gt This command sets the address of h fm_base which is where the flash control registers are mapped in X memory The set_hfm_base and add_hfm_unit commands should not be changed for a particular processor Their values will always be the same set_hfm_config_base lt address gt This command sets the address of hfm_config_base which is where the flash security values are written in program flash memory If this command is present the debugger used the add
28. Directives for DSP56800E Description Prototype Remarks Targeting DSP56800E This section describes the pragma options available with the Metrowerks C compiler A pragma is a method for modifying compiler settings from the source code rather than the preference panels Typically you would use the settings panels to set global options and use pragmas for special cases The setting can be easily turned on and off for different portions of the code asmoutput This pragma controls the generation of an assembly file for each compiled file processed pragma asmoutput on off Each file that has assembly output activated will generate an asm file that is equivalent to the original c file The asm file is created in the same directory as the original c file and replaces the c extension with asm This pragma works for an individual file However an option is also available in the M56800E Processor panel to globally create assembly output DSP 97 C for DSP56800E Pragma Directives for DSP56800E Description Prototype Remarks Description Prototype Remarks Description Prototype Remarks DSP 98 check_c_src_pipeline This pragma controls the detection of a pipeline conflict in the C language source code when it is compiled pragma check_c_src_pipeline off conflict Use this pragma to detect and generate an error message if the C language source code has a pipeline conflict when it is
29. Fpmemwrite MOVE Y1 RO Set up pointer to address NOP Pipeline delay for RO MOVE YO P RO Write 16 bit value to address pointed to by RO in P memory and post increment RO rts return to calling function ENDSEC End of section END End of source program You can now call your assembly language function from C as shown in Listing 6 10 Targeting DSP56800E DSP 117 Inline Assembly Language and Intrinsics Calling Assembly Language Functions from C Code Listing 6 10 Sample Code Calling an Assembly Language Function from C void pmemwrite short short Write a value into P memory void main void other code Write the value given in the first parameter to the address of the second parameter in P memory pmemwrite short 0xE9C8 short 0x0010 other code DSP 118 Targeting DSP56800E Inline Assembly Language and Intrinsics Calling Functions from Assembly Language Calling Functions from Assembly Language Assembly programs can call C function or Assembly language functions This section explains the compiler convention for e Calling C Functions from Assembly Language Functions written in C can be called from within assembly language instructions For example if you defined your C program function as void foot void Do something You could then call your C function from assembly language as jsr Ffoot e Calling Assembly Language Functi
30. Global Optimizations panel Listing 5 6 Sample Code pragma optimize_for_size Function definition int afunc void Function statements pragma optimize for _size on Remaining function statements Restore optimize_for_size to its previous value pragma optimize _for_size reset The entire function afunc is compiled and optimized for size Targeting DSP56800E DSP 105 C for DSP56800E Pragma Directives for DSP56800E define_section Description This pragma controls the definition of a custom section Prototype tfpragma define section lt sectname gt lt istring gt lt ustring gt lt accmode gt Remarks Arguments lt sectname gt Identifier by which this user defined section is referenced in the source that is via the following instructions e pragma section lt sectname gt begin e _declspec lt sectname gt lt istring gt Section name string for initialized data assigned to lt section gt For example data Optional Arguments lt ustring gt Section name string for uninitialized data assigned to lt section gt If ustring is not specified than istring is used lt accmode gt One of the following indicating the attributes of the section R readable RW readable and writable Note this is the default RX readable and executable RWX readable writable and executable Note The default is RW DSP 106 Targeting DSP56800E C for DSP56800
31. Panels The M56800E Target panel options are e Always reset on download Select this checkbox to cause the CodeWarrior IDE to issue a reset to the target board each time you connect to the board e Use initialization file Optionally you may want to specify an initialization file The initialization file is a text file that instructs the debugger how to initialize the hardware after reset but before downloading code Use the initialization file commands to write values to various registers memory locations and to set up flash memory parameters Four initialization files are provided 56852E_ext_xp cfg 56858E_ext_xp cfg 56838E_ext_xp cfg and 56838E_Flash cfg They are located at the following path CodeWarrior path M56800E Support initialization The first three files enable external memory on the DSP56852 DSP56858 and DSP56838 respectively The file 56838E_Flash cfg enables flash memory on the DSP56838 Use the appropriate file if you intend to use external memory or program the flash memory To set up the initialization file 1 Select the checkbox Use initialization file in the M56800E Target panel 2 Use either of the following options to enter the file name e Type in the file name in the text box If a full path is not specified the debugger searches for the file in the project directory If the file is not found the debugger then searches for the file in the following path CodeWarrior path M56800E Support ini
32. Reuse Strings Select this option if you want the compiler to store each string literal separately When you select this option the compiler stores only one copy of identical string literals This option helps you save memory if your program contains identical string literals that you would not modify If you select this option and if you change one of the strings all the strings will be changed e Require Function Prototypes Select this option if you want the compiler to generate an error when you use a function that is defined after it is referenced and does not have a prototype If the function is implicitly defined that is defined before it is referenced and does not have a prototype then the compiler will issue a warning when this option is on This option helps you to prevent errors that occur when you call a function before you declare or define it For example without a function prototype you may pass data of the wrong type Asa result your code may not work as you expect even though it compiles without error To check whether this option is on use _ option require prototypes DSP 50 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels C C Warnings Settings in the C C Warnings panel Figure 4 5 affect only C language features implemented for DSP56800E NOTE The CodeWarrior compiler for DSP56800E does not support C There are no C warning features applicable to DSP5
33. Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion This operation is not optimal on the DSP56800E because of the saturation requirements and the bidirectional capability See the intrinsic shlfts which is more optimal OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 shr_r Word16 s _val2shft Wordl6 s_shftamount short result short sl 0x2468 short s2 1 result shr sl1 s2 Expected value of result 0x1234 DSP 151 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support shrtNs Definition Note Prototype Example Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed Saturation does not occur during a left shift When an accumulator is the destination zeroes out the LSP portion Ignores upper N 5 bits of s_shftamount except the sign bit MSB If s_shftamount is positive and the value in the lower 5 bits of s_shftamount is greater than 15 the result is 0 if sval2shft is positive and OxFFFF is sval2shft is negative If s_shftamount is negative and the absolute value in the lower 5 bits of s_shftamount is greater than 15 the result is 0 Word16 shrtNs Word16 sval2shft Wordl16 s_shftamount short result short sl 0x2468 short s2 1 res
34. The Linker Command File LCF performs all the necessary stack and heap initialization When Stationery is used to create a new project the appropriate LCFs are added to the new project See any Stationery generated LCFs for examples of how stack and heap are initialized Targeting DSP56800E DSP 281 ELF Linker and Command Language Linker Command File Syntax Writing Data Directly to Memory You can write data directly to memory using the WRITEx command in the linker command file The WRITEB command writes a byte the WRITEH command writes two bytes and the WRITEW command writes four bytes You insert the data at the section s current address Listing 9 20 Embedding Data Directly Into Output example data_section WRITEB 0x48 H WRITEB 0x69 Lid pal WRITEB 0x21 El os DSP 282 Targeting DSP56800E ELF Linker and Command Language Linker Command File Keyword Listing Linker Command File Keyword Listing This section explains the keywords available for use when creating CodeWarrior for DSP56800E application objects with the linker command file Valid linker command file functions keywords directives and commands are location counter Definition Example Targeting DSP56800E The period character always maintains the current position of the output location Since the period always refers to a location in a SECTIONS block it can not be used outside a section definition A period may appe
35. To call the command line tools use the following format Format Tools File Names Format Compiler mwcc56800e exe compiler options linker options file list Linker mwld56800e exe linker options file list Assembler mwasm56800e exe assembler options file list The compiler automatically calls the linker by default and any options from the linker is passed on by the compiler to the assembler However you may choose to only compile with the c flag In this case the assembler will only assemble and will not call the linker Also available are environment variables These are used to provide path information for includes or libraries and to specify which libraries are to be included You can specify the variables listed in Table 9 3 Environment Variables Tool Library Description Compiler MWC56800Elncludes Similar to Access Paths panel separate paths with and prefix a path with to specify a recursive path DSP 293 ELF Linker and Command Language DSP56800E Command Line Tools Tool Library Description Linker MW56800E Libraries Similar to MWC56800E Includes MW56800E LibraryFiles List of library names to link with project separate with Assembler MWAsm56800Elncludes similar to MWC56800E Includes These are the target specific variables and will only work with the DSP56800E tools The generic variables MWCIncludes MWLibraries MWLibraryF
36. To download electronic copies of these manuals or order printed versions visit this web address http www motorola com Targeting DSP56800E DSP 17 Introduction References DSP 18 Targeting DSP56800E Getting Started This chapter explains how to install and run the CodeWarrior IDE on your Windows operating system This chapter also explains how to connect your hardware for each of the communications protocols supported by the CodeWarrior debugger This chapter contains the following sections e System Requirements e Installing the CodeWarrior IDE for DSP56800E e Creating a Project e Editing the Contents of a Project System Requirements Table 2 1 Targeting DSP56800E This section lists the system requirements to operate the CodeWarrior IDE for DSP56800E Table 2 1 lists requirements for installing and operating the CodeWarrior IDE Requirements for the CodeWarrior IDE Category Requirement Hardware 133 MHz Pentium compatible processor 64 MB RAM CD ROM drive for installation Software Microsoft Windows 98 2000 NT XP Other 200 MB hard drive space DSP56800E Hardware Requirements The hardware requirements necessary to debug the DSP56800E are DSP 19 Getting Started Installing the CodeWarrior IDE for DSP56800E e Power Supply e 56800E EVM or Custom 56800E Development Board with a JTAG header connected Installing the CodeWarrior IDE for DSP56800E The CodeWarrior in
37. Word16 abs_s Word1l6 svarl Example int result sl OXxE000 0 25 result abs_s sl1 Expected value of result 0x2000 0 25 negate Definition Negates a 16 bit integer or fractional value returning a 16 bit result Assumptions Prototype Example Returns 0x7FFF for an input of 0x8000 OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 negate Word16 svarl int result sl 0xE000 0 25 result negate sl Expected value of result 0x2000 0 25 Targeting DSP56800E DSP 124 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_abs Definition Assumptions Absolute value of a 32 bit integer or fractional value returning a 32 bit result Returns Ox7FFFFFFF for an input of 0x80000000 OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_abs Word32 lvarl Example long result 1 0xE0000000 0 25 result L_abs s1 Expected value of result 0x20000000 0 25 L_negate Definiton Negates a 32 bit integer or fractional value returning a 32 bit result Assumptions Prototype Example Targeting DSP56800E Returns 0x7FFFFFFF for an input of 0x80000000 OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_negate Word32 lvarl
38. address modes allows access beyond the 64K word boundary set by 16 bit addressing Globals live in lower memory This option is available only if the checkbox for Large Data Model is selected This option instructs the compiler to access global and static data with 16 bit addresses while all pointer and stack operations are performed using 24 bit addressing e Pad pipeline for debugger You must enable this option when using the debugger This option inserts a NOP after certain branch instructions required to make the breakpoints work reliably Due to the extra NOP instructions there is a growth of about 5 in the code If you do not set this option you may not recover the branch instructions after the debugger comes across a breakpoint Also select the Pad pipeline for debugger option in the M56800E Assembler Settings panel Figure 4 6 Emit separate character data section If enabled all character data is broken out and placed into its own data sections The compiler automatically selects the proper section The available sections are data char Initialized static or global character data objects are placed here bss char Uninitialized static or global character data objects are placed here const data char Const qualified character objects and static string data are placed here You can locate these sections in the lower half of the memory map thus ensuring that the data can be addressed For more information se
39. allowing developers to create custom or proprietary tools For more information go to Metrowerks Support at this URL DSP 33 Development Studio Overview The Development Process DSP 34 http www metrowerks com MW Support Once the compiler generates object code the plug in linker generates the final executable file Multiple linkers are available for some platform targets to support different object code formats Linking To link object code into a final binary file select Project gt Make from the menu bar of the Metrowerks CodeWarrior window The Make command brings the active project up to date then links the resulting object code into a final output file The CodeWarrior IDE controls the linker through the use of linker command files There is no need to specify a list of object files The Project Manager tracks all the object files automatically You can also use the Project Manager to specify link order The Target gt M56800E Target settings panel lets you set the name of the final output file Debugging To debug a project select Project gt Debug from the menu bar of the Metrowerks CodeWarrior window Viewing Preprocessor Output To view preprocessor output select the file in the project window and select Project gt Preprocess from the menu bar of the Metrowerks CodeWarrior window The CodeWarrior IDE displays a new window that shows you what your file looks like after going through the preprocessor Yo
40. an interactive tool Launching and Operating the Debugger NOTE CodeWarrior IDE automatically enables the debugger and sets de bugger related settings within the project 1 Set debugger preferences Select Edit gt sdm Settings from the menu bar of the Metrowerks CodeWarrior window The IDE displays the Remote Debugging window DSP 194 Targeting DSP56800E Debugging for DSP56800E Launching and Operating the Debugger Figure 7 16 Remote Debugging Panel a sdm external memory Settings 21xi Target Settings Panels Remote Debugging Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations Linker ELF Disassembler M56800E Linker Editor Custom Keywords Debugger Other Executables Debugger Settings Remote Debugging MB56800E Target Remote Debug Opt Connection Settings Connection Local Hardware Connection CCS y Edit Connection ii download path peer M F Launch remote host application i Clock Speed e000 ia Factory Settings Revert Import Panel Export Panel Targeting DSP56800E OK Cancel Apply Select the Connection For example select Local Hardware Connection CCS Click OK button Debug the project Use either of the following options e From the Metrowerks CodeWarrior window select Project gt Debug e Click the Debug button in the project window
41. apply to the current build target Targeting DSP56800E DSP 37 Target Settings Target Settings Overview DSP 38 To view the Target Settings panel Click on the name of the Target Settings panel in the Target Settings panels list on the left side of the Target Settings window The CodeWarrior IDE displays the target settings panel that you selected Change the settings in the panel Click OK Exporting and Importing Panel Options to XML Files The CodeWarrior IDE can export options for the current settings panel to an Extensible Markup Language XML file or import options for the current settings panel from a previously saved XML file Exporting Panel Options to XML File Click the Export Panel button Assign a name to the XML file and save the file in the desired location Importing Panel Options from XML File Click the Import Panel button Locate the XML file to where you saved the options for the current settings panel Open the file to import the options Saving New Target Settings in Stationery To create stationery files with new target settings Create your new project from an existing stationery Change the target settings in your new project for any or all of the build targets in the project Save the new project in the Stationery folder Targeting DSP56800E Target Settings Target Settings Overview Restoring Target Settings After you change settings in an existing project you can restore the
42. base of a section Integral Types The syntax for linker command file expressions is very similar to the syntax of the C programming language All integer types are long orunsigned long Octal integers commonly know as base eight integers are specified with a leading zero followed by numeral in the range of zero through seven Listing 9 13 shows valid octal patterns that you can put into your linker command file DSP 276 Targeting DSP56800E ELF Linker and Command Language Linker Command File Syntax Listing 9 13 Sample Octal Patterns _octal_number _octal_number2 012 03245 Decimal integers are specified as a non zero numeral followed by numerals in the range of zero through nine To create a negative integer use the minus sign in front of the number Listing 9 14 shows examples of valid decimal integers that you can write into your linker command file Listing 9 14 Sample Decimal Integers _dec_num 9999 _decimalNumber 1234 Hexadecimal base sixteen integers are specified as 0x or 0X a zero with an X followed by numerals in the range of zero through nine and or characters A through F Examples of valid hexadecimal integers that you can put in your linker command file appear in Listing 9 15 Listing 9 15 Sample Hex Integers _somenumber 0x0F21 _fudgefactorspace OXFOOD _hexonyou Oxcafe Targeting DSP56800E DSP 277 ELF Linker and Command Language Linker Comman
43. bits counter2 unsigned long This parameter holds the most significant 24 bits if the counter has been extended to 40 bits This parameter must be a valid pointer even if the counter has not been extended This function retrieves the value of the counter of the specified breakpoint unit This function is most useful when using the special counting function of the breakpoint but can also be used to retrieve the trigger occurrence counter 4 Error code as defined in the sub section Definitions on page 334 DSP 325 Libraries and Runtime Code EOnCE Library _eonce_GetCounterStatus Prototype Parameters Remarks Returns DSP 326 Retrieves the status of the breakpoint counter int _eonce_GetCounters char counterlsZero char counterIsStopped counterIsZero char This parameter returns a 1 if the breakpoint counter has reached Zero counterIsStopped char This parameter returns a 1 if the breakpoint counter has been stopped by a Counter Stop Trigger This function returns the state of the breakpoint counter when using the special counting function Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce_SetupTraceBuffer Prototype Parameters Remarks Returns Targeting DSP56800E Configures the behavior of the trace buffer int _eonce_SetupTraceBuffer unsigned int options option
44. command followed by a space e The hint shows the syntax for the remainder of the command e To scroll through all of the debugger specific commands that you can use on the command line press the space bar when the cursor is at the start of the command line in the debugging window The highlighted portions of the commands indicate shortcuts that can be used for commands Press the space bar after typing a shortcut to complete the command automatically Repeat a Command Line Debugging Command To execute a debugging command again in the command line debugging window Type the debugging command and press Enter This executes the command the first time Press Enter again This executes the same command again Alternatively type an exclamation point followed by the ID number of the command and press Enter To see the ID numbers of commands execute the history debug ging command Review Previously Entered Commands To sequentially review previously entered commands press the Up Arrow and Down Arrow keys DSP 211 Debugging for DSP56800E Command Line Debugging DSP 212 NOTE Clear a Command from the Command Line To clear a command from the command line that you have typed but not yet executed press the Escape key Stop an Executing Script To stop a script that is executing press the Escape key Switch between Insert and Overwrite Mode To switch between insert and overwrite mode when entering commands on
45. compiled In some cases the source code can be a mix of assembly language and C language The option conflict only detects and generates error messages for pipeline conflict check_inline_asm_pipeline This pragma controls the detection of a pipeline conflict in the assembly language source code when it is compiled pragma check_inline_asm_pipeline off conflict conflict_and_stal1 Use this pragma to detect and generate an error message if the assembly language source code has a pipeline conflict when it is compiled In some cases the source code can be a mix of assembly language and C language The option conflict only detects and generates error messages for pipeline conflict The option conflict_and_stall detects and generates error messages for pipeline conflicts and stalls interrupt This pragma controls the compilation of object code for interrupt routines pragma interrupt lt options gt lt mode gt on off reset An Interrupt Service Routine ISR is a routine that is executed when an interrupt occurs Setting C routines as ISRs is done using Targeting DSP56800E C for DSP56800E Pragma Directives for DSP56800E pragmas pragma interrupt To make a routine service an interrupt you must e Write the routine e Set up the routine so that it is called when some interrupt occurs The pragma interrupt option can be used to perform the following e Instruct the compiler to push register values
46. directory that have a file extension of txt dir c tmp This example lists all files in the tmp directory of the C drive dir ad This example lists only the subdirectories in the current directory ls usr This example lists the contents of the subdirectory called usr disassemble Use the disassemble debugging command to disassemble the instructions in the specified memory block The syntax for the disassemble command follows di sassemble addr_block addr_block address_first address_last address count count a value indicating the number of memory locations Table 7 14 shows examples of the disassemble command Targeting DSP56800E DSP 223 Debugging for DSP56800E Command Line Debugging Table 7 14 Debugging Command Examples disassemble Example Description disassemble Disassembles instructions from PC if changed last address disassemble p 0 20 Disassembles program memory address block 0 to 20 disassemble p 50 10 Disassembles 10 memory locations starting at memory map hexadecimal 50 display Use the display debugging command to e Display the contents of a register or memory location e List all the register sets on a target e Add one or more register sets registers or memory locations to the default display items e Remove one or more register sets registers or memory locations from the default display items The memory output radix is specified by th
47. display complete list of active optimizations no dead display dump e OE HEHE HEHEHE HEHEHE HEHEHE HEHE HEHEHE H HOH H H DO keyword for this tool specify hardware DO loops off no hardware DO loops default nonested hardware DO loops but no nested ones nested nested hardware DO loops padpipe for this tool ldata largedata for this tool data space not limited to 64K for this tool globalsInLowerMemory pad pipeline for debugger globals live in lower memory implies large data model sprog smallprog for this tool program space limited to 64K DSP 302 Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools Debugging Control Options sym keyword off on full path w arn ings keyword off on no cmdline no err or no iserr or all no pragmas no illpragmas no empty dec no possible no unwanted no unusedarg no unusedvar no unused no extracomma no comma no pedantic no extended no hidevirtual no hidden virtual no implicit conv no notinlined no largeargs no structclass no padding no notused no unusedexpr no ptrintconv Targeting DSP56800E lobal cased generate debugging information same as sym full lobal specify debugging options do not generate debugging informat
48. following command to save the configuration config save 8 Press Enter Targeting DSP56800E DSP 173 Debugging for DSP56800E Command Converter Server Changing the Command Converter Server Protocol to PCI To change the command converter server to a PCI Connection 1 While the command converter server is running right click on the command converter server icon shown in Figure 7 1 or double click on it 2 From the menu shown in Figure 7 2 select Show Console 3 At the console command line in the Metrowerks Command Converter Server window shown in Figure 7 3 type the following command delete all 4 Press Enter Type the following command config cc pci Press Enter 7 Type the following command to save the configuration config save 8 Press Enter Setting Up a Remote Connection A remote connection is a type of connection to use for debugging along with any preferences that connection may need To change the preferences for a remote connection or to create a new remote connection 1 On the main menu select Edit gt Preferences The IDE Preferences Window appears 2 Click Remote Connections in the left column The Remote Connections panel shown in Figure 7 4 appears DSP 174 Targeting DSP56800E Debugging for DSP56800E Command Converter Server Figure 7 4 Remote Connections Panel 21xi IDE Preference Panels Remote Connections General Build Settings IDE Extras Local Hardware Connection CCS
49. here pragma interrupt void ISR_2 void ISR_2 code goes here See Listing 5 4 for an example of using the called option in the interrupt pragma Targeting DSP56800E DSP 101 C for DSP56800E Pragma Directives for DSP56800E Listing 5 4 Sample Code using the called option in pragma interrupt extern long Datal Data2 Datain void ISR1_inc_Datal_by_Data2 void This is a routine called by the interrupt service routine ISR1 pragma interrupt called Datal Data2 return void ISR1 void This is an interrupt service routine pragma interrupt Data2 Datain 2 ISR_inc_Datal_by_Data2 DSP 102 Targeting DSP56800E C for DSP56800E Pragma Directives for DSP56800E Targeting DSP56800E Avoiding Possible Hitches with enabled Pragma Interrupt Enabling pragma interrupt with the called or default mode for a C routine saves only the volatile registers for that C routine Register values are not preserved if the ISR makes one or more function calls You might want to avoid the situations described below e Ifa routine that has pragma interrupt enabled caller calls another C function routine callee it is possible that the callee can change some registers that are not saved by the caller To avoid this use either of the following options Call only pragma interrupt enabled routines from routines that are pragma interrupt enabled using t
50. language modules or libraries Targeting DSP56800E C for DSP56800E Optimizing Code for DSP56800E To prevent compatibility issues between C object files built with the large data memory model and those built with the small data memory model the memory model is encoded into the object file The linker verifies that all objects linked into an executable have compatible memory models The ELF header s e_flags field contains bit fields in which encode the data memory model attributes of the object file define EF_M56800E_LDMM 0x00000001 Large data memory model flag Additionally C language objects are identified by an ELF header flag define EF_M56800E_C 0x00000002 Object file generated from C source Optimizing Code for DSP56800E This section explains register coloring an optimization specific to DSP56800E development The C compiler performs register coloring In this optimization the compiler may assign two or more register variables to the same register The compiler does this optimization if the code is not using the variables at the same time In the following example the compiler can place i and j in the same register Listing 5 1 Sample Code Register Coloring short 1 int j for 1i 0 for 3 0 1 lt 100 i MyFunc i j lt 100 j MyFunc j However if the code includes the expression MyFunc i j it indicates to the compiler that i and j are simu
51. link and debug code all within the CodeWarrior IDE Options for code generation debugging and navigation of your project are all configurable in the CodeWarrior IDE 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 those features unique to the CodeWarrior IDE for the DSP56800E For a complete understanding of the CodeWarrior IDE refer to the CodeWarrior IDE User s Guide for general information and this manual for information specific to the DSP56800E processor The CodeWarrior Release Notes contain information about new fea tures bug fixes and incompatibilities that do not appear in the docu mentation because of release deadlines Release Notes are on the CodeWarrior IDE CD Targeting DSP56800E Introduction New In This Release New In This Release Additions in this version are e Large data memory model support e Inline 32 bit multiply routines e Emit separate character section option in preference panel e pragma interrupt comr option e pragma optimize_for_size on off reset option References e The following manuals are included with this product Code Warrior IDE User s Guide Assembler Reference Manual MSL C Reference Metrowerks Standard C libraries e To learn more about the DSP56800E processor refer to the following manual DSP56800E Family Manual Motorola Inc 2001
52. mask When a data compare trigger is selected this edit box becomes available This value specifies which bits of the data value are compared e Invert data compare When a data compare trigger is selected this checkbox becomes available When checked the comparison result of the data value is inverted logical NOT e Breakpoint counter This edit box specifies the number of times a sub trigger preceded by a see above must occur to cause a trigger e Advanced trigger This pull down list contains options for combining triggers The types of triggers that can be combined are triggers set in this panel and core events e Core events This set of checkboxes specify which core events are allowed to enter the breakpoint logic and cause a trigger DEBUGEV trigger enabled When this checkbox is selected the DEBUGEV instruction causes a core event Overflow trigger enabled When this checkbox is selected overflow and saturation conditions in the processor cause core events e Use step counter to execute DSP 192 Targeting DSP56800E Debugging for DSP56800E Using the DSP56800E Simulator When this checkbox is selected the processor steps through additional instructions after a trigger is signalled The number of instructions to be stepped is specified in the edit box that is enabled when this checkbox is checked Using the DSP56800E Simulator NOTE Figure 7 14 Targeting DSP56800E The CodeWarrior
53. mode between assembly mode and register mode The syntax for the view command follows v iew a r Table 7 30 shows examples of the view command Debugging Command Examples view Example Description view Toggle the view mode view a Set the view mode to assembly mode view r Set the view mode to register mode view a 100 Display the assembly that begins at hexadecimal address 100 wait Use the wait debugging command to cause the debugger to wait for the specified amount of time The syntax for the wait command follows w ait milliseconds Table 7 31 shows examples of the wait command Targeting DSP56800E Debugging for DSP56800E System Level Connect Table 7 31 NOTE Table 7 32 Debugging Command Examples wait Example Description wait The debugger waits until you press the space bar on the keyboard wait 2 The debugger waits for two milliseconds watchpoint Use the wat chpoint debugging command to add remove or display a watchpoint Due to hardware resource limitations you can set only one watch point at a time The syntax for the wat chpoint command follows wat chpoint variable_name watchpoint_id off Table 7 31 shows examples of the watchpoint command Debugging Command Examples watchpoint Example Description watchpoint The debugger displays the watchpoint list watchpoint i The debugger adds the variable i to the watchpoint list Sys
54. new file gt gt fileName Appends the segment to an existing file DSP 288 Targeting DSP56800E ELF Linker and Command Language Linker Command File Keyword Listing OBJECT Definition The OBJECT keyword allows control over the order in which functions are placed in the output file Prototype OBJECT function sourcefile c It is important to note that if you write an object to the output file using the OBJECT keyword the same object will not be written again by either the GROUP keyword or the wildcard REF_INCLUDE Definition The REF_INCLUDE directive allows you to specify sections that you do not want the linker to deadstrip but only if they satisfy a certain condition the file that contains the section must be referenced This is useful if you want to include version information from your source file components You must specify the section s you want to keep before you use the SECTIONS keyword Prototype REF _INCLUDE sectionType sectionType SECTIONS Definition A basic SECTIONS directive has the following form Prototype SECTIONS lt section_spec gt Targeting DSP56800E section_spec is one of the following e sectionName AT loadAddress contents gt segmentName e sectionName AT load Address contents gt gt segmentName sectionName is the section name for the output section It must start with a period character For example mysection DSP 289 ELF Linker and Command Language Link
55. on the software stack at entry to a C function and restore them upon exit e Preserve the register values for the function that was interrupted e Emit an RTI for the return statement depending upon the mode selected If the interrupt routine has a return value the return register is not saved There are several ways to use this pragma with an on off reset arguments or with no arguments Arguments lt options gt alignsp Aligns the stack pointer register correctly to allow long values to be pushed on to the stack Use this option when your project mixes C code and assembly code Use this option specifically on ISRs which may interrupt assembly routines that do not maintain the long stack alignment requirements at all times Restores the stack pointer to its original value before returning from the subroutine comr The Operating Mode Register OMR is set for the following to ensure correct execution of C code in the ISR 36 bit values used for condition codes CM bit cleared Convergent Rounding R bit cleared No Saturation mode SA bit cleared Instructions fetched from P memory XP bit cleared lt mode gt saveall Preserves register values by saving and restoring all registers by calling the INTERRUPT_SAVEALL and INTERRUPT _ RESTOREALL routines in the Runtime Library Targeting DSP56800E DSP 99 C for DSP56800E Pragma Directives for DSP56800E called Preserves register values by saving and restoring registers
56. option for name maximum length 63 chars show help for an option whose name or help contains keyword case sensitive for keyword maximum length 63 chars show help for groups whose names contain keyword case sensitive for keyword maximum length 63 chars categorize groups of options by tool default show all options available in this tool show options executed by this tool default show options passed to another tool show options used in all tools global for this tool show version configuration and build date global collect timing statistics global show progress and version global verbose information cumulative implies progress global search access paths for source files specified on the command line may specify object code and libraries as well this option provides the IDE s access paths Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools style no stderr global use separate stderr and stdout streams if using nostderr stderr goes to stdout functionality no wraplines global word wrap messages default maxerrors max specify maximum number of errors to print zero means no maximum default is 0 maxwarnings max specify maximum number of warnings to print zero means no maximum default is 0 msgstyle keyword global set error warning message style mpw use MPW message style std use standard message style defau
57. path location of full path Allocating Stacks and Heaps for the DSP56800E Stationery linker command files LCF define heap stack and bss locations LCFs are specific to each target board When you use M56800E stationery to create a new project CodeWarrior automatically adds the LCF to the new project See ELF Linker and Command Language for general LCF information See each specific target LCF in Stationery for specific LCF information See Table 10 2 for the variables defined in each Stationery LCF LCF Variables and Address Variables Address _stack_addr the start address of the stack _heap_size the size of the heap _heap_addr the start address of the heap _heap_end the end address of the heap Targeting DSP56800E Libraries and Runtime Code MSL for DSP56800E NOTE Targeting DSP56800E Variables Address _bss_start start address of memory reserved for uninitialized variables _bss_end end address of bss To change the locations of these default values modify the linker command file in your DSP56800E project Ensure that the stack and heap memories reside in data memory Definitions Stack The stack is a last in first out LIFO data structure Items are pushed on the stack and popped off the stack The most recently added item is on top of the stack Previously added items are under the top the oldest item at the bottom The top of the stack may be in low memory or high memor
58. read nmemb This parameter specifies the number of data elements to read channel_id This parameter specifies the channel ID of the communication channel from which to read read This parameter contains the number of data elements read This function returns S_OK if the call succeeds or S_ FALSE if the call fails DSP 253 High Speed Simultaneous Transfer Host Side Client Interface hsst_write Returns DSP 254 A host side client application uses this function to write data that the target application can read without stopping the core HRESULT hsst_write void data size_t size size_t nmemb size_t channel_id size_t written data This parameter specifies the data buffer that holds the data to write size This parameter specifies the size of the individual data elements to write nmemb This parameter specifies the number of data elements to write channel_id This parameter specifies the channel ID of the communication channel to write to written This parameter contains the number of data elements written This function returns S_OK if the call succeeds or S_FALSE if the call fails Targeting DSP56800E High Speed Simultaneous Transfer Host Side Client Interface hsst_size Returns A host side client application uses this function to determine the size of unread data in bytes in the communication channel HRESULT hsst_size size_t channel_id size_t unread chan
59. result OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_add Word32 src_dst Word32 src2 long la 0x40000000 0 5 long lb 0x20000000 0 25 long result result L_add la 1b Expected value of result 0x60000000 0 75 DSP 127 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_sub Definition Assumptions Prototype Example DSP 128 Subtraction of two 32 bit integer or fractional values returning a 32 bit result OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_sub Word32 src_dst Word32 src2 long la 0x40000000 0 5 e long 1b 0xE0000000 0 25 long result result L_sub la lb Expected value of result 0x60000000 0 75 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Control Click any of these links to jump to the corresponding intrinsic functions e stop e wait e turn off conv rndg e turn off sat e turn on conv rnd e turn on sat stop Definition Generates a STOP instruction which places the processor in the low power STOP mode Prototype void stop void Usage stop wait Definition Generates a WAIT instruction which places the processor in the low power WAIT mode Prototype void wait void Usage
60. specified communication channel The client application receives a notification whenever data is available to read from the specified channel HSST notifies the client application that data is available to read from the specified channel The client must implement this function void NotifiableHSSTClient Update size_t descrip tor size_t size size_t nmemb HSST calls the Notifiable HSST Client Update function when data is available to read HRESULT hsst_attach_listener size_t cid NotifiableHSSTClient subscriber cid This parameter specifies the channel ID of the communication channel to listen to Targeting DSP56800E High Speed Simultaneous Transfer Host Side Client Interface subscriber This parameter specifies the address of the variable of class Notifiable HSST Client Returns This function returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_detach_listener Returns Use this function to detach a host side client application that you previously attached as a listener to the specified communication channel HRESULT hsst_detach_listener size_t cid cid This parameter specifies the channel ID of the communication channel from which to detach a previously specified listener This function returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_set_log_dir Targeting DSP56800E A host side client application uses this function to set a log directory for th
61. that appears By default the History combo box displays the most recent settings on subsequent viewings Memory Type Combo Box The memory types that can appear in the Memory Type Combo box are e P Memory Program Memory e X Memory Data Memory Address Text Field Specify the address where you want to write the memory If you want it to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Size Text Field Specify the number of words to write to the target If you want it to be interpreted as hex prefix your entry with 0x otherwise it is interpreted as decimal Fill Expression Text Field Fill writes a set of characters to a location specified by the address field on the target repeatedly copying the characters until the user supplied fill size has been reached Size is the total words written not the number of times to write the string Interpretation of the Fill Expression The fill string is interpreted differently depending on how it is entered in the Fill String field Any words prefixed with 0x is interpreted as hex bytes Thus 0xBE 0xEF would actually write OxBEEF on the target Optionally the string could have been set to DSP 181 Debugging for DSP56800E Save Restore Registers OxBEEF and this would do the same thing Integers are interpreted so that the equivalent signed integer is written to the target ASCII Strings ASCII strings can be quoted to have literal interp
62. that you can see your project at a glance and easily navigate among your source code files The Code Warrior IDE automatically manages build dependencies A project can have multiple build targets A build target is a separate build with its own settings that uses some or all of the files in the project For example you can have both a debug version and a release version of your software as separate build targets within the same project The CodeWarrior IDE has an extensible architecture that uses plug in compilers and linkers to target various operating systems and microprocessors The CodeWarrior CD includes a C compiler for DSP 29 Development Studio Overview CodeWarrior IDE DSP 30 NOTE the DSP56800E family of processors Other CodeWarrior software packages include C C and Java compilers for Win32 Mac OS Linux and other hardware and software combinations CodeWarrior Compiler for DSP56800E The CodeWarrior compiler for DSP56800E is an ANSI compliant C compiler This compiler is based on the same compiler architecture used in all Code Warrior C compilers When it is used together with the CodeWarrior linker for DSP56800E you can generate DSP56800E applications and libraries The CodeWarrior compiler for DSP56800E does not support C CodeWarrior Assembler for DSP56800E The CodeWarrior assembler for DSP56800E has an easy to use syntax The CodeWarrior IDE assembles any file with an asm extension in the proj
63. the following taken instructions BCC forward branch BRSET forward branch BRCLR forward branch JCC forward and backward branches Backward branches excluding JCC backward branches Select this checkbox to capture target addresses of the following taken instructions BCC backward branch BRSET backward branch BRCLR backward branch Set trigger s Select this button to open the Set Trigger panel Figure 7 13 For more information on using this panel see Set Trigger Panel on page 191 The resulting trigger halts trace buffer capture e Capture initially halted started by trigger When this option is checked the trace buffer starts off halted e Buffer full action This pull down list lets you select the resulting action caused by the trace buffer filling Set Trigger Panel The Set Trigger panel Figure 7 13 lets you set triggers for all the EOnCE functions It can be accessed from the panels used to DSP 190 Targeting DSP56800E Debugging for DSP56800E EOnCE Debugger Features configure those functions The options available change depending on the function being configured Figure 7 13 Set Trigger Panel Set Trigger j xj Primary trigger type Program trigger y Advanced trigger Primary trigger core event y Primary trigger E Program access y A Core events V DEBUGEY trigger enabled 0x0 Program address 0x0 Data compare length shit 0x1 instructions after trigger CT6bt Note Usin
64. the 16 bit integer or fractional value into the lower 16 bits of a 32 bit value and sign extends the upper 16 bits of a 32 bit value Prototype Word32 L_deposit_1 Word16 ssrc Example short sl Ox7FFF long result result L_deposit_1l s1 Expected value of result 0x00007FFF Targeting DSP56800E DSP 133 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Division Click any of the following links to jump to the corresponding intrinsic functions e div s e div _s4q e div ls e div Is4q div_s Definition Note Prototype Example DSP 134 Single quadrant division that is both operands positive of two 16 bit fractional values returning a 16 bit result If both operands are equal returns 0x7FFF occurs naturally Does not check for division overflow cases Does not check for divide by zero cases Word16 div_s Word16 s_denominator Word16 s_ numerator short s1 0x2000 0 25 short s2 0x4000 0 5 short result result div_s s2 s1l Expected value of result 0 25 0 5 0 5 0x4000 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support div_s4q Definition Note Prototype Example Four quadrant division of two 16 bit fractional values returning a 16 bit result Does not check for division overflow cases Does not check for divide by zero cases Word16 div_s4q Word16 s_numerator Wordl6 s_de
65. the case with sectionName SIZEOFW Definition The SIZEOFW function returns the size of the given segment or section The return value is the size in words Prototype SIZEOFW sectionName segmentName symbol In order to use segmentName with this command the segment Name must start with the period character even though segment Names are not required to start with the period character by the linker as is the case with sectionName WRITEB Definition The WRITEB command inserts a byte of data at the current address of a section Prototype WRITEB expression expression is any expression that returns a value 0x00 to OxFF Targeting DSP56800E DSP 291 ELF Linker and Command Language Linker Command File Keyword Listing WRITEH Definition The WRITEH command inserts two bytes of data at the current address of a section Prototype WRITEH expression expression is any expression that returns a value 0x0000 to OxFFFF WRITEW Definition The WRITEW command inserts 4 bytes of data at the current address of a section Prototype WRITEW expression expression is any expression that returns a value 0x00000000 to OXFFFFFFFF DSP 292 Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools DSP56800E Command Line Tools Table 9 2 Table 9 3 Targeting DSP56800E This section contains the following topics e Usage e Response File e Sample Build Script e Arguments Usage
66. the command converter server resides when running the command converter server from a location on the network 5 Enter the Port to which the command converter server listens or use the default port which is 41475 DSP 176 Targeting DSP56800E Debugging for DSP56800E Load Save Memory Click the OK button To Change an Existing Remote Connection To change an existing remote connection Double click on the connection name that you want to change or click once on the connection name and click the Change button shown in Figure 7 4 in grey To Remove an Existing Remote Connection To remove an existing remote connection Click once on the connection name and click the Remove button shown in Figure 7 4 in grey Debugging a Remote Target Board For debugging a target board connected to a remote machine with Code Warrior IDE installed perform the following steps Connect the target board to the remote machine Launch the command converter server CCS on the remote machine with the local settings configuration using instructions Ms described in the section Essential Target Settings for Command Converter Server on page 171 In the Target Settings gt Remote Debugging panel for your project make sure the proper remote connection is selected Launch the debugger Load Save Memory Targeting DSP56800E From the menu bar of the Metrowerks CodeWarrior window select Debug gt Load Save Memory to displa
67. times count 1 will be written to the BCNTR register STB sub trigger starts the trace buffer HTB sub trigger halts the trace buffer Counter Trigger Modes The following triggers generate a Counter Stop Trigger The exceptions are the modes that generate both start and stop triggers DSP 336 Targeting DSP56800E Libraries and Runtime Code EOnCE Library Listing 10 3 The defined identifiers listed in Listing 10 3 must be OR ed into the options parameter of the _eonce_SetCounterTrigger function A key for the defined identifiers listed in Listing 10 3 is given in Table 10 6 Counter Trigger Modes B1PA B1PR B1PW B2PF wW w wW wW w w wW wW 1XA_ 1PF_ 1PA_ 1XR_AND_B2DR 1XW_ 1XA_ 1PF_ 1PA_ B2PF_ B1XA B2PF_ B1XW_ B2PF_ B1XR_ B2PF_ B1PF_SC_B2PF_HC B1PA_SC_B2PF_HC B2PF_SC_B1PA_HC OR_B2PF OR_B2PF OR_B2PF AND_B2DW AND_B2DRW THEN_B2PF THEN_B2PF THEN_B1PA THEN_B2PF THEN_B1XA THEN_B2PF THEN_B1XW THEN_B2PF THEN_B1XR Targeting DSP56800E DSP 337 Libraries and Runtime Code EOnCE Library Table 10 6 Defined Identifier Key for Counter Trigger Modes B1 breakpoint 1 value set in valuel B2 breakpoint 2 value set in value2 P p memory address this is followed by a type of access X x memory address this is followed by a type of access D value being read from or written to x memory A memory access R memory read W memory write F memory fetch only follo
68. window displays the current default input radix Table 7 25 shows examples of the radix command Debugging Command Examples radix Example Description radix Displays the currently enabled radix radix D Changes the input radix to decimal radix H Changes the input radix to hexadecimal radix f r0 r7 Changes the display radix for the specified registers to fraction radix d x 0 10 r1 Changes the display radix for the specified register and memory blocks to decimal restart Use the restart debugging command to restart the debugging session The syntax for the restart command follows re start run Use the run debugging command to execute a Tcl script This command executes a script file block by block You can use the run command to run a script that includes these commands load close debug ki11 and run However the preceding commands cannot reside in a block such as a loop For example this script is invalid DSP 239 Debugging for DSP56800E Command Line Debugging DSP 240 set x 0 while Sx lt 5 load a mcp debug kill The syntax for the run command follows ru n file_name The following example executes a file named test tcl run test tel save Use the save debugging command to save the contents of specified memory locations to a binary file or a text file in hexadecimal format The syntax for the save command follows salve h b addr_block f
69. window to Tcl mode use the Tcl commands when clashing Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 10 Debugging Command Examples config continued Example Description config m auto Set the command line debugging window to auto mode resolve clashing automatically config hexprefix 0x Show hexadecimal numbers with 0x prefix config memidentifier m Set the memidentifier to m config processor Dsp568E Generic Set the processor to DSP56800E config target Get the default build target name config project Get the default project name config target sdm Change the default build target to sdm copy Use the copy debugging command to copy the contents of a memory address or block of addresses to another memory location The syntax for the copy command follows colpy addr_group addr addr_group address addr_block addr_block address_first address_last address count count a value indicating the number of memory locations The addr_group symbol is the location or locations from which the command copies the contents The addr variable specifies the first address in memory to which the command copies the contents Table 7 11 shows examples of the copy command Targeting DSP56800E DSP 221 Debugging for DSP56800E Command Line Debugging Table 7 11 Table 7 12 DSP 222 Debugging Command Examples copy Example Description Copy p 00 1f p 30
70. with the CodeWarrior IDE you proceed through the development stages familiar to all programmers write code compile and link code and debug code The difference between the CodeWarrior IDE and traditional command line environments is in how the software in this case the CodeWarrior IDE helps you manage your work more effectively If you are not familiar with an integrated development environment in general or with the CodeWarrior IDE in particular you will find the topics in this section helpful Project Files versus Makefiles The CodeWarrior IDE project is analogous to a collection of makefiles because you can have multiple builds in the same project For example you can have one project that maintains both a debug version and a release version of your code You can build either or both of these versions as you wish Different builds within a single project are called build targets The CodeWarrior IDE uses the project window to list the files in a project A project can contain various types of files such as source code files and libraries You can easily add or remove files from a project You can assign files to one or more build targets within the same project These assignments let you easily manage files common to multiple build targets DSP 31 Development Studio Overview The Development Process DSP 32 The CodeWarrior IDE automatically handles the dependencies between files and it tracks which files have c
71. 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 that host you use the CodeWarrior IDE to develop code to target various platforms Targeting DSP56800E DSP 15 Introduction CodeWarrior IDE and Its Documentation DSP 16 NOTE The term target has two meanings in the CodeWarrior IDE e Platform Target The operating system processor or microcontroller for which you write code If you write code for a particular processor running a specific desktop operating system you are creating code for a platform target e Build Target The settings and files that determine the contents of your code as well as the process in which this code compiles and links into the final output The CodeWarrior IDE lets you specify multiple build targets for a particular platform target For example you can compile a debugging version build target and an optimized version build target of your program for the Windows operating system platform target The build targets can share files in the same project even though each build target uses its own settings After debugging the program generating a final version is as simple as selecting the project s build target and using a single Make command The CodeWarrior IDE has compilers linkers a debugger a source code browser and editing tools You can edit navigate examine compile
72. 000 x0 OXFFFF 0x031E0000 Yo 0x0000 0x031E Edit register values To edit values in the register window double click a register value Change the value as you wish Exit the window The modified register values are saved Targeting DSP56800E Debugging for DSP56800E Register Details Window Register Details Window Figure 7 21 From the menu bar of the Metrowerks CodeWarrior window select View gt Register Details or in the Registers window Figure 7 19 double click on the register The Register Details window appears Figure 7 21 Register Details Window x Description File Browse Format Default v aaae 8 71818 413 21 110 EE Register Name Type the name of a register or a full path to a description file in the Description File field Revert Read Reset Value Text View Auto y Targeting DSP56800E In the Register Details window type the name of the register e g OMR SR IPR etc in the Description File field The applicable register and its values appears By default the CodeWarrior IDE looks in the following path when searching for register description files CodeWarrior bin Plugins support Registers dsp568e Register description files must end with the xm1 extension Alternatively you can use the Browse button to locate the register description files Using the Format list box in the Register Details window you can change the format in which the CodeW
73. 00E DSP 153 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_shlfts Definition Note Assumptions Prototype Example DSP 154 Arithmetic left shift of 32 bit value by a specified shift amount Saturation does occur during a left shift if required This is not a bidirectional shift Assumed s_shftamount is positive OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_shlfts Word32 lval2shft s_shftamount long result 1 0x12345678 short sl 3 result shlfts l s1 Expected value of result Word16 Ox91A259E0 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_shr Definition Note Assumptions Prototype Example Targeting DSP56800E Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion This operation is not optimal on the DSP56800E because of the saturation requirements and the bidirectional capability See the intrinsic L_shrtNs which is more optimal OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_shr Word32 lval2shft Word16 s_ shft
74. 14 23 24 __mod_initint16 11 12 13 14 15 16 17 Targeting DSP56800E DSP 167 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions DSP 168 Targeting DSP56800E Y Debugging for DSP56800E This chapter describes the generic features of the CodeWarrior debugger This chapter contains the following sections Target Settings for Debugging Command Converter Server Load Save Memory Fill Memory Save Restore Registers EOnCE Debugger Features Using the DSP56800E Simulator Launching and Operating the Debugger Register Details Window Loading a elf File without a Project Command Line Debugging System Level Connect Debugging in the Flash Memory Notes for Debugging on Hardware Target Settings for Debugging Targeting DSP56800E This section explains how to control the debugger by modifying the appropriate settings panels To properly debug DSP56800E software you must set certain preferences in the Target Settings window The M56800E Target panel is specific to DSP56800E development The remaining settings panels are generic to all build targets DSP 169 Debugging for DSP56800E Command Converter Server Table 7 1 Other settings panels can affect debugging Table 7 1 lists these panels Setting Panels that Affect Debugging This panel Affects Refer to M56800E Linker symbolics linker Linker Issues for warnings DSP56
75. 2PF B1PA_OR_N_B2PF B1XR_AND_N_B2DR B1XW_AND_N_B2DW B1XA_AND_N_B2DRW B1PF_N_THEN_B2PF B1PF N B1PA_ B1PA THEN N_THEN_B2PF B2PF N B2PF_ B2PF N_THEN_B1PA THEN_B1PA_N B1XA_ B1XA THEN N_THEN_B2PF B2PF N B2PF_ B2PF N_THEN_B1XA THEN_B1XA_N B1XW_ B1XW THEN N_THEN_B2PF B2PF N B2PF_ B2PF N_THEN_B1XW THEN_B1XW_N B1XR_N_THEN_B2PF B1XR THEN B2PF N B2PF_N_THEN_B1XR THEN_B1XR_N B2PF B1PF_STB_B2PF_HTB Targeting DSP56800E DSP 335 Libraries and Runtime Code EOnCE Library B1PA_STB_B2PF_HTB B2PF_STB_B1PA_HTB Table 10 5 Defined Identifier Key for Normal Trigger Modes Identifier Fragments Description B1 breakpoint 1 value set in valuel B2 breakpoint 2 value set in value2 P p memory address this is followed by a type of access X x memory address this is followed by a type of access D value being read from or written to x memory A memory access R memory read W memory write F memory fetch only follows a P OR links two sub triggers by a logical or AND links two sub triggers by a logical and THEN creates a sequence first sub trigger must occur then second sub trigger must occur to complete the trigger N the sub trigger it follows must occur N times as set in the count parameter if N follows an operation then the combination of the sub triggers must occur N
76. 56800E_EABI_Tools Drivers for the CCS and command line tools Additional default files used by the CodeWarrior IDE for the DSP56800E stationery M56800E Support Includes Metrowerks Standard Library MSL a subset of the standard MSL adapted specifically for DSP56800E Motorola Documentation Documentation specific to the Motorola DSP568xxE series Stationery Default settings that are used to create DSP56800E projects Each target stationery item is set to a specific debugging protocol Targeting DSP56800E DSP 23 Getting Started Creating a Project Creating a Project Figure 2 1 DSP 24 Project File Object NOTE Dsp56800E EAB Stationery Empty Project sample Makefile Importer Wizard To create a new project from project stationery From the menu bar of the Metrowerks CodeWarrior window select File gt New The New window appears with a list of options in the Projects tab Figure 2 1 New Window Project name Location C Documents and Settings bct Add to Project Project 1 OK Cancel Select DSP56800E EABI Stationery in the Project tab To create a new project without using stationery select Empty Project in the New window This option lets you create a project from scratch If you are a beginner do not use an empty project because of the complexities involved in using the correct libraries and files an
77. 6 s_shftamount Example short result short sl 0x1234 short s2 3 result shlfts sl s2 Expected value of result 0x91a0 Targeting DSP56800E DSP 149 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support shr Definition Note Assumptions DSP 150 Prototype Example Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion This operation is not optimal on the DSP56800E because of the saturation requirements and the bidirectional capability See the intrinsic shlfts which is more optimal OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 shr Word16 sval2shft Word16 s_shftamount short result short sl 0x2468 short s2 1 result shr sl1 s2 Expected value of result 0x1234 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support shr_r Definition Note Assumptions Prototype Example Targeting DSP56800E Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed If a right shift is performed then rounding performed on result
78. 6 Non Volatile SOC CO 16 Non Volatile SOC C10 32 Non Volatile SOC C 36 Volatile non SOC Includes volatile register C2 D2 4 Volatile non SOC D1 16 Non Volatile SOC DO 16 Non Volatile SOC D10 32 Non Volatile SOC D 36 Volatile non SOC Includes volatile register D2 DSP 84 Targeting DSP56800E C for DSP56800E Calling Conventions and Stack Frames for DSP56800E Unit Register Name Size Type Comments Address RO 24 Volatile non SOC Generation Unit AGU R1 24 Volatile non SOC R2 24 Volatile non SOC R3 24 Volatile non SOC R4 24 Volatile non SOC R5 24 Non volatile SOC If R5 is used as a pointer it is no longer a non volatile SOC regis ter that is it can be saved over called functions N 24 Volatile non SOC SP 24 Volatile non SOC N3 16 Volatile non SOC MO1 16 Volatile non SOC In certain registers values must be kept for proper C execution Set to OxFFFF for proper execu tion of C code Program PC 21 Volatile non SOC Controller LA 24 Volatile non SOC LA2 24 Volatile non SOC HWS 24 Volatile non SOC FIRA 21 Volatile non SOC FISR 13 Volatile non SOC OMR 16 Volatile non SOC In certain registers values must be kept for proper C execution For example set the CM bit SR 16 Volatile non SOC LC 16 Volatile non SOC LC2 16 Volatile non SOC Targeting DSP56800E DSP 85 C
79. 6 or 21 bits e Prefix File The Prefix File specifies a file to be included at the beginning of every assembly file in the project This field lets you include common definitions without using an include directive in every file Targeting DSP56800E DSP 57 Target Settings DSP56800E Specific Target Settings Panels ELF Disassembler The ELF Disassembler panel Figure 4 7 appears when you disassemble object files To view the disassembly of a module select Project gt Disassemble Figure 4 7 ELF Disassembler Panel Target Settings Panels ELF Disassembler Target Target Settings Access Paths Build Extras Runtime Settings File Mappings Source Trees MB56800E Target E Language Settings C C Language C C Warnings MS56800E Assembler Code Generation M56800E Processor Global Optimizations MV Show Headers TT Verbose Info M Show Symbol and String Tables V Show Relocations Show Code Modules JV Use Extended Mnemonics T Show Source Code MV Show Addresses and Object Code Y Show Comments Show Data Modules Disassemble Exception Tables I Show Debug Info Factory Settings Revert Import Panel Export Panel OK Cancel Apply The ELF Disassembler panel options are e Show Headers The Show Headers option determines whether the assembled file lists any ELF header information in the disassembled output e Show Symbol and String Tables
80. 6800E Debugging for DSP56800E Register Details Window NOTE NOTE NOTE Targeting DSP56800E Select type of memory Locate the Page list box at the bottom of the View Memory window Select X for X Memory Enter memory address Type the memory address in the Display field located at the top of the Memory window To enter a hexadecimal address use standard C hex notation for example 0x0 You also can enter the symbolic name whose value you want to view by typing its name in the Display field of the Memory window The other view options Disassembly Source and Mixed do not apply when viewing X memory Viewing P Memory You can view P memory space and edit the opcode hexadecimal values at debug time On targets that have Flash ROM you cannot edit those values in the memory window that reside in Flash memory Locate a particular address in program memory To view program memory from the menu bar of the Metrowerks CodeWarrior window select Data gt View Memory The Memory window appears Figure 7 22 Select type of memory Locate the Page list box at the bottom of the View Memory window Select P for P Memory DSP 203 Debugging for DSP56800E Register Details Window 3 Enter memory address Type the memory address in the Display field located at the top of the Memory window To enter a hexadecimal address use standard C hex notation for example 0x82 DSP 204 Targeting DSP56800E Debug
81. 6800E development The following options are not applicable to the DSP56800E compiler Disable the options at all times e Hidden Virtual Functions e Inconsistent use of class and struct Keywords Figure 4 5 E Simulator Settings C C W aminas Target Target Settings Access Paths Build Extras Runtime Settings File Mappings Source Trees MB56800E Target Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations E Linker ELF Disassembler M56800E Linker Factory C C Warnings Panel 21x J Treat All Warnings As Errors I Illegal Pragmas I Empty Declarations Possible Errors I Unused Variables Unused Arguments Extra Commas Extended Error Checking I Hidden Virtual Functions I Implicit Arithmetic Conversions I Non nlined Functions I Inconsistent Use of class and struct Keywords Revert Import Panel Export Panel Settings OK Cancel Apply Targeting DSP56800E DSP 51 Target Settings DSP56800E Specific Target Settings Panels The C C Warnings panel options are e Illegal Pragmas When you select this option the compiler displays a warning if it encounters an illegal pragma To check whether this option is on use _ option warn_illpragma Listing 4 1 Example of Illegal Pragma Statements that generate Warnings prag
82. 6800E DSP 317 Libraries and Runtime Code EOnCE Library EOnCE Library DSP 318 The EOnCE Enhanced On Chip Emulator library provides functions which allows your program to control the EOnCE The library lets you set and clear triggers for breakpoints watchpoints program traces and counters With several option enumerations the library greatly simplifies using the EOnCE from within the core and thus eliminates the need for a DSP56800E User Manual The library and the debugger are coordinated so that the debugger does not overwrite a trigger set by the library and vice versa To use the EOnCE library you must include it in your project The name of the file is eonce 56800E 1mm 1ib and it is located at CodeWarrior M56800ESupport eonce lib The Large Data Model option must be enabled in the M56800E Processor preference panel Any source file that contains code that calls any of the EOnCE Library functions must include eonceLib h This header file is located at CodeWarrior M56800E Support eonce include The library functions are listed below e _eonce Initialize e _eonce SetTrigger e _eonce SetCounterTrigger e _eonce ClearTrigger e eonce GetCounters e eonce GetCounterStatus e _eonce SetupTraceBuffer e eonce GetTraceBuffer e eonce ClearTraceBuffer e eonce StartTraceBuffer e eonce HaltTraceBuffer e eonce EnableDEBUGEV e _eonce EnableLimitTrigger Targeting DSP56800E Libraries and R
83. 8 402 4 404 20 Boe a d dss 4 OO Normal Trigger Modes a a a oe ee ee 885 Counter Trigger Modes 2 2 2 1 396 Data Selection Modes 2 338 Counter Function Modes 2 339 Normal Unit Action Options 8 2 her ts ave aoe oo 2 B89 Counter Unit Action Options 340 Accumulating Trigger Options 340 Miscellaneous Trigger Options 342 Trace Buffer Capture Options 342 Trace Buffer Full Options 2055 lt 2 Gg eee Gy BB Miscellaneous Trace Buffer Option 344 Index 345 DSP 14 Targeting DSP56800 Introduction This manual explains how to use the CodeWarrior Integrated Development Environment IDE to develop code for the DSP56800E family of processors This chapter contains the following sections e CodeWarrior IDE and Its Documentation e References CodeWarrior IDE and Its Documentation The CodeWarrior IDE has a simple graphical user interface and versatile tools for developing software Using the CodeWarrior IDE you can develop a program plug in library or other code The CodeWarrior IDE allows you to assemble source code files resource files library files and configuration settings in a project without writing a complicated build script or makefile You can also add or delete source code files from a project using the mouse and keyboard instead of tediously editing a build script For any project
84. 800E on page 109 M56800E optimizations Optimizing Code for Processor DSP56800E on page 95 Debugger Debugging options Table 4 2 on page 40 Settings Remote Debugging Remote Debugging on Debugging communication page 70 protocol The M56800E Target panel is unique to DSP56800E debugging The available options in this panel depend on the DSP56800E hardware you are using and are described in detail in the section on Remote Debug Options on page 72 Command Converter Server DSP 170 NOTE The command converter server CCS handles communication between the CodeWarrior debugger and the target board An icon in the status bar indicates the CCS is running The CCS is automatically launched by your project when you start a CCS debug session if you are debugging a target board using a local machine However when debugging a target board connected to a 4 remote machine see Setting Up a Remote Connection on page 174 Projects are set to debug locally by default The protocol the debug ger uses to communicate with the target board for example PCI is determined by how you installed the CodeWarrior software To mod ify the protocol make changes in the Metrowerks Command Converter Server window Figure 7 3 Targeting DSP56800E Debugging for DSP56800E Command Converter Server Essential Target Settings for Command Converter Server Before you can download programs to a target board for deb
85. 852_ Finit_M56852END Finit_M56852_ Finit_M56852_ setup the OMr with the values required by C 1 bfset NL_MODE omr ensure NL 1 enables nsted DO loops nop nop bfclr CM_MODE XP_MODE R_MODE SA_MODE omr ensure CM 0 optional for C ensure XP 0 to enable harvard architecture ensure R 0 required for C ensure SA 0 required for C DSP 316 Targeting DSP56800E Libraries and Runtime Code Runtime Initialization Setup the m01 register for linear addressing move w 1 x0 moveu w x0 m01 Set the m register to linear addressing moveu w hws la Clear the hardware stack moveu w hws la nop nop CALLMAIN Initialize compiler environment Initialize the Stack move l gt gt F_Lstack_addr r0 bftsth 0001 r0 bee noinc adda 1 r0 noinc tfra r0 sp set stack pointer too move w 0 r1 nop move w r1 x sp adda l sp jsr F__init_sections Call main move w 0 y0 Pass parameters to main move w 0 R2 move w 0 R3 jsr Fmain Call the Users program The fflush calls where removed because they added code growth in cases where the user is not using any debugger IO Users should now make these calls at the end of main if they use debugger IO move w 0 r2 E jsr Ffflush Flush File I0 jsr Ffflush_console Flush Console IO end of program halt CPU debughlt rts Finit_M568521 E ND endsec Targeting DSP5
86. By default the command line debugger uses hexadecimal as the input radix and display radix unless you change them You can override the default input radix when entering an individual value To specify a hexadecimal constant precede the constant with a dollar sign To specify a decimal constant precede the con stant with a grave accent To specify a binary value precede the constant with a percent sign To specify a fraction value pre cede the constant with a caret The syntax for the radix command follows r adix b dad f h ul register reg_block addr_group 1 The following list defines the first parameter b d h u J as follows e b binary e d decimal e f fraction e h hex e u unsigned The preceding parameter when not followed by register names or memory locations specifies the radix to use as the default input radix When followed by register names or memory locations the radix is the default display radix when displaying the values contained in the specified register or memory location reg_block register_first register_last addr_group address addr_block addr_block address_first address_last address count count a value indicating the number of memory locations Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 25 NOTE Targeting DSP56800E If you enter the radix command without any parameters the debugging
87. CodeWarrior Development Studio Motorola DSP56800E Embedded Systems Targeting Manual rn 102002 Revised 20021021 Metrowerks the Metrowerks logo and CodeWarrior are registered trademarks of Metrowerks Corp in the US and or other countries All other tradenames and trademarks are the property of their respective owners O Copyright 2002 Metrowerks Corp ALL RIGHTS RESERVED 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 products for any particular purpose nor does Metrowerks assume any liability 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 failure 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 or automobile navigation or communication emergency systems or other applications with a similar degree of potential hazard Documentation stored on electronic media may be printed for non commercial personal use only further to the
88. DE User Guide Custom Keywords Use this panel to change the colors that the CodeWarrior IDE uses for different types of text See IDE User Guide Other Executables Use this panel to specify other executables to debug while debugging the current target See IDE User Guide Global Optimizations Use this panel to configure how the compiler optimizes the object code See IDE User Guide Debugger Settings Use this panel to specify settings for the CodeWarrior debugger DSP 40 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels DSP56800E Specific Target Settings Panels This section explains individual settings on DSP56800E specific target settings panels Target Settings The Target Settings panel Figure 4 2 lets you set the name of your build target as well as the linker and post linker plug ins to use with the build target By selecting a linker you are specifying which family of processors to use The other available panels in the Target Settings window change to reflect your choice NOTE As the selection of the linker determines which panels are applicable to your project first select the settings for your build target Figure 4 2 Target Settings Panel Target Settings Panels Target Settings Target Settings Target Name Simulator Access Paths ae Build Extras inker M56800E Linker y Runtime Settings Predinker None y File Mappings E Source Trees Postli
89. Definitions and Examples on page 158 However please refer to intrinsics_56800E h for any last minute changes Figure 6 1 Intrinsic Functions for DSP56800E Category Function Category cont Function cont Absolute Negate abs s Multiplication MAC mac r negate msu r L abs mult L negate mult r Addition Subtraction add L mac sub L_msu L add L mult L sub L mult Is Control stop Normalization ffs s wait norm_s turn_off conv rndg ffs 1 turn_off sat norm turn_on_conv_rndg Rounding round turn_on_sat Shifting shl Deposit Extract extract_h shlftNs extract_ shifts L deposit h shr L deposit shr r Division div_s shrtNs div_s4q L shl div_Is L_shiftNs div_ls4q L_shifts L_shr L shr r L_shrtNs Targeting DSP56800E DSP 123 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Absolute Negate Click any of the following links to jump to the corresponding intrinsic functions e abs s e negate e L abs e L negate abs_s Definition Assumptions Absolute value of a 16 bit integer or fractional value returning a 16 bit result Returns 0x7FFF for an input of 0x8000 OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype
90. E Pragma Directives for DSP56800E NOTE Foran example of define_section see Listing 5 7 Related Pragma section Targeting DSP56800E DSP 107 C for DSP56800E Pragma Directives for DSP56800E section Description This pragma controls the organization of object code Prototype pragma section lt sectname gt begin data pragma section lt sectname gt end Remarks Argument lt sectname gt Identifier by which this user defined section is referenced in the source Listing 5 7 Sample Code pragma define_section and pragma section 1 Define the section pragma define_section mysection mysection data RW 2 Specify the data to be put into the section pragma section mysection begin int a 10 SO A ED By A A SI i Pe UB E bes int b 10 pragma section mysection end int main void int 1 for 1 0 i lt 10 1 b il a il 3 In the linker command file add the section to the main_application_data entries in the data sections area of the linker command file by inserting the following line mysection data Related Pragma define_section DSP 108 Targeting DSP56800E C for DSP56800E Linker Issues for DSP56800E Description Prototype Remarks Listing 5 8 unused This pragma controls the suppression of warnings for variables and parameters that are not referenced in a function pragma unused var_name var_name This pragma suppresse
91. Figure 7 13 For 4 more information on using this panel see Set Trigger Panel on page 190 e Action This pull down list lets you select the resulting action caused by the trigger DSP 185 Debugging for DSP56800E EOnCE Debugger Features Halt core Stops the processor Interrupt Causes an interrupt and uses the vector for the EOnCE hardware breakpoint unit 0 Special Counters This feature lets you use the special counting function of the EOnCE unit To open the EOnCE Special Counter panel Figure 7 10 1 From the menu bar select EOnCE gt Special Counter This panel is non modal and will update itself whenever the processor stops Figure 7 10 EOnCE Special Counter Panel E EOnCE Special Counter x Use 16 bit counter to count peik clock cycles Note Using the 40 bit counter will disable stepping in the debugger Set trigger s Perform action hat core v On condition counter reaches zero before stop trigger occurs Courter vue Set Cloze DSP 186 Targeting DSP56800E Debugging for DSP56800E EOnCE Debugger Features NOTE Targeting DSP56800E The EOnCE Special Counter panel options are e Counter size This pull down list gives you the option to use a 16 or 40 bit counter Using the 40 bit counter will disable stepping in the debugger e Counter function This pull down list allows you to choose which counting function to use Set trigger s P
92. Functions address modification by either using hardware resources or by directly manipulating the address mathematically Since modulo buffers occur often in DSP programming these buffers have hardware support on chip Specifically modulo control registers work in conjunction with the pointer update addressing modes of the DSP such that a range of addresses is accessed rather than a continuous linear address space But hardware support for modulo buffers have strict requirements on buffer address alignment pointer register resources only RO and R1 update in a modulo fashion and limited modulo addressing instructions Because of these hardware limitations the compiler actually implements modulo buffers by manipulating the buffers via intrinsic or built in function calls In summary we use a well defined set of instrinsic APIs to implement modulo buffers in C for the DSP56800E compiler Modulo Addressing Intrinsic Functions Definitions and Examples This section describes the intrinsic functions used for modulo addressing These functions are e _ mod init e mod initintl6 e mod start e _ mod access e _ mod update e _ mod stop e _ mod getintl6 e mod setintl6 e mod error DSP 158 Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions _mod_init Definition Prototype Example Targeting DSP56800E Initialize a modulo buffer pointer with arbitr
93. HEHEHE HEHE HEHEHE HOH HHH HOH OH treat source as C always generate warnings for use of C features out side Embedded C subset implies dialect cplus dialect cplus specify word size for enumeration types use minimum sized enums default use int sized enums specify inline options tur n on inlining for inline functions default tur n off inlining auto inline small functions without do tur inline explicitly specified not auto inline default n on aggressive inlining same as inline on auto defer inlining until end of compilation u nit this allows inlining of functions in both directions cased inline functions up to n levels deep level 0 is the same as inline on for n range 0 8 enable ISO C template parser note this requ ires a different MSL C library default is off reverse mapping of n and r so that n 13 and r 10 for Macintosh MPW compatability dis allow Microsoft VC extensions enable extensions redefining macros allowing XXX yyy syntax when declaring method yyy of class XXX allowing extra commas ignoring casts to the same type treating function types with equivalent parameter lists but different return types a a s equal llowing pointer to integer conversions and various syntactical differences disable extensions default on non x86 targets enable multi byte
94. LT directory to PATH set PATH PATH SCOMPILER DSP56800E_EABT Tools Command_Line_Tools T REM compile options and files set COPTIONS 03 set CFILELIST filel c file2 c set LOPTIONS m FSTART_ o output elf g set LCF linker cmd REM compile assemble and link mwcc56800e SCOPTIONSS SCFILELISTS mwasm56800e SAFILELIST mwld56800e SLOPTIONS SLFILELISTS LCF oe Targeting DSP56800E DSP 295 ELF Linker and Command Language DSP56800E Command Line Tools Arguments General Command Line Options General Command Line Options All the options are passed to the linker unless otherwise noted Please see help usage for details about the meaning of this help help keyword usage no spaces all no normal no obsolete no ignored no deprecated no meaningless no compatible opt ion name search keyword group keyword tool keyword all this other skipped both version timing progress v erbose search DSP 296 o a OH global for this tool display help show usage information insert blank lines between options in printout show all standard options show only standard options show obsolete options show ignored options show deprecated options show options meaningless for this target show compatibility options show help for a given
95. NOTE When a function makes a dynamic allocation R5 is reserved as a stack frame pointer This is the stack pointer before allocations are done Stack Alignment The compiler must always operate with the stack pointer long aligned This means e The start up code in the runtime first initializes the stack pointer to an odd value e Atall times after that the stack pointer must point to an odd word address e The compiler never generates an instruction that adds or subtracts an odd value from the stack pointer e The compiler never generates a MOVE W or MOVEU W instruction that uses the X SP or X SP addressing mode Data Alignment Requirements for DSP56800E The following rules describe data layout for both the stack and global memory of DSP56800E e Bytes are aligned on byte boundaries There is an exception to this rule bytes which are passed on the stack are always word aligned and reside in the lower bytes e Words are aligned on word boundaries e Longs and floats and doubles are aligned on double word boundaries as follows Least significant word is always on an even word address Most significant word is always on an odd word address Long accesses through pointers in AGU registers for example RO through R5 or N point to the least significant word That is the address is even Long accesses through pointers using SP point to the most significant word That is the address in SP is o
96. P 251 High Speed Simultaneous Transfer Host Side Client Interface hsst_open A host side client application uses this function to open a communication channel with the low level target Opening a channel that has already been opened will result in the same channel ID being returned HRESULT hsst_open const char channel_name size_t cid channel_name This parameter specifies the communication channel name cid This parameter specifies the channel ID associated with the communication channel Returns This function returns S_OK if the call succeeds or S_FALSE if the call fails hsst_close A host side client application uses this function to close a communication channel with the low level target HRESULT hsst_close size_t channel_id channel_id This parameter specifies the channel ID of the communication channel to close Returns This function returns S_OK if the call succeeds or S_FALSE if the DSP 252 call fails Targeting DSP56800E High Speed Simultaneous Transfer Host Side Client Interface hsst_read Returns Targeting DSP56800E A host side client application uses this function to read data sent by the target application without stopping the core HRESULT hsst_read void data size_t size size_t nmemb size_t channel_id size_t read data This parameter specifies the data buffer into which data is read size This parameter specifies the size of the individual data elements to
97. P 321 Libraries and Runtime Code EOnCE Library _eonce_SetCounterTrigger Prototype Parameters DSP 322 Sets a trigger condition used for special counting functions int _eonce _SetCounterTrigger unsigned int unit unsigned long options unsigned long valuel un signed long value2 unsigned long mask unsigned int counter unsigned long counter2 unit unsigned int This parameter specifies which breakpoint unit to use options unsigned long This parameter describes the behavior of the trigger For more information on the identifiers for this parameter please see the 4 sub section Definitions on page 313 value1 unsigned long This parameter specifies the address or data value to compare as defined by the options parameter value2 unsigned long This parameter specifies the address or data value to compare as defined by the options parameter mask unsigned long This parameter specifies which bit of value2 to compare counter unsigned int This parameter specifies the value used to pre load the counter which proceeds backward when EXTEND_COUNTER is OR ed into the options parameter counter contains the least signifi cant 16 bits counter2 unsigned long This parameter specifies the value used to pre load the counter which proceeds backward When EXTEND_COUNTER is OR ed into the options parameter counter2 contains the most signif icant 24 bits However when EXTEND_COUNTER is not OR ed Tar
98. P56800E Simulator Ge alah ah Bw 98 Cycle Instruction Count A ot et eae we Gr tale Machine Cycle Count sea a A eS ot 193 Machine Instruction Count 194 Launching and Operating the Debugger 2 194 Setting Breakpoints 2d ye He e a ee 7 Setting Watch polis 2 a RA a rasa 198 Viewing and Editing Register Values 199 Register Details Window 201 Viewing X Memory a E PR eh EG 202 Viewing P Memory dute A aa Boece de B S 203 Loading a elf File without a Project 2 2 207 Command Line Debugging a t te ae a a ok Se 208 Tel Suppott 3 4 4 64 44 8 4 He RRR Ds 208 Automatically resolving clashing commands 208 Tcl support for executing script files 209 Tel support for using a start up script 209 Command Line Debugging Tasks sae e e ZO Open a Command Line Debugging Window da a 210 Enter a Single Command Line Debugging Command 210 Enter Multiple Command Line Debugging Commands 210 View Debugging Command Hints O REA Repeat a Command Line Debugging Command or oa Review Previously Entered Commands 211 Clear a Command from the Command Line 212 Stop an Executing Script 2 mom ZA Switch between Insert and Overwrite Mode EA Y 212 Scroll Text in the Command Line Debugging Window 212 Copy Text from the Command Line Debugging Window 213 Paste Text into the C
99. R name name command to tell the linker to place the memory segment after the specified segment In the example below overlayl and overlay2 are placed after the code segment When multiple memory segments are specified as parameters for AFTER the highest memory address is used DSP 287 ELF Linker and Command Language Linker Command File Keyword Listing Example memory code RWX ORIGIN 0x8000 LENGTH 0 overlayl RWX ORIGIN AFTER code LENGTH 0 overlay2 RWX ORIGIN AFTER code LENGTH 0 data RW ORIGIN 0x1000 LENGTH 0 ORIGIN is the assigned address LENGTH is one of the following a value greater than zero If you try to put more code and data into a memory seen than your specified length allows the linker stops with an error autolength by specifying When the length is 0 the linker lets you Zero put as much code and data into a memory segment as you want NOTE There is no overflow checking with autolength The linker can pro duce an unexpected result if you use the autolength feature without leaving enough free memory space to contain the memory segment For this reason when you use autolength use the AFTER keyword to specify origin addresses gt fileName is an option to write the segment to a binary file on disk instead of an ELF program header The binary file is put in the same folder as the ELF output file This option has two variants gt fileName Writes the segment to a
100. STTUPL e y a kee ce AP e ee aa Arguments ae ce ok as ela ae 92 g i a O Seta i slg 93 de Migs tafe ea 94 eds ee oe A DP Bev 95 EREA panes ee EAN 98 Ea 98 98 99 Avoiding Possible Hitches with enabled Braet Tarun 103 optimization_level 2 220 402 sa A optimize_for_size define_section o SOON 20 a om aoe a a aes unused e aa E e Bo se ee 8 Dip Se 38 Linker Issues for DSP56800E Deadstripping Unused Code and Data iia s aei amp ig He a ee a Bee ee A 6 Inline Assembly Language and Intrinsics Working With DSP56800E Inline Assembly Language Inline Assembly Language Syntax for DSP56800E Function level Inline Assembly Language Statement level Inline Assembly Language Adding Assembly Language to C Source Code Assembly Language Quick Guide Creating Labels for M56800E Assembly Using Comments in M56800E Assembly Inline Assembly Optimization E Calling Assembly Language Functions om c Code Calling Inline Assembly Language Functions Calling Pure Assembly Language Functions Calling Functions from Assembly Language Instrinsic Functions for DSP56800E Targeting DSP56800 E Bos 104 105 2 a 108 109 cds oh atk Og DSP 5 Table of Contents An Overview of Intrinsic Functions 120 Implementation aia a a ias we at are Sle Fractional Arithmetic 2 122 Macros
101. Setting Up a Remote Connection 174 To Add a New Remote Connection 175 To Change an Existing Remote Connection 177 To Remove an Existing Remote Connection 177 Debugging a Remote Target Board 2 177 Load Save Memory 20 aco a ce Gd a 177 History Combo Box ia eke ela ee amp 178 Radio Buttons E ae Be ne a ee EE Memory Type Combo Bok E pes ras a a AO Address Text Field 2 2 ee 179 Size Text Field lt a oS he ee ee Be a ra CD Dialog Box Controls 2 2 2 2 2 ew 179 Fill Memory Fo Ue es ane O Se 2 SEBO History Combe Box ae BEN anus Se oars eh ve Has Sogo ed en eI OU Memory Type Combo Box 2 181 Address Text Field 2 2 181 Size Text Field 2 a ca See fe eee L8L Fill Expression Text Field se ok oy oe 191 Dialog Box Controls yi ao es Go ear ele ale 82 pave Restore Registers aS a ok es a an es OZ History Combo Box 2 183 Radio Buttons 2 0 24 2 4 183 Register Group List 4 403 a ha we Se eae 104 Dialog Box Controls 2 2 2 we 2 184 EOnCE Debugger Features 552g als i ae wa ele de a TA Set Hardware Breakpoint Panel 2 185 DSP 8 Targeting DSP56800 Table of Contents Special Counters o e is ir la e a ici 186 Trace Butter ye Ea E Boe E e Ye me oe a OR Set Tigger Panels Sus sians an A e a dg a E E A e 190 Using the DS
102. Speed Simultaneous Transfer Target Library Interface HSST_open Returns A target application uses this function to open a bidirectional communication channel with the host The default setting is for the function to open an output channel in buffered mode Opening a channel that has already been opened will result in the same channel ID being returned HSST_STREAM HSST_open const char stream stream This parameter passes the communication channel name This function returns the stream associated with the opened channel HSST_close Returns A target application uses this function to close a communication channel with the host int HSST_close HSST_STREAM stream stream This parameter passes a pointer to the communication channel This function returns 0 if the call was successful or 1 if the call was unsuccessful HSST_setvbuf DSP 260 A target application can use this function to perform the following actions e Set an open channel opened in write mode to use buffered mode Targeting DSP56800E High Speed Simultaneous Transfer Target Library Interface NOTE This can greatly improve performance e Resize the buffer in an existing buffered channel opened in write mode e Provide an external buffer for an existing channel opened in write mode e Reset buffering to unbuffered mode You can use this function only after you successfully open the channel The contents of a buffer eit
103. The Show Symbol and String Tables option determines whether the disassembler lists the symbol and string table for the disassembled module DSP 58 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Targeting DSP56800E e Verbose Info The Verbose Info option instructs the disassembler to show additional information in the ELF file For the symtab section some of the descriptive constants are shown with their numeric equivalents The sections 1ine and debug are shown with an unstructured hex dump Show Relocations The Show Relocations option shows relocation information for the corresponding text rela text or data rela data section Show Code Modules The Show Code Modules option determines whether the disassembler outputs the ELF code sections for the disassembled module If enabled the Use Extended Mnemonics Show Source Code Show Addresses and Object Code and Show Comments options become available Use Extended Mnemonics The Use Extended Mnemonics option determines whether the disassembler lists the extended mnemonics for each instruction of the disassembled module This option is available only if the Show Code Modules option is enabled Show Addresses and Object Code The Show Addresses and Object Code option determines whether the disassembler lists the address and object code for the disassembled module This option is available only if the Show Code Modules
104. The Stack pane shows the function calling stack e Variables pane The Variables pane displays local variables e Source pane The Source pane displays source or assembly code The toolbar at the top of the window has buttons that allows you access to the execution commands in the Debug menu Setting Breakpoints 1 Locate the code line Scroll through the code in the Source pane of the Program window until you come across the main function 2 Select the code line Click the gray dash in the far left hand column of the window next to the first line of code in the main function A red dot appears Figure 7 18 confirming you have set your breakpoint Targeting DSP56800E DSP 197 Debugging for DSP56800E Launching and Operating the Debugger Figure 7 18 Breakpoint in the Program Window msdm elf Thread 0x0 REx Oo hHooawea Breakpoint Setting DSP 198 NOTE Value Location 0x0000056C 0x0000056C 788 Ox000005C 6341 0x000005C6 de int main void define SIZE 10 int arr SIZE 4 6 7 1 2 3 4 12 4 5 int 1 7 print_array arr SIZE z for i 0 i lt SIZE 1 i e To remove the breakpoint click the red dot The red dot disappears Line 23 Col 1 Setting Watchpoints For details on how to set and use watchpoints see the CodeWarrior IDE User s Guide NOTE For the DSP56800E only one watchpoint is available This watch point is only available on hardware
105. This chapter contains the following sections e MSL for DSP56800E e Runtime Initialization e EOnCE Library MSL for DSP56800E Targeting DSP56800E This section explains the Metrowerks Standard Library MSL that has been modified for use with DSP56800E Using MSL for DSP56800E CodeWarrior for DSP56800E includes a version of the Metrowerks Standard Library MSL MSL is a complete C library for use in embedded projects All of the sources necessary to build MSL are included in CodeWarrior for DSP56800E along with the project files for different configurations of MSL If you already have a version of the CodeWarrior IDE installed on your computer the Code Warrior installer adds the new files needed for building versions of MSL for DSP56800E DSP 309 Libraries and Runtime Code MSL for DSP56800E The project directory for the DSP56800E MSL is CodeWarrior M56800E Support ms1 MSL_C DSP_56800E projects MSL C 56800E mcp Do not modify any of the source files included with MSL If you need to make changes based on your memory configuration make changes to the runtime libraries Ensure that you include one or more of the header files located in the following directory CodeWarrior M56800E Support ms1 MSL_C DSP_56800E inc When you add the relative to compiler path to your project the appropriate MSL and runtime files will be found by your project If you create your project from Stationery the new pro
106. This chapter contains the following sections e Structure of Linker Command Files e Linker Command File Syntax e Linker Command File Keyword Listing e DSP56800E Command Line Tools Targeting DSP56800E DSP 269 ELF Linker and Command Language Structure of Linker Command Files Structure of Linker Command Files Listing 9 1 Linker command files contain three main segments e Memory Segment e Closure Blocks e Sections Segment A command file must contain a memory segment and a sections segment Closure segments are optional Memory Segment In the memory segment available memory is divided into segments The memory segment format looks like Listing 9 1 Sample MEMORY Segment MEMORY segment_1 segment_2 data RWX ORIGIN RWX ORIGIN RW Segment_name and so on 0x8000 LENGTH 0x1000 AFTER segment_1 LENGTH 0 ORIGIN 0x2000 LENGTH 0x0000 RW ORIGIN memory address LENGTH segment length DSP 270 The first memory segment definition segment_1 can be broken down as follows e the RWX portion of the segment definition pertains to the ELF access permission of the segment The RWX flags imply read write and execute access e ORIGIN represents the start address of the memory segment in this case 0x8000 LENGTH represents the size of the memory segment in this case 0x1000 Memory segments with RWX attribu
107. This command resets the board if Always reset on download is checked in the Debugger s M56800E Target panel shown in Figure 4 13 and the download process begins When the download to the board is complete the IDE displays the Program window sdm elf in sample shown in Figure 7 17 DSP 195 Debugging for DSP56800E Launching and Operating the Debugger NOTE Source code is shown only for files that are in the project folder or that have been added to the project in the project manager and for which the IDE has created debug information You must navigate the file system in order to locate sources that are outside the project folder and not in the project manager such as library source files Figure 7 17 Program Window Step Out Step Into Breakpoint Step Over ill Watchpoint Expressions K Break Run Symbolics a sdm elf Thread 010 A ao main o Variables All Value Location 0x0000056C 0x0000056C 788 Ox000005C 6341 0x000005C6 int main void fdefine SIZE 10 int arr SIZE 4 6 7 1 2 3 4 12 4 5 int 1 3 printf j gt printf Are to be a DSP Warrior n print_array arr SIZE z for i 0 i lt SIZE 1 i Line 23 Col 1 5 Navigate through your code The Program window has three panes e Stack pane DSP 196 Targeting DSP56800E Debugging for DSP56800E Launching and Operating the Debugger
108. This example copies the contents of p memory addresses 00 through 1f toa contiguous block of p memory beginning at address 30 copy p 20 10 p 50 This example copies the contents of 10 consecutive p memory locations that start at address 20 to a contiguous block of p memory beginning at address 50 debug Use the debug command to start a command line debugging session for a project The syntax for the debug command follows de bug project_file_name Table 7 12 shows examples of the debug command Debugging Command Examples debug Example Description debug This example starts a debugging session for the open default project debug des mcp This example starts a debugging session for the project named des mcp dir or Is Use the dir debugging command to list the contents of a directory when developing on a Windows host Use the same syntax that you use for the operating system dir command Targeting DSP56800E Debugging for DSP56800E Command Line Debugging NOTE You can use the dir debugging command the same way you use the dir OS command with one exception You cannot use any op tion that requires user input from the keyboard such as p for the dir OS command Table 7 13 shows examples of the dir and 1s commands Table 7 13 Debugging Command Examples dir Example Description dir This example lists all files in the current directory dir txt This example lists all files in the current
109. Used with Intrinsics 122 Intrinsic Functions for Math Support 123 Absolute Negat s e poe 42h Ad ep SA AS a GDS ASS an A Ia AR A amp Wee e lene Ze negates y soras A A aOR a a 124 MEabSt oy e 4h cap go E ta GO Ao da e ca A oe ZO Ee MegGaee e Seok tele Oa pA a Ee lee tA a ZO Addition Subtraction 126 BGA nad Ae de oe Bae Be Gade ee SSS A se I SU a iets be oh ies pea a Wows Sn ch Soleo lace A ee Mee Ge te el ee E ig e ok OR A he aR ee Re a ke RS ee OR SE Mii PUIG Se Aes Ga A cee ee ake Sp er ee a ee HHS CONTON geeth e a a Sr Ge ae Bt os Sut ca Gy lt n A ad ce Me Stopes 412 24 aS A 2 Oe ee ee ae 4 29 E turn_off_conv_rndg 130 turn oft sabia ye Moe de Bae amp ar oe 130 urn Onwconvic rnd 2424 2 4 o ews we ee 30 CUPO On Sat Sire aele oa p ld ae a Saks Deposit Extract 4 2 4 23 ated Sg 21 Sdn te 282 extract Hoy amp 4th lt a lt Si ue Se ce So Me lt n enna ok re ae Se AZ extract lima e a a A Oe a we ee AS Li ASPOSTIE Mets e m ogar a a a a 22133 bGdepo svete a o e AO DIVISION et a dt dt e EA ee PS Al AIV EA oh oe he cae ech he ce dy Se ce SG Oe Re ea we Seo Shen i OA Cav SAR IRA we Ye a Be oe a a oe RD aed ven OO MESA elem SG AR a a oe amp oD div GAG oros e t oe BO ee A oe a a a 36 Multiplication MAC 00 ao sa wa Ge ST TAG Se A A A ae tee oe ae te Ot amp lL TOSS gt as ele el ok a Ok eek amp Aor eA ak 2 als WATE AG B A
110. Warrior window select Project gt Add Files e Drag files from the desktop or Windows Explorer to the project window To remove files a Select the files in the project window that you want to delete Targeting DSP56800E DSP 27 Getting Started Editing the Contents of a Project b Press the Delete key or right click and select remove 2 Edit code in the source files Use the IDEs source code editor to modify the content of a source code file To open a file for editing use either of the following options e Double click the file in the project window e Select the file in the project window and press Enter Once the file is open you can use all of the editor s features to work with your code DSP 28 Targeting DSP56800E Development Studio Overview This chapter is for new users of the CodeWarrior IDE This chapter contains the following sections e CodeWarrior IDE e The Development Process If you are an experienced CodeWarrior IDE user you will recognize the look and feel of the user interface However it is necessary that you become familiar with the DSP56800E runtime software environment CodeWarrior IDE Targeting DSP56800E The CodeWarrior IDE lets you create software applications It controls the project manager the source code editor the class browser the compiler linker and the debugger In the project manager you can organize all the files and settings related to your project so
111. Word16 sinpl Word16 sinp2 Example short sl 0x2000 0 25 short s2 0x2000 0 257 7 short result result mult_r s1 s2 Expected value of result 0 625 0x0800 L_mac Definition Multiply two 16 bit fractional values and add to 32 bit fractional Assumptions Prototype Example value generating a 32 bit result saturating if necessary OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word32 L_mac Word32 laccum Word16 sinpl Word16 sinp2 short sl 0xC000 0 5 short s2 0x4000 0 5 long result Acc 0x20000000 0 25 result L_mac Acc s1 s2 Targeting DSP56800E DSP 139 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Expected value of result 0 L_msu Definition Assumptions Multiply two 16 bit fractional values and subtract this product from a 32 bit fractional value saturating if necessary Generates a 32 bit result OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_msu Word32 laccum Word16 sinpl Word16 sinp2 Example short sl 0xC000 0 5 short s2 0xC000 0 5 long result Acc 0 result L_msu Acc s1 s2 Expected value of result 0 25 L_mult Definition Multiply two 16 bit fractional values generating a signed 32 bit Assumptions Prototype Example
112. _ mode lt units pages all gt Sets the erase mode set_hfm_verify_erase lt 1 0 gt Set the flash memory erase verification mode set_hfm_verify_program lt 1 0 gt Sets the flash program verification mode NOTE The writepmem writexmem and writereg commands are exe cuted in order after the target is reset and before debugging begins e Breakpoint Mode HW Only Targeting DSP56800E DSP 77 Target Settings DSP56800E Specific Target Settings Panels From this list box choose one of the following or accept the default which is Automatic Automatic the CodeWarrior software automatically decides when to use hardware or software breakpoints Software the CodeWarrior software always uses software breakpoints NOTE Software breakpoints are breakpoints where the debugger writes a debug instruction into your code These breakpoints can not be set in flash since it is read only Hardware the CodeWarrior software always uses hardware breakpoints if available NOTE Hardware breakpoints are breakpoints that use the on chip debug ging capabilities of the DSP56800E These capabilities are limited by the number of hardware breakpoints available DSP 78 Targeting DSP56800E C for DSP56800E This chapter contains the following sections General Notes on C Number Formats for DSP56800E Calling Conventions and Stack Frames for DSP56800E Data Alignment Requireme
113. _ setint16 Definition Write a 16 bit signed integer to the modulo buffer and update the pointer This function evaluates lt int_expr gt and copies the value to the location pointed to by the modulo pointer The modulo pointer is then updated by lt amount gt lt amount gt must be a compile time constant Prototype int __ mod _setintl6 int lt mod_desc gt int lt int_expr gt int lt amount gt Example Write the modulo buffer with a value derived from an expression do not update modulo pointer _ mod _setintl1l6 0 getrandomint 0 __mod_error Definition Setup a modulo error variable This function registers a static DSP 162 integer address to hold the error results from any of the modulo buffer API calls The function returns 0 if it is successful 1 otherwise The argument must be the address of a static global integer variable This variable holds the result of calling each of the previously defined API functions This allows the user to monitor the status of the error variable and take action if the error variable is non zero Typically the user would use __mod_error during development and remove it once debugging is complete __mod_error generates no code although the error variable may occupy a word of memory A non zero value in the error variable indicates a misuse of the one of the API functions Once the error variable is set it is reset when __mod_stop is called The error variable contains the error number o
114. _GetCounters 325 _eonce_GetCounterStatus 326 _eonce_GetTraceBuffer 328 _eonce_HaltTraceBuffer 331 _eonce_Initialize 320 _eonce_SetCounterTrigger 322 _eonce_SetTrigger 321 _eonce_SetupTraceBuffer 327 _eonce_StartTraceBuffer 330 EOnCE Special Counter panel 186 Error 166 Exporting and importing panel options to XML Files 38 extended data addressing examples 92 external library compatibility 94 extract_h 132 extract_l 132 F ffs_1 143 ffs_s 142 File Mappings panel 40 fileName 288 fill memory 180 fill memory dialog box 180 Flash Memory commands 246 debugging 246 Flash security features 248 float size floating point type 81 floating point formats for DSP56800E 81 Force Active Symbols text box 70 force_active 271 275 285 fractional arithmetic 122 DSP 348 equation for converting 122 G general notes on C for DSP56800E 79 general purpose registers 199 Generate ELF Symbol Table checkbox 68 Generate Link Map checkbox 66 Generate Listing File checkbox 55 Generate S Record File checkbox 68 Generate Symbolic Info checkbox 65 GLOBAL directive assembly function definitions 116 global integer 93 Global Optimizations settings panel 40 global pointer variable 94 global variables linker command file 275 group keyword 278 286 H Hardware DO Loops 62 heap size 281 High Speed Simultaneous Transfer HSST host side client interface hsst_attach_listener 256 hsst_block_mode 255 hsst_close 252 hsst_
115. _src_pipeline on page 98 pragma check_inline_asm_pipeline _on page 98 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels M56800E Linker The M56800E Linker panel Figure 4 9 controls the behavior of the linker This panel is only available if the current build target uses the M56800E Linker Figure 4 9 M56800E Linker Panel Target Settings Panels MS56800E Linker Target Target Settings MV Generate Symbolic Info I Disable Deadstripping Access Paths IV Store Full Path Names IV Generate ELF Symbol Table Build Extras V Generate Link Map I Suppress Warning Messages Runtime Setti E P List Unused Objects File Mappings Source Trees Show Transitive Closure MB56800E Target Generate S Record File Language Settings I Sort By Address Max Record Lenath C C Language C C Warnings EOL Character M56800E Assembler Entry Point Fntlsim Code Generation M56800E Processor Force Active Symbols Global Optimizations Linker ELF Disassembler Factory Settings Revert Import Panel Export Panel DK Cancel Apply The M56800E Linker panel options are e Generate Symbolic Info The Generate Symbolic Info option controls whether the linker generates debugging information If the option is enabled the linker generates debugging information This information is included within the linked ELF file This setting does not generate a separate file If
116. a HSST_raw_read DSP 264 A target application uses this function to read raw data from a communication channel without any automatic conversion for endianness while communicating size_t HSST_raw_read void ptr size_t length HSST_STREAM rs ptr This parameter specifies the pointer that points to the buffer into which data is read length This parameter specifies the size of the buffer in bytes rs Targeting DSP56800E High Speed Simultaneous Transfer Target Library Interface This parameter specifies a pointer to the communication channel Returns This function returns the number of bytes of raw data read NOTE This function is useful for sending data structures e g C type struc tures HSST_raw_write A target application uses this function to write raw data to a communication channel without any automatic conversion for endianness while communicating size_t HSST_raw_write void ptr size_t length HSST_STREAM rs ptr This parameter specifies the pointer that points to the buffer that holds the data to write length This parameter specifies the size of the buffer in bytes rs This parameter specifies a pointer to the communication chan nel Returns This function returns the number of data elements written NOTE This function is useful for sending data structures e g C type struc tures Targeting DSP56800E DSP 265 High Speed Simultaneous Transfer Target Li
117. a ru to indicate that the input file is an unsigned decimal ile Table 7 20 shows examples of the input command Debugging Command Examples input Description input p 100 in dat RD This example sets up the input feature so that the simulator gets values from the in dat file in This example is valid only for decimal format specified by RD and places them the simulator in a memory block p 100 when the target application reads program memory location 100 input off Targeting DSP56800E This example closes all input files and stops the input feature The command is the same both when debugging with the simulator or with target hardware kill Use the kil1 debugging command to close one or all current debugging sessions The syntax for the ki11 command follows k 111 all Table 7 21 shows examples of the ki11 command DSP 233 Debugging for DSP56800E Command Line Debugging Table 7 21 Table 7 22 DSP 234 Debugging Command Examples kill Example Description kill Kills the current debugging session kill all Kills all the debug sessions when debugging multiple cores load Use the load debugging command to open a project or load records into memory The syntax for the load command follows l oad project_file_name eld_file_name or l oad h b filename memory_location The following list defines the first parameter of the second version of the load command
118. a A Je CE by Bes On we 4268 HSST LIS ye Y home He de Ge Oe Se a RA Sh ee OS HSST_SiZe sa sosa a roa oe oe soa s ee we 2604 HSST_raw_read 4 oaoa oa ek bee ee ee 4 2 264 HSST raw write ep an 0k se aD Ge ea cece ah ee BP Mere ZOO HSST_set_log_dir Bs fim fe By Sn bh ae det doe amp 25266 HSS Tanger Program Example book BoM ss o 2266 9 ELF Linker and Command Language 269 Structure of Linker Command Files 270 Memory Segment y c o ate toca om wide a 02 O Closure Blocks a e we a RN Sections Segment a A A a ek da a 272 Linker Command File Srita A A AA A O Alignments ara rai A ae ee ARS Arithmetic Operations 274 Comments lar 5 He Ae A See ee Ae oe AP ee ATA Deadstrip Prevention E A RO Variables Expressions and Tiere Types e Ae tas pa Bd L O Variables and Symbols ate ce ae ee oe ww I EAPO Expressions and Assignments 276 Integral Types o rd SOS aie Se ZO File Selection ers ok oe eh ce a ew el LL Function Selection a ee ee PROD aa AZ ROM to RAM Copying cigalas GAO Stack and Heap Poon a g e prae a age OL Writing Data Directly to Menor A Ai TEO Linker Command File Keyword Listing 283 location counter 283 AD Rey oak tthe vee ee ce Beek Stee Aas Se AP eet anh Mee e at DO ABTEN a a Le Ate Bee oe ee eo Bo eee a 2284 AT GNAL Uh tes Salads oe eee ete A Oke ear SPR ZOO PFORCE ACTIVE amp s Sg Beis ya ae
119. age functions e All statements must either be a label LocalLabel Or an instruction instruction operands e Each statement must end with a new line e Assembly language directives instructions and registers are not case sensitive The following two statements are the same add x0 y0 ADD X0 YO Creating Labels for M56800E Assembly A label can be any identifier that you have not already declared as a local variable A label must end with a colon Listing 6 5 Labels in M56800E Assembly xl add x0 yl a x2 add x0 yl a x3 add x0 yl a ERROR MISSING COLON DSP 114 Targeting DSP56800E Inline Assembly Language and Intrinsics Calling Assembly Language Functions from C Code Using Comments in M56800E Assembly Comments in inline assembly language can only be in the form of C and C comments You cannot begin the inline assembly language comments with a semicolon nor with a pound sign the preprocessor uses the pound sign You can use the semicolon for comments in asm sources The proper comment format is shown in Listing 6 6 Listing 6 6 Comments Allowed in M56800E In line Assembly Language move x r3 y0 ERROR add x0 y0 OK move r2 x sp ERROR adda r0 r1 n OK Inline Assembly Optimization To optimize a specific block of inline assembly source code use the inline assembly directive optimize_iasm on off By default this directive is off but can be turned on for sec
120. age syntax specific to DSP56800E development with the CodeWarrior IDE Function level Inline Assembly Language Although the DSP56800 and DSP56800E are assembly source code compatible do not re use DSP56800 assembly code in the DSP56800E compiler due to calling convention differences between the DSP56800 and DSP56800E compilers To specify that a block of code in your file should be interpreted as assembly language use the asm keyword and standard DSP56800E instruction mnemonics To ensure that the C compiler recognizes the asm keyword you must disable the ANSI Keywords Only option in the C C Language panel You can use the M56800E inline assembly language to specify that an entire function is in assembly language by using the syntax displayed in Listing 6 1 Function level Syntax asm lt function header gt lt local declarations gt lt assembly instructions gt DSP 112 The function header is any valid C function header and the local declarations are any valid C local declarations Statement level Inline Assembly Language The M56800E inline assembly language supports single assembly instructions as well as asm blocks within a function using the syntax in Listing 6 2 Targeting DSP56800E Inline Assembly Language and Intrinsics Working With DSP56800E Inline Assembly Language Listing 6 2 Statement level Syntax asm inline assembly statement inline assembly statement asm inline
121. amount long result 1 0x24680000 short s2 1 result L_shrtNs 1 s2 Expected value of result 0x12340000 DSP 155 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_shr_r Definition Assumptions Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed If a right shift is performed then rounding performed on result Saturation may occur during a left shift OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_shr_r Word32 lval2shft Word16 s_shftamount Example long 11 0x41111111 short s2 1 long result result L_shr_r 11 s2 Expected value of result 0x20888889 L_shrtNs Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed Saturation does not occur during a left shift Note Ignores upper N 5 bits of s_shftamount except the sign bit MSB Prototype Word32 L_shrtNs Word32 lval2shft Wordl6 s_shftamount Example long result 1 0x24680000 DSP 156 short s2 1 result L_shrtNs 1 s2 Expected value of result 0x12340000 Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Modulo Addressing Intrinsic Functions
122. an perform these actions e Get the default build target name e Get the default project name The syntax for the config command follows conf ig c olor Ir m cee ies le tai text_color background_color Targeting DSP56800E DSP 219 Debugging for DSP56800E Command Line Debugging NOTE Table 7 10 Example config m ode dsp tcl auto s cro11 number_of_lines h exprefix hexadecimal_prefix mem identifier memory_identifier plrocessor processor_name subprocessor_name text_color R_value G_value B_value background_color R_value G_value B_value R_value the R value of an RGB color G_value the Gvalue of an RGB color B_value the B value of an RGB color The valid values to specify an RGB color are from 0 through 255 number_of_lines the number of lines to scroll Table 7 10 shows examples of the config command Debugging Command Examples config Description Display all current configuration status information config c e ff 0 0 Set the error text color to red config Q r 0 0 0 ff Sif ff Set the register display color to black and the background color to white config s 10 Set the page scrolling size to decimal 16 lines config m dsp Set the command line debugging window to dsp mode use the command line debugging commands when clashing config m DSP 220 tel Set the command line debugging
123. annel_id tcl_proc_name The following example uses the hsst_attach_listener command to execute the procedure call_back automatically when a communication channel has data available from the target proc call_back global hsst_descriptor global hsst_nmemb global hsst_size puts hsst_read Shsst_size hsst_nmemb Shsst_descriptor set cid hsst_open channell hsst_attach_listener cid call_back hsst_block_mode Use the hsst_block_mode command to configure a communication channel in blocking mode Doing so causes all calls to hsst_read to block until the requested amount of data is available from the target The default setting is for all channels to be in blocking mode The syntax for hsst_block_mode follows hsst_b lock_mode channel_id The following example configures a channel in blocking mode hsst_block_mode Scid DSP 229 Debugging for DSP56800E Command Line Debugging hsst_close Use the hsst_close debugging command to close a communication channel with the host machine The syntax for the hsst_close command follows hsst_c lose channel_id The following example closes a channel and sets the result to the variable cid hsst_close cid hsst_detach_listener Use the hsst_detach_listener command to detach a listener that had been previously attached for automatic data notification The syntax for hsst_detach_listener follows hsst_d etach_listener channel_id The following example detaches a
124. appropriate libraries Below is a list of the DSP56800E libraries e Metrowerks Standard Libraries MSL MSL C 56800E 1ib Standard C library support for Small Data Model MSL C 56800E lmm lib Standard C library support for Large Data Model e Runtime Libraries runtime 56800E 1lib Low level functions for MSL support for Small Data Model with Host I O via JTAG port runtime 56800E lmm lib Low level functions for MSL support for Large Data Model with Host I O via JTAG port runtime_hsst_56800E 1lib Low level functions for MSL support for Small Data Model with Host I O via HSST runtime_hsst_56800E_1mm lib Low level functions for MSL support for Large Data Model with Host I O via HSST e HSST Libraries There are debug and release targets for SDM and LDM The release targets have maximum optimization settings and debug info turned off For more information see High Speed Simultaneous Transfer on page 251 DSP 311 Libraries and Runtime Code MSL for DSP56800E Table 10 1 Table 10 2 DSP 312 hsst_56800E 1ib DSP 56800E HSST client functions for Small Data Model hsst_56800E_1mm lib DSP56800E HSST client functions for Large Data Model Host File Location Files are created with fopen on the host machine as shown in Table 10 1 Host File Creation Location fopen filename parameter host creation location filename with no path target project file folder full
125. ar anywhere a symbol is allowed Assigning a value to period that is greater than its current value causes the location counter to move but the location counter can never be decremented This effect can be used to create empty space in an output section In the example below the location counter is moved to a position that is 0x1000 bytes past the symbol FSTART_ data data bss FSTART FSTART_ 0x1000 _ end gt DATA DSP 283 ELF Linker and Command Language Linker Command File Keyword Listing ADDR Definition The ADDR function returns the address of the named section or memory segment Prototype ADDR sectionName segmentName symbol In the example below ADDR is used to assign the address of ROOT to the symbol __rootbasecode Example MEMORY ROOT RWX ORIGIN 0x8000 LENGTH 0 SECTIONS code __rootbasecode ADDR ROOT text gt ROOT NOTE In order to use segmentName with this command the segment Name must start with the period character even though segment Names are not required to start with the period character by the linker as is the case with sectionName ALIGN Definition The ALIGN function returns the value of the location counter aligned on a boundary specified by the value of alignValue The alignValue must be a power of two Prototype ALIGN alignValue Note that ALIGN does not update the location counter it only performs arithmetic To update the loc
126. arrior IDE displays the registers DSP 201 Debugging for DSP56800E Register Details Window NOTE Figure 7 22 Using the Text View list box in the Register Details window you can change the text information the CodeWarrior IDE displays Viewing X Memory You can view X memory space values as hexadecimal values with ASCII equivalents You can edit these values at debug time On targets that have Flash ROM you cannot edit those values in the memory window that reside in Flash memory Locate a particular address in program memory From the menu bar of the Metrowerks CodeWarrior window select Data gt View Memory The Source pane in the Program window needs to be the active one in order for the Data gt View Memory to be activated The Memory window appears Figure 7 22 View X Memory Window Pa A Display 00000000 00000008 00000010 00000018 00000020 00000028 00000030 00000038 00000040 Word Size 16 y Page x y Ahi DSP 202 0x0 View Raw data v Hex 00000000 00001000 AE 030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 3030 OA0O 4172 6520 796F 7520 7265 6164 7920 746F 2062 6520 6120 4453 5020 5761 7272 696F 723F DADO 3030 3030 3030 3030 3030 3030 3030 3030 3030 303D 3030 3030 3030 3030 3030 3030 3030 OADA 0041 7272 6179 203D 2000 2564 2000 DADO 2049 4E46 0020 696E 6600 494E 4600 696E 6600 Are you re ady to be a DSP Warrior Targeting DSP5
127. ary data using the address specified by the lt addr_expr gt This function expects a byte address lt addr_expr gt is an arbitrary C expression which normally evaluates the address at the beginning of the modulo buffer although it may be any legal buffer address The lt mod_desc gt evaluates to a compile time constant of either 0 or 1 represented by the modulo pointers RO or R1 respectively The lt mod_sz gt is a compile time integer constant representing the size of the modulo buffer in bytes The lt data_sz gt is a compile time integer constant representing the size of data being stored in the buffer in bytes lt data_sz gt is usually derived from the sizeof operator The __mod_init function may be called independently for each modulo pointer register If __mod_error has not been previously called no record of __mod_init errors are saved If __mod_error has been previously called __mod_init may set one of the error condition in the static memory location defined by __mod_error See __mod_error description for a complete list of error conditions void __mod_init int lt mod_desc gt void lt addr_expr gt int lt mod_sz gt int lt data_sz gt Initialize a modulo buffer pointer with a buffer size of 3 and where each element is a structure __mod_init 0 void amp struct_buf 0 3 sizeof struct mystruct DSP 159 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions
128. ases e The first two 16 bit integer values are passed in YO and Y1 e The first two 32 bit integer or float values are passed in A and B e The first four pointer parameters are passedinR2 R3 R4 and R1 in that order e If A and B are not used for 32 bit parameters they are used for the third and fourth 16 bit parameters e If Bis not used for a 32 bit parameter it is used for the third 16 bit parameter The remaining parameters those not passed in registers are passed on the stack The stack is incremented by the total amount of space required for memory parameters The increment must be an even number of words due to the requirement that SP must be continuously long aligned The stack parameters are moved to the stack from left to right beginning with the stack location closest to SP Because a long parameter must begin at an even address one word gap may be introduced before a long parameter is moved onto the stack DSP 82 Targeting DSP56800E C for DSP56800E Calling Conventions and Stack Frames for DSP56800E Returning Values From Functions The registers A RO R2 and YO are used to return function results as follows 16 bit integer values are returned in YO 32 bit integer or float values are returned in A All pointer values are returned in R2 Structure results are returned in a temporary space allocated by the caller A pointer to this space is passed in RO as a hidden parameter When a function makes a d
129. assembly statement Listing 6 3 The inline assembly language statement is any valid assembly language statement Note that the only difference between the two lines of code is the use of braces versus parenthesis and the terminating semicolon requirement when using parenthesis Adding Assembly Language to C Source Code There are two ways to add assembly language statements in a C source code file You can define a function with the asm qualifier or you can use the inline assembly language The first method uses the asm keyword to specify that all statements in the function are in assembly language as shown in Listing 6 3 and Listing 6 7 Note that if you are using this method you must define local variables within the function Defining a Function with asm asm long MyAsmFunction void Local variable definitions Assembly language instructions Targeting DSP56800E The second method uses the asm qualifier as a statement to provide inline assembly language instructions as shown in Listing 6 4 Note that if you are using this method you must not define local variables within the inline asm statement DSP 113 Inline Assembly Language and Intrinsics Working With DSP56800E Inline Assembly Language Listing 6 4 Inline Assembly with asm long MyInlineAsmFunction void asm move x r0 x0 Assembly Language Quick Guide Keep these points in mind as you write assembly langu
130. ation counter use an assignment such as DSP 284 Targeting DSP56800E ELF Linker and Command Language Linker Command File Keyword Listing Example ALIGN 0x10 update location counter to 16 byte alignment ALIGNALL Definition ALIGNALL is the command version of the ALIGN function It forces the minimum alignment for all the objects in the current segment to the value of alignValue The alignValue must be a power of two Prototype ALIGNALL alignValue Unlike its counterpart ALIGN ALIGNALL is an actual command It updates the location counter as each object is written to the output Example code ALIGNALL 16 Align code on 16 byte boundary init text ALIGNALL 16 align data on 16 byte boundary rodata gt text FORCE_ACTIVE Definition The FORCE_ACTIVE directive allows you to specify symbols that you do not want the linker to deadstrip You must specify the symbol s you want to keep before you use the SECTIONS keyword Prototype FORCE_ACTIVE symbol symbol Targeting DSP56800E DSP 285 ELF Linker and Command Language Linker Command File Keyword Listing GROUP Definition The GROUP keyword allows you to selectively include files and sections from certain file groups Prototype GROUP fileGroup sectionType Definition In the example all the bss sections of the files in the file group named PAD are specified Example GROUP PAD bss INCLUDE Defin
131. aving new target settings stationery files 38 section 108 SECTION mapping in assembly language 116 sections 272 289 290 security features Flash Memory 248 segmentName 290 Set Hardware Breakpoint panel 185 set hardware breakpoints 185 Set Trigger panel 191 set trigger panel 190 set_hfm_base 247 set_hfm_bases 77 set_hfm_config_base 247 set_hfm_erase_mode 77 248 set_hfm_verify_erase 77 248 set_hfm_verify_program 77 248 set_hfmclkd 77 246 setting breakpoints 197 Targeting DSP56800 setting debugger preferences 194 setting up a remote connection 174 setting watchpoints 198 settings panels Access Paths 40 Build Extras 40 C C Language 45 C C Warnings 51 Custom Keywords 40 Debugger Settings 40 ELF Disassembler 58 File Mappings 40 Global Optimizations 40 M56800E Assembler 55 M56800E Linker 65 M56800E Processor 61 M56800E Target 43 M56800E Target panel 75 M56800E Target Settings panel 41 Other Executables 40 Remote Debug Options panel 73 Remote Debugging panel 70 Runtime Settings 40 Source Trees 40 shl 147 shlftNs 148 shlfts 149 short double size floating point type 81 short size ordinal type 80 Show Addresses and Object Code checkbox 59 Show Code Modules checkbox 59 Show Comments checkbox 60 Show Data Modules checkbox 60 Show Debug Info checkbox 60 Show Headers checkbox 58 Show Relocations checkbox 59 Show Source Code checkbox 59 Show Symbol and String Tables checkbox 58 Show Transitive Closure checkbox 67 shr
132. be added by using the pound character or C style double slashes C style comments are not accepted by the LCF parser Listing 9 8 shows examples of valid comments Sample Comments This is a one line comment text This is a partial line comment DSP 274 Targeting DSP56800E ELF Linker and Command Language Linker Command File Syntax Listing 9 9 Deadstrip Prevention The M56800E linker removes unused code and data from the output file This process is called deadstripping To prevent the linker from deadstripping unreferenced code and data use the FORCE ACTIVE KEEP SECTION and REF INCLUDE directives to preserve them in the output file Variables Expressions and Integral Types This section explains variables expressions and integral types Variables and Symbols All symbol names within a Linker Command File LCF start with the underscore character _ followed by letters digits or underscore characters Listing 9 9 shows examples of valid lines for a command file Valid Command File Lines _dec_num 99999999 _hex num 0x9011276 Listing 9 10 Variables that are defined within a SECTIONS section can only be used within a SECTIONS section in a linker command file Global Variables Global variables are accessed in a linker command file with an P prepended to the symbol name This is because the compiler adds an F prefix to externally defined symbols Listing 9 10
133. bled signed char n a 8 128 to 127 unsigned char n a 8 0 to 255 short n a 16 32 768 to 32 767 unsigned short n a 16 0 to 65 535 int n a 16 32 768 to 32 767 unsigned int n a 16 0 to 65 535 long n a 32 2 147 483 648 to 2 147 483 647 unsigned long n a 32 0 to 4 294 967 295 pointer small data model 16 0 to 65 535 enabled large data model 24 0 to 16 777 215 Targeting DSP56800E C for DSP56800E Number Formats for DSP56800E Table 5 2 Targeting DSP56800E 56800E Floating Point Formats Table 5 2 shows the sizes and ranges of the floating point types for the M56800E compiler M56800E Floating Point Types Type Size Range bits float 32 1 17549e 38 to 3 40282e 38 short double 32 1 17549e 38 to 3 40282e 38 double 32 1 17549e 38 to 3 40282e 38 long double 32 1 17549e 38 to 3 40282e 38 DSP 81 C for DSP56800E Calling Conventions and Stack Frames for DSP56800E Calling Conventions and Stack Frames for DSP56800E The DSP56800E compiler stores data and call functions differently than the DSP56800 compiler Advantages of the DSP56800E include more registers that are used for parameters and the more efficient storage of bytes Passing Parameters to Functions The registers A B R1 R2 R3 R4 YO and Y1 are used to pass parameters to functions When a function is called the parameter list is scanned from left to right Parameters are passed in registers in the following c
134. brary Interface HSST_set_log_dir Returns NOTE Listing 8 2 A target application uses this function to set the host side directory for storing temporary log files Old logs that existed prior to the call to HSST_set_log_dir are over written Logging stops when the channel is closed or when HSST_set_log_dir is called with a null argument These logs can be used by the host side function HSST_set_log_dir int HSST_set_log_dir HSST_STREAM stream char dir_name stream This parameter passes a pointer to the communication channel dir_name This parameter passes a pointer to the path to the directory in which to store temporary log files This function returns 0 if the call was successful or 1 if the call was unsuccessful HSST Target Program Example In Listing 8 2 the HSST target program runs in parallel with the host plugin The target communicates with the host side your computer To restart the program after execution click on Restart HSST as shown in Figure 8 1 Sample HSST Target Program include lt stdio h gt include lt stdlib h gt include HSST DSP 266 h Targeting DSP56800E High Speed Simultaneous Transfer Target Library Interface define buf_size 1000 Data size long i test_buffer buf_size int main HSST_STREAM channel_1 channel_2 int written _items 0 int read_items 0 for i 0 i lt buf _ size i test_buffer i i Openi
135. buf 9 The pointer is updated by 1 unit each time through the loop for 1 0 1 lt 100 i int _ mod _access M0 i _ mod _update MO0 1 Reset modulo control register to linear addressing mode _ mod _stop Listing 6 13 Modulo Buffer Example 2 Set up a static location to save error codes if _ mod_error err_codes printf __mod_error set up failedin Initialize a modulo buffer pointer pointing to an array of 10 ints __mod_initint16 M0O amp int_buf 9 10 Check for success of previous call if err_code printf __mod_initint16 failed n _ mod _start DSP 164 Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Write modulo buffer with the result of the expression i Decrement the buffer pointer for each execution of the loop The modulo buffer wraps from index 0 to 9 through the entire execution of the loop for 1 100 Oe dd __mod_setint16 M0O i 1 __mod_stop NOTE Targeting DSP56800E Caveats on Using the Modulo Buffer API Modulo buffers must be aligned properly See the M56800E User s Manual on modulo buffer alignment constraints There is no run time validation of alignment of modulo buffers Using the modulo buffer API on unaligned buffers will cause erratic and unpredictable behavior during data accesses Writing the modulo contro
136. ccess Paths panel 36 40 access permission flags 287 accessing data object global pointer variable 94 accessing data objects examples 93 global integer 93 Accumulating Trigger Options 340 add 126 Add Files command 27 add_hfm_unit 77 247 adding assembly language 113 addr 284 AFTER command 287 align 284 alignall 285 Targeting DSP56800 alignment stack 87 alignsp pragma interrupt 99 Allocating Memory and Heaps for DSP56800E 312 asm keyword 112 asmoutput 97 assembly language 111 statements adding 113 bootstrap code 315 breakpoints 197 Bring Up To Date command 32 Build Extras panel 40 Build System 33 build target defined 16 C C language general notes for DSP56800E 79 C C Language panel 45 46 C C Warnings panel 51 called option in pragma interrupt 102 called pragma interrupt 100 calling assembly functions from C code 115 Calling Conventions and Stack Frames for DSP56800E 82 changing PCI connection command converter server 174 Changing Target Settings 37 char size 80 character data addressing additional information 90 check_c_src_pipeline 98 check_inline_asm_pipeline 98 code and data storage for DSP56800E 89 code deadstripping unused 109 code editing 28 CodeWarrior compiler architecture 33 34 debugging for DSP56800E 169 CodeWarrior IDE available tools 16 comparison to command line 31 DSP 345 Index development process 31 installing 20 CodeWarrior IDE and Its Documentation 15 CodeWarri
137. ception handler addresses The final task performed by the startup code is to call your main function e Force Active Symbols The Force Active Symbols field instructs the linker to include symbols in the link even if the symbols are not referenced In essence it is a way to make symbols immune to deadstripping When listing multiple symbols use a single space between them as a separator Remote Debugging The Remote Debugging panel Figure 4 10 or Figure 4 11 and the M56800E Target panel Figure 4 13 let you set communication connections for interaction between a DSP56800E board or Simulator and the CodeWarrior DSP56800E debugger The Remote Debugging panel options are e Connection Settings The Connection list box allows you to choose the previously defined remote connection that you want to use for debugging Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels For example you may use a previously defined connection based on the simulator remote connection type called Simulator or you may choose to use a connection based on the CCS command converter server called Local Hardware Connection CCS Simulator Select the Simulator in the Connection list box to use the DSP56800E Simulator to test your code instead of downloading the code to actual DSP56800E hardware The Remote Debugging panel shown in Figure 4 10 appears Figure 4 10 Remote Debugging with the Simu
138. character encodings for source text comments and strings preven t header files from being processed more than once Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools pragma r equireprotos relax_pointers RTTI on off som som_env_check stdkeywords on off str ings keyword no reuse no pool no readonly strict on off trigraphs on off wchar_t on off Optimizer Options E HE HEHE HEHEHE HEHEHE HEHEHE HEHEHE H H H H define a pragma for the compiler such as pragma require prototypes relax pointer type checking rules select run time typing information for C default is on enable Apple s Direct to SOM implementation enables automatic SOM environment and new allocation checking implies som allow only standard keywords default is off specify string constant options reuse strings equivalent strings are the same object default pool strings into a single data object make all string constants read only specify ANSI strictness checking default is off enable recognition of trigraphs default is off enable wchar_t as a built in C type default is on Note that all options besides opt off on all space speed level are for backwards compatibility other optimization options may be superceded by use of opt level xxx O O keyword no RF WDNR OO opt keyword off none on all full no space
139. cted clicking OK reads the registers from the target piece by piece and writes it to the specified file The status field is updated with the current progress of the operation Browse Button Clicking the Browse button displays OPENFILENAME or SAVEFILENAME depending on whether you selected the Restore Registers or Save Registers radio button EOnCE Debugger Features The following EOnCE Debugger features are discussed in this section e Set Hardware Breakpoint Panel e Special Counters e Trace Buffer e Set Trigger Panel DSP 184 Targeting DSP56800E Debugging for DSP56800E EOnCE Debugger Features NOTE Figure 7 9 These features are only available when debugging with a hardware target For more information on the debugging capabilities of the EOnCE see the EOnCE chapter of your processor s user manual Set Hardware Breakpoint Panel The Set Hardware BreakPoint panel Figure 7 9 lets you set a trigger to do one of the following halt the processor cause an interrupt or start or stop trace buffer capture To open this panel From the menu bar select EOnCE gt Set Breakpoint Trigger s To clear triggers set with this panel From the menu bar select EOnCE gt Clear Triggers Set Hardware Breakpoint Panel Set Hardware Breakpoint xj Set trigger Action 7 Targeting DSP56800E The Set Hardware BreakPoint panel options are e Set trigger Select this button to open the Set Trigger panel
140. d File Syntax File Selection When defining the contents of a SECTION block specify the source files that are contributing to their sections The standard method is listing the files as shown in Listing 9 16 In a large project the list can become very long For this reason you have to use the asterisk keyword The keyword represents the filenames of every file in your project Note that since you have already added the text sections from the main c file2 c and file3 c files the keyword does not allow addition of the text sections from those files again Sometimes you may only want to include the files from a particular file group The GROUP keyword allows you to specify all the files of a named file group Listing 9 16 Sample File Listing SECTIONS example section main c text file2 c text file3 c text text GROUP fileGroupl text GROUP fileGroup1 data gt MYSEGMENT DSP 278 Targeting DSP56800E ELF Linker and Command Language Linker Command File Syntax Listing 9 17 Function Selection The OBJECT keyword allows precise control over how functions are placed within a section For example if the functions pad and foot are to be placed before anything else in a section use the code as shown in the example in Listing 9 17 Sample Function Selection Using OBJECT Keyword SECTIONS program_section OBJECT Fpad main c OBJECT Ffoot main c te
141. d Save Memory dialog box has two radio buttons e Load Memory e Save Memory The default is Load Memory Memory Type Combo Box The memory types that appear in the Memory Type Combo box are e P Memory Program Memory e X Memory Data Memory Address Text Field Specify the address where you want to write the memory If you want your entry to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Size Text Field Specify the number of words to write to the target If you want your entry to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Dialog Box Controls Cancel Esc and OK In Load and Save operations all controls are disabled except Cancel for the duration of the load or save The status field is updated with the current progress of the operation Clicking Cancel halts the operation and re enables the controls on the dialog box Clicking Cancel again closes the dialog box Pressing the Ese key is same as clicking the Cancel button With the Load Memory radio button selected clicking OK loads the memory from the specified file and writes it to memory until the end of the file or the size specified is reached If the file does not exist an error message appears DSP 179 Debugging for DSP56800E Fill Memory With the Save Memory radio button selected clicking OK reads the memory from the target piece by piece and writes it to the specified file The stat
142. d selecting the correct build target settings Targeting DSP56800E Getting Started Creating a Project Figure 2 2 Targeting DSP56800E Type a name in the Project name field The CodeWarrior IDE adds the mcp extension automatically to your file when the project is saved The mcp extension allows any user to recognize the file as a Metrowerks CodeWarrior project file For example DSP56800E mcp Set the location for the project use If you want to change the default location perform the following steps Click the Set button The Create New Project dialog box Figure 2 2 appears Create New Project Dialog Box 2x Save in E Projects 0 e En File name Save as type Project Files mcp y Cancel V Create Folder a Specify the path where you want the project file to be saved Use the standard navigation controls in the Create New Project dialog box b Click the Save button The CodeWarrior IDE closes the Create New Project dialog box If you want to use the default location for your project go to step 5 In either case the Code Warrior IDE creates a folder with the same name as your project in the directory you select DSP 25 Getting Started Creating a Project NOTE Figure 2 3 New Project Select project stationery Project Stationery MB56800E Simulator M56838E M56852E M56858E EEE Cancel a DSP 26 Enable the Create Folder checkbox in th
143. d_update Definition Update the modulo pointer The __mod_update function updates the modulo pointer by the number of data type units specified in lt amount gt lt amount gt may be negative Of course the pointer will wrap to the beginning of the modulo buffer if the pointer is advanced beyond the modulo boundaries lt amount gt must be a compile time constant Prototype void _ mod _update int lt mod_desc gt int lt amount gt Example Advance the modulo pointer by 2 units __mod_access 0 2 __mod_stop Definition Reset modulo addressing to linear addressing This function writes the modulo control register with a value which restore linear addressing to the RO and R1 pointer registers Prototype void _ mod _stop int lt mod_desc __mod_getint16 Definition Prototype Targeting DSP56800E Retrieve a 16 bit signed value from the modulo buffer and update the modulo pointer This function returns an integer value from the location pointed to by the modulo pointer The function then updates the modulo pointer by lt amount gt integer units lt amount gt 2 bytes lt amount gt must be a compile time constant int _ mod getint16 int lt mod_desc gt int lt amount gt DSP 161 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Example Retrieve an integer value from a modulo buffer and update the modulo buffer pointer by one word int y y _ mod _getint16 0 1 __ mod
144. dd Targeting DSP56800E DSP 87 C for DSP56800E Data Alignment Requirements for DSP56800E e Structures are aligned on a word boundary not on a byte boundary NOTE A structure containing only bytes is still word aligned e Structures are aligned on a double word boundary if 32 bit elements exist in the structure or if an inner structure itself is double word aligned e Arrays are aligned on the size of one array element Pointer Types Word versus Byte Pointers The use of DSP56800E byte and word pointers to implement C pointer types is implied by the alignment requirements defined above The detailed rules used by the compiler are as follows e Use word pointers for all structures e Use the SP to access the stack resident data of all types Bytes Shorts Longs Floats Doubles Any pointer variables e Use word pointers for all accesses to Shorts Longs Any pointer variables e Use byte pointers for Single global or static byte variable when accessed through a pointer using X Rn Global or static array of byte variables Although no pointers are used for accessing scalar global or static byte variables directly by their addresses an instruction with a BP suffix is used MOVE U BP X xxxx lt dest gt MOVE BP lt src gt X XxXxXX DSP 88 Targeting DSP56800E C for DSP56800E Code and Data Storage for DSP56800E Reordering of Data for Optimal Usage Reordering of data is
145. de files global cased like M but write dependency map to a file and generate object code global cased like MD but do not list system include files global scan source files for dependencies and emit Makefile do not generate object code continue working after errors in earlier files global compile only do not link do not precompile any files based on the filename extension global treat include lt gt like include always search both user and system path lists specify output filename or directory for object file s or text output or output filename Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools P precompile file dir preprocess prefix file S no stdinc U u ndefine nam E HE HEHE HEHEHE HEHEHE HEHEHE HEHEHE H HOH H for linker if called global cased preprocess and send output to file do not generate code generate precompiled header from source write header to file if specified or put header in dir if argument is write header to source specified location if neither is defined header filename is derived from source filename note the driver can tell whether to precompile a file based on its extension precompile file source then is the same as c o file source global preprocess source files prefix text file or precompiled header onto all source files global cased passed to all tools d
146. de the compiler creates This panel is available only if the current build target uses the M56800E Linker Figure 4 8 M56800E Processor Panel e sdm Settings Axl Target Settings Panels M56800E Processor G Target E Hardware DO Loops No Do Loops y Target Settings Small Program Model Access Paths Large Data Model Build Extras Runtime Settings F Globals live in lower memory File Mappings Source Trees i M56800E Target E Language Settings C C Language C C Warnings i M56800E Assembler Code Generation H M56800E Processor Global Optimizations Linker ELF Disassembler M56800E Linker IV Pad pipeline for debugger J Emit separate character data section J Zero initialized globals live in data instead of BSS I Create Assembly Output Pipeline Conflict Detection Inline Asm IN ot Detected v C Language IN ot Detected Y Factory Settings Revert Import Panel Export Panel OK Cancel Apply Targeting DSP56800E DSP 61 Target Settings DSP56800E Specific Target Settings Panels The M56800E Processor panel options are e Hardware DO Loops This option controls compiler support for the different levels of hardware DO loops From the list box select any of the following options to specify the level of nested loops that the compiler may generate No Do Loops compiler will not generate any DO loops No Nest DO Loops compiler can generate DO loops but wil
147. debugging 195 editing contents of 27 platform target 16 R ref include 271 275 289 references Motorola Documentation 17 register coloring 95 register coloring optimization 95 Register Details Window 201 registers display contents 199 function parameters 82 general purpose 199 non volatile 83 stack pointer 86 volatile 83 Related documentation for targeting manual 17 remote connection add a new one 175 remove an existing one 177 remote connections setting up 174 Remote Connections panel 175 Remote Debug Options panel 73 Remote Debugging for the Command Converter Server local connection panel 72 Remote Debugging panel 70 195 Remote Debugging with the Simulator panel 71 remote target board debugging 177 Targeting DSP56800 Index requirements See system requirements requirements system 19 reset pragma interrupt 100 Restoring Target Settings 39 Return Codes 334 335 Returning Values from Functions 83 ROM copy table 280 ROM to RAM copy 279 rounding 145 runtime initialization 315 Runtime Settings panel 40 runtime ROM to RAM copy 280 S sample code pragma interrupt and function block 101 pragma interrupt on off reset 101 called option in pragma interrupt 102 pragma define_section and pragma section 108 pragma optimization 104 pragma optimize_for_size 105 pragma unused 109 register coloring 95 save restore registers 182 save restore registers dialog box 183 saveall pragma interrupt 99 S
148. detach_listener 257 hsst_noblock_mode 256 hsst_open 252 hsst_read 253 hsst_set_log_dir 257 hsst_size 255 hsst_write 254 introduction 251 target library interface HSST_close 260 HSST_flush 263 HSST_open 260 HSST_raw_read 264 HSST_raw_write 265 HSST_read 263 HSST_set_log_dir 266 HSST_setvbuf 260 HSST_size 264 HSST_write 262 introduction 259 host defined 15 Targeting DSP56800 Index HSST example Host Program 258 Target Program 266 HSST Host Program example 258 HSST Target Program example 266 hsst_attach_listener 256 hsst_attach_listener debugging command 229 hsst_block_mode 255 hsst_block_mode debugging command 229 HSST_close 260 hsst_close 252 hsst_close debugging command 230 hsst_detach_listener 257 hsst_detach_listener debugging command 230 HSST_flush 263 hsst_log debugging command 230 hsst_noblock_mode 256 hsst_noblock_mode debugging command 231 HSST_open 260 hsst_open 252 hsst_open debugging command 231 HSST_raw_read 264 HSST_raw_write 265 HSST_read 263 hsst_read 253 hsst_read debugging command 231 HSST_set_log_dir 266 hsst_set_log_dir 257 HSST_setvbuf 260 HSST_size 264 hsst_size 255 HSST_write 262 hsst_write 254 hsst_write debugging command 232 icon command converter server 172 implied fractional value 122 include keyword 286 init function 315 inline assembly defining functions 113 function level 112 instructions 112 optimization 115 statement level 112 Targeting DSP56800 syntax 112 insta
149. e Additional Information about Character Data Addressing on page 90 Additionally structures containing character data will be placed in character data sections Zero initialized globals live in data instead of BSS If enabled then the globals that are initialized to zero reside in the data section instead of the bss section DSP 63 Target Settings DSP56800E Specific Target Settings Panels DSP 64 e Create Assembly Output If enabled then every c file will have assembly source code generated The pragma pragma asmoutput can be used to turn off individual files For more details see asmoutput on page 97 Pipeline Conflict Detection Use this option to detect and generate a warning or error message if the inline assembly source code and C language source code have pipeline conflicts when they are compiled In some cases the source code can be a mix of assembly language and C language Inline Asm This option is for detecting pipeline conflicts in the Inline Assembly source code From this list box select any of the following options Not Detected Conflict Error Conflict Error Hardware Stall Warning C Language This option is for detecting pipeline conflicts in the C source code From this list box select any of the following options Not Detected Conflict Error For more details on how to use pragmas to detect pipeline conflicts see the following pragma check_c
150. e Create New Project file dialog box to create a new folder for your project in the selected location Click OK in the New window The New Project window appears Figure 2 3 with a list of board specific project stationeries New Project Window x xl New Project Select project stationery senate a Assembler Mixed C and Assembler Simple C M56838E M56852E M56858E aa E Select the Project Stationery for your target In case of the Simulator click the hierarchical control for the Project Stationery to expand the hierarchical view Then select Simple C language from the hierarchical tree Click OK in the New Project window A project window appears Figure 2 4 This window displays all the files and libraries that are part of the project stationery Targeting DSP56800E Getting Started Editing the Contents of a Project Figure 2 4 CodeWarrior Project Manager Window 0 x 40 sam Jay gy BA Files Link Order Targets e Fle Code Data OE e H code 0 Do y Sl e 5 1 support 0 Oe gf B 9 files 0 0 A Editing the Contents of a Project To change the contents of a project 1 Add source files to the project Most stationery projects contain source files that act as placeholders Replace these placeholders with your own files To add files use either of the following options e From the menu bar of the Metrowerks Code
151. e Debugging Table 7 17 Table 7 18 DSP 228 Debugging Command Examples go Example Description go This command returns immediately The program stops at the first occurrence of a breakpoint You also can use the stop debugging command to break the program go 1 This command stops polling the target when no breakpoint is reached within 1 second It also sets a Tcl variable called still_running tol go all This command starts all the target programs when debugging multiple cores help Use the help debugging command to display help for the debugging commands in the command line debugger window The syntax for the help command follows h elp command command_shortcut Table 7 18 shows examples of the help command Debugging Command Examples help Example Description help This example lists all the debugging commands help b This example displays help for the break debugging command history Use the history debugging command to list the history of the commands entered during the current debugging session The syntax for the history command follows Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Targeting DSP56800E hi story hsst_attach_listener Use the hsst_attach_listener command to set up a Tcl procedure that the debugger notifies whenever there is data in a communication channel The syntax for hsst_attach_listener command follows hsst_a ttach_listener ch
152. e Use rh to indicate that the output file is a hexadecimal file e Use ru to indicate that the output file is an unsigned decimal file Choose from the following options to indicate how to write to the output file e Use a to cause the debugger to append to the output file if it already exists e Use o to cause the debugger to overwrite the output file if it already exists Table 7 24 shows examples of the output command Debugging Command Examples Output Description output p 0 out dat RD A This example stores values which are written to the memory location p 0 by the target This example is valid only forthe application to the file out dat in decimal format simulator indicated by RD The A option appends the values to file out dat if the file already exists output off Targeting DSP56800E This example closes all output files and stops the output feature pwd Use the pwd debugging command to display the working directory The syntax for the pwd command follows pwd radix Use the radix debugging command to e Display the current default input radix number base e Change the default number base for command entry or for display of registers and memory locations DSP 237 Debugging for DSP56800E Command Line Debugging DSP 238 NOTE Changing the default input radix allows you to enter constants in the chosen radix without typing a radix specifier before each constant
153. e build targets have post linkers that perform additional work such as data format conversion on the final executable file Because there is no post linker for the DSP56800E select None in the Post linker list box Output Directory This field shows the directory to which the CodeWarrior IDE saves the executable file which is built from the current project To save the executable file to a different directory click Choose To erase the contents of this field click Clear DSP 42 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels M56800E Target The M56800E Target panel Figure 4 3 instructs the project type and the output file name This panel is only available when the current build target uses the M56800E Linker Figure 4 3 M56800E Target Panel Target Settings Panels MB56800E Target Target Target Settings Project Type Application y Access Paths Build Extras Application Info Runtime Settings Output File Name MBBB00E File Mappings Source Trees E Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations E Linker ELF Disassembler M56800E Linker Revert Import Panel Export Panel OK Cancel Apply Factory Settings The M56800E Target panel options are e Project Type The Project Type list box determines the kind of project Application and Library Usuall
154. e radix command When you display registers or memory locations the display command returns the values to Tcl Consequently you can embed the display command to Tcl as follows set r0 display r0 puts ro0 set r0M display p r0 32bit puts Sr0M set r0r1 display r0 r1 puts r0rl By default the display command displays memory as 16 bits per unit you can change that by specifying unit size as 8bit 16bit 32bit 64bit The syntax for the display command follows dlisplayl regset on all DSP 224 Targeting DSP56800E Debugging for DSP56800E Command Line Debugging off all off id_number on reg group reg_block addr_group 8bit 16bit 32bit 64bit off reg_group reg_block addr_group 8bit 16bit 32bit 64bit Table 7 15 Targeting DSP56800E reg group alist of register sets separated by spaces reg_block register_first register_last addr_group address addr_block addr_block address_first address_last address count count a value indicating the number of memory locations Table 7 15 shows examples of the display command Debugging Command Examples display Example Description display Displays the default items for example register sets The command line debugger executes the display command whenever program execution stops display on Lists the default display items display regset Lists all the availab
155. e specified communication channel This function allows the host side client application to use data logged from a previous High Speed Simultaneous Transfer HSST session rather than reading directly from the board After the initial call to hsst_set_log_dir the CodeWarrior software examines the specified directory for logged data associated with the relevant channel instead of communicating with the board to get the data After all the data has been read from the file all future reads are read from the board DSP 257 High Speed Simultaneous Transfer Host Side Client Interface Returns NOTE Listing 8 1 To stop reading logged data the host side client application calls hsst_set_log_dir with NULL as its argument This call only affects host side reading HRESULT hsst_set_log_dir size_t cid const char log_directory cid This parameter specifies the channel ID of the communication channel from which to log data log_directory This parameter specifies the path to the directory in which to store temporary log files This function returns S_OK if the call succeeds or S_FALSE if the call fails HSST Host Program Example In Listing 8 1 the host is the IDE plugin DLL to the interface with the HSST target DSP56800E project This establishes data transfer between the host your computer and the target the DSP56800E board Before launching the program the IDE plugin needs to be created and placed in the folder
156. eBuffer Clears the contents of the trace buffer Prototype int _eonce_ClearTraceBuffer Parameters There are no parameters for this function Remarks This function clears the trace buffer and is useful when you want a fresh set of data It is necessary to resume capturing when the trace buffer is full and configured to stop capturing Returns Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E DSP 329 Libraries and Runtime Code EOnCE Library _eonce_StartTraceBuffer Resumes trace buffer capturing Prototype int _eonce StartTraceBuffer Parameters There are no parameters for this function Remarks This function causes the trace buffer to immediately start capturing 4 Returns Error code as defined in the sub section Definitions on page 334 DSP 330 Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce_HaltTraceBuffer Halts trace buffer capturing Prototype int _eonce_HaltTraceBuffer Parameters There are no parameters for this function Remarks This function causes the trace buffer to immediately stop capturing 4 Returns Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E DSP 331 Libraries and Runtime Code EOnCE Library _eonce EnableDEBUGEV Allows or disallows a DEBUGEV instruction to cause a core event in breakpoint unit 0 Prototype int _eonce_EnableDEBUGEV char enable Parameters
157. eadstripping checkbox 68 div_ls 135 div_ls4q 136 div_s 134 div_s4q 135 double size floating point type 81 DSP56800E calling conventions and stack frames 82 code and data storage 89 floating point formats 81 integer formats 80 linker 109 pragma directives 97 Simulator 193 stack frame 86 E editing code 32 project contents 27 source files 28 See also IDE User Guide editor of IDE 28 ELF Disassembler settings panel 58 Show Addresses and Object Code checkbox 59 Show Code Modules checkbox 59 Show Comments checkbox 60 Show Data Modules checkbox 60 Show Debug Info checkbox 60 Show Headers checkbox 58 Show Relocations checkbox 59 Show Source Code checkbox 59 Show Symbol and String Tables checkbox 58 Use Extended Mnemonics checkbox 59 Verbose Info checkbox 59 Enable Debugger command 34 EOnCE Debugger Features 184 set hardware breakpoints 185 set trigger panel 190 special counters 186 trace buffer 187 EOnCE Definitions Accumulating Trigger Options 340 Counter Function Modes 339 Counter Trigger Modes 336 Counter Unit Action Options 340 Data Selection Modes 338 DSP 347 Index Miscellaneous Trace Buffer Options 344 Miscellaneous Trigger Options 342 Normal Trigger Modes 335 Normal Unit Action Options 339 Return Codes 334 335 Trace Buffer Capture Options 342 Trace Buffer Full Options 343 EOnCE Library 318 _eonce_ClearTraceBuffer 329 _eonce_ClearTrigger 324 _eonce_EnableDEBUGEV 332 _eonce_EnableLimitTrigger 333 _eonce
158. ecause the OSCNTR is needed for stepping and would corrupt the counter Trace Buffer Capture Options The options in Table 10 14 determine which kind of changes of flow will be captured OR in as many of the following defined identifiers into the options parameter of the _eonce_SetupTraceBuffer function DSP 342 Targeting DSP56800E Libraries and Runtime Code EOnCE Library Table 10 14 Trace Buffer Capture Options Defined Identifier Description CAPTURE_CHANGE_OF_FLOW_NOT_ TAKEN saves target addresses of conditional branches and jumps that are not taken to the trace buffer CAPTURE_CHANGE_OF_FLOW_INTER RUPT saves addresses of interrupt vector fetches and target addresses of RTI instructions to the trace buffer CAPTURE_CHANGE_OF_FLOW_SUBR OUTINE saves the target addresses of JSR BSR and RTS instructions to the trace buffer CAPTURE_CHANGE_OF_FLOW_0 saves the target addresses of the following taken instructions to the trace buffer BCC forward branch BRSET forward branch BRCLR forward branch JCC forward and backward branches CAPTURE_CHANGE_OF_FLOW_1 saves the target addresses of the following taken instructions to the trace buffer BCC backward branch BRSET backward branch BRCLR backward branch Trace Buffer Full Options The options in Table 10 15 describe what action to take when the trace buffer is full One of the following defined identifiers must be OR ed int
159. ecifying the operation in an asm block every time that the operation is required NOTE Support for intrinsic functions is not part of the ANSI C standard They are an extension provided by the CodeWarrior compiler DSP 120 Targeting DSP56800E Inline Assembly Language and Intrinsics Instrinsic Functions for DSP56800E Implementation The CodeWarrior DSP56800E intrinsic functions are implemented as inline C functions in intrinsics_56800E h which is located in the MSL directory tree These inline functions contain mostly inline assembly language code An example is the abs_s intrinsic It is defined as Listing 6 11 Example Code Definition of Intrinsic Function abs_s define abs_s a __abs_s a ABS_S inline Word16 _ abs_s register Word16 svarl Defn Absolute value of a 16 bit integer or fractional value returning a 16 bit result Returns 7fff for an input of 8000 DSP56800E instruction syntax abs FFF Allowed src regs FFF Allowed dst regs same Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code AECA F ACA F F HF F asm abs svarl return svarl Targeting DSP56800E DSP 121 Inline Assembly Language and Intrinsics Instrinsic Functions for DSP56800E Fractional Arithmetic Many of the intrinsic functions for Motorola DSP56800E use fractional arithmetic with implied fractional values An implied fractional value is a symbol which has been declared as an integer
160. ect For further information refer to the Assembler Reference Manual CodeWarrior Linker for DSP56800E The CodeWarrior linker for Motorola DSP56800E is in an Executable and Linker Format ELF linker This linker lets you generate an ELF file the default output file format for your application and generate an S record output file for your application CodeWarrior Debugger for DSP56800E The CodeWarrior debugger controls your program s execution and lets you see what happens internally as your program runs Use the debugger to find problems in your program s execution The debugger can execute your program one statement at a time and suspend execution when control reaches a specified point When the debugger stops a program you can view the chain of function calls examine and change the values of variables inspect the contents of the processor s registers and see the contents of memory Targeting DSP56800E Development Studio Overview The Development Process Metrowerks Standard Library The Metrowerks Standard Library MSL is a set of standard C libraries for use in developing DSP56800E applications These libraries are ANSI compliant Access the library sources for use in your projects These libraries are a subset of the same ones used for all platform targets but the libraries have been customized and the runtime adapted for use in DSP56800E development The Development Process Targeting DSP56800E While working
161. ecurity features of the DSP56800E allow the processor to be locked out and thus disable access through the EOnCE port If the debugger attempts to connect to a secure device and the initialization file is set up for flash programming the debugger will then disable the security feature by issuing a command that erases all of the flash memory Notes for Debugging on Hardware The following list are some things to be aware of when debugging on a hardware target e There is only one hardware breakpoint available which is shared by IDE breakpoints when the Breakpoint Mode is set to hardware in the M56800E Target panel watchpoints and EOnCE triggers Only one of these may be set at a time e When a hardware breakpoint trigger is set to react to an instruction fetch IDE hardware breakpoint or EOnCE trigger be aware that the hardware will react to the fetch whether or not DSP 248 Targeting DSP56800E Debugging for DSP56800E Notes for Debugging on Hardware Targeting DSP56800E the fetched instruction is executed For example if a hardware breakpoint is set just after a loop the processor will stop with the execution point inside the loop This is because the target instruction will be fetched while the program is in the loop due to the large pipeline A branch will occur to facilitate the loop however the processor will stop because the target instruction has already been fetched The M56800E cannot single step over certain
162. ee hs GA es GRA te is Se ie A ee ds oe AGS M UVESTCE Ll rr SE a Sue ehh ABD DSP 6 Targeting DSP56800 Table of Contents Targeting DSP56800 L_mac Lmsu L_mult L_mult_ls Normalization ffs_s norm_s ffs_1 norm_l Rounding round Shifting SAL e shlftNs shlfts shr shr_r shrtNs L_shl L_shlftNs L_shlfts L_shr L_shr_r L_shrtNs Modulo Addressing THN TN An Overview of Modulo Addressing Modulo Addressing Intrinsic Functions Definitions and Examples _ mod_init _ mod_initintl16 __mod_start __mod_access __mod_update __mod_stop _ mod _getintl6 __mod_setintl6 __mod_error 139 140 140 141 2 142 142 143 143 144 145 145 146 fa dz 148 ge LAD 242150 51 y 152 153 z 153 154 22 199 156 156 157 157 158 159 160 160 160 161 161 161 162 162 DSP 7 Table of Contents Modulo Buffer Examples E RA Caveats on Using the Modulo Buffer API a rte ly eer N Error Code Documentation 1 2 166 7 Debugging for DSP56800E 169 Target Settings for Debugging ae ae ae ae os fang e DOD Command Converter Server kane 170 Essential Target Settings for Command notes Server v a EZI Changing the Command Converter Server Protocol to Parallel Fotto d sead 172 Changing the Command Convene Sones Protocol to PCL 174
163. els Figure 4 4 Target Target Settings Access Paths Build Extras Runtime Settings File Mappings Source Trees MB56800E Target Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations Linker ELF Disassembler M56800E Linker C C Language Panel sdm Settings 21 xi C C Language Force C compilation 150 C Template Parser J Enable C99 Extensions 7 Enable Objective C I Legacy for scoping 7 Enable C Exceptions V Enable ATTI 7 Enable bool Support 7 Enable wchar_t Support Inline Depth Don tInine y I Auto Inline J Deferred Inlining Tl Bottom up Inlining D ANSI Strict ANSI Keywords Only Expand Trigraphs P Multi Byte Aware 7 EC Compatibility Mode 7 Map newlines to CR Relaxed Pointer Type Rules Tl Enums Always Int Use Unsigned Chars Il Pool Strings IV Reuse Strings IV Require Function Prototypes Prefix File Factory Settings Revert Import Panel Export Panel DK Cancel Apply The C C Language panel options are e Inline Depth NOTE Select this function if you want the compiler to determine whether to inline a function based on the settings of ANSI Keywords Only and the Inline Depth and Auto inline options When you call an inline function the compiler inserts the function s code instead of issuing instructions to call that function Inline func ti
164. enable char This parameter can specify a non zero or zero value If it is a non zero value then the DEBUGEV instruction causes a core event If it is a zero value then the action is disallowed Remarks This function configures the behavior for the DEBUGEV instructions For a core event to occur breakpoint unit 0 must be activated by setting a trigger using the _eonce_SetTrigger or _eonce_SetCounterTrigger functions Returns Error code as defined in the sub section Definitions on page 334 DSP 332 Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce_EnableLimitTrigger Allows or disallows a limit trigger to cause a core event in breakpoint unit 0 Prototype int _eonce_EnableLimitTrigger char enable Parameters enable char This parameter can specify a non zero or zero value If it is a non zero value it allows a limit trigger to cause a core event If it is a zero value it disallows the action Remarks This function configures the behavior for overflow and saturation conditions in the processor core For a core event to occur breakpoint unit 0 must be activated by setting a trigger using the _eonce_SetTrigger or _eonce_SetCounterTrigger functions Returns Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E DSP 333 Libraries and Runtime Code EOnCE Library Definitions This sub section defines Return Codes Normal Trigger Modes Co
165. er Command File Keyword Listing AT loadAddress is an optional parameter that specifies the address of the section The default if not specified is to make the load address the same as the relocation address contents are made up of statements These statements can e Assign a value to a symbol e Describe the placement of an output section including which input sections are placed into it segmentName is the predefined memory segment into which you want to put the contents of the section The two variants are gt segmentName Places the section contents at the beginning of the memory segment segmentName gt gt segmentName Appends the section contents to the memory segment segmentName Here is an example section definition Example SECTIONS etext if F_textSegmentStart footpad c text ALIGN 0x10 padfoot c text F_textSegmentEnd gt TEXT data data gt DATA bss bss gt BSS COMMON DSP 290 Targeting DSP56800E ELF Linker and Command Language Linker Command File Keyword Listing SIZEOF Definition The SIZEOF function returns the size of the given segment or section The return value is the size in bytes Prototype SIZEOF sectionName segmentName symbol NOTE In order to use segmentName with this command the segment Name must start with the period character even though segment Names are not required to start with the period character by the linker as is
166. ers or memory locations You can change the contents of e A single register e A block of registers e A single memory address e A block of memory addresses The syntax for the change command follows c hange register reg_block address addr_block value 8bit 16bit 32bit 64bit reg_block register_first register_last addr_block address_first address_last address count count a value indicating the number of memory locations whose contents to change Table 7 7 shows examples of the change command Debugging Command Examples change Example Description change R1 123 This example changes the contents of R1 to 123 change R1 R5 5432 This example changes the contents of R1 through R5 to 5432 DSP 217 Debugging for DSP56800E Command Line Debugging Table 7 7 Debugging Command Examples change continued Example change p 10 17 3456 Description This example changes p memory address 10 through 17 to 3456 change p 18 1f 03456 This example changes p memory addresses 18 through 1f to 00003456 When you change the contents of one or more memory locations you do not have to specify the memory access mode whether the mode is eight bit 16 bit 32 bit or 64 bit If you do not specify the memory access mode the debugger determines it as follows e If value isa fractional value the mode is 16 bit e If value is a hexadecimal value the debugger deter
167. etTrigger Prototype Parameters Remarks Returns Targeting DSP56800E Sets a trigger condition used to halt the processor cause an interrupt or start and stop the trace buffer This function does not set triggers for special counting functions int _eonce_SetTrigger unsigned int unit unsigned long options unsigned long valuel unsigned long value2 unsigned long mask unsigned int counter unit unsigned int This parameter specifies which breakpoint unit to use options unsigned long This parameter describes the behavior of the trigger For more information on the identifiers for this parameter please see the sub section Definitions on page 313 valuel unsigned long This parameter specifies the address or data value to compare as defined by the options parameter value2 unsigned long This parameter specifies the address or data value to compare as defined by the options parameter mask unsigned long This parameter specifies which bits of value2 to compare counter unsigned int This parameter specifies the number of successful comparison matches to count before completing trigger sequence as defined by the options parameter This function sets all triggers except those used to define the special counting function behavior Carefully read the list of defined identifiers that can be OR ed into the options parameter MN Error code as defined in the sub section Definitions on page 334 DS
168. f the last error A successful Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions call to an API function will not reset the error variable only __mod_stop will reset the error variable Prototype int __mod_error int lt static_object_addr gt Example Register the error number variable static int myerrno assert __mod_error amp myerrno 0 Modulo Buffer Examples In this section we provide two modulo buffer examples that are shown in Listing 6 12 and Listing 6 13 Listing 6 12 Modulo Buffer Example 1 pragma define section DATA _INT_MODULO data_int_modulo Place the buffer object in a unique section so the it can be aligned properly in the linker control file pragma section DATA _INT_MODULO begin int int_buf 10 pragma section DATA _INT_MODULO end Convenient defines for modulo descriptors define MO 0 define M1 1 int main void int i Modulo buffer will be initialized RO will be the modulo pointer register The buffer size is 10 units The unit size is sizeof int _ mod_init MO void amp int_buf 0 10 sizeof int Targeting DSP56800E DSP 163 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Write the modulo control register _ mod_start Write int_buf 0 through int_buf 9 RO initially points at int_buf 0 and wraps when the pointer value exceeds int_
169. ff turn off all warnings on turn on all warnings global warning options no cmdline command line parser warnings no Jerr or treat warnings as errors no iserr or display dump display list of active warnings show keyword specify disassembly options only none as in show none or e g show only code data all show everything default no code no text show disassembly of code sections default no comments show comment field in code implies show code default no extended show extended mnemonics implies show code default no data show data with show verbose show hex dumps of sections default no debug no sym show symbolics information default no exceptions show exception tables implies show data default no headers show ELF headers default no hex show addresses and opcodes in code disassembly implies show code default no names show symbol table default no relocs show resolved relocations in code and relocation tables default no source show source in disassembly implies show DSP 306 Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools with show verbose displays entire source file in output else shows only four lines around each function show exception tables default show verbose information including hex du
170. for DSP56800E Calling Conventions and Stack Frames for DSP56800E Figure 5 1 DSP 86 Stack Frame The stack frame is generated as shown in Figure 5 1 The stack grows upward meaning that pushing data onto the stack increments the address in the stack pointer Stack Frame sp outgoing parametes The stack pointer register SP is a 24 bit register like other Address Generation Unit AGU registers and it is always treated as a word pointer The stable position for SP during a function execution is at the top of the user and compiler locals The SP increases during the call if the stack is used for passed parameters The software stack supports structured programming techniques such as parameter passing to subroutines and local variables These techniques can be used for both assembly language programming as well as high level language programming It is possible to support passed parameters and local variables for a subroutine at the same time within the stack frame Local data is stored by size Smaller data is placed closest to the stack pointer in an attempt to use the various stack pointer addressing modes with small offsets Therefore all bytes are packed two per word near the stack pointer The block of words is next followed by blocks of longs Aggregates structs and arrays are furthest from the stack pointer and not sorted by size Targeting DSP56800E C for DSP56800E Data Alignment Requirements for DSP56800E
171. for DSP56800E Command Converter Server Changing the Command Converter Server Protocol to Parallel Port If you specified the wrong parallel port for the command converter server when you installed CodeWarrior for DSP56800E you can change the port Change the parallel port 1 Click the command converter server icon While the command converter server is running locate the command converter server icon on the status bar Right click on the command converter server icon Figure 7 1 Figure 7 1 Command Converter Server Icon A menu appears Figure 7 2 Figure 7 2 Command Converter Server Menu Configure Show console Hide console About CCS Quit CCS 2 Select Show console from the menu The Metrowerks Command Converter Server window appears Figure 7 3 DSP 172 Targeting DSP56800E Debugging for DSP56800E Command Converter Server Figure 7 3 Metrowerks Command Converter Server Window Metrowerks Command Converter Server iol xj File Edit Show Prefs History Help Metrowerks Command Converter Server console display active 0 Parallel Port LPT 1j CC software ver 2 6 Server listening on port 41475 Clients accepted from all hosts bin 1 mM 3 On the console command line type the following command delete all 4 Press Enter Type the following command substituting the number of the parallel port to use for example 1 for LPT1 config cc parallel 1 Press Enter 7 Type the
172. for DSP56800E includes the Motorola DSP56800E Simulator This software lets you run and debug code ona simulated DSP56800E architecture without installing any additional hardware The simulator simulates the DSP56800E processor not the peripherals In order to use the simulator you must select a connection that uses the simulator as your debugging protocol from the Remote Debugging panel The simulator also enables the DSP56800E menu for retrieving the machine cycle count and machine instruction count when debug ging Cycle Instruction Count Using the simulator you can retrieve the machine cycle count and machine instruction count Machine Cycle Count From the menu bar of the Metrowerks CodeWarrior window select DSP56800E gt Get machine cycle count The following window appears Figure 7 14 Machine Cycle Count DSP 193 Debugging for DSP56800E Launching and Operating the Debugger Metrowerks CodeWarrior x Machine cycles simulated Q Machine Instruction Count From the menu bar of the Metrowerks CodeWarrior window select DSP56800E gt Get machine instruction count The following window appears Figure 7 15 Figure 7 15 Machine instruction Count Metrowerks CodeWarrior x Machine instructions simulated Q NOTE Cycle counting is not accurate while single stepping through source code in the debugger It is only accurate while running Thus the cycle counter is more of a profiling tool than
173. for an input of 0x0000 Does not actually normalize the value Also see the intrinsic ffs_s which handles the case where the input 0x0000 differently Word16 ffs _s Wordl6 ssrc short sl 0x2000 25 short result result ffs_s sl1 Expected value of result 1 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support norm_s Definition Note Prototype Example Computes the number of left shifts required to normalize a 16 bit value returning a 16 bit result Returns a shift count of 0 for an input of 0x0000 Does not actually normalize the value This operation is NOT optimal on the DSP56800E because of the case of returning 0 for an input of 0x0000 See the intrinsic ffs _s which is more optimal but generates a different value for the case where the input 0x0000 Word16 norm_s Word16 ssrc short sl 0x2000 25 short result result norm_s s1 Expected value of result 1 ffs_l Definition Note Prototype Example Targeting DSP56800E Computes the number of left shifts required to normalize a 32 bit value returning a 16 bit result finds 1st sign bit Returns a shift count of 31 for an input of 0x00000000 Does not actually normalize the value Also see the intrinsic norm 1 which handles the case where the input 0x00000000 differently Word16 ffs_1 Word32 lsrc long 11 0x20000000 25 short result
174. for odd SP Increment Decrement Default Data Memory Model fi 6 bit Default Program Memory Model fi 9 bit y Prefix File y Revert Import Panel Export Panel Factory Settings OK Cancel Apply The M56800E Assembler Settings panel options are Targeting DSP56800E e Generate Listing File The Generate Listing File option determines whether a listing file is generated when the CodeWarrior IDE assembles the source files of the project If this option is enabled the assembler creates a listing file which contains the source file along with line numbers relocation information and macro expansions If this option is disabled the assembler does not generate the listing file DSP 55 Target Settings DSP56800E Specific Target Settings Panels DSP 56 When a listing file is output the file is created in the same directory as the assembly file and an 1st extension is appended to the end of the file name Expand Macros in Listing This option is available only if the checkbox for Generate Listing File is selected If this option is enabled the assembler macros expand in the assembler listing Assert NOPs on pipeline conflicts If this option is enabled the assembler automatically inserts NOPs wherever a pipeline conflict is detected An error will be emitted when pipeline conflicts are detected Emit Warnings for NOP Assertions If this option is enabled the assembler warns you that it in
175. g DSP 236 next Use the next debugging command to step over subroutine calls If you execute the next command interactively the command returns immediately The target program starts to run Then you can either wait for the target program to stop executing for example on a breakpoint or type the stop debugging command to stop the execution of the target program If you execute the next command in a script the command line debugger polls until the debugger stops for example on a breakpoint and then executes the next command in the script If the command line debugger continues polling indefinitely because the debugging process does not stop you can stop the script by pressing the Escape key The syntax for the next command follows n ext output Use the output debugging command to map a target memory block to a host file When the target application writes to the memory block the application writes the contents to the specified file instead The syntax for the output command follows o utput address filename rd rf rh ru a o off Specify address when using the simulator to debug Choose from the following options to indicate the format of the output file e Use rd to indicate that the output file is a decimal file e Use rf to indicate that the output file is a fractional file Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 24 Example
176. g the step counter will disable single C 32bit stepping in the debugger V Overflow trigger enabled M Use step counter to execute OxFFFFFFFF Data mask Invert data c ompare 0x1 Breakpoint counter Cancel The Set Trigger panel options are e Primary trigger type This pull down list contains the general categories of triggers that can be set e Primary trigger This pull down list contains the specific forms of the triggers that can be set This list changes depending on the selection made in the Primary trigger type option The symbol contained in some of the triggers descriptions specifies that the sub trigger that it precedes must occur the number of times specified in the Breakpoint counter option to cause a trigger The gt symbol specifies that the first sub trigger must occur then the second sub trigger must occur to cause a trigger Targeting DSP56800E DSP 191 Debugging for DSP56800E EOnCE Debugger Features e Value options There are two edit boxes used to specify addresses and data values The descriptions next to the boxes change according to the selection in Primary trigger type and Primary trigger According to these options only one value may be available e Data compare length When the data trigger address and data compare trigger is selected this set of radio buttons becomes available These options allow you to specify the length of data being compared at that address e Data
177. geting DSP56800E Libraries and Runtime Code EOnCE Library counter2 should be setto 0 Remarks This function is used to set special counting function triggers The special counting options are defined in the sub section Definitions on page 334 Carefully read the list of defined identifiers that can be OR ed into the options parameter 4 Returns Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E DSP 323 Libraries and Runtime Code EOnCE Library _eonce_ClearTrigger Prototype Parameters Remarks Returns DSP 324 Clears a previously set trigger int _eonce_ClearTrigger unsigned int unit unit unsigned int This parameter specifies which breakpoint unit to use This function clears a trigger set with the _eonce_SetTrigger or _eonce_SetCounterTrigger functions 4 Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce _GetCounters Prototype Parameters Remarks Returns Targeting DSP56800E Retrieves the values in the two counter registers int _eonce_GetCounters unsigned int unit unsigned int counter unsigned long counter2 unit unsigned int This parameter specifies which breakpoint unit to use counter unsigned int This parameter holds the value of the counter or the least sig nificant 16 bits if the counter has been extended to 40
178. ging for DSP56800E Register Details Window 4 Figure 7 23 Select how you want to view P memory Using the View list box you have the option to view P Memory in four different ways e Raw Data Figure 7 23 View P Memory Raw Data Window eee Hx Display 00000082 ooo0008A 00000092 DODODOSA DODODDA2 DODOODDAA DO00D0B2 DODODOBA ooooo0ce Word Size 16 y Page p y Figure 7 24 0x82 View Raw data v Hex 00000002 00001002 7BSC BSSA FSFF 4887 7800 SAE0 OOF1 0B70 7CAG OOE 7BS2 4887 0200 1FD8 9A14 FEOF 7B32 4887 2600 1F08 54E2 FESF 7B82 4887 4A00 1F08 54E2 9414 BESA FSFF SAES 54E2 DEOO 4B0F 0000 1FFO 7F90 1049 1FFO 28E0 B6SA FSFF 7FBO 29E0 B48A FSFF 2489 14F0 564 OOE 1FFO 28E0 B6SA FSFF 2289 7FBO B7SA FSFF 2389 54E2 0801 7FBO 0144 ss s He xa mu mu ne sp He un na Ta a a He Qe na Tu a Ha Je ee Tu na wa ee ee nn Te nn Ke nu n sn u nn nn Un on u T nu nu e Disassembly Figure 7 24 View P Memory Disassembly Window lolx Display 0x1 000 View Disassembly y Line 1 P 00001000 28005 YO A P 00001001 4440FFFF add w H1 A P 00001003 907A move w A1 X SP 6 P 00001004 46C0FFFF add w H 1 Y0 P 00001006 8F05 tst w Yo P 00001007 A402 kye loat2str 0x2b9 Oxl00a P 00001008 DF4BFFFA clr w X SP 6 P 0000100A SAB4FFDC adda 36 SP RO P 0000100C B020 move w X RO 4 A P 0000100D 487A orp w X SP 6 A
179. hanged since the last build When you rebuild a project only those files that have changed are recompiled The CodeWarrior IDE also stores compiler and linker settings for each build target You can modify these settings by changing the options in the target settings panels of the CodeWarrior IDE or by using pragma statements in your code Editing Code The CodeWarrior IDE features a text editor It handles text files in MS DOS Windows UNIX and Mac OS formats To open and edit a source code file or any other editable file in a project use either of the following options e Double click the file in the project window e Click the file The file is highlighted Drag the file to the Metrowerks Code Warrior IDE window The editor window has excellent navigational features that allow you switch between related files locate any particular function mark any location within a file or go to a specific line of code Compiling To compile any source code file in the current build target select the source code file in the project window and then select Project gt Compile from the menu bar of the Metrowerks CodeWarrior window To compile all the files in the current build target that were modified since they were last compiled select Project gt Bring Up To Date from the menu bar of the Metrowerks CodeWarrior window In UNIX and other command line environments object code compiled from a source code file is stored in a bina
180. hat load applications onto embedded systems have a maximum length for S records The CodeWarrior debugger can handle S records as large as 256 bytes If you are using something other than the CodeWarrior debugger to load your embedded appli cation you need to determine its maximum length EOL Character The EOL Character list box defines the end of line character for the S record file This list box is available only if you enable the Generate S Record File option DSP 69 Target Settings DSP56800E Specific Target Settings Panels DSP 70 e Entry Point The starting point for a program is set in the Entry Point field in the MS6800E Linker settings panel The Entry Point field specifies the function that the linker first uses when the program runs The default function found in this field is located within the startup code that sets up the DSP56800E environment before your code executes This function and its corresponding startup code will be different depending upon which stationery you have selected In the case of hardware targeted stationery the startup code can be found in the following path support lt name of hardware e g M56852E gt startup In the case of simulator targeted stationery the startup code can be found in the following path support M56800E init The startup code performs other tasks such as clearing the hardware stack creating an interrupt table and getting the stack start and ex
181. he called mode or Use the pragma interrupt saveall mode for the caller The first option may be more efficient because only the registers that are used are preserved The second option is easier to implement but is likely to have a large overhead The situation described above also holds true for library functions because library functions do not have pragma interrupt enabled These calls include C Standard Library calls and Runtime Library calls such as multiplication division and floating point math C Standard Library and Runtime Library CW libraries functions require the AGU Address Generation Unit to be in linear addressing mode that is the MO1 registers are set to 1 If a function is interrupted and was using modulo address arithmetic any calls to CW libraries from the ISR do not work unless the M01 is set to 1 in the ISR Also the MO1 register would need to be restored before exiting the ISR so that the interrupted function can resume as before with the same modulo address arithmetic mode settings DSP 103 C for DSP56800E Pragma Directives for DSP56800E optimization_level Description This pragma controls global optimization Prototype pragma optimization_level lt level gt reset Remarks lt level gt is an integer number between 0 and 4 inclusive The optimization_level pragma controls the global optimization level programmatically through the pragma preprocessor statement You may set the o
182. hen debugging multiple cores Targeting DSP56800E DSP 242 Debugging for DSP56800E Command Line Debugging Table 7 29 NOTE Targeting DSP56800E switchtarget When you are performing multi core or multi chip debugging use the switchtarget debugging command to list the available debugging sessions and to specify to which session you want to send subsequent debugging commands The syntax for the switchtarget command follows sw itchtarget index Table 7 29 shows examples of the switchtarget command Debugging Command Examples switchtarget Example Description switchtarget This example lists the currently available debugging sessions switchtarget 0 Choose the debugging session whose session ID is 0 to send subsequent debugging commands to system Use the system debugging command to execute a system command The command line debugger supports executing system commands that require keyboard input However the command line debugger does not support commands that use the full screen display such as the DOS edit command The syntax for the system command follows sy stem system_command The following example runs a system command that deletes all files in the current directory with the tmp file extension DSP 243 Debugging for DSP56800E Command Line Debugging Table 7 30 DSP 244 system del tmp view Use the view debugging command to change the view mode You can toggle the view
183. her internal or external at any time are indeterminate int HSST_setvbuf HSST_STREAM rs unsigned char buf int mode size size rs This parameter specifies a pointer to the communication chan nel buf This parameter passes a pointer to an external buffer mode This parameter passes the buffering mode as either buffered specified as HSSTFBUF or unbuffered specified as HSSTN BUF size This parameter passes the size of the buffer Returns This function returns 0 if the call was successful or 1 if the call was unsuccessful Targeting DSP56800E DSP 261 High Speed Simultaneous Transfer Target Library Interface NOTE You must flush the buffers before exiting the program to ensure that all the data that has been written is sent to the host For more de tails see HSST flush HSST_write A target application uses this function to write data for the host side client application to read size_t HSST_write void data size_t size size_t nmemb HSST_STREAM stream data This parameter passes a pointer to the data buffer holding the data to write size This parameter passes the size of the individual data elements to write nmemb This parameter passes the number of data elements to write stream This parameter passes a pointer to the communication channel Returns This function returns the number of data elements written DSP 262 Targeting DSP56800E High Speed Simultaneous Tra
184. his example toggles the current bringtofront setting of the window bringtofront on Targeting DSP56800E This example sets the command line debugger window to always display in front of other windows DSP 215 Debugging for DSP56800E Command Line Debugging cd Use the cd debugging command to change to a different directory or display the current directory When typing a directory name you can press the Tab key to complete the name automatically You can use an asterisk as a wild card when entering directory names The syntax for the cd command follows cd path Table 7 6 shows examples of the cd command Table 7 6 Debugging Command Examples cd Example Description cd This example displays the current directory cd c This example changes the directory to the root directory of the C drive cd d mw 0622 test This example changes the directory to the specified directory on the D drive cd c p s DSP 216 This example uses a wild card character to change the current directory to a different directory on the specified drive For example if there is a directory named Program_Files in the root directory of the C drive this example changes the current directory to that directory Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 7 Targeting DSP56800E change Use the change debugging command to change the contents of regist
185. ied file History Combo Box The History combo box displays a list of recent saves and restores If this is the first time you have saved or restored the History combo box is empty If you saved or restored before the combo box remembers your last ten sessions The most recent session will appear at the top of the list Radio Buttons The Save Restore Registers dialog box has two radio buttons e Save Registers e Restore Registers The default is Save Registers DSP 183 Debugging for DSP56800E EOnCE Debugger Features Register Group List This list is only available when you have selected Save Registers If you have selected Restore Registers the items in the list are greyed out Select the register group that you wish to save Dialog Box Controls Cancel Esc and OK In Save and Restore operations all controls are disabled except Cancel for the duration of the load or save The status field is updated with the current progress of the operation Clicking Cancel halts the operation and re enables the controls on the dialog box Clicking Cancel again closes the dialog box Pressing the Esc key is same as clicking the Cancel button With the Restore Registers radio button selected clicking OK restores the registers from the specified file and writes it to the registers until the end of the file or the size specified is reached If the file does not exist an error message appears With the Save Register radio button sele
186. ilename a c o addr_block address_first address_last address count count a value indicating the number of memory locations The following list defines the first parameter to the save command e h write a text file in hexadecimal format e When you save to a file in hexadecimal text format the debugger saves the memory location information in the file Consequently when you load a file saved in this format you do not have to specify the memory address e b write a binary file e When you save to a binary file the debugger does not save the memory location information in the file Consequently when Targeting DSP56800E Debugging for DSP56800E Command Line Debugging you load a file saved in this format you must specify the memory address The following list defines the last parameter to the save command e a append to an existing file e c write if the file does not yet exist e If the file to which you are trying to save already exists the save command does not overwrite the file Instead the save command cancels and returns without changing the file e o overwrite an existing file You can use the Tcl set command to assign a name to a particular block of memory You can then substitute that name instead of typing the specification for the memory block repeatedly Table 7 26 shows examples of the save command Table 7 26 Debugging Command Examples save Example Description set addressBl
187. iles and MWAsmIncludes apply to all target tools on your system such as Windows If you only have the DSP56800E tools installed then you may use the generic variables if you prefer Response File In addition to specifying commands in the argument list you may also specify a response file A response file s filename begins with an O for example file and the contents of the response file are commands to be inserted into the argument list The response file supports standard UNIX style comments For example the response file file contain the following Response file file change output file name to out elf generate debugging symbols o out elf g The above response file can used in a command such as mwcc56800e file main c It would be the same as using the following command mwcc56800e o out elf g main c DSP 294 Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools Sample Build Script This following is a sample of a DOS batch BAT file The sample demonstrates e Setting of the environmental variables e Using the compiler to compile and link a set of files REM set GUI compiler path set COMPILER fpath to compiler REM set includes path set MWCIncludes COMPILER S M56800E Support set MWLibraries COMPILER M56800E Support set MWLibraryFiles Runtime 56800E Lib MSL C 56800E 1lib REM add C
188. in the init file performs other tasks such as clearing the hardware stack creating an interrupt table and retrieving the stack start and exception handler addresses The final task performed by the init function is to call function the main The starting point for a program is set in the Entry Point field in the M56800E Linker settings panel The project for the DSP56800E runtime is CodeWarrior M56800E Support runtime_56800E projects Runtime 56800E mcp Table 10 3 Library Names and Locations Library Name Location Large Memory Model CodeWarrior M56800E Support runtime_56800E lib Runtime 56800E lmm lib Small Memory Model CodeWarrior M56800E Support runtime_56800E lib Runtime 56800E Lib Targeting DSP56800E When creating a project from R1 1 or later Stationery the associated init code is specific to the DSP56800E board See the startup folder in the new project folder for the init code DSP 315 Libraries and Runtime Code Runtime Initialization Listing 10 1 Sample Initialization File DSP56852EVM 56852 init asm z Metrowerks a Motorola Company sample description main entry point to C code 7 setup runtime for C and call main OMR mode bits NL_MODE EQU 8000 CM_MODE EQU 0100 XP_MODE EQU 0080 R_MODE EQU 0020 SA_MODE EQU 0010 section rtlib XREF F_stack_addr org p GLOBAL Finit_M56852_ SUBROUTINE Finit_M56852_ Finit_M56
189. in the standard dialog box that appears Alternatively you can drag and drop a elf file onto the IDE You may have to add additional access paths in the Access Path preference panel in order to see all of the source code Choose Project gt Debug to begin debugging the application When you debug a e1f file without a project the IDE sets the Build before running setting on the Build Settings panel of the IDE Preference panels to Never Consequently if you open another project to debug after debugging a el file you must change the Build before running setting before you can build the project The project that the CodeWarrior tools uses to create a new project for the given e1f file is 56800E_Default_Project xml and is located in the path CodeWarrior bin plugins support directory You can create your own version of this file to use as a default setting when opening a elf file Create a new project with the default setting you want Export the project to xml format Rename the xml format of the project to 56800E_Default_Project xml and place it in the support directory Back up or rename the original version of the default xml project be fore overwriting it with your own customized version DSP 207 Debugging for DSP56800E Command Line Debugging Command Line Debugging Table 7 2 DSP 208 In addition to using the regular CodeWarrior IDE debugger windows you also can debug on the command line When you debug
190. ion default turn on debugging information store full paths to source files global for this tool warning options passed to all tools turn off all warnings passed to all tools turn on most warnings passed to all tools command line driver parser warnings passed to all tools treat warnings as errors turn on all warnings require prototypes illegal pragmas empty declarations possible unwanted effects unused arguments unused variables same as w no unusedarg no unusedvar extra commas pedantic error checking hidden virtual functions implicit arithmetic conversions inline functions not inlined passing large arguments to unprototyped functions inconsistent use of class and struct padding added between struct members result of non void returning function not used use of expressions as statements without side effects conversions from pointers to integers and DSP 303 ELF Linker and Command Language DSP56800E Command Line Tools display dump Linker vice versa display list of active warnings Command Line Linker Options dis assemble L 1 path lr path l file no defaults nofail no stdlib E HE HE SHE HEHEHE HEHEHE HEHEHE HEHEHE HEH HHH HoH global disassemble object code and do not link implies nostdlib global cased add library search path default is to search current working directory and then system direct
191. is option is on use _ option mpwc_newline Relaxed Pointer Type Rules When you select this option the compiler treats char and unsigned char as the same type While prototypes are checked for compatible pointer types direct pointer assignments are allowed This option is useful for if you are using code written before the ANSI ISO standard Old source code frequently uses these types interchangeably To check whether this option is on use _ option mpwc_relax Enums Always Int When you select this option the underlying type is always signed int All enumerators must be no larger than a signed int If an enumerated constant is larger than an int the compiler generates an error However if you do not select this option enumerators that can be represented as an unsigned int are implicitly converted to signed int The compiler chooses the integral DSP 49 Target Settings DSP56800E Specific Target Settings Panels data type that supports the largest enumerated constant The type could be as small as a char or as large as long int To check whether this option is on use _ option enumalwaysint e Use Unsigned Chars Select this option to allow the C compiler to treat a char declaration as an unsigned char declaration To check whether this option is on use _ option unsigned_char NOTE If you select this option your code may not be compatible with librar ies that were compiled with this option turned off e
192. isassemble and send output to file global use standard system include paths specified by the environment variable MWCIncludes added after all system I paths default cased undefine symbol name Front End C C Language Options ansi keyword off on relaxed strict ARM on loff bool on off char keyword signed unsigned Cpp_exceptions on off dialect lang keyword Cc Targeting DSP56800E specify ANSI conformance options overriding the given settings same as stdkeywords off enum min and strict off default same as stdkeywords on enum min and strict on same as stdkeywords on enum int and strict on check code for ARM Annotated C Reference Manual conformance default is off enable C bool type true and false constants default is off set sign of char chars are signed default chars are unsigned passed to linker enable or disable C exceptions default is on passed to linker specify source language treat source as C always DSP 299 ELF Linker and Command Language DSP56800E Command Line Tools C ec enum keyword min int inline keyword on smart none off auto noauto all deferred level n iso_templates onloff no mapcr msext keyword on off no multibyte aware once DSP 300 e HE HEHE HEHE HEHEHE SHE HEHEHE HEHEHE HEHEHE HEHE HEHEHE HEHEHE HEHEHE HEHEHE
193. it OxFFFF gt 0x8000 then add 1 short result result round l Expected value of result 0x1235 Targeting DSP56800E DSP 145 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Shifting Click any of the following links to jump to the corresponding intrinsic functions e shl e shliftNs e shifts e shr e shr r e shrtNs e L shl e L shlftNs e L shlfts e L shr e L shr r e L shrtNs DSP 146 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support shli Definition Note Assumptions Prototype Example Targeting DSP56800E Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion This operation is not optimal on the DSP56800E because of the saturation requirements and the bidirectional capability See the intrinsic shlftNs or shlfts which are more optimal OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Word16 shl Word16 sval2shft Word16 s_shftamount short result short sl 0x1234 short s2 1 result shl sl1 s2 Expected value of result 0x2468 DSP 147 Inline Assembly Language and Intrinsics Intrinsic Functions for Math S
194. ition The INCLUDE command allows you to include a binary file in the output file Prototype INCLUDE filename KEEP_SECTION Definition The KEEP_SECTION directive allows you to specify sections that you do not want the linker to deadstrip You must specify the section s you want to keep before you use the SECTIONS keyword Prototype KEEP _SECTION sectionType sectionType DSP 286 Targeting DSP56800E ELF Linker and Command Language Linker Command File Keyword Listing The MEMORY directive allows you to describe the location and size of memory segment blocks in the target This directive specifies the linker the memory areas to avoid and the memory areas into which The linker command file may only contain one MEMORY directive However within the confines of the MEMORY directive you may MEMORY Definition it links the code and date define as many memory segments as you wish Prototype MEMORY memory _spec The memory_ spec is segmentName accessFlags ORIGIN address LENGTH length COMPRESS gt fileName segmentName can include alphanumeric characters and underscore _ characters accessFlags are passed into the output ELF file Phdr p_flags The accessFlags can be e R read e W write e X executable for P memory placement ORIGIN address is one of the following a memory address an AFTER command Targeting DSP56800E Specify a hex address such as 0x8000 Use the AFTE
195. iw a See a A BD GROUP 200 ad amp 2 ewe delat a leo a em 280 INCLUDE anida o ae Bie Gude ogy ba uel Ap ot Shs on 28286 KEEP SECTION 2 286 DSP 12 Targeting DSP56800 Table of Contents MEMORY OBJECT REF_INCLUDE SECTIONS SIZEOF SIZEOFW WRITEB WRITEH WRITEW A DSP56800E Coinmiana Line Tools Usage Response File Sample Build Script Arguments General Command ioe Options Compiler Linker Assembler 10 Libraries and Runtime Code Targeting DSP56800 MSL for DSP56800E Using MSL for DSP56800E Console and File I O Allocating Stacks and Heaps for the DSP56800E l Definitions Runtime Initialization EOnCE Library _eonce_Initialize _eonce_SetTrigger _eonce_SetCounterTrigger _eonce_ClearTrigger _eonce_GetCounters _eonce_GetCounterStatus _eonce_SetupTraceBuffer _eonce_GetTraceBuffer _eonce_ClearTraceBuffer _eonce_StartTraceBuffer 287 289 289 289 e 291 291 2 5291 eee a y 292 293 293 294 295 296 296 297 304 307 309 309 309 310 312 313 315 318 320 321 ye i 024 025 326 ES 2e 328 3 929 330 DSP 13 Table of Contents _eonce_HaltTraceBuffer 331 _eonce_EnableDEBUGEV 332 _eonce_EnableLimitTrigger 333 Definitions Has Go ta cee pres a Go FE Gee bar Ge amp At Go GAD OM Return Codes 4
196. ject will have the proper support access path Console and File I O DSP56800E Support provides standard C calls for I O functionality with full ANSI ISO standard I O support with host machine console and file I O for debugging sessions Host I O through the JTAG port or HSST in addition to such standard C calls such as memory functions malloc and free A minimal thin printf via console_write and fflush_console is provided in addition to standard I O See the MSL C Reference manual Metrowerks Standard Library Library Configurations There are Large Data Model and Small Data Model versions of all libraries Small Program Model default is off for all library and Stationery targets Metrowerks Standard Library MSL provides standard C library support The Runtime libraries provide the target specific low level functions below the high level MSL functions There are two types of Runtime libraries e JTAG based Host I O Targeting DSP56800E DSP 310 Libraries and Runtime Code MSL for DSP56800E NOTE Targeting DSP56800E e HSST based Host I O For each project requiring standard C library support a matched pair of MSL and Runtime libraries are required SDM or LDM pairs The HSST library is added to HSST client to client DSP56800E targets For more information see High Speed Simultaneous Transfer on page 251 DSP56800E stationery creates new projects with LDM and SDM tar gets and the
197. l not generate nested DO loops Nested DO Loops compiler can generate DO loops that are nested up to two deep i e the outer and inner loops can both be DO loops NOTE An inner loop is nested inside an outer loop if it is entirely con tained in it The compiler generates hardware DO loops for 1 aggregate array and structure initializations and for struct copy under the following conditions e aggregate is byte aligned and aggregate size is greater than four bytes or e aggregate is word aligned and aggregate size is greater than four words or e aggregate is long aligned and if Optimize for Smaller Code Size is selected in the Global Optimizations panel as described in the IDE User s Guide aggregate size is greater than eight words if Optimize for Faster Execution Speed is selected aggregate size is greater than 32 words 2 counted loops in C if the loop counter is less than 65536 and there are no jumps to subroutines inside the loop e Small Program Model If enabled the Small Program Model option allows for more efficient switch table generation Enable this option only if the entire program code fits in 0x0 OxFFFF e Large Data Model If enabled extends the data addressing range of the DSP56800E by providing 24 bit address capability to some DSP 62 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Targeting DSP56800E instructions 24 bit
198. l register viaa __mod_start call essentially changes the global address generation state of the hardware Therefore all user function calls run time supporting function calls standard library calls and interrupts are affected by this change of state It is the customer s responsibility to make sure that any side effects i e RO and R1 update in a modulo way of enabling the modulo ad dressing state are accounted for Enabling the modulo use of the R1 address register also enables the RO address register even if RO is not explicitly initialized with __ mod_init or__mod_initint16 If only one modulo pointer is required we recommend using RO only A successful API call does not clear the error code in the error variable Only __mod_stop clears the error code in the error variable DSP 165 Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Error Code Documentation If you want to register a static variable as error code storage use __mod_error Should an error occur the error code storage will contain one of the values shown in Table 6 2 For a list of modulo addressing intrinsic functions and their possible error codes see Table 6 3 Table 6 2 Description of Error Codes for Modulo Addressing Value Description 11 lt mod_desc gt parameter must be zero or one 12 RO modulo pointer is already initialized An extraneous callto__mod_init or __mod_initint16 to initialize RO has been
199. lator sdm external memory Settings ax Target Settings Panels Remote Debugging Source Trees MB56800E Target Connection Settings Connection Simulator X Edit Connection Language Settings C C Language Remote download path __ gt __ z C C Warnings FO MS56800E Assembler Code Generation MB56800E Processor Global Optimizations Linker ELF Disassembler MB56800E Linker Editor Custom Keywords Debugger Other Executables Debugger Settings Remote Debugging y m F Launch remote host application KK o n n Factory Settings Revert Import Panel Export Panel OK Cancel Apply Command Converter Server Select the Local Hardware Connection CCS in the Connection list box if you want use the command converter server with your computer connected to a Targeting DSP56800E DSP 71 Target Settings DSP56800E Specific Target Settings Panels DSP56800E board The Remote Debugging panel is shown in Figure 4 11 Figure 4 11 Remote Debugging for the Command Converter Server Local Connection Target Settings Panels Remote Debugging Language Settings Connection Settings C C Language C C Warnings Connection Lacal Hardware Connection CCS y Edit Connection M56800E Assembler mm download path Code Generation o MS56800E Processor Linker ELF Disassembler M56800 E Linker Editor fas Cl
200. le register sets on the target chip display on Add regsetl and regset2 register lt regsetl gt lt regset2 gt sets to the default display items display off SIM Remove the SIM register set from the default display items display on ALL Add all supported register sets to the default display items display on p 230 10 Add the specified memory locations to the default display items DSP 225 Debugging for DSP56800E Command Line Debugging Table 7 15 DSP 226 Debugging Command Examples display continued Example Description display off p 230 10 Remove the specified memory locations from the default display items display off all Remove all the items from the default display items display off 2 Remove the item whose ID is 2 from the default display items display PC Lists the value of register PC and returns to Tcl display R1 R5 Lists the contents of registers R1 through R5 display p 00 100 Displays the p memory contents from address 0 to hexadecimal 100 display p 00 200 8bit Display hexadecimal 200 memory units contents from address 0 Access memory in 8bit mode evaluate Use the evaluate debugging command to display a C variable type or value The syntax of the evaluate command follows e valuate b a h u variable The following list defines the options for the first parameter b da h u 1 as follows e b binary e d decimal e f fracti
201. license agreement related to the product associated with the documentation Subject to the foregoing non commercial personal use no portion of this documentation may be reproduced or transmitted in any form or by any means electronic or mechanical without prior written permission from Metrowerks USE OF ALL SOFTWARE DOCUMENTATION AND RELATED MATERIALS ARE SUBJECT TO THE METROWERKS END USER LICENSE AGREEMENT FOR SUCH PRODUCT How to Contact Metrowerks Corporate Headquarters Metrowerks Corporation 9801 Metric Blvd Austin TX 78758 U S A World Wide Web http www metrowerks com Ordering amp Technical Support Voice 800 377 5416 Fax 512 997 4901 Table of Contents 1 Introduction CodeWarrior IDE and Its Documentation New In This Release 2 22202282242 References 2 Getting Started System Requirements e o o a we HS DSP56800E Hardware Requirements Installing the CodeWarrior IDE for DSP56800E Installing the CodeWarrior IDE What Gets Installed 2 2 a a Creating a Project a 5 4 e e dee amp ae Editing the Contents of a Project 2 1 3 Development Studio Overview CodeWarrior IDE i CodeWarrior Compiler for DSP56800E peu CodeWarrior Assembler for DSP56800E CodeWarrior Linker for DSP56800E CodeWarrior Debugger for DSP56800E Metrowerks Standard Library The Development Process y
202. listener that previously was attached hsst_detach_listener S cid hsst_log Use the hsst_log debugging command to log the data to a directory The syntax for the hsst_1og command follows hsst_l og cid directory_name Table 7 19 shows examples of the hsst_log command DSP 230 Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 19 Targeting DSP56800E Debugging Command Examples hsst_log Example Description hsst_log cid c logdata_ The debugger logs the data to the specified directory hsst_log cid 0 The debugger turns off the log hsst_noblock_mode Use the hsst_noblock_mode command to configure a communication channel in non blocking mode Dong so causes all calls to hsst_read to return immediately with any available data limited by the requested size The syntax for hsst_noblock_mode follows hsst_n oblock_mode channel_id The following example configures a channel in non blocking mode set cid hsst_open channel1 hsst_noblock_mode cid hsst_open Use the hsst_open debugging command to open a communication channel with the host machine The syntax for the hsst_open command follows hsst_o pen channel_name The following example opens a channel and sets the returned ID to the variable cid set cid hsst_open ochannel1 hsst_read Use the hsst_read debugging command to read data from an opened communication channel DSP 231 Debugging for DSP56800E Comma
203. lling CodeWarrior IDE 20 int size floating point type 80 integer formats for DSP56800E 80 integral types in LCF 275 interrupt 98 arguments 99 intrinsic functions absolute negate 124 abs_s 124 L_abs 125 L_negate 125 negate 124 addition subtraction 126 add 126 L_add 127 L_sub 128 sub 127 control 129 stop 129 turn_off_conv_rndg 130 turn_off_sat 130 turn_on_conv_rndg 130 turn_on_sat 131 wait 129 deposit extract 132 extract_h 132 extract_l 132 L_deposit_h 133 L_deposit_1 133 division 134 div_ls 135 div_ls4q 136 div_s 134 div_s4q 135 for math support 123 modulo addressing 157 multiplication MAC 137 L_mac 139 L_msu 140 L_mult 140 L_mult ls 141 mac_r 137 msu_r 138 mult 138 mult_r 139 normalization 142 ffs__s 142 ffs_1 143 DSP 349 Index norm_l 144 norm_s 143 rounding 145 round 145 shifting 146 L_shl 153 L_shlftNs 153 L_shlfts 154 L_shr 155 L_shr_r 156 L_shrtNs 156 shl 147 shlftNs 148 shlfts 149 shr 150 shr_r 151 shrtNs 152 K keep_section 271 275 286 L L_abs 125 L_add 127 L_deposit_h 133 L_deposit_1 133 L_mac 139 L_msu 140 L_mult 140 L_mult_ls 141 L_negate 125 L_shl 153 L_shlftNs 153 L_shlfts 154 L_shr 155 L_shr_r 156 L_shrtNs 156 L_sub 128 labels M56800E assembly 114 Large Data Model 91 large data model 62 large data model support 91 Launching and Operating the Debugger 194 LCF See linker command files LENGTH autolength by specifying zero 288 DSP 350 value greater tha
204. lt gcc use GCC like message style IDE use CW IDE like message style parseable use context free machine parseable message Compiler Preprocessing Precompiling and Input File Control Options e HE HE HEHEHE HEHEHE HE HEHEHE HEHEHE HEHE HEHEHE HHH HOH OH Q lobal compile only do not link lobal generate object code lobal interpret include filepaths specified for a foreign operating system i e lt sys stat h gt or lt sys stat h gt when enabled and will separate directories and cannot be used in filenames note this is not a problem on Win32 since these characters are already disallowed in filenames it is safe to leave the option on default specify include searching semantics before searching any access paths the path specified by this option will be searched c no codegen no convertpaths Q Q Q cwd keyword proj begin search in current working directory default source begin search in directory of source file explicit no implicit directory only search I or ir paths include begin search in directory of referencing file D d efine cased define symbol name to value if name value no defaults specified else 1 lobal passed to linker same as nolstdinc default lobal passed to all tools Q dis assemble Targeting DSP56800E DSP 297 d E P ext extension gccinc ludes 1 I I i
205. ltaneously live and places the variables in different registers Targeting DSP56800E DSP 95 C for DSP56800E Optimizing Code for DSP56800E With the DSP56800E development tools you can instruct the compiler to 1 Store all local variables on the stack The compiler loads and stores local variables when you read and write to them Level 0 behavior may be preferable during debugging because all variables are guaranteed to have meaningful values after they have been initialized through the end of the function 2 Place as many local variables as possible in registers In this case two or more variables whose lifetimes do not overlap can use the same register If you prefer this behavior set the optimization to Level 1 or higher in the Global Optimizations panel NOTE At optimization Level 1 and higher local variables can be assigned to different registers in different sections of your code This behavior could produce unexpected results if you compile your code and then attempt to debug it Variables that are declared volatile or those that have the address taken are not kept in registers and may be useful in the presence of interrupts 3 Run Peephole Optimization for the DSP56800E at Levels 1 through 4 NOTE Peephole optimizations are small local optimizations that eliminate some compare instructions and improve branch sequences DSP 96 Targeting DSP56800E C for DSP56800E Pragma Directives for DSP56800E Pragma
206. ma near_data off WARNING near data is not a pragma e Empty Declarations When you select this option the compiler declares a warning if it encounters a declaration with no variable name To check whether this option is on use __ option warn_emptydecl1 Listing 4 2 Example of Empty Declarations that generate Warnings int WARNING int i OK e Possible Errors Select this option if you want the compiler to check for some common typographical mistakes that are legal C syntax but that may have unwanted side effects such as putting in unintended semicolons or confusing and The compiler generates a warning if it encounters one of these An assignment in a logical expression or the condition in awhile if or for expression This check is useful if you use when you meant to use An equal comparison in a statement that contains a single expression This check is useful if you use when you meant to use A semicolon directly after a while if or for statement To check whether this option is on use _ option warn_possunwant DSP 52 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Targeting DSP56800E e Unused Variables When you select this option compiler generates a warning when it encounters a variable that you declare but do not use This check helps you find misspelled variable names and variables you have written out of your prog
207. made 13 R1 modulo pointer is already initialized An extraneous call to _mod_init or __mod_initint16 to initialize R1 has been made 14 Modulo buffer size must be a compile time constant 15 Modulo buffer size must be greater than one 16 Modulo buffer size is too big 17 Modulo buffer size for RO and R1 must be the same 18 Modulo buffer data types for RO and R1 must be the same 19 Modulo buffer has not been initialized 20 Modulo buffer has not been started 21 Parameter is not a compile time constant 22 Attempt to use word pointer functions with byte pointer initialization __mod_getint16 and__mod_setint16 were called but __mod_init was used for initialization __mod_initint16 is required for pointer initialization DSP 166 Targeting DSP56800E Inline Assembly Language and Intrinsics Modulo Addressing Intrinsic Functions Value Description 23 Modulo increment value is too big for modulo buffer size The increment value must be less than or equal to the buffer size 24 Illegal use of R1 as a modulo pointer RO must be initialized as modulo before R1 can be used in a modulo context Table 6 3 Description of Error Codes for Modulo Addressing __mod_init 11 12 13 14 15 16 17 18 21 __mod_stop none __mod_getint16 11 14 22 24 __mod_setint16 11 14 22 24 _ mod_start none __ mod_access 11 19 24 _ mod _ update 11
208. mines the mode as shown in Table 7 8 Table 7 8 Memory Access Mode for Hexadecimal Values Memory Access Mode Eight bit 8bit When value Length Is length lt 2 Examples 1 12 01 16 bit 16bit 2 lt length lt 4 0001 123 32 bit 32bit 4 lt length lt 8 00000123 1234567 64 bit 64bit length gt 8 123456789 e If value is a decimal value the debugger determines the mode as shown in Table 7 9 Table 7 9 Memory Access Mode for Decimal Values Memory Access Mode Eight bit 8bit When value ls value lt Oxff Examples 0 54 255 16 bit 16bit value gt Oxff 256 65535 1000 32 bit 32bit Oxffff lt value lt Oxffffffff 65536 3253532 64 bit 64bit DSP 218 value gt Oxffffffff 4294967296 Targeting DSP56800E Debugging for DSP56800E Command Line Debugging cls Use the c1s debugging command to clear the command line debugging window The syntax for the cls command follows cl s close Use the close debugging command to close the opened default project The syntax for the close command follows clo se config Use the config debugging command to configure the command line debugging window You can configure these items e Window colors e Scrolling size e Mode e The default build target e The hexadecimal prefix e The memory identifier e The processor name e The subprocessor name In addition you c
209. mp of program segments in applications identifiers are case sensitive default generate debug information expand macro in listin output add nop to resolve pipeline dependency default emit warning when there is a pipeline emit warning when there is a hardware stall DSP56800 instructions imply code default no xtables no verbose default Assembler Assembler Control Options no case no debug no macro_expand no assert_nop no warn_nop dependency no warn_stall no legacy allow legacy data prog 16 no debug_workaround data keyword 16 24 prog keyword 16 19 21 Targeting DSP56800E Pad nop workaround debuggin issue in some implementation default data memory compatibility 16 bit default 24 bit program memory compatibility 16 bit default t9 pit 21 bit DSP 307 ELF Linker and Command Language DSP56800E Command Line Tools DSP 308 Targeting DSP56800E 10 Libraries and Runtime Code You can use a variety of libraries with the CodeWarrior IDE The libraries include ANSI standard libraries for C runtime libraries and other codes This chapter explains how to use these libraries for DSP56800E development With respect to the Metrowerks Standard Library MSL for C this chapter is an extension of the MSL C Reference Consult that manual for general details on the standard libraries and their functions
210. n memory and the value of each linker generated symbol Although the linker aggressively strips unused code and data when the CodeWarrior IDE compiles the relocatable file it never deadstrips assembler relocatable files or relocatable files built with other compilers If a relocatable file was not built with the CodeWarrior C compiler the link map lists all of the unused but unstripped symbols List Unused Objects The List Unused Objects option controls whether the linker includes unused objects in the link map Enable the option to let the linker include unused objects in the link DSP 66 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Listing 4 3 map The linker does not link unused code in the program Usually this option is disabled However you might want to enable it in certain cases For example you might discover that an object you expect to be used is not actually used This option is not available unless you enable the Generate Link Map option Show Transitive Closure The Show Transitive Closure option recursively lists in the link map file all of the objects referenced by main Listing 4 3 shows some sample code To show the effect of the Show Transitive Closure option you must compile the code Sample Code to Show Transitive Closure void foot void int a 100 void pad void f int b 101 int main void foot pad return 1 Targe
211. n zero 288 libraries MSL for DSP56800E 309 support for DSP56800E 309 Library EOnCE 318 license key 21 linear addressing 103 link order 110 linker for DSP56800E 109 link order 110 See also linker command files settings 65 linker command files 269 access permission flags 287 addr 284 AFTER command 287 align 284 alignall 285 alignment 273 arithmetic operations 274 command blocks 271 comments using character 274 deadstripping prevention 275 expressions syntax 276 file selection 278 force_active 285 function selection 279 global variables 275 group keyword 278 286 heap size 281 include keyword 286 integral types 275 keep_section 286 memory directive 287 memory segment 270 object 289 object keyword 279 ref_include 289 sections 289 290 sections segment 272 sizeof 291 sizeofw 291 stack size 281 symbols 275 variables type 275 writeb 291 writeh 292 writew 292 Targeting DSP56800 Index writing data to memory 282 Linker Issues for Motorola DSP56800E 109 Linker list box 42 linking 34 See also IDE User Guide List Unused Objects checkbox 66 load save memory 177 load save memory dialog box 178 loading a elf file without a project 207 long double size floating point type 81 long size ordinal type 80 M M56800E Assembler settings panel 55 Generate Listing File checkbox 55 M56800E Linker Disable Deadstripping checkbox 68 Force Active Symbols text box 70 Generate ELF Symbol Table checkbox 68 Generate Symb
212. nce an address cannot exceed the maximum physical address if you place character data in the upper half of memory the data is rendered unaddressable since address registers have a fixed width For example assuming the small memory model maximum data address is 64 KB words if you place character data at 0x8001 it would require an address of 0x10002 to access it The address 0x10002 does not fit into a 16 bit storage as is required by the small data memory model In order to give you more flexibility the compiler will under your control place all character data into specially named sections as described in Emit separate character data section on page 63 You can then locate these sections in the lower half of the memory map thus ensuring that the data can be addressed Targeting DSP56800E C for DSP56800E Large Data Model Support Large Data Model Support The DSP56800E extends the data addressing range of the DSP56800 by providing 24 bit address capability to some instructions 24 bit address modes allow the user access beyond the 64K word boundary set by 16 bit addressing Large data memory model support is controlled by check boxes in the M56800E Processor panel Figure 5 2 See M56800E Processor on page 61 for detail description of options in the panel Figure 5 2 M56800E Processor Panel Large Data Model 5 ldm Settings UA Target Settings Panels E Target Target Settings Access Paths Build Ext
213. nd Line Debugging DSP 232 The syntax for the hsst_read command follows hsst_r ead size nmemb cid The following example uses the hsst_read command to read 15 data items each 1 byte in length from the channel identified by the variable cid puts hsst_read 1 15 cid The debugger returns and displays the data hsst_write Use the hsst_write debugging command to write data to an opened communication channel The syntax for the hsst_write command follows hsst_w ritel size data cid The following example uses the hsst_write command to write 0x1234 as 2 bytes of data to the channel identified by the variable cid hsst_write 2 0x1234 Scid input Use the input debugging command to map a target memory block to a host file When a target application reads the memory block the application reads the contents of the specified host file instead The syntax for the input command follows 1 nput id_num address filename rd r rh ru off Specify address when using the simulator to debug Specify id_num when using target hardware to debug Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 20 Example Choose from the following options to indicate the format of the input file e Use rd to indicate that the input file is a decimal file e Use rf to indicate that the input file is a fractional file e Use rh to indicate that the input file is a hexadecimal file
214. nd line Click the right mouse button or choose Edit gt Paste Command Line Debugging Commands This section describes the command line debugging commands The default number base for entering commands and displaying registers and memory is hexadecimal You can change it with the radix command or you can override it when entering an individual value To specify a hexadecimal constant precede the constant with a dollar sign To specify a decimal constant precede the con stant with a grave accent To specify a binary value precede the constant with a percent sign To specify a fraction value pre cede the constant with a caret alias Use the alias debugging command to e Create a pseudonym for a debugging command e Remove a pseudonym for a debugging command e List all currently defined aliases The syntax for the alias command follows allias alias_name alias_definition Table 7 3 shows examples of the alias command DSP 213 Debugging for DSP56800E Command Line Debugging Table 7 3 Table 7 4 DSP 214 Debugging Command Examples alias Example Description alias cd This example creates a command named to go to the parent directory alias This example lists all the currently set aliases alias This example removes a previously specified alias named break Use the break debugging command to e Seta breakpoint e Remove a breakpoint e Display all curren
215. ndg 130 turn_off sat 130 turn_on_conv_rndg 130 turn_on_sat 131 U unlock Flash security features 248 unsigned char size ordinal type 80 unsigned int size ordinal type 80 unsigned long size ordinal type 80 unsigned short size ordinal type 80 unused 109 unused code and data deadstripping 109 Use Extended Mnemonics checkbox 59 using comments in M56800E assembly 115 V variables in LCF 275 Verbose Info checkbox 59 viewing memory P memory 203 Register Details Window 201 X memory 202 volatile registers 83 W wait 129 watchpoints 198 web site 17 Windows system requirements 19 writeb 282 291 writeh 282 292 writepmem 77 writereg 77 writew 282 292 writexmem 77 Targeting DSP56800 Index X X memory 202 XML files exporting and importing panel options 38 Targeting DSP56800 DSP 355 CWDSP56800E1 D REV 1 10 2002
216. nel_id This parameter specifies the channel ID of the applicable com munication channel unread This parameter contains the size of unread data in the commu nication channel This function returns S_OK if the call succeeds or S_FALSE if the call fails hsst_block_mode Returns Targeting DSP56800E A host side client application uses this function to set a communication channel in blocking mode All calls to read from the specified channel block indefinitely until the requested amount of data is available By default a channel starts in the blocking mode HRESULT hsst_block_mode size_t channel_id channel_id This parameter specifies the channel ID of the communication channel to set in blocking mode This function returns S_OK if the call succeeds or S_FALSE if the call fails DSP 255 High Speed Simultaneous Transfer Host Side Client Interface hsst_noblock_mode Returns A host side client application uses this function to set a communication channel in non blocking mode Calls to read from the specified channel do not block for data availability HRESULT hsst_noblock_mode size_t channel_id channel_id This parameter specifies the channel ID of the communication channel to set in non blocking mode This function returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_attach_listener DSP 256 Use this function to attach a host side client application as a listener to a
217. ng channel 1 and 2 from TARGET side channel_1 HSST_open channel_1 channel_2 HSST_open channel_2 TARGET writing data to channel 1 written_items HSST_write test_buffer sizeof long buf_size channel_1 TARGET reading data from channel 2 read_items HSST_read test_buffer sizeof long buf_size channel_2 return 0 Figure 8 1 Restart HSST Metrowerks CodeWarrior File Edit View Search Project Debug Data EOnCE Trace Buffer MEME Window Help Bees hOBAaWa O Restart HSSTClientMain Targeting DSP56800E DSP 267 High Speed Simultaneous Transfer Target Library Interface DSP 268 Targeting DSP56800E 9 ELF Linker and Command Language The CodeWarrior Executable and Linking Format ELF Linker makes a program file out of the object files of your project The linker also allows you to manipulate code in different ways You can define variables during linking control the link order to the granularity of a single function change the alignment and even compress code and data segments so that they occupy less space in the output file All of these functions are accessed through commands in the linker command file LCF The linker command file has its own language complete with keywords directives and expressions that are used to create the specifications for your output code The syntax and structure of the linker command file is similar to that of a programming language
218. nker None y M56800E Target Output Directory E Language Settings G Choose C C Language roject C C Warnings Clear M56800E Assembler Code Generation MS56800E Processor Global Optimizations E Linker ELF Disassembler M56800E Linker Save project entries using relative paths Factory Settings Revert Import Panel Export Panel OK Cancel Apply Targeting DSP56800E DSP 41 Target Settings DSP56800E Specific Target Settings Panels The Target Settings panel options are e Target Name Use the Target Name field to set or change the name of a build target When you use the Targets view in the project window you see the name displayed in the Target Name field NOTE The name you specify here is not the name of your final output file It is in stead a name for your personal use that you assign to the build target You specify the name of the final output file in the Output File Name field of the Target gt M56800E Target panel e Linker For DSP56800E projects you must select the M56800E Linker After you select this linker only the panels appropriate for your build target in this case DSP56800E are available e Pre linker Some build targets have pre linkers that perform additional work such as data format conversion before the final executable file is built Because there is no pre linker for the DSP56800E select None in the Pre linker list box e Post linker Som
219. nominator short s1 0xE000 0 25 short s2 0xC000 0 5 short result result div_s4q s1 s2 Expected value of result 0 25 0 5 0 5 0x4000 div_Is Definition Note Prototype Example Targeting DSP56800E Single quadrant division that is both operands positive of a 32 bit fractional dividend and a 16 bit fractional divisor returning a 16 bit result If both operands are equal returns 0x7FFF occurs naturally Does not check for division overflow cases Does not check for divide by zero cases Word16 div_ls Word16 s denominator Word32 1 numerator long 1 0x20000000 0 25 short s2 0x4000 0 5 short result result div_ls s2 s1 Expected value of result 0 25 0 5 0 5 0x4000 DSP 135 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support div_ls4q Definition Note Prototype Example DSP 136 Four quadrant division of a 32 bit fractional dividend and a 16 bit fractional divisor returning a 16 bit result Does not check for division overflow cases Does not check for divide by zero cases Word16 div_ls4q Word32 1_numerator s_denominator long 1 0xE0000000 0 25 short s2 0xC000 0 5 short result result div_ls4q s1 s2 Wordl6 Expected value of result 0 25 0 5 0 5 0x4000 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support Multiplicati
220. nsfer Target Library Interface HSST_read A target application uses this function to read data sent by the host size_t HSST read void data size_t size size_t nmemb HSST_STREAM stream data This parameter passes a pointer to the data buffer into which to read the data size This parameter passes the size of the individual data elements to read nmemb This parameter passes the number of data elements to read stream This parameter passes a pointer to the communication channel Returns This function returns the number of data elements read HSST_ flush A target application uses this function to flush out data buffered ina buffered output channel int HSST_ flush HSST_STREAM stream stream This parameter passes a pointer to the communication channel The High Speed Simultaneous Transfer HSST feature flushes Targeting DSP56800E DSP 263 High Speed Simultaneous Transfer Target Library Interface Returns all open buffered communication channels if this parameter is null This function returns 0 if the call was successful or 1 if the call was unsuccessful HSST_ size Returns A target application uses this function to determine the size of unread data in bytes for the specified communication channel size_t HSST_size HSST_STREAM stream stream This parameter passes a pointer to the communication channel This function returns the number of bytes of unread dat
221. nts for DSP56800E Code and Data Storage for DSP56800E Large Data Model Support Optimizing Code for DSP56800E Pragma Directives for DSP56800E Linker Issues for DSP56800E General Notes on C Note the following on the DSP56800E processor e C language is not supported e Standard C trigonometric and algebraic floating point functions for example sine cosine tan and square root are not supported NOTE A few trigonometric or algebraic functions may be implemented within the DSP56800E MSL R2 0 but these functions are mere ex amples and they are not supported by the DSP56800E e C pointers only allow access to X memory Targeting DSP56800E DSP 79 C for DSP56800E Number Formats for DSP56800E Number Formats for DSP56800E This section explains how the CodeWarrior compiler implements integer and floating point types for 56800E processors You can also read limits h for more information on integer types and float h for more information on floating point types Both limits hand float h are located under the M56800E Support Table 5 1 DSP 80 folder 56800E Integer Formats Table 5 1 shows the sizes and ranges of the data types for the M56800E compiler 56800E Ordinal Types Type Option Setting Size Range bits char Use Unsigned Chars 8 128 to 127 is disabled in the C C Language settings panel Use Unsigned Chars 8 0 to 255 is ena
222. o the options parameter of the _eonce_SetupTraceBuffer function Targeting DSP56800E DSP 343 Libraries and Runtime Code EOnCE Library Table 10 15 Trace Buffer Full Options Defined Identifier Description TB_FULL_NO_ACTION capture continues overwriting previous entries TB_FULL_HALT_CAPTURE capture is halted TB_FULL_DEBUG processor enters debug mode TB_FULL_INTERRUPT processor interrupts to vector specified as Trace Buffer Interrupt Miscellaneous Trace Buffer Option The TRACE BUFFER HALTED option may be OR ed into the options parameter of the _eonce_SetupTraceBuffer function This option puts the trace buffer in a halted state when leaving _eonce_SetupTraceBuffer function This is most useful when setting a trigger by calling _eonce_SetTrigger to start the trace buffer when a specific condition is met DSP 344 Targeting DSP56800E Index Symbols __mod_access 160 __mod_error 162 __mod_getintl6 161 _mod_init 159 _mod_initint16 160 __mod setintl6 162 _ mod start 160 __mod_stop 161 __mod_update 161 _eonce_ClearTraceBuffer 329 _eonce_ClearTrigger 324 _eonce_EnableDEBUGEV 332 _eonce_EnableLimitTrigger 333 _eonce_GetCounters 325 _eonce_GetCounterStatus 326 _eonce_GetTraceBuffer 328 _eonce_HaltTraceBuffer 331 _eonce_Initialize 320 _eonce_SetCounterTrigger 322 _eonce_SetTrigger 321 _eonce_SetupTraceBuffer 327 _eonce_StartTraceBuffer 330 A abs_s 124 A
223. ock Speed feooo Global Optimizations Tr Launch remote host application Custom Keywords Debugger Other Executables Debugger Settings Remote Debugging MS56800E Target Remote Debug Opt Factory Settings Revert Import Panel Export Panel OK Cancel Apply If you select the Command Converter Server then the option JTAG Clock Speed appears with a default value of 8000 kHz e Remote download path this option is not supported at this time e Launch remote host application this option is not supported at this time Remote Debug Options The Remote Debug Options panel Figure 4 12 lets you select different remote debug options DSP 72 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Figure 4 12 Remote Debug Options s sdm external memory Settings f ax Remote Debug Options Target Settings Panels E Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations Linker ELF Disassembler M56800E Linker Editor Custom Keywords Debugger Other Executables Debugger Settings Remote Debugging MB56800E Target Remote Debug Opt m Program Download Options Initial Launch Successive Runs Section Type Download Verify Download Verify Executable Iv a Constant Data Iv Fr Initialized Data Iv Fr r Unitialized Data Iv Memory Configuration Options
224. ock1 p 10 31 Dumps the set addressBlock2 p 10000 20 contents of two save h SaddressBlockl SaddressBlock2 hexfile a memory blocks to a text file called hexfile lodin append mode set addressBlockl p 10 31 Dumps the set addressBlock2 p 10000 20 contents of two save b SaddressBlockl SfaddressBlock2 binfile o memory blocks to a binary text file called binfile lodin overwrite mode step Use the step debugging command to step through a program The debugger automatically executes the display debugging command each time that you invoke the step command Targeting DSP56800E DSP 241 Debugging for DSP56800E Command Line Debugging Table 7 27 Table 7 28 The syntax for the step command follows st ep li in into out Table 7 27 shows examples of the step command Debugging Command Examples step Example Description step li This example steps one line step in This example steps one instruction step into This example steps into a function step out This example steps out of a function stop Use the stop debugging command to stop a running program after invoking a go step or next debugging command The syntax for the stop command follows s top all Table 7 28 shows examples of the stop command Debugging Command Examples stop Example Description stop Stops the currently running target program stop all Stops all currently running target programs w
225. olic Info checkbox 65 List Unused Objects checkbox 66 Show Transitive Closure checkbox 67 Store Full Path Names checkbox 66 M56800E Linker settings panel 65 Generate Link Map checkbox 66 Generate S Record File checkbox 68 Max Record Length field 69 S Record EOL Character list menu 69 Suppress Warning Messages checkbox 68 M56800E Processor settings panel 61 Hardware DO Loops 62 M56800E Target panel 75 M56800E Target Settings panel 41 44 Output File Name 44 Project Type 43 mac_r 137 Make command 34 makefiles 31 memory address 287 memory directive 287 memory window P memory 203 X memory 202 menu command converter server 172 Metrowerks Standard Library MSL for DSP56800E 309 Miscellaneous Trace Buffer Options 344 Targeting DSP56800 Miscellaneous Trigger Options 342 modulo addressing intrinisic functions 157 overview 157 modulo addressing intrinsic functions __mod_access 160 __mod_error 162 __mod_getint16 161 _ mod _init 159 __ mod _initintl6 160 __mod_setint16 162 _ mod start 160 __mod_stop 161 __mod_update 161 definitions and examples 158 modulo buffer example 1 163 example 2 164 example diagram 157 modulo buffer API caveats on using 165 Motorola Documentation 17 msu_r 138 mult 138 mult_r 139 N negate 124 New Connection window 176 New Project window 26 New window 24 non volatile registers 83 norm_l 144 norm_s 143 Normal Trigger Modes 335 Normal Unit Action Options 339 number formats f
226. ommand Line Debugging Window 213 Command Line Debugging Commands 213 BAS em a goa an e a ae amp e213 DrSalS se 9 ox He os wae ca Ge Mon A Sia ie ae tak op ge et ok el bringtofront ik a at oh A os 2 BS ire Geko Targeting DSP56800 DSP 9 Table of Contents DSP 10 CO ye eye ene Ee ee Be Be A ere ie ee E ot Sd 216 CHANCE e Sy oe ee ER AA Yer Ss 217 CIS hig eet ho Sas He Se a eh OS te Be 219 ClO A IA ar ee Me ane tne or 219 COMMS o bre la a Be Re ae Bs 219 COPY ak Ae Ge ae es 221 EA 222 Gin OP Si 2 oh a 2 Biba BS de HOR BS ak BR si 222 disassemble soa e Me en aca gt A HE Hae ge 223 displays Se Om teat oe anlar a EAC ae OR Ge Ugh ale Ae E 224 ValUate s Lats S a Be et Se eh De oe ms hk ee OR 226 XIE ir AA A ee eed 227 BORRADA A a RAE ee EE en E 227 Help e Boorse eB g oe a aA RE ae BS eee Sook 228 STO See cat Ses A e e A gn ran BR 228 hsst_attach_listener 229 hsst_block_mode Daw ede Bo Se oo oh ie a a229 NSSt CIOS se 4 84 aaa Leia ie re eee a Mca 230 hsst_detach_listener 1 2 230 SSI atau ane E Be 6 Bed 230 hsst_noblock_mode 231 ASS s eas e nada ta EN tO a aa 231 hsstreadis Sh Be sa Ok SoS 231 hsst_write 232 PUE LE a A E AAA AA E 232 AP 233 VOR cg eee de So te o a e a ee 234 IOS ha b arate 235 DEXE amp ein Arce Boece Ae e A A A eB doeh a 236 output we Ys 236 PWs Bo oem AE a ot A G4 237 radix i sas S FA
227. on e h hex e u unsigned The preceding parameter defines the format in which to display the value of the variable Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 16 Targeting DSP56800E Debugging Command Examples evaluate Example Description evaluate Lists the types for all the variables in the current and global stack evaluate 1 Returns the value of the variable 1 exit Use the exit debugging command to close the command line debugging window The syntax for the exit command follows ex it go Use the go debugging command to start the program that you are debugging from the current instruction The syntax for the go command follows glo all time_period If you execute the go command interactively the command returns immediately The target program starts to run Then you can either wait for the target program to stop executing for example on a breakpoint or type the stop debugging command to stop the execution of the target program If you execute the go command in a script the command line debugger polls until the debugger stops for example on a breakpoint and then executes the next command in the script If the command line debugger continues polling indefinitely because the debugging process does not stop you can stop the script by pressing the Escape key Table 7 17 shows examples of the go command DSP 227 Debugging for DSP56800E Command Lin
228. on MAC Click any of the following links to jump to the corresponding intrinsic functions e mac r e msu r e mult e mult r e L mac e L msu e L mult L mult ls mac_r Definition Assumptions Prototype Example Targeting DSP56800E Multiply two 16 bit fractional values and add to 32 bit fractional value Round into a 16 bit result saturating if necessary When an accumulator is the destination zeroes out the LSP portion OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled OMR s R bit was set to 1 at least 3 cycles before this code that is 2 s complement rounding not convergent rounding Word16 mac_r Word32 laccum Word16 sinpl Wordl16 sinp2 short sl 0xC000 short s2 0x4000 short result long Acc 0x0x0000FFFF result mac_r Acc sl1 s2 Expected value of result 0xE001 DSP 137 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support msu_r Definition Assumptions Prototype Example Multiply two 16 bit fractional values and subtract this product from a 32 bit fractional value Round into a 16 bit result saturating if necessary When an accumulator is the destination zeroes out the LSP portion OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled OMR s R bit was set to 1 at least 3 cycles before this code that is
229. on use __option only_std_keywords Expand Trigraphs Select this option if you want the C compiler to ignore trigraph characters Many common character constants look like trigraph sequences especially on Mac OS and this extension allows you to use them without including escape characters If you are writing code that must follow the ANSI ISO standard strictly select this option To check whether this option is on use _ option trigraphs Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels NOTE Targeting DSP56800E If this option is on exercise caution when you initialize strings or multi character constants that contain questions marks e Map newlines to CR When you select this option the C compiler allows you to choose how to interpret the newline An and return r characters In most compilers Ar is translated to the value 0x0D the standard value for carriage return and An is translated to 0x0A the standard value for linefeed However the C compiler in the Macintosh Programmers Workshop known as MPW C r is translated to 0x0A and n is translated to 0x0D the opposite of the typical behavior If you select this option the compiler uses the MPW C conventions for An and r characters If you do not select this option the compiler uses the CodeWarrior C and C conventions for the n and r characters To check whether th
230. on page 94 demonstrates how a global pointer variable is loaded into an address register The pointer variable is located at X 0x4567 Int gpl Settings for Loading a Global Pointer Variable Large Data Memory Model Globals in Instruction Comments 64K memory Off Off move w X 0x4567 r0 Default 16 bit addressing 16 bit pointer value On Off move X 0x004567 r0 24 bit addressing pointer value is 24 bit Off On Combination not allowed On On move X 0x4567 r0 16 bit addressing pointer value is 24 bit DSP 94 External Library Compatibility If the main application is built with the large data model external libraries written in C must be built with the large data model enabled This requirement is enforced by the linker The linker will catch issues where a global object is located out of range of a particular instruction encoding A more serious compatibility problem exists regarding passing pointer parameters Applications built with the large data memory model may pass pointer parameters on the stack Libraries built using the small memory model may expect the pointer arguments to occupy a single word of memory when in fact the arguments occupy 2 words This will lead to a runtime corruption of the stack You may or may not build external libraries or modules written in assembly with extended addressing modes The linker does not enforce any compatibility rules on assembly
231. on the command line you can use e Commands included in the Tcl script language e Additional debugging commands that are specific to the debugger Tcl Support This section describes how the command line debugger handles Tcl support Automatically resolving clashing commands Several command line debugging commands clash with built in Tcl commands The command line debugger resolves them as shown in Table 7 2 when the mode is set to auto Resolving Clashing Commands Command Resolution load When you enter the command with one argument containing eld or mcp the command line debugger loads the project Otherwise the debugger calls the Tcl load command break When you enter the command with no argument and in a script file the command line debugger calls the built in Tcl break command Otherwise the debugger uses the break command to control breakpoints close When you enter the close command with no argument the command line debugger closes the current debugging session Otherwise the debugger calls the built in Tcl close command Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Listing 7 1 Tcl support for executing script files Tcl usually executes a script file as one large block Tcl returns only after the entire file executes However the run debugging command executes script files line by line If a particular line is not a complete Tcl command the run command appends the ne
232. ons starting at the last function to the first function in a chain of function calls To check whether this option is on use __option inline_bottom_up e ANSI Strict This option affects several extensions to the C language supported by the CodeWarrior compiler The extensions are C style comments Unnamed arguments in functions definitions Targeting DSP56800E DSP 47 Target Settings DSP56800E Specific Target Settings Panels DSP 48 A not followed by argument in a macro Using an identifier after endif Using typecasted pointers as lvalues Converting pointers to types of the same size Arrays of zero length in structures The D constant suffix In each case the extension is available only if the option is not selected If the option is selected then these extensions to the ANSI C standard are disabled To check whether this option is on use _ option ANSI_Strict ANSI Keywords Only Select this option if you want the compiler to generate an error if it encounters any of the CodeWarrior C additional keywords Use this option if you are writing code that must strictly follow the ANSI ISO standard When this option is not selected the following additional keywords are available to you asm This keyword allows you to use the compiler s built in inline assembler inline This keyword allows you to declare a C function as inline To check whether this option is
233. ons from Assembly Language To call an assembly language function from assembly language use the jsr instruction with the function name as defined in your assembly language source For example you can call your function in Listing 6 9 on page 117 as jsr Fpmemwrite Targeting DSP56800E DSP 119 Inline Assembly Language and Intrinsics Instrinsic Functions for DSP56800E Instrinsic Functions for DSP56800E This section explains issues related to DSP56800E intrinsic functions and using them with DSP56800E projects An Overview of Intrinsic Functions CodeWarrior for DSP56800E has intrinsic functions to generate inline assembly language instructions Intrinsic functions are used to target specific processor instructions They can be helpful in accomplishing a few different things e Intrinsic functions let you pass in data to perform specific optimized computations For example some calculations may be inefficient if coded in C because the compiler has to follow ANSI C rules to represent data and this may cause the program to jump to runtime math routines for certain computations In such cases it probably is better to code these calculations using assembly language instructions and intrinsic functions e Intrinsic functions can control small tasks For example with intrinsic functions you can set a bit in the operating mode register to enable saturation This is more convenient than using inline assembly language syntax and sp
234. ons makes your programs faster because you execute the func tion s code immediately without a function call but possibly larger because the function s code may be repeated in several different places DSP 46 If you do not select ANSI Keywords Only option you can declare C functions to be inline The list box for the Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Inlining options allows you to select inline no functions only functions declared inline or all small functions as shown in Table 4 3 Table 4 3 Options for Inline Depth Menu Options Inline Don t Inline Does not inline functions not even C or C declared inline Smart Inline small functions to a depth of 2 to 4 inline functions deep 1 to 8 Always inlines functions to the depth specified by the numerical selection Always Inline Always inlines functions no matter the depth Auto Inline Select this option to allow the compiler to choose which functions to inline To check whether this option is on use _ option auto_inline Deferred Inlining Select this option if you want the compiler to allow inlining of inline and auto inline functions that are called before these functions are declared To check whether this option is on use _ option defer_codegen The compiler requires more memory for this option e Bottom up Inlining Select this option if you want the compiler to inline functi
235. onversions When you select this option the compiler issues a warning if the destination of an operation is not large enough to hold all the possible results For example assigning the value of a variable type long to a variable of type char results ina warning if this option is on To check whether this option is on use _ option warn_implicitconv e Non Inlined Functions Select this option if you want the compiler to issue a warning when it is unable to inline a function To check whether this option is on use _ option warn_notinlined DSP 54 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels M56800E Assembler The M56800E Assembler panel Figure 4 6 determines the format used for the assembly source files and the code generated by the DSP56800E assembler Figure 4 6 M56800E Assembler Settings Panel MB56800E Assembler Target Settings Panels Target Target Settings Access Paths Build Extras Runtime Settings File Mappings Source Trees MB56800E Target Language Settings C C Language C C Warnings M56800E Assembler Code Generation M56800E Processor Global Optimizations amp Linker ELF Disassembler M56800E Linker I Generate Listing File Expand Macros in Listing I Assert NOPs on pipeline conflicts Emit Warnings for NOP assertions TT Emit Warnings for Hardware Stalls Allow legacy instructions Y Pad Pipeline for Debugger J Emit Warnings
236. or DSP56800E 80 O object 289 object keyword 279 off pragma interrupt 100 on pragma interrupt 100 optimization inline assembly 115 pragma object code 105 optimization_level 104 DSP 351 Index optimize_iasm 115 optimizing code for DSP56800E 95 register coloring 95 ORG directive 116 memory space location 116 ORIGIN AFTER command 287 memory address 287 Other Executables settings panel 40 Output Directory field 42 P P memory 203 Disassembly Data 205 Mixed Data 206 Raw Data 205 Source Data 206 pad pipeline debugger 63 Passing Parameters to Functions 82 platform target defined 16 pointer size ordinal type 80 pointer types word versus byte pointers 88 possible hitches pragma interrupt 103 Post Linker list box 42 pragma asmoutput 97 check_c_src_pipeline 98 check_inline_asm_pipeline 98 define_section 106 interrupt 98 optimization_level 104 section 108 unused 109 Pragma Directives for DSP56800E 97 pragma interrupt alignsp 99 called 100 comr 99 default 100 off 100 on 100 reset 100 saveall 99 pragma interrupt and function block 101 DSP 352 pragma interrupt on off reset 101 pragma object code optimization 105 pragma optimization 104 pragma optimize_for_size 105 Pre Linker list box 42 Preprocess command 34 preprocessing 34 See also IDE User Guide Program window 196 Project Files versus Makefiles 31 Project Manager window 27 project stationery 26 Project Type 43 projects build target 16
237. or IDE Target Settings Panels 40 Command Converter Server 174 changing PCI connection 174 changing the parallel port 172 local connection 71 target settings 171 command converter server icon 172 menu 172 Command Converter Server window 173 command line and CodeWarrior IDE compared 31 command line debugging clashing Tcl commands resolving 208 commands alias 213 break 214 bringtofront 215 cd 216 change 217 close 219 cls 219 config 219 copy 221 debug 222 dir 222 disassemble 223 display 224 evaluate 226 exit 227 go 227 help 228 history 228 hsst_attach_listener 229 hsst_block_mode 229 hsst_close 230 hsst_detach_listener 230 hsst_log 230 hsst_noblock_mode 231 hsst_open 231 hsst_read 231 hsst_write 232 input 232 kill 233 load 234 log 235 Is 222 DSP 346 next 236 output 236 pwd 237 radix 237 restart 239 run 239 save 240 step 241 stop 242 switchtarget 243 system 243 view 244 wait 244 watchpoint 245 introduction 208 tasks clear a command from the command line 212 copy text from the command line debugging window 213 enter a single command 210 enter multiple commands 210 open a command line debugging window 210 paste text into the command line debugging window 213 repeat a command 211 review previously entered commands 211 scroll text in the command line debugging window 212 switch between insert and overwrite mode 212 view debugging command hints 211 Tcl script files executing 209 Tcl start up script
238. ories see defaults search paths have global scope over the command line and are searched in the order given global like 1 but add recursive library search path cased add a library by searching access paths for file named lib lt file gt lt ext gt where lt ext gt is a typical library extension added before system libraries see defaults global same as no stdlib default continue importing or disassembling after errors in earlier files global use system library access paths specified by MWLibraries and add system libraries specified by SMWLibraryFiles default global cased disassemble and send output to file do not link implies nostdlib ELF Linker Options no dead strip force_active symbol keep local on off m ain symbol map keyword closure unused DSP 304 e HE HE HEHE HEHEHE HEHEHE HEHEHE enable dead stripping of unused code default specify a list of symbols as undefined useful to force linking of static libraries keep local symbols such as relocations and output segment names generated during link default is on set main entry point for application or shared library use main to specify no entry point for symbol maximum length 63 chars default is FSTART_ generate link map file calculate symbol closures list unused symbols Targeting DSP56800E ELF Linker and Command Language DSP56800E Command Line Tools
239. ower memory preference panel selection instructs the compiler to access global and static data with 16 bit addresses while all pointer and stack operations are performed using 24 bit addressing Global data may still exist in extended memory if you place the global data in extended memory using the linker control file But you can only access global data through data pointers or assembly level addressing It is your responsibility to properly place data in the memory map if the Globals live in lower memory option is enabled If Globals live in lower memory is enabled the run time results are undefined when global data exists and accessed in extended memory Examples Accessing Data Objects Examples of how the compiler might generate accesses to various data objects are Example 1 This example Table 5 5 demonstrates how a global integer is accessed with the various combinations of the large data memory model switches The global variable is located at address X 0x1234 Int gl Settings for Accessing Global Integer Large Data Memory Model Globals in Instruction Comments 64K memory Off Off move w X 0x1234 y0 Default values On Off move w X 0x001234 y0 Off On Combination not allowed On On move w X 0x1234 y0 Globals accessed using 16 bit addressing Targeting DSP56800E DSP 93 C for DSP56800E Large Data Model Support Table 5 6 Example 2 This example Table 5 6
240. path ir path no keepobj ects MMD make nofail nolink noprecompile nosyspath o file dir DSP 298 e HE H H H E E H H H ELF Linker and Command Language DSP56800E Command Line Tools disassemble files to stdout global cased preprocess source files global cased preprocess and strip out line directives global specify extension for generated object files with a leading period appends extension without replaces source file s extension for extension maximum length 14 chars default is none global adopt GCC include semantics add I paths to system list if I is not specified and search directory of referencing file first for includes same as cwd include global change target for I access paths to the system list implies cwd explicit while compiling user paths then system paths are searched when using tinclude only system paths are searched with include a global cased append access path to current tinclude list see gccincludes and 1 global append a recursive access path to current include list global keep object files generated after invoking linker if disabled intermediate object files are temporary and deleted after link stage objects are always kept when compiling global cased scan source files for dependencies and emit Makefile do not generate object code global cased like M but do not list system inclu
241. previous settings by using any of the following methods e To restore the previous settings click Revert at the bottom of the Target Settings window e To restore the settings to the factory defaults click Factory Settings at the bottom of the window Targeting DSP56800E DSP 39 Target Settings CodeWarrior IDE Target Settings Panels CodeWarrior IDE Target Settings Panels Table 4 2 lists and explains the CodeWarrior IDE target settings panels that can apply to DSP56800E Table 4 2 Code Warrior IDE Target Settings Panels Target Settings Description Panels Access Paths Use this panel to select the paths that the CodeWarrior IDE searches to find files in your project You can add several kinds of paths including absolute and project relative See IDE User Guide Build Extras Use this panel to set options that affect the way the CodeWarrior IDE builds a project including the use of a third party debugger See IDE User Guide Runtime Settings Use this panel to set a variety of options including e A host application to use when debugging a non executable file for example a shared library A working directory e Program arguments e Environment variables See DE User Guide File Mappings Use this panel to associate a file name extension such as c with a plug in compiler See IDE User Guide Source Trees Use this panel to define project specific source trees root paths for use in your projects See I
242. ptimization level to any legal value 0 4 using this method The reset option resets the optimization level to its prior value before the pragma is encountered This pragma does not affect the interactive preference panel settings for global optimization levels If this pragma occurs in the middle of a function definition the entire function is compiled as if the pragma had occurred before the function definition since the actual compilation of the function is deferred until the function is parsed entirely Listing 5 5 Sample Code Pragma Optimization Function definition int afunc void Function statements pragma optimization_level 0 Remaining function statements Restore optimization level to its previous value pragma optimization_level reset The entire function afunc is compiled under optimization level 0 DSP 104 Targeting DSP56800E C for DSP56800E Pragma Directives for DSP56800E optimize_for_size Description This pragma controls optimization to reduce the size of object code Prototype pragma optimize_for_size on off reset Remarks This option lets you choose what the compiler does when it must decide between creating small code or fast code If this option is on the compiler creates smaller object code at the expense of speed If this option off the compiler creates faster object code at the expense of size This pragma corresponds to the Optimize for Size option in the
243. ram If you want to use this warning but need to declare a variable that you do not use use the pragma statement unused on page 109 To check whether this option is on use _ option warn_unusedvar Unused Arguments When you select this option the compiler generates a warning when it encounters an argument you declare but do not use This check helps you find misspelled argument names and arguments you have written out of your program There are two ways to avoid this warning Use the pragma unused statement You can turn off the ANSI Strict option in the C C Language Panel and not assign a name to the unused argument To check whether this option is on use _ option warn_unusedarg Extra Commas When you select this option the compiler generates a warning when it encounters an extra comma in enums To check whether this option is on use _ option warn_extracomma Extended Error Checking When you select this option the compiler generates a warning not an error if it encounters one of the following syntax problems A non void function that does not contain a return statement An integer or floating point value assigned to an enum type An empty return statement return in a function that is not declared void DSP 53 Target Settings DSP56800E Specific Target Settings Panels To check whether this option is on use _ option extended_errorcheck e Implicit Arithmetic C
244. rameter of the _eonce_SetTrigger function when a breakpoint unit other than unit 0 is being configured Targeting DSP56800E DSP 341 Libraries and Runtime Code EOnCE Library Table 10 12 Accumulating Trigger Options Mode with Breakpoint Unit other than 0 Defined Identifier Description PREV_UNIT_OR_THIS_TRIGGER a trigger is generated if the previous breakpoint unit passes in a trigger signal or this breakpoint unit creates a trigger signal PREV_UNIT_THEN_THIS_TRIGGER a trigger is generated if the previous breakpoint unit passes in a trigger signal followed by this breakpoint unit creating a trigger signal Miscellaneous Trigger Options The defined identifiers in Table 10 13 are optional Table 10 13 Miscellaneous Trigger Options Defined Identifier Description INVERT_B2_COMPARE the signal from breakpoint 2 is inverted before entering the combination logic this can be OR ed into the options parameter of the _eonce_SetTrigger or _eonce_SetCounterTrigger function EXTEND _COUNTER the counter when using the special counting function is extended to 40 bits by using the OSCNTR as the most significant 24 bits this can be OR ed into the options parameter of the _eonce_SetCounterTrigger function when configuring breakpoint unit 0 WARNING It is not recommended that this option be used if the processor will enter debug mode breakpoint console or file I O before the counter is read b
245. ras Runtime Settings File Mappings Source Trees MB56800E Target B Language Settings C C Language C C Warnings M56800E Assembler G Code Generation Global Optimizations E Linker ELF Disassembler M56800E Linker MB56800E Processor Hardware DO Loops No Do Loops y I Small Program Model JV Large Data Model J Globals live in lower memory A V Pad pipeline for debugger Emit separate character data section Zero initialized globals live in data instead of BSS I Create Assembly Output m Pipeline Conflict Detection Inline Asm Not Detected y C Language Not Detected y Factory Settings Revert Import Panel Export Panel Targeting DSP56800E OK Cancel Apply DSP 91 C for DSP56800E Large Data Model Support Data which is located beyond the 16 bit address boundary is sometimes referred to as extended data Extended data can be thought of as existing in extended or upper memory Memory located below the 64K boundary is called lower memory By default the compiler accesses all data by 16 bit addresses That is absolute addresses X xxxx addressing mode are limited to 16 bits Direct addressing or pointer registers load or store 16 bit addresses Indexed addressing indexes are 16 bit quantities Data pointers are treated as 16 bit pointers and you may store them in a single word of memory When the large data memory model is enabled the compiler accesses all data by
246. ress to mimic part of the hardware reset behavior by copying the protection values from the configuration field to the appropriate flash control registers add_hfm_unit lt startAddr gt lt endAddr gt lt bank gt lt numSectors gt lt pageSize gt lt progMem gt lt boot gt lt interleaved gt This command adds a flash unit to the list and sets its parameters The set_hfm_base and add_hfm_unit commands should not be changed for a particular processor Their values will always be the same DSP 247 Debugging for DSP56800E Notes for Debugging on Hardware set_hfm_erase_mode units pages all This command sets the erase mode as units pages or a11 If you set this to units the units that are programmed are mass erased If set this to pages the pages that are programmed are erased If you set this to al1 all units are mass erased including those that have not been programmed If you omit this command the erase mode defaults to the unit mode set_hfm_verify_erase 110 If you set this to 1 the debugger verifies that the flash memory has been erased and alerts you if the erase failed If this command is omitted the flash erase is not verified set_hfm_verify_program 110 If you set this to 1 the debugger verifies that the flash has been programmed correctly and alerts you if the programming failed If you omit this command flash programming is not verified Unlock Flash Security Features The flash memory s
247. retation of spaces inside the quotes Otherwise spaces in the string are ignored Note that if the ASCII strings are not quoted and they are numbers it is possible to create illegal numbers If the number is illegal an error message is displayed Dialog Box Controls OK Cancel and Esc Clicking OK writes the memory piece by piece until the target memory is filled in The Status field is updated with the current progress of the operation When this is in progress the entire dialog box grays out except the Cancel button so the user cannot change any information Clicking the Cancel button halts the fill operation and re enables the controls on the dialog box Clicking the Cancel button again closes the dialog box Pressing the Esc key is same as pressing the Cancel button Save Restore Registers DSP 182 From the menu bar of the Metrowerks CodeWarrior window select Debug gt Save Restore Registers to display the Save Restore Registers dialog box Figure 7 8 Targeting DSP56800E Debugging for DSP56800E Save Restore Registers Figure 7 8 Save Restore Registers Dialog Box Save Restore Registers x History X m Parameters m Operation Save Registers Restore Registers General Purpose Registers Cancel Filename Browse P Overwrite Existing m Progress Targeting DSP56800E Use this dialog box to save and restore register groups to and from a user specif
248. rupts to vector set for this unit UNIT_ACTION_TRIGGER_BEFORE_ZERO enters debug mode is unit 0 else passes signal on to next unit INTERRUPT_CORE_TRIGGER_BEFORE_ZERO interrupts to vector set for this unit DSP 340 Accumulating Trigger Options One of the defined identifiers in Table 10 11 must be OR ed into the options parameter of the _eonce_SetTrigger function when breakpoint unit 0 is being configured Targeting DSP56800E Libraries and Runtime Code EOnCE Library Table 10 11 Accumulating Trigger Options Mode with Breakpoint Unit 0 PREV_UNIT_OR_THIS_TRIGGER_OR_CORE_EV a trigger is generated if the ENT previous breakpoint unit passes in a trigger signal or this breakpoint unit creates a trigger signal or if a core event occurs PREV_UNIT_THEN_THIS_TRIGGER_OR_CORE_ a trigger is generated if the EVENT previous breakpoint unit passes in a trigger signal followed by either this breakpoint unit creating a trigger signal or a core event occurring THIS_TRIGGER_THEN_CORE_EVENT a trigger is generated if this breakpoint unit creates a trigger signal followed by a core event occurring PREV_UNIT_THEN_THIS_TRIGGER_THEN_CO a trigger is generated if the RE_EVENT previous breakpoint unit passes in a trigger signal followed by this breakpoint unit creating a trigger signal followed by a core event occurring One of the defined identifiers in Table 10 12 must be OR ed into the options pa
249. ry file a o or obj file On Windows targets the CodeWarrior IDE stores and manages object files internally in the data folder Targeting DSP56800E Development Studio Overview The Development Process Figure 3 1 A proprietary compiler architecture is at the heart of the CodeWarrior IDE This architecture handles multiple languages and platform targets Front end language compilers generate an intermediate representation IR of syntactically correct source code The IR is memory resident and language independent Back end compilers generate code from the IR for specific platform targets The CodeWarrior IDE manages the whole process Figure 3 1 CodeWarrior Build System Targeting DSP56800E C C Java Object Pascal As a result of this architecture the CodeWarrior IDE uses the same front end compiler to support multiple back end platform targets In some cases the same back end compiler can generate code from a variety of languages Users derive significant benefit from this architecture For example an advance in the C C front end compiler means an immediate advance in all code generation Optimizations in the IR mean that any new code generator is highly optimized Targeting a new processor does not require compiler related changes in the source code so porting is much more simpler All compilers are built as plug in modules The compiler and linker components are modular plug ins Metrowerks publishes this API
250. s an example Sample Section level Closure Block KEEP_SECTION interruptl interrupt2 Targeting DSP56800E A variant is REF_INCLUDE It keeps a section in the link but only if the file where it is coming from is referenced This is very useful to include version numbers Listing 9 4 shows an example of this DSP 271 ELF Linker and Command Language Structure of Linker Command Files Listing 9 4 Sample Section level Closure Block With File Dependency REF_INCLUDE version Sections Segment Inside the sections segment you define the contents of your memory segments and define any global symbols to be used in the output file The format of a typical sections block looks like Listing 9 5 NOTE As shown in Listing 9 5 the bss section needs to go after the data section Listing 9 5 Sample SECTIONS Segment SECTIONS section_name the section name is for your reference the section name must begin with a filename c text put the text section from filename c filename2 c text then the text section from filename2 c filename c data filename2 c data filename c bss filename2 c bss ALIGN 0x10 align next section on 16 byte boundary gt segment_1 this means map these contents to segment_1 next_section_name more content descriptions gt segment_x end of next_section_name definition end of the sections block DSP 272 Targeting DSP56800E
251. s the compile time warnings for the unused variables and parameters specified in its argument list You can use this pragma only within a function body and the listed variables must be within the scope of the function Sample Code pragma unused pragma warn_unusedvar on This pragma is equivalent to Unused Variables option in C C Warning panel pragma warn_unusedarg on This pragma is equivalent to Unused Variables option in C C Warning panel static void ff int a int b pragma unused a b Compiler does not warn that a and b are unused Linker Issues for DSP56800E Targeting DSP56800E This section explains background information on the DSP56800E linker and also how it operates Deadstripping Unused Code and Data The M56800E Linker deadstrips unused code and data only from files compiled by the CodeWarrior C compiler Assembler relocatable files and C object files built by other compilers are never deadstripped DSP 109 C for DSP56800E Linker Issues for DSP56800E DSP 110 Libraries built with the CodeWarrior C compiler contribute only the used objects to the linked program If a library has assembly or other C compiler built files only those files that have at least one referenced object contribute to the linked program If you enable deadstripping the linker always completely ignores unreferenced objects files Link Order The DSP56800E linker always proces
252. s unsigned int This parameter describes the behavior of the trace buffer Please see the section Definitions for more information on the identifi ers for this parameter This function sets the behavior of the trace buffer Triggers can also be set to start and stop trace buffer capture using the _eonce_SetTrigger function MN Error code as defined in the sub section Definitions on page 334 DSP 327 Libraries and Runtime Code EOnCE Library _eonce_GetTraceBuffer Prototype Parameters Remarks Returns DSP 328 Retrieves the contents of the trace buffer int _eonce GetTraceBuffer unsigned int count un signed long buffer count unsigned int This parameter passes in the size of the buffer if 0 is passed in the contents of the trace buffer are not retrieved instead the number of entries in the trace buffer are returned in count buffer unsigned long This parameter points to an array in which the contents of the trace buffer are returned starting with the oldest entry This function retrieves the addresses contained in the trace buffer The addresses represent the program execution point when certain change of flow events occur The trace buffer behavior including capture events can be configured using _eonce_SetupTraceBuffer Error code as defined in the sub section Definitions on page 334 Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce_ClearTrac
253. se in the Initial Launch part of the table exept that they apply to those launches after the initial launch This can sometimes be useful in decreasing the download time for successive runs when it is known that the memory of a given section has not changed from the previous debug session e Memory Configuration Options Use Memory Configuration File This option is not used by the DSP56800E debugger M56800E Target The M56800E Target panel Figure 4 13 and the Remote Debugging panel Figure 4 10 or Figure 4 11 let you set communication protocols for interaction between a DSP56800E board or Simulator and the CodeWarrior DSP56800E debugger DSP 74 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Figure 4 13 M56800E Target Panel N Target Settings Panels Language Settings iHe C C Language C C Warnings MB56800E Assembler Code Generation E Linker i ELF Disassembler i M56800E Linker Editor i Custom Keywords Debuager Other Executables Debugger Settings Remote Debugging Remote Debug Opt MB56800E Processor Global Optimizations Factory Settings IV Always reset on download IV Use initialization file Breakpoint Mode Hw Only N M56800E Target S6858E_ext_xp cfg Choose Automatic v Import Panel Export Panel Targeting DSP56800E OK Cancel Apply DSP 75 Target Settings DSP56800E Specific Target Settings
254. sections F__ Begin _Data Start location for RAM 0x3000 data Write data to the section ROM fp_state data rtlib data F_ End Data Get end location for RAM bss sections rtlib bss lo bss F__ ROM Address __ROM Address gt data To make the runtime copy from ROM to RAM you need to know where the data starts in ROM __ROM_Address and the size of the block in ROM you want to copy to RAM In the following example Listing 9 19 copy all variables in the data section from ROM to RAM in C code DSP 280 Targeting DSP56800E ELF Linker and Command Language Linker Command File Syntax Listing 9 19 ROM to RAM Copy From C After Writing Data Flash include lt stdio h gt include lt string h gt int GlobalFlash 6 From linker command file extern _ Begin Data _ ROMAddress __End_Data void main void unsigned short a 0 b 0 c 0 unsigned long dataLen 0x0 unsigned short _ myArray Oxdead Oxbeef Oxcafe Calculate the data length of the X memory written to Flash dataLen unsigned long amp __End_ Data unsigned long s__Begin_Data Block move from ROM to RAM memcpy unsigned long amp Begin _ Data const unsigned long amp __ROMAddress dataLen a GlobalFlash return Stack and Heap To reserve space for the stack and heap arithmetic operations are performed to set the values of the symbols used by the runtime
255. serted a NOP to avoid a pipeline conflict This option is applicable when Assert NOPs on pipeline conflicts is enabled Emit Warnings for Hardware Stalls If this option is enabled the assembler warns you that a hardware stall will occur when executed This option is used to help you optimize the cycle count Allow legacy instructions If this option is enabled the assembler allows the legacy DSP56800 instruction syntax and sets the Default Data Memory Model and the Default Program Memory Model to 16 bits Pad Pipeline for Debugger You must enable this option when using the debugger This option inserts a NOP after certain branch instructions required to make the breakpoints work reliably Due to the extra NOP instructions there is a growth of about 5 in the code If you do not set this option you may not recover the branch instructions after the debugger comes across a breakpoint Also select the Pad pipeline for debugger option in the M56800E Processor Settings panel Figure 4 8 Emit Warnings for odd SP Increment Decrement This enables assembler warnings on instructions that can misalign the stackframe Default Data Memory Model Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels The factory setting for this memory is 16 bits however you can set this memory to 24 bits e Default Program Memory Model The factory setting for this memory is 19 bits however you can set this memory to 1
256. ses C and assembly source files as well as archive files a and lib in the order specified under the Link Order tab in the project window Therefore if a symbol is defined in a source code file and a library the linker uses the definition which appears first in the link order If you want to change the link order select the Link Order tab in the project window and drag your source or library file to the preferred location in the link order list Files that appear at the top of the list are linked first Targeting DSP56800E 6 Inline Assembly Language and Intrinsics This chapter explains the support for inline assembly language and intrinsic functions that is built into the CodeWarrior compiler This chapter only covers the CodeWarrior IDE implementation of Motorola assembly language Working With DSP56800E Inline Assembly Language This section explains how to use the CodeWarrior compiler s for inline assembly language programming including assembly language syntax This chapter contains the following sections e Working With DSP56800E Inline Assembly Language e Inline Assembly Optimization e Calling Functions from Assembly Language e Instrinsic Functions for DSP56800E Targeting DSP56800E DSP 111 Inline Assembly Language and Intrinsics Working With DSP56800E Inline Assembly Language NOTE Listing 6 1 Inline Assembly Language Syntax for DSP56800E This section explains the inline assembly langu
257. shows an example of using a global variable in a linker command file This example sets the global variable _foot declared in C with the extern keyword to the location of the address location current counter Using a Global Variable in the LCF F foot Targeting DSP56800E DSP 275 ELF Linker and Command Language Linker Command File Syntax If you use a global symbol in an LCF as in Listing 9 10 you can access it from C program sources as shown in Listing 9 11 Listing 9 11 Accessing a Global Symbol From C Program Sources extern unsigned long _foot void main void unsigned long i i _foot _foot value determined in LCF Expressions and Assignments You can create symbols and assign addresses to those symbols by using the standard assignment operator An assignment may only be used at the start of an expression and a semicolon is required at the end of an assignment statement An example of standard assignment operator usage is shown in Listing 9 12 Listing 9 12 Standard Assignment Operator Usage _symbolicname some_expression Legal _syml _sym2 _sym3 ILLEGAL When an expression is evaluated and assigned to a variable it is given either an absolute or a relocatable type An absolute expression type is one in which the symbol contains the value that it will have in the output file A relocatable expression is one in which the value is expressed as a fixed offset from the
258. staller automatically installs all the necessary components for you to begin development You must use the CodeWarrior installer to ensure that you have all the required files If you have any questions regarding the installer read the instructions provided in the CodeWarrior CD Installing the CodeWarrior IDE To install the CodeWarrior IDE perform these steps 1 Insert the CodeWarrior CD into your computer s CD ROM drive If Auto Install is disabled on your computer you must run the setup exe program at the root directory on the CD 2 Follow the CodeWarrior software installation instructions on your screen After installing the CodeWarrior IDE restart your computer Restarting ensures that the newly installed drivers are available for use 3 Registered and 30 day evaluation users have separate registering procedures e Registered Users The Register CodeWarrior program MWRegister exe is run as part of the installation procedure However if it is not run you can run MWRegister exe located in the licensing directory and follow the directions on the screen If you have any licensing questions please contact license metrowerks com DSP 20 Targeting DSP56800E Getting Started Installing the CodeWarrior IDE for DSP56800E 4 e 30 day Evaluation Users Visit the following website and enter your validation code located on the CodeWarrior Studio CD case http ww metrowerks com key eval You
259. subject to these guidelines e Reordering is required when local variables are allocated on the stack e Reordering is not performed for all passed parameters that are not passed in registers but instead passed in memory e Reordering is not performed when locating fields within a structure Code and Data Storage for DSP56800E The DSP56800E has a dual Harvard architecture with separate CODE P memory and DATA X memory memory spaces The ranges of memory vary depending on whether you have the small memory or large memory model enabled Table 5 4 You might need to specify how the project defined sections map to real memory by using the ELF Linker and Command Language and M56800E Linker Settings panel Table 5 4 Code and Data Memory Small Model Large Model Range Range Section Size Word Address Size Word Address CODE 128 KB 0 OXFFFF 1MB O Ox7FFFF P memory DATA 128 KB 0 OxFFFF 32 MB 0 OxFFFFFF X memory Character data is limited to 64 KB or O Ox7FFF for small model and 16 MB or 0 OX7FFFFF for large model Targeting DSP56800E DSP 89 C for DSP56800E Code and Data Storage for DSP56800E DSP 90 Additional Information about Character Data Addressing An architectural peculiarity of the DSP56800E is the existence of byte addresses for character 1 byte data and word addresses for all other data A byte address is calculated by multiplying the word address by 2 Si
260. targets Targeting DSP56800E Debugging for DSP56800E Launching and Operating the Debugger Viewing and Editing Register Values Registers are platform specific Different chip architectures have different registers 1 Access the Registers window From the menu bar of the Metrowerks CodeWarrior window select View gt Registers Expand the General Purpose Registers tree control to view the registers as in Figure 7 19 or double click on General Purpose Registers to view the registers as in Figure 7 20 Figure 7 19 General Purpose Registers for DSP56800E B sdm elf Thread oxo H General Purpose Registers A AO Al Al B BO B1 B2 Cc co Ci T2 D Targeting DSP56800E O0xD000000000 Ox0000 O0xD000 0x00 0x0000000000 OxD000 O0x0000 0x00 ox0000000000 0x0000 0x0000 0x00 Ox0000000000 Oj x Register Value NKI DSP 199 Debugging for DSP56800E Launching and Operating the Debugger Figure 7 20 2 3 DSP 200 General Purpose Registers Window General Purpose Registers Window loj x sdm elf Thread 0x0 ox0000000000 A0 0x0000 0x0000 A2 0x00 ox0000000000 B0 0x0000 0x0000 B2 0x00 Ox0000000000 CO 0x0000 0x0000 c2 0x00 oxo000000000 DO 0x0000 0x0000 D2 0x00 Ox000000 LA2 0x000000 0x0000 Lc2 0x0000 OXFFFF N3 oxoooo Ox000000 OMR 0x0003 0x000082 RO OXDODESA 0x000E59 R2 0x000000 Ox000000 R4 oxoooooo Ox000000 SP 0x000833 0x0314 HWSO 0x000000 Ox000000 FIRA 0x000000 0x0
261. te Debug Options Gog Gy Se We og FS GR Gs 72 M56800E Target 6 6 6 bee RB eS be Bee ke oe i TA 5 C for DSP56800E 79 General NotesonC om abo he eo SS 79 Number Formats for DSP56800E ci Soc See te Es te Bs at 80 56800E Integer Formats a Ba aces a ee a a 80 56800E Floating Point Formats 81 Calling Conventions and Stack Frames for DSP56800E 82 Passing Parameters to Functions 82 Returning Values From Functions 83 Volatile and Non Volatile Registers 0 0 aaa 83 Non volatile Registers cart a a a 83 Volatile Registers 3 se e ac ap oop ae Soe 4 83 Stack Frame dis a at we ss ds Ge LA hs Te wee gs Be 80 Stack Alignment Be ee Te dee SOT Data Alignment Requrenents fon DSP56800E Es Ord OF Pointer Types Word versus Byte Pointers 88 Reordering of Data for Optimal Usage 89 Code and Data Storage for DSP56800E 89 Additional Information about Character Data Addresing 90 Large Data Model Support operas 91 DSP 4 Targeting DSP56800 Table of Contents Examples Extended Data Addressing Examples Accessing Data Objects Example l a ia ee 2 Example 2 de Og Geo hc fe Ghee a wth Ce A External Library Companbiligy sate aie amp Optimizing Code for DSP56800E Pragma Directives for DSP56800E asmoutput ie Rik he eR ARS check_c_srce_pipeline Hs a Gee o A check_inline_asm_pipeline IM
262. tem Level Connect Targeting DSP56800E The CodeWarrior IDE DSP56800E debugger lets you connect to a loaded target board and view system registers and memory A system level connect does not let you view symbolic information during a connection DSP 245 Debugging for DSP56800E Debugging in the Flash Memory NOTE The following procedure explains how to connect in the context of developing and debugging code on a target board However you can select the Debug gt Connect command anytime you have a project window open even if you have not yet downloaded a file to your tar get board To perform a system level connect Select the Project window for the program you downloaded From the menu bar select Debug gt Connect The debugger connects to the board You can now examine registers and the contents of memory on the board Debugging in the Flash Memory DSP 246 The debugger is capable of programming flash memory The programming occurs at launch during download The flash programming option is turned on and the parameters are set in the initialization file This file is specified in the Debugger gt M56800E Target preference panel A list of flash memory commands is given in the next section The stationery provides an example of how to specify a default initialization file how to write a linker command file for flash memory and how to copy initialized data from ROM to RAM using provided library functions Flash Memory
263. ter Start Triggers Targeting DSP56800E Normal Unit Action Options This list of options describes the action taken when a non counter trigger is generated One of the defined identifiers in Table 10 9 must be OR ed into the options parameter of the _eonce_SetTrigger function DSP 339 Libraries and Runtime Code EOnCE Library Table 10 9 Normal Unit Actions Options Mode UNIT_ACTION enters debug mode is unit 0 else passes signal on to next unit INTERRUPT_CORE interrupts to vector set for this unit HALT_TRACE_BUFFER trace buffer capture is halted START_TRACE_BUFFER trace buffer capture is started Table 10 10 Counter Unit Action Options This list of options describes the action taken when a counter trigger is generated One of the defined identifiers in Table 10 10 must be OR ed into the options parameter of the _eonce_SetCounterTrigger function Identifiers that include ZERO_BEFORE_TRIGGER only perform the action when the counter counts down to zero before the Counter Stop Trigger occurs Identifiers that include TRIGGER_BEFORE_ZERO only perform the action when the Counter Stop Trigger occurs before the counter counts down to zero Counter Unit Actions Options Mode Defined Identifier Description NO_ACTION counter status bits still get set UNIT_ACTION_ZERO_BEFORE_TRIGGER enters debug mode is unit 0 else passes signal on to next unit INTERRUPT_CORE_ZERO_BEFORE_TRIGGER inter
264. tes are placed in to P memory while RW attributes are placed into X memory If you cannot predict how much space a segment will occupy you can use the function AFTER and LENGTH 0 unlimited length to fill in the unknown values Targeting DSP56800E ELF Linker and Command Language Structure of Linker Command Files NOTE Listing 9 2 Closure Blocks The linker is very good at deadstripping unused code and data Sometimes however symbols need to be kept in the output file even if they are never directly referenced Interrupt handlers for example are usually linked at special addresses without any explicit jumps to transfer control to these places Closure blocks provide a way to make symbols immune from deadstripping The closure is transitive meaning that symbols referenced by the symbol being closed are also forced into closure as are any symbols referenced by those symbols and so on The closure blocks need to be in place before the SECTIONS defini tion in the linker command file The two types of closure blocks available are e Symbol level Use FORCE_ACTIVE to include a symbol into the link that would not be otherwise included An example is shown in Listing 9 2 Sample Symbol level Closure Block FORCE_ACTIVE break_handler interrupt_handler my_function Listing 9 3 e Section level Use KEEP_SECTION when you want to keep a section usually a user defined section in the link Listing 9 3 show
265. the command line press the Insert key Scroll Text in the Command Line Debugging Window The scrolling line number can be set by the config debugging command To scroll text in the command line debugging window e To scroll up one screen of text press the Page Up key e To scroll down one screen of text press the Page Down key By default the number of lines scrolled by the Page Up and Page Down keys is the number of lines displayed in the debugging win dow If you resize the window the number of lines scrolled changes accordingly You also can use the debugger specific config com mand to change the number of lines scrolled by the Page Up and Page Down keys To scroll up one line of text press Ctrl Up Arrow key To scroll down one line of text press Ctrl Down Arrow key To scroll left one column press Ctrl Left Arrow key To scroll right one column press Ctrl Right Arrow key To scroll to the beginning of the displayed buffer press Ctrl Home To scroll to the end of the displayed buffer press Ctrl End Targeting DSP56800E Debugging for DSP56800E Command Line Debugging NOTE Targeting DSP56800E Copy Text from the Command Line Debugging Window To copy text from the window to the clipboard Drag your mouse over the text to copy Press Enter or choose Edit gt Copy Paste Text into the Command Line Debugging Window To paste text from the clipboard into the window Place the mouse cursor on the comma
266. tialization directory e Click the Choose button in the panel The Choose file dialog box appears Navigate to the file you want to select The selected file name appears in the text box Each line in the file begins with a command or the character indicating that the line is ignored Blanks lines are also ignored Table 4 4 lists the supported commands and their arguments For a more detailed description of the Flash DSP 76 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels Memory commands see Flash Memory Commands on page 246 Table 4 4 Commands and Arguments for Initialization Files Commands Argument Description writepmem lt addr gt lt value gt Writes a 16 bit value to the specified P Memory location writexmem lt addr gt lt value gt Writes a 16 bit value to the specified X Memory location writereg lt regName gt lt value gt Writes a 16 bit value to the specified register set_hfmclkd lt value gt Writes the value which represents the flash memory s clock divider to the hfmclkd register set_hfm_base lt address gt Sets the address of hfm_base which is where the flash memory control registers are mapped in X Memory add_hfm_unit lt startAddr gt lt endAddr gt Adds a flash memory unit lt bank gt lt numSectors gt to the list and sets its lt pageSize gt lt progMem gt parameters lt boot gt lt interleaved gt set_hfm_ erase
267. ting DSP56800E After you compile the source the linker generates a link map file Note that this option is not available unless you enable the Generate Link Map option DSP 67 Target Settings DSP56800E Specific Target Settings Panels Listing 4 4 Effects of Show Transitive Closure in the Link Map File Link map of Finit_sim_ 1 interrupt_vectors text found in 56800E vector asm 2 sim_intRoutine notype local found in 56800E_vector asm 2 Finit_sim_ func global found in 56800E_init asm 3 Fmain func global found in M56800E_main c 4 Ffoot func global found in M56800E_main c 4 Fpad func global found in M56800E_main c 3 F__init_sections func global found in Runtime 56800E 1lib initsections o 4 Fmemset func global found in MSL C 56800E 1ib mem o 5 F__fi11 mem func global found in MSL C 56800E 1lib mem_funcs o 1 Finit_sim_ func global found in 56800E_init asm e Disable Deadstripping The Disable Deadstripping option prevents the linker from removing unused code and data e Generate ELF Symbol Table The Generate ELF Symbol Table option instructs the linker to generate an ELF symbol table as well as a list of relocations in the ELF executable file e Suppress Warning Messages The Suppress Warning Messages option controls whether the linker displays warnings If this option is disabled the linker displays warnings in the Message window If this option is disabled the linker does not display warnings
268. tions of code If you do not specifically specify this directive as off for example optimize_iasm off then optimizations will continue until the end of the function Calling Assembly Language Functions from C Code Targeting DSP56800E You can call assembly language functions from C just like you would call any standard C function You need to use standard C syntax for calling inline assembly language functions and pure assembly language functions in asm files Calling Inline Assembly Language Functions You can call inline assembly language functions just like you would call any standard C function Listing 6 7 demonstrates how to create an inline assembly language function in a C source file This example adds two 16 bit integers and returns the result DSP 115 Inline Assembly Language and Intrinsics Calling Assembly Language Functions from C Code Notice that you are passing two 16 bit addresses to the add_int function You pick up those addresses in R2 and R3 and in YO pass back the result of the addition Listing 6 7 Sample Code Creating an Inline Assembly Language Function asm int add_int int i int j move w x r2 y0 move w x r3 x0 add x0 y0 int result returned in y0 rts Now you can call your inline assembly language function with standard C notation as in Listing 6 8 Listing 6 8 Sample Code Calling an Inline Assembly Language Function int x 4 y y add_int 23
269. tly set breakpoints The syntax for the break command follows b reak func_name machine_addr file_name line _num column_number func_name brkpt_num off Table 7 4 shows examples of the break command Debugging Command Examples break Example Description break foo This example sets a breakpoint on the function foo break foo off This example removes the breakpoint from the function foo break p 1048a This example sets a breakpoint on the machine address 1048a break This example displays all the breakpoints Targeting DSP56800E Debugging for DSP56800E Command Line Debugging Table 7 4 Debugging Command Examples break continued Example break 4 off Description This example removes breakpoint number 4 To determine the number assigned to a particular breakpoint execute the break command break main c 15 bringtofront This example sets a breakpoint on line 15 in main c Please note The filename argument is case sensitive You may get an error message if it is typed incorrectly Use the bringtofront debugging command to indicate whether to always display the command line debugging window in front of all other windows on the screen The syntax for the bringtofront command follows bri ngtofront on off Table 7 5 shows examples of the bringtofront command Table 7 5 Debugging Command Examples bringtofront Example bringtofront Description T
270. two and three word uninterrupted sequences However the debugger compensates using software breakpoints and the trace buffer to allow single stepping in these situations But if these techniques cannot be used e g debugging in ROM or the trace buffer in use single stepping over these sequences results in the processor executing each instruction in the sequence before stopping The execution will be correct Just be aware of this slide in these situations DSP 249 Debugging for DSP56800E Notes for Debugging on Hardware DSP 250 Targeting DSP56800E 8 High Speed Simultaneous Transfer NOTE High Speed Simultaneous Transfer HSST facilitates data transfer between low level targets hardware or simulator and host side client applications The data transfer occurs without stopping the core The host side client must be an IDE plug in or a script run through the command line debugger When the customer links their application to the target side hsst lib the debugger detects that the customer wants to use hsst and automatically enables hsst communications To use HSST you must launch the target side application through the debugger Host Side Client Interface Targeting DSP56800E This section describes the API calls for using High Speed Simultaneous Transfer HSST from your host side client application At the end of this section an example of a HSST host side program is given Listing 8 1 on page 258 DS
271. u can use this feature to track down bugs caused by macro expansion or other subtleties of the preprocessor Targeting DSP56800E Target Settings Each build target in a CodeWarrior project has its own settings This chapter explains the target settings panels for DSP56800E software development The settings that you select affect the DSP56800E compiler linker assembler and debugger This chapter contains the following sections e Target Settings Overview e CodeWarrior IDE Target Settings Panels e DSP56800E Specific Target Settings Panels Target Settings Overview NOTE Targeting DSP56800E The target settings control e Compiler options e Linker options e Assembler options e Debugger options e Error and warning messages When you create a project using stationery the build targets which are part of the stationery already include default target settings You can use those default target settings if the settings are appropriate or you can change them Use the DSP56800E project stationery when you create a new project DSP 35 Target Settings Target Settings Overview Target Setting Panels Table 4 1 lists the target settings panels Table 4 1 Target Setting Panels Settings Group Panel Name Target Target Settings Access Paths Build Extras Runtime Settings File Mappings Source Trees M56800E Target Language Settings C C Language
272. ugging you must specify the target settings for the command converter server Local Settings If you specify that the CodeWarrior IDE start the command converter server locally the command converter server uses the connection port for example LPT1 that you specified when you installed CodeWarrior for DSP56800E e Remote Settings If you specify that the CodeWarrior IDE start the command converter server on a remote machine specify the IP address of the remote machine on your network as described in 4 Setting Up a Remote Connection on page 174 e Default Settings By default the command converter server listens on port 41475 You can specify a different port number for the debugger to connect to if needed as described in Setting Up a Remote Connection on page 174 This is necessary if the CCS is configured to a port other than 41475 After you have specified the correct settings for the command converter server or verified that the default settings are correct you can download programs to a target board for debugging The CodeWarrior IDE starts the command converter server at the appropriate time if you are debugging on a local target Before debugging on a board connected to a remote machine ensure the following e The command converter server is running on the remote host machine e Nobody is debugging the board connected to the remote host machine Targeting DSP56800E DSP 171 Debugging
273. ult shrtNs sl1 s2 Expected value of result 0x1234 Targeting DSP56800E DSP 152 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support L_shl Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion Note This operation is not optimal on the DSP56800E because of the saturation requirements and the bidirectional capability See the intrinsic L_shl or L_shlfts which are more optimal Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_shl Word32 lval2shft Word16 s_shftamount Example long result 1 0x12345678 short s2 1 result L_shl 1l s2 Expected value of result 0x2468ACF0 L_shlftNs Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation does not occur during a left shift Note Ignores upper N 5 bits of s_shftamount except the sign bit MSB Prototype Word32 L_shl1ftNs Word32 lval2shft Word16 s_shftamount Example long result 1 0x12345678 short s2 1 result L_shlftNs 1 s2 Expected value of result 0x2468ACFO Targeting DSP568
274. uncounted D8C287BC5B1B HOSTID ANY FEATURE Win32_Plugins_DSP56800E metrowks 2 000 permanent uncounted 5FC07C47D6FB HOSTID 00C04ff5efb0 d Any future keys can likewise be appended to the bottom of this file If you encounter difficulty in installing this key please contact Metrowerks Customer support at Ph 800 377 5416 Fax 512 873 4901 email license metrowerks com NOTE Do not move the license dat file after installation DSP 22 Targeting DSP56800E Getting Started Installing the CodeWarrior IDE for DSP56800E What Gets Installed Table 2 2 describes the folders that are installed as part of the standard full CodeWarrior IDE for the DSP56800E installation Each of the folders is located in your CodeWarrior IDE installation directory Table 2 2 Contents Installed with the CodeWarrior IDE for DSP56800E Directory Name Contents Bin The CodeWarrior IDE application and associated plug in tools CCS Command converter server executable files and related support files CodeWarrior Examples Target specific projects and code CodeWarrior Help All the core help files for the CodeWarrior IDE as well as target specific help All help files are accessed through the Help menu or F1 help CodeWarrior Manuals The CodeWarrior documentation tree CW Release Notes Release notes for the CodeWarrior IDE and each tool Licensing The registration program and additional licensing information M
275. unter Trigger Modes Data Selection Modes Counter Function Modes Normal Unit Action Options Counter Unit Action Options Accumulating Trigger Options Miscellaneous Trigger Options Trace Buffer Capture Options Trace Buffer Full Options Miscellaneous Trace Buffer Option Return Codes Every function except _eonce_Initialize returns one of the error codes in Table 10 4 Table 10 4 Error Codes Error Code Description EONCE_ERR_NONE No error EONCE_ ERR NOT_INITIALIZED The _eonce_Initialize function has not been called before the current function EONCE_ERR_UNIT_OUT_OF_RANGE The unit parameter is greater than or equal to EONCE_ERR_LOCKED_OUT The core cannot access the EOnCE registers the number of units specified in _eonce_Initialize because the debugger has locked out the core This occurs when a trigger has been set using the EOnCE GUI panels or through an IDE breakpoint or watchpoint DSP 334 Targeting DSP56800E Libraries and Runtime Code EOnCE Library Normal Trigger Modes One of the defined identifiers listed in Listing 10 2 must be OR ed into the options parameter of the _eonce_SetTrigger function A key for the defined identifiers listed in Listing 10 2 is given in Table 10 5 Listing 10 2 Normal Trigger Modes B1PA_N B1PR_N B1PW_N B2PF_N 1XA OR_B2PF_N 1XA N_OR_B2PF B2PF THEN B B B1PF_OR_B2PF_N B1PA_OR_B2PF_N B1PA_N_OR_B2PF B1PF_OR_N_B
276. untime Code EOnCE Library Targeting DSP56800E The sub section Definitions on page 334 defines Return Codes Normal Trigger Modes Counter Trigger Modes Data Selection Modes Counter Function Modes Normal Unit Action Options Counter Unit Action Options Accumulating Trigger Options Miscellaneous Trigger Options Trace Buffer Capture Options Trace Buffer Full Options Miscellaneous Trace Buffer Option DSP 319 Libraries and Runtime Code EOnCE Library _eonce_lnitialize Prototype Parameters Remarks Returns DSP 320 Initializes the library by setting the necessary variables void _eonce_Initialize unsigned long baseAddr un signed int units baseAddr unsigned long This parameter specifies the location in X memory where the EOnCE registers are located units unsigned int This parameter specifies the number of EOnCE breakpoint units available This function must be called before any other library function is called Its parameters are dependent on the processor being used Instead of calling this function directly one of the defined macros can be called in its place These include _eonce_Initialize56838E _eonce_Initialize56852E and _eonce_Initialize56858E These macros call _eonce_Initialize with the correct parameters for the 56838 56852 and 56858 respectively Nothing Targeting DSP56800E Libraries and Runtime Code EOnCE Library _eonce_S
277. upport shiftNs DSP 148 Definition Note Prototype Example Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation does not occur during a left shift When an accumulator is the destination zeroes out the LSP portion Ignores upper N 5 bits of s_shftamount except the sign bit MSB If s_shftamount is positive and the value in the lower 5 bits of s_shftamount is greater than 15 the result is 0 If s_shftamount is negative and the absolute value in the lower 5 bits of s_shftamount is greater than 15 the result is 0 if sval2shft is positive and OxFFFF if sval2shft is negative Word16 shlftNs Word16 sval2shft Wordl16 s_shftamount short result short sl 0x1234 short s2 1 result shlftNs s1 s2 Expected value of result 0x2468 Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support shifts Definition Arithmetic left shift of 16 bit value by a specified shift amount Saturation does occur during a left shift if required When an accumulator is the destination zeroes out the LSP portion Note This is not a bidirectional shift Assumptions Assumed s_shftamount is positive OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 shlfts Word16 sval2shft Wordl1
278. us field is updated with the current progress of the operation Browse Button Clicking the Browse button displays OPENFILENAME or SAVEFILENAME depending on whether you selected the Load Memory or Save Memory radio button Fill Memory Figure 7 7 DSP 180 From the menu bar of the Metrowerks Code Warrior window select Debug gt Fill memory to display the Fill Memory dialog box Figure 7 7 Fill Memory Dialog Box Fill Memory x History v Parameters Memory Type P Memoy y Address Cancel Size ss Fill Expr a m Progress Use this dialog box to fill memory at a specified location and size with user specified raw memory data You can associate a key binding with this dialog box for quick access Press the Tab key to cycle through the dialog box display which lets you quickly make changes without using the mouse History Combo Box The History combo box displays a list of recent fill operations If this is the first time you perform a fill operation the History combo box is Targeting DSP56800E Debugging for DSP56800E Fill Memory NOTE Targeting DSP56800E empty If you do more than one fill then the combo box populates with the memory address of that fill to a maximum of ten sessions If you enter information for an item that already exists in the history list that item moves up to the top of the list If you do another fill then this item is the first one
279. ushing this button opens the Set Trigger panel For more information on using this panel see Set Trigger Panel on page 190 Perform action This pull down list lets you select the action that occurs when the correct conditions are met as set in the Set Trigger panel and the On condition pull down list On condition This pull down list lets you set the order in which a trigger and counter reaching zero must occur to perform the action specified in Perform action Counter value This edit box should be preloaded with a non zero counter value when setting the counter The counter will proceed backward until a stop condition occurs The edit box will contain the value of the counter and will be updated whenever the processor stops Trace Buffer The trace buffer lets you view the target addresses of change of flow instructions that the program executes The trace buffer is configured with the Trace Buffer Setup panel Figure 7 11 To open this panel From the menu bar select Trace Buffer gt Setup Trace Buffer DSP 187 Debugging for DSP56800E EOnCE Debugger Features Figure 7 11 Trace Buffer Setup Panel Trace Buffer Setup E Capture mbally Halted started by tigger Mo action oldest entries owermitker 7 A Cancel To view the contents of the trace buffer Figure 7 12 1 From the menu bar select Trace Buffer gt Dump Trace Buffer DSP 188 Targeting DSP56800E Debugging for DSP56800E
280. using 209 Tcl support 208 Command line tools arguments 296 response file 294 sample build script 294 usage 293 Command line tools for DSP56800E 293 commands Add Files 27 Bring Up To Date 32 Compile 32 Enable Debugger 34 Flash Memory 246 Make 34 Targeting DSP56800 Index Preprocess 34 Compile command 32 compiler architecture 33 34 intermediate representation IR 33 plug in modules explained 33 support for inline assembly 111 compiling 32 See also IDE User Guide comr pragma interrupt 99 Connect menu item 245 Connection list menu 70 Console 310 Console and File I O 310 Contents of Trace Buffer panel 189 Counter Function Modes 339 Counter Trigger Modes 336 Counter Unit Action Options 340 Create a New Project dialog box 25 Creating a Project 24 creating labels for DSP56800E Assembly 114 Custom Keywords settings panel 40 D data alignment requirements for DSP56800E 87 Data Selection Modes 338 deadstripping unused code and data 109 deadstripping prevention 271 275 Debugger Settings panel 40 debugger setting preferences 169 194 debugging 34 Command Converter Server 170 ELF files 296 Flash Memory 246 projects 195 Register Details Window 201 Target panel 169 without symbolics 245 See also IDE User Guide debugging a remote target board 177 default pragma interrupt 100 define_section 106 defining an inline assembly function 113 definition BSS 313 heap 313 Targeting DSP56800 stack 313 Disable D
281. walt Targeting DSP56800E DSP 129 Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support turn_off_conv_rndg Definition Note Prototype Usage Generates a sequence for disabling convergent rounding by setting theR bit in the OMR register and waiting for the enabling to take effect When convergent rounding is disabled 2 s complement rounding is then used when rounding is performed void turn_off_conv_rndg void turn_off_conv_rndg turn_off_sat Definition Prototype Usage Generates a sequence for disabling automatic saturation in the MAC Output Limiter by clearing the SA bit in the OMR register and waiting for the disabling to take effect void turn_off_sat void turn_off_sat turn_on_conv_rndg Definition Prototype Usage DSP 130 Generates a sequence for enabling convergent rounding by clearing theR bit in the OMR register and waiting for the enabling to take effect void turn_on_conv_rndg void turn_on_conv_rndg Targeting DSP56800E Inline Assembly Language and Intrinsics Intrinsic Functions for Math Support turn_on_sat Definition Generates a sequence for enabling automatic saturation in the MAC Output Limiter by setting the SA bit in the OMR register and waiting for the enabling to take effect Prototype void turn_on_sat void Usage turn_on_sat Targeting DSP56800E DSP 131 Inline Assembly Language and Intrinsics
282. will receive a license key by email after you submit your information in the evaluation form at this website Install the license key as follows a Locate the license dat file in your CodeWarrior installation folder The file is located at the root of the CodeWarrior installation directory so if you have installed the CodeWarrior software at the default installation path you can find it here C Program Files Metrowerks CodeWarrior license dat It is important that this file remain at this location Use any standard text editor to open this file For example NotePad Copy or type the key starting on a new line at the bottom of this file For example if your new license key was FEATURE Win32_ Plugins _DSP56800E metrowks 2 000 permanent uncounted 5FC07C471 D6FB HOSTID 00C04ff5efb0 And the existing license dat file contained FEATURE FEATURE ry Win32_CWI DE_Limited metrowks 5 0 permanent uncounted 2C3C43468173 HOSTID ANY Win32_CWIDE_Unlimited metrowks 5 0 permanent uncounted D8C287 BC5 B1B HOSTID ANY Targeting DSP56800E DSP 21 Getting Started Installing the CodeWarrior IDE for DSP56800E After pasting or typing in the new key the file contains FEATURE Win32_CWIDE_Limited metrowks 5 0 permanent uncounted 2C3C43468173 HOSTID ANY FEATURE Win32_CWIDE_Unlimited metrowks 5 0 permanent
283. ws a P OR links two sub triggers by a logical or AND links two sub triggers by a logical and THEN creates a sequence first sub trigger must occur then second sub trigger must occur to complete the trigger SC sub trigger starts the counter HC sub trigger halts the counter Data Selection Modes If the trigger mode being set includes a data value compare contains B2D from the list Normal Trigger Modes or Counter Trigger Modes then one of the defined identifiers in Table 10 7 must be OR ed into the options parameter of the _eonce_SetTrigger or _eonce_SetCounterTrigger function If not then do not OR in any of these identifiers DSP 338 Targeting DSP56800E Libraries and Runtime Code EOnCE Library Table 10 7 Data Selection Modes Defined Description Identifiers B2D_BYTE makes a comparison when the data being moved is of byte length B2D_WORD makes a comparison when the data being moved is of word length B2D_LONG makes a comparison when the data being moved is of long length Counter Function Modes One of the defined identifiers in Table 10 8 must be OR ed into the options parameter of the _eonce_SetCounterTrigger function Table 10 8 Counter Function Modes Defined Identifiers Description PCLK_CLOCK_CYCLES count pclk cycles CLK_CLOCK_CYCLES count clk cycles INSTRUCTIONS_ EXECUTED count instructions executed TRACE_BUFFER_WRITES count writes to the trace buffer COUNTER_START_TRIGGERS count Coun
284. ws installed directory There is no synchronization of debug events in the startup script Consequently add the run debugging command to the startup script and place the following debugging commands in another script to execute them debug go stop kill next and step Command Line Debugging Tasks This section describes some tasks for command line debugging Open a Command Line Debugging Window To open a command line debugging window choose Debug gt Command Line Debugger When the debugging window opens it displays several command hints at the bottom of the window Enter a Single Command Line Debugging Command To enter a single debugging command Type a command or its shortcut followed by a space on the command line For example the shortcut for the break command is b If needed type any options separating them from the command and each other with spaces Press Enter Enter Multiple Command Line Debugging Commands To enter multiple debugging commands Decide which commands Tcl and debugger specific to use Type the commands into a file Targeting DSP56800E Debugging for DSP56800E Command Line Debugging NOTE Targeting DSP56800E Save the file with a tcl extension to indicate that it is a Tcl script Enter the run command to run the script View Debugging Command Hints You can view debugging command hints as follows e To view the hint for a particular debugger specific command type the
285. xt gt ROOT NOTE Targeting DSP56800E If an object is written once using the OBJECT function selection key word the same object will not be written again if you use the file selection keyword ROM to RAM Copying In embedded programming it is common to copy a portion of a program resident in ROM into RAM at runtime For example program variables cannot be accessed until they are copied to RAM To indicate data or code that is meant to be copied from ROM to RAM the data or code is assigned two addresses One address is its resident location in ROM where it is downloaded The other is its intended location in RAM where it is later copied in C code Use the MEMORY segment to specify the intended RAM location and the AT address parameter to specify the resident ROM address For example you have a program and you want to copy all your initialized data into RAM at runtime Listing 9 18 shows the LCF you use to set up for writing data to ROM DSP 279 ELF Linker and Command Language Linker Command File Syntax Listing 9 18 LCF to Setup for ROM to RAM Copy MEMORY text RWX ORIGIN 0x8000 LENGTH 0x0 code p data RW ORIGIN 0x3000 LENGTH 0x0 data x gt RAM J SECTIONS main_application text sections text rtlib text fp_engine txt user text gt text __ROM_ Address 0x2000 data AT __ROM Address ROM Address definition data
286. xt line until it gets a complete Tcl script block For example the Tcl source command executes the script in Listing 7 1 as one block but the run debugging command executes it as two blocks the set statement and the while loop Example Tcl Script set x 0 while Sx lt puts x is 5 S y set x expr x 1 NOTE Targeting DSP56800E The run debugging command synchronizes the debug events be tween blocks in a script file For example after a go next or step debugging command run polls the debugging thread state and re frains from executing the next line or block until the debugging thread stops However the Tcl source command does not con sider the state of the debugging thread Consequently use the run debugging command to execute script files that contain these de bugging commands debug go next stop and kill Tcl support for using a start up script You can use a start up script with the command line debugger You can specify command line debugger commands in the script For example you might want to set an alias or a color configuration DSP 209 Debugging for DSP56800E Command Line Debugging DSP 210 NOTE Name the start up script tcld tcl The command line debugger executes the start up script the first time you open the command line debugger window provided that the file is in the correct directory for the host platform you are using For Windows place tcld tcl in the Windo
287. y depending on stack design and use M56800E uses a 16 bit wide stack Heap Heap is an area of memory reserved for temporary dynamic memory allocation and access MSL uses this space to provide heap operations such as malloc M56800E does not have an operating system OS but MSL effectively synthesizes some OS services such as heap operations BSS BSS is the memory space reserved for uninitialized data The compiler will put all uninitialized data here If Zero initialized globals live in data instead of BSS on page 63 is checked then the globals that are initialized to zero reside in the data section instead of the bss section The stationery init code zeroes this area at startup See the M56852 init startup code in this chapter for general information and the stationery init code files for specific target implementation details DSP 313 Libraries and Runtime Code MSL for DSP56800E NOTE Instead of accessing the original Stationery files themselves in the Stationery folder create a new project using Stationery which will make copies of the specific target board files such as the LCF DSP 314 Targeting DSP56800E Libraries and Runtime Code Runtime Initialization Runtime Initialization The default init function is the bootstrap or glue code that sets up the DSP56800E environment before your code executes This function is in the init file for each board specific stationery project The routines defined
288. y the Load Save Memory dialog box Figure 7 6 DSP 177 Debugging for DSP56800E Load Save Memory Figure 7 6 DSP 178 NOTE Load Save Memory Dialog Box Load Save Memory x History y m Parameters Operation Load Memory C Save Memory Memory Type P Memory Address cme Size Filename Browse F Oyente Existing Fileformat Binary Raw y m Progress Use this dialog box to load and save memory at a specified location and size with a user specified file You can associate a key binding with this dialog box for quick access Press the Tab key to cycle through the dialog box displays which lets you quickly make changes without using the mouse History Combo Box The History combo box displays a list of recent loads and saves If this is the first time you load or save the History combo box is empty If you load save more than once the combo box fills with the memory address of the start of the load or save and the size of the fill to a maximum of ten sessions If you enter information for an item that already exists in the history list that item moves up to the top of the list If you perform another operation that item appears first By default the History combo box displays the most recent settings on subsequent viewings Targeting DSP56800E Debugging for DSP56800E Load Save Memory Targeting DSP56800E Radio Buttons The Loa
289. y you want to build an application Use this menu to select the project type that reflects the kind of project you are building Targeting DSP56800E DSP 43 Target Settings DSP56800E Specific Target Settings Panels e Output File Name The Output File Name field specifies the name of the executable file or library that you want to create This file is also used by the CodeWarrior debugger Application names end with the extension elf and library names end with the extension LD NOTE When building a library be sure to name it with the extension 1ib the default file mapping entry for libraries If you wish to change an extension you must add a file mapping entry in the File Mappings panel For more information on File Mappings see the IDE User Guide DSP 44 Targeting DSP56800E Target Settings DSP56800E Specific Target Settings Panels C C Language Settings in the C C Language panel Figure 4 4 only affect C language features implemented for the DSP56800E The following options are not applicable to the DSP56800E compiler Disable the options at all times e Force C compilation e ISO C Template Parser e Enable C99 Extensions e Enable Objective C e Legacy for scooping e Enable C Exceptions e Enable RTTI e Enable bool Support e Enable wchar_t Support e Multi Byte Aware e EC Compatibility Mode e Pool Strings Targeting DSP56800E DSP 45 Target Settings DSP56800E Specific Target Settings Pan
290. ynamic allocation R5 is reserved as a stack frame pointer This is the original stack pointer before allocations are done Registers C10 and D10 are saved across function calls R5 is saved across calls unless it is reserved as a frame pointer as noted above Registers C2 and D2 are not saved across function calls Volatile and Non Volatile Registers Non volatile Registers Non volatile registers are registers that can be saved across functions calls These registers are also called saved over a call registers SOCs Volatile Registers Volatile registers are registers that cannot be saved across functions calls These registers are also called non SOC registers NOTE See Table 5 3 for a list of volatile non SOC and non volatile SOC registers Targeting DSP56800E DSP 83 C for DSP56800E Calling Conventions and Stack Frames for DSP56800E Table 5 3 Volatile and Non Volatile Registers Unit Register Name Size Type Comments Arithmetic Y1 16 Volatile non SOC Logic Unit ALU YO 16 Volatile non SOC Y 32 Volatile non SOC XO 16 Volatile non SOC A2 4 Volatile non SOC A1 16 Volatile non SOC AO 16 Volatile non SOC A10 32 Volatile non SOC A 36 Volatile non SOC B2 4 Volatile non SOC B1 16 Volatile non SOC BO 16 Volatile non SOC B10 32 Volatile non SOC B 36 Volatile non SOC C2 4 Volatile non SOC C1 1
291. you select Project gt Debug the CodeWarrior IDE enables the Generate Symbolic Info option for you Targeting DSP56800E DSP 65 Target Settings DSP56800E Specific Target Settings Panels If the Generate Symbolic Info option is not enabled the Store Full Path Names option is not available NOTE If you decide to disable the Generate Symbolic Info option you cannot debug your project using the CodeWarrior debugger For this rea son the compiler enables this option by default Store Full Path Names The Store Full Path Names option controls how the linker includes path information for source files when generating debugging information If this option is enabled the linker includes full path names to the source files If this option is disabled the linker uses only the file names By default this option is enabled This option is available only if you enable the Generate Symbolic Info option e Generate Link Map The Generate Link Map option controls whether the linker generates a link map Enable this option to let the linker generate a link map The file name for the link map adds the extension xMAP to the generated file name The linker places the link map in the same folder as the output elf file For each object and function in the output file the link map shows which file provided the definition The link map also shows the address given to each object and function a memory map of where each section resides i
Download Pdf Manuals
Related Search
Related Contents
Mode d`emploi Opmaak 1 - DVD2one.com ワイドスライダー.. 取扱説明書 Trustedchoice.com Agency Profile User Manual version in english. NVR and Hybrid DVR Systems Setup Guide Colorado Convention Center Denver, CO May 14 User`s manual - Charles HAMEL Copyright © All rights reserved.
Failed to retrieve file