Home
MC56F83xx/DSP5685x Family Targeting Manual
Contents
1. v Beanname GPIO_CO Pinforl O Ea O a ete TN v GPIOCO_SCLK1_TBO_P Pin signal Pull resistor autoselected pull w no pull resistor Open drain no open drain Y Direction Input Output v Input Output Initialization Int directior Output v Init value 0 Safe mode yes Optimization fc speed e In the project window s Processor Expert page select the bean name GPIO_C1 The Bean Inspector information changes accordingly f Use the Pin for I O middle column list box to select GPIOC1_MOSI1_TB1_PHASEB1 g Repeat substeps e and f for bean GPIO_C2 to change its associated pin to GPIOC2_MISO1_TB2_INDEX1 h Repeat substeps e and f for bean GPIO_C3 to change its associated pin to GPIOC3_SSA_B_TB3_HOME1 i Repeat substeps e and f for bean GPIO_D6 to change its associated pin to GPIOD6_TxD1 j Repeat substeps e and f for bean GPIO_D7 to change its associated pin to GPIOD7_RxD1 k In the project window s Processor Expert page select the bean name IRQA The Bean Inspector information changes accordingly 1 Use the Pin middle column list box to select IRQA_B m Repeat substeps k and 1 for bean IRQB to change its associated pin to IRQB_B n You may close the Bean Inspector window 108 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Ex
2. 04 307 Compiler icsi a Soe Sh Bo a ae a ae a o 309 Tinker taa a a ew ie ke cae E A 316 Assembler cocoa a S a A 320 14 Libraries and Runtime Code 321 MSL for DSP56800E taa td a2 Using MSL for DSP56800E 2 321 Allocating Stacks and Heaps for the DSP56800E 2 324 Runtime Initialization 2 e o sgh B25 EOnCE Library 2 2 2 Se grt bos Hk 2 IZA eonce Initialize tad as e A _eonce_SetTrigger ee o wo 331 _eonce_SetCounterTrigger 2 0 NS _eonce_ClearTrigger fel Sore ADOS _eonce_GetCounters 2 2 ee a a 334 _eonce_GetCounterStatus bate en es BO o per ee See OM _eonce_SetupTraceBuffer bac cen we RoR ce A O _eonce_GetTraceBuffer 2 2 ee o 336 _eonce_ClearTraceBuffer e 336 _eonce_StartTraceBuffer s soa eor waa n a E e a a a a 337 Targeting MC56F83xx DSP5685x Controllers 11 For More Information www freescale com Freescale Semiconductor Inc Table of Contents _eonce_HaltTraceBuffer 4 337 _eonce_EnableDEBUGEV 338 _eonce_EnableLimitTrigger 2 2 2 338 Definitions Ara Se ee eB by aon Ag Se ee 339 A Porting Issues 349 Converting the DSP56800E Projects from Previous Versions 349 Removing illegal object_c on pragma directive Warning
3. F Use Memory Configuration File 78 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 15 Remote Debug Options Panel Elements Element Purpose Comments Program Checked Download checkboxes specify the Section types Download section types to be downloaded on initial Executable program code Options area launch and on successive runs sections that have X flags in Checked Verify checkboxes specify the the linker command file section types to be verified that is read Constant Data program back to the linker data sections that do not have X or W flags in the linker command file Initialized Data program data sections with initial values These sections have W flags but not X flags in the linker command file Uninitialized Data program data sections without initial values These sections have W flags but not X flags in the linker command file Use Memory Not supported at this time Configuration File checkbox Targeting MC56F83xx DSP5685x Controllers 79 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels 80 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 9 Processor Expert
4. div_s4q Four quadrant division of two 16 bit fractional values returning a 16 bit result NOTE Does not check for division overflow or division by zero Prototype Word16 div_s4q Word16 s_ numerator Word16 s denominator Example 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 Single quadrant division that is both operands are positive two 16 bit fractional values returning a 16 bit result If both operands are equal returns Ox7FFF occurs naturally 248 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions NOTE Does not check for division overflow or division by zero Prototype Word16 div_ls Word32 1 numerator Word16 s denominator Example long 1 0x20000000 0 25 short s2 0x4000 0 5 short result result div_ls 1 s2 Expected value of result 0 25 0 5 0 5 0x4000 div_ls4q Four quadrant division of a 32 bit fractional dividend and a 16 bit fractional divisor returning a 16 bit result NOTE Does not check for division overflow or division by zero Prototype Word16 div _1s4q Word32 1 numerator Word16 s denominator Example long 1 0xE0000000 0 25 short s2 0xC000 0 5 short result result div_ls4q s1 s2
5. Using the Bean Inspector to set a bean s initialization properties automatically adds bean initialization code to CPU initialization code You use the Bean Inspector to adjust bean properties so that generated code is optimal for your application Beans greatly facilitate management of on chip peripherals When you choose a peripheral from bean properties the PEI presents all possible candidates But the PEI indicates which candidates already are allocated and which are not compatible with current bean settings Processor Expert Menu Table 5 1 explains the selections of the Processor Expert menu Targeting MC56F83xx DSP5685x Controllers 85 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 5 1 Processor Expert Menu Selections Design Item Subitem Action Open Processor none Opens the PEI for the current project Expert Available only if the current project does not already involve the PEI Code Design none Generates code including drivers for the lt Project gt current project Access these files via the Generate Code folder of the project window Files page Undo Last Code none Deletes the most recently generated code returning project files to their state after the previous error free code generation View Project Panel Brings the Processor Expert page to the front of the CodeWarrior project window
6. 350 B DSP56800x New Project Wizard 351 OVERVIEW of dc dere e BE EH A eee a eo aoe ko BO Page Rules lt s no te Gwe Gwe Re pe ee ae ee 358 Resulting Target Rules 2 ee 396 Rule Notes so 24658 soso we Bg a gt a a ee A ek ee I DSP56800x New Project Wizard Graphical User Interface 357 Invoking the New Project Wizard 2 2 2 1 397 New Project Dialog Box 2 2 2 ee 2 358 Target Pages 205 58 art dh wwe dees We at de R399 Program Choice Page 2 2 a ee 363 Data Memory Model Page 2 365 External Internal Memory Page 366 Finish Page gs 2 24 ra a as a 07 12 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Introduction This manual explains how to use the CodeWarrior Integrated Development Environment IDE to develop code for the DSP56800E family of processors MC56F3xx and DSP56F5x This chapter contains the following sections e CodeWarrior IDE e Freescale 56800 E Hybrid Controllers References CodeWarrior IDE The CodeWarrior IDE consists of a project manager a graphical user interface compilers linkers a debugger a source code browser and editing tools You can edit navigate examine compile link and debug code within the one Code Warrior environment The CodeWarrior IDE lets you configure op
7. Expected value of result 0 25 0 5 0 5 0x4000 Targeting MC56F83xx DSP5685x Controllers 249 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Multiplication MAC The intrinsic functions of the multiplication MAC group are mac_r msu_r mult mult_r L_mac L_msu L_mult L_mult_ls mac_r 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 Assumptions 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 mac_r Word32 laccum Word16 sinpl Wordl16 sinp2 250 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short sl 0xC000 0 5 short s2 0x4000 0 5 short result long Acc Ox0000FFFF result mac_r Acc s1 s2 Expected value of result 0xE001 msu_r 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 accu
8. Expected value of result 1 258 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Rounding The intrinsic function of the rounding group is e round round Rounds a 32 bit fractional value into a 16 bit result When an accumulator is the destination zeroes out the LSP portion Assumptions 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 Prototype Word16 round Word32 lvarl Example long 1 0x12348002 if low 16 bits OxFFFF gt 0x8000 then add 1 short result result round l Expected value of result 0x1235 Targeting MC56F83xx DSP5685x Controllers 259 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Shifting The intrinsic functions of the shifting group are e shl e shlftNs e shifts e shr e shr r e shrtNs e L shl e L_shlftNs e L_shlfts e L shr e L shrr e L_shrtNs shi 260 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
9. option warn_extracomma command Inconsistent Use of class and struct Keywords Leave clear Does not apply to C Capitialization include file capitialization Clear Compiler does not perform such checks checkbox Empty Checked Compiler issues warnings According to this option the Declarations about declarations without variable names incomplete declaration int would checkbox Clear Compiler does not issue such prompt the compiler response warnings WARNING To check whether this option is in effect use the __ option warn_emptydecl command Include File Checked Compiler issues warning about See pragma warn_filenamecaps Pad Bytes Added Checked Compiler checks for pad bytes added Clear Compiler does not perform such checks See pragma warn_padding Undefined Macro In if Checked Compiler checks for undefined macro in if Clear Compiler does not perform such checks Targeting MC56F83xx DSP5685x Controllers See pragma warn_undefmacro 59 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 7 C C Warnings Panel Elements continued Element Purpose Comments Non Inlined Checked Compiler issues a warning if To check whether this option is in Functions unable to inline a function effect use the checkbox Clea
10. 1 Use any combination stationery template files library files or your own source files 2 Compiler linker debugger settings target specification optimizations 3 Edit source and resource files 4 Possible corrections adding a file changing settings or editing a file 37 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process Project Files A CodeWarrior project consists of source code library and other files The project window Figure 3 2 lists all files of a project letting you e Add files Remove files e Specify the link order e Assign files to build targets and e Direct the IDE to generate debug information for files Figure 3 2 Project Window 38 x 0 sam Mev Sy BA Files Link Order Targets e File Code Data Mw v a code Y EE DSP56800E sim support EQ init EQ interrupt vectors H linker command files E lib Runtime 56800E lib MSL C 56800 lib Runtime 56800 E Imm lib n a n a BS MSL C 56800 Imm lib n a cm e KKKKEE oooooooo ocoocoooo la ha la ha ba hs ds ds ds ls 3 x w NOTE Figure 3 2 shows a floating project window Alternatively you can dock the project window in the IDE main window or make it a child window You can have multiple project windows open at the same time if the windows are docked their tabs let you control which one is at the front of th
11. BSS BSS is the memory space reserved for uninitialized data The compiler will put all uninitialized data here If the Zero initialized globals live in data instead of BSS checkbox in the M56800E Processor Panel is checked 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 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 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 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 the main function Targeting MC56F83xx DSP5685x Controllers 325 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization The starting point for a program is set in the Entry Po
12. Floats Doubles Any pointer variables e Word pointers to access Shorts Longs Any pointer variables e Byte pointers for Single global or static byte variable if accessed through a pointer using X Rn Global or static array of byte variables The compiler does not use pointers to access scalar global or static byte variables directly by their addresses Instead it uses an instruction with a BP suffix MOVE U BP X xxxx lt dest gt MOVE BP lt SYIC gt X XXXX Reordering Data for Optimal Usage The compiler changes data order for optimal usage The data reordering follows these guidelines 132 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Variables in Program Memory e Reordering is mandatory if local variables are allocated on the stack The compiler does not reorder data for parameter values passed in memory instead of being passed in registers The compiler does not reorder data when locating fields within a structure Variables in Program Memory This features allows the programmer full flexibility in deciding the placement of variables in memory Variables can be now declared as part of the program memory using a very simple and intuitive syntax For example _ pmem int c c isan integer that will be stored in program memory This feature is very useful when data memory is tight
13. Prototype int _eonce SetCounterTrigger unsigned int unit unsigned long options unsigned long valuel unsigned long value2 unsigned long mask unsigned int counter unsigned long counter2 Parameters unitunsigned int Specifies which breakpoint unit to use optionsunsigned long Describes the behavior of the trigger For more information on the identifiers for this parameter please see the sub section Definitions on page 325 valuelunsigned long Specifies the address or data value to compare as defined by the options parameter value2unsigned long Specifies the address or data value to compare as defined by the options parameter maskunsigned long Specifies which bit of value2 to compare counterunsigned int 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 significant 16 bits 332 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library counter2unsigned long Specifies the value used to pre load the counter which proceeds backward When EXTEND_COUNTER is OR ed into the options parameter count er2 contains the most significant 24 bits However when EXTEND COUNTER is not OR ed counter2 should be set to 0 Remarks This function is used to set special counting function triggers T
14. hsst_close A host side client application uses this function to close a communication channel with the low level target Prototype HRESULT hsst_close size_t channel_id Parameters channel _ id Specifies the channel ID of the communication channel to close Returns S_OK if the call succeeds or S_FALSE if the call fails 154 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface hsst_read A host side client application uses this function to read data sent by the target application without stopping the core Prototype HRESULT hsst_read void data size_t size size_t nmemb size_t channel id size_t read Parameters data Specifies the data buffer into which data is read size Specifies the size of the individual data elements to read nmemb Specifies the number of data elements to read channel _ id Specifies the channel ID of the communication channel from which to read read Contains the number of data elements read Returns S_OK if the call succeeds or S_ FALSE if the call fails Targeting MC56F83xx DSP5685x Controllers 155 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface hsst_write A host side client application uses this function to write data that the ta
15. 158 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface Prototype HRESULT hsst_attach listener size t cid NotifiableHSSTClient subscriber Parameters cid Specifies the channel ID of the communication channel to listen to subscriber Specifies the address of the variable of class Notifiable HSST Client Returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_detach_listener Use this function to detach a host side client application that you previously attached as a listener to the specified communication channel Prototype HRESULT hsst_detach listener size_t cid Parameters cid Specifies the channel ID of the communication channel from which to detach a previously specified listener Returns S_OK if the call succeeds or S_FALSE if the call fails Targeting MC56F83xx DSP5685x Controllers 159 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface hsst_set_log_ dir 160 A host side client application uses this function to set a log directory for the 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
16. L_add Addition of two 32 bit integer or fractional values returning a 32 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 Word32 L_add Word32 src_dst Word32 src2 Example long la 0x40000000 0 5 long 1b 0x20000000 0 25 long result result L add la 1b Expected value of result 0x60000000 0 75 L_sub Subtraction of two 32 bit integer or fractional values returning a 32 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 Word32 L sub Word32 src_dst Word32 src2 Targeting MC56F83xx DSP5685x Controllers 241 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example long la 0x40000000 0 5 long lb OxE0000000 0 25 long result result L sub la 1b Expected value of result 0x60000000 0 75 Control The intrinsic functions of the control group are e stop e wait e turn_off conv_rndg e turn_off sat e turn_on_conv_rndg e turn_on_sat stop Generates a STOP instruction which places the processor in the low power STOP mode Prototype void stop void Usage stop 242 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freesca
17. break case 2 GPIO C1 SetVal break case 3 GPIO C2 SetVal break case 4 GPIO C3 SetVal break case 5 GPIO D6 SetVal break case 6 GPIO D7 SetVal break clear the given LED void clrLED int void clrLED int num if IRQA On num 7 num if IRQB On switch num case 1 GPIO CO ClrVal break case 2 GPIO C1 ClrVal break case 3 GPIO C2 ClrVal break case 4 GPIO C3 ClrVal break 116 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial case 5 GPIO D6 ClrVal break case 6 GPIO D7 ClrVal break else switch num case 1 GPIO C0 SetVal break case 2 GPIO C1 SetVal break case 3 GPIO C2 SetVal break case 4 GPIO C3 SetVal break case 5 GPIO D6 SetVal break case 6 GPIO D7 SetVal break define CLEARLEDS showNumberWithLEDs 0 method to set each LED status to reflect the given number bitfield void shwNumberWithLEDs long void showNumberWithLEDs long num int i for i 0 i lt 6 i if num gt gt i amp 1 setLED i 1 else clrLED i 1 J Pattern Count from 0 to 63 in binary using LEDs to represent bits of the current number 1 enabled LED 0 disabled LED void pattern void pattern long i int J for i 0 i lt 0b111111 i showNumberwWithLEDs
18. 2 2 2 ee 2 138 Code and Data Storage n 2 2 ee 139 Large Data Model Support tule Goi eye a Roe a oh ke ae ae TA Extended Data Addressing Example bo he We Ey e e eK e a ey AZ Accessing Data Objects Examples 2 2 7 142 External Library Compatibility 2 2 2 144 Optimizing Code 2 ee 144 Deadstripping and Link Order 2 2 a a 145 Working with Peripheral Module Registers 2 2 146 Compiler Generates Bit Instructions 2 2 2 146 Explanation of Undesired Behavior 2 2 2 2 148 Recommended Programming Style 149 Generating MAC Instruction Set 2 2 2 2 ee ee 150 7 High Speed Simultaneous Transfer 153 Host Side Client Interface 2 2 a eee eee ee 153 hsst opin mg in Be Slee ds ied A we We ot BSS hsst Clos gt oe a Pal ooh ee RO ee SA psst reado sg cu Se re Be ee E i Se i we TDD Nsstawerites LE er ett A Go A SG HSstzsizex 22 Sato eo Ge a ee leat Af ida a ow Oot La QT hsst_block_mode 2 00 2 004 157 hsst_noblock_mode 2 0 2 0422 2 158 hsst_attach_listener 2 2 2 ee ee ee ee 158 hsst_detach_listener 2 ee ee 159 Targeting MC56F83xx DSP5685x Controllers 5 For More Information www freescale com Freescale Semiconductor Inc Table of Contents hsst_set_log dir 160 HSST Host Program Exampl 160
19. Build Extras panel 48 Targeting MC56F83xx DSP5685x Controllers E C for DSP56800E 119 146 C C language panel 51 C C warnings panel 56 59 calling conventions 121 124 Changing Target Settings 45 child windows 32 33 code storage 139 Code Warrior IDE 13 14 35 36 installing 23 installing and registering 20 CodeWarrior IDE Target Settings Panels 48 command converter server 180 188 command window 218 conventions calling 121 124 converting CodeWarrior projects 349 CPU types overview window 98 creating a project 29 34 Custom Keywords settings panel 48 Cycle Instruction Count 215 D data alignment 131 133 data storage 139 deadstripping 145 debugger command converter server 180 188 EOnCE features 206 214 fill memory 202 204 load save memory 200 202 operating 188 195 save restore registers 204 206 system level connect 219 Debugger Settings panel 48 debugging 179 224 flash memory 219 notes for hardware 223 target settings 179 180 development process 36 42 building compling and linking 40 42 debugging 42 editing code 39 40 project files 38 39 TMP 369 For More Information www freescale com Freescale Semiconductor Inc development studio overview 35 42 dialog boxes fill memory 202 204 load save memory 200 202 save restore registers 204 206 directories installation 23 div_ls intrinsic function 248 249 div_ls4q intrinsic function 249 div_s intrinsic function 247 248 div_s4q intrinsic function 248 d
20. For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Code and Data Storage Table 6 4 Code and Data Memory Ranges Small Model Large Model Section Size Range Size Range Word Address Word Address CODE 128 KB 0 OXFFFF 1MB 0 OX7FFFF P memory DATA 128 KB 0 OxXFFFF 32 MB 0 OXFFFFFF X memory DATA 64 KB 0 Ox7FFF 16 MB 0 OX7FFFFF X memory character data A peculiarity of the DSP56800E architecture is byte addresses for character 1 byte data but word addresses for data of all other types To calculate a byte address multiply the word address by 2 An address cannot exceed the maximum physical address so placing character data in the upper half of memory makes the data unaddressable Address registers have a fixed width For example in the small memory model maximum data address 64 KB placing character data at 0x8001 requires an access address of 0x10002 But this access address does not fit into 16 bit storage as the small data memory model requires Under your control the compiler increases flexibility by placing all character data into specially named sections as described in Emit separate character data section checkbox You can locate these sections in the lower half of the memory map making sure that the data can be addressed Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Frees
21. 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 DSP56800E Specific Target Settings Panels The rest of this chapter explains the target settings panels specific to DSP36800E development 48 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Target Settings Use the Target Settings panel Figure 4 2 to specify a linker This selection also specifies your target Table 4 3 explains the elements of the Target Settings panel The Target Settings window changes its list of panels to reflect your linker choice As your linker choice determines which other panels are appropriate it should be your first settings action Figure 4 2 Target Settings Panel N Target Settings Target Name Simulator Linker M56800E Linker y Pre linker None y Postlinker None y Dutput Directory Clear HProjectioutput Save project entries using relative paths Table 4 3 Target Settings Panel Elements Element Purpose Comments Target Name Sets or changes the name of a build target For your development convenience text box not the name of the final output file Use the AGB Target Setting panel to name the
22. pool strings into a single data object no readonly make all string constants read only strict on off specify ANSI strictness checking default is off trigraphs on off enable recognition of trigraphs default is off wchar_t on loff enable wchar_t as a built in C type default is on Optimizer Options Note that all options besides opt off on all space speed level are for backwards compatibility other optimization options may be superceded Targeting MC56F83xx DSP5685x Controllers 313 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments by use of opt level xxx 0 same as 02 O keyword cased control optimization you may combine options as in 04 p 0 same as opt off 1 same as opt level 1 2 same as opt level 2 3 same as opt level 3 4 same as opt level 4 p same as opt speed s same as opt space opt keyword off none on all full no space no speed 1 evel num H HHHHHHHHHHHHHHHHH HHH H H 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 level 1 global register allocation peephole dead code elimination level 2 adds common subexpression elimination and copy propagation level 3 adds loop transformations
23. segment_ name RW ORIGIN memory address LENGTH segment length and so on 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 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 attributes 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 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 NOTE The closure blocks need to be in place before the SECTIONS definition in the linker command file The two types of closure bloc
24. 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 removal of dead code no deadstore removal of dead assignments no lifetimes computation of variable lifetimes no loop invariants removal of loop invariants no prop agation propagation of constant and copy assignments no strength strength reduction reducing multiplication by an index variable into addition 314 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no dead same as opt no deadcode and opt no deadstore display dump display complete list of active H optimizations DSP M56800E CodeGen Options DO keyword H for this tool H specify hardware DO loops off H no hardware DO loops default nonested hardware DO loops but no nested ones nested nested hardware DO loops padpipe for this tool pad pipeline for debugger ldata largedata for this tool data space not limited to 64K globalsInLowerMemory for this tool globals live in lower memory implies large H data model sprog smallprog H for this tool H program space limited to 64K g global cased generate debugging information same
25. tape We he ches it ae Be Bb E AD Bdeposit tie s eG a Bee kee a ee te we a a AO L_depositl 2 24 2 8 ew ee eR ee Ree eee ee ee 4246 UNES As Ae weet ee ee hy oe Bent RO ee SB te Sty ZA divs4q 2 4 pe 4 Abo 4 Oe Dee e Sea AP o 4 248 diy IS A o at en ak ee be Be at nt af ee er owe ee is ZAS 8 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table of Contents EN A eae ke ee oe i ee BA eo ae a ee ek A249 MACHT e eh A eee Bee a Ged he ee a Bere Be 250 MS Sree ei SS 6 A ete YO oe ee a 25 MUI 228 ee ee op WA eee wb ARE E aa mU a Bi he is Pee ee a as Se ee RIE DIR Eomae E ke ia tA eae paid ty Ane Sand eee DO MS Bf Bere ahh ee a ee a BO Be Bo ERA B m lt a 4a fe Se a oe a es OE ee eh ne le Gy 2 254 E mle IS et te Ack Se eK eh wet AS TESS o ow hee Se ae HO EDO NOMS ara eG a Ae ee a a we a Ge 236 A ae eo tte Sh eS ee he Yeo ee ee eee a na oe eet 2OF A eh eee oe 258 LOU Ate e Beg ee Ea Ok red fe ey a ip ee a DOD SOL ti gs os Ok S lish Lee de Roe Tt ee BO rok kb ee he 2 e260 ShIftNS coo ode eed Re ES Soe ee a oe ee a O SOIS o Yak SE Se ee ve a A er ee eB Be eke ve LOZ SHE cei ar ee hh da en et amp hos OS SMe res wee Sd ae BR E es De ty oe oe lass GES ee See OF ShrtNs 00 2 age BOG ge Raa a Boe Ee ae a eel OA ESA Lo AO Ae tei Bok ce A ee Sa A a ZO E SMIN S ase ob eo Ay Mele o Te Shifts a hoaa amp ee OP we le le ee Oe Bee a ele of DO TerSht sc torte ce Ge Be A
26. 292 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Putting Data in pROM Flash at Build time The linker commands have specific instructions which set values in the binary image at the build time Listing 12 20 For example WRITEH inserts two bytes of data at the current address of a section These commands are placed in the LCF which tells the linker at build time to place data in P or X memory Optionally you can also set the current location prior to the write command to ensure a specific location address for easier reference later The location within the section is not important For more information please see the LCF section in this document Listing 12 20 LCF write example using MC56F832x for build time executing_ code text sections 0x00A4 optionally set the location we use 0x00A4 in this case WRITEH OxABCD now set some value here location within the section is not important text interrupt routines text rtlib text fp engine text user text etc gt p flash ROM Putting Data in pROM Flash at Run time The assembly example in Listing 12 21 fetches the pROM flashed value at run time in Listing 12 20 Listing 12 21 LCF write example using MC56F832x for run time move 1 H 00A4 rl move the pROM address into r3 move w p r3 x0 fetch data f
27. Processor Expert Windows e Item names Items to be set Double click on group names to expand or collapse this list For the Method or Event page double clicking on an item may open the file editor at the corresponding code location e Selected settings Possible settings for your application To change any ON OFF type setting click the circular arrow button Settings with multiple possible values have triangle symbols click the triangle to open a context menu then select the appropriate value Timing settings have an ellipsis button click this button to open a setting dialog box e Setting status Current settings or error statuses Use the comments page to write any notations or comments you wish NOTE If you have specified a target compiler the Bean Inspector includes an additional Build options page for the CPU bean If your project includes external peripherals the Bean Inspector includes an additional Used page Clicking a circular arrow button reserves a resource for connection to an external device Clicking the same button again frees the resource The Basic Advanced and Expert view mode buttons at the bottom of the window let you change the detail level of Bean Inspector information The Bean Inspector window has its own menu bar Selections include restoring default settings saving the selected bean as a template changing the bean s icon disconnecting from the CPU and several kinds of help inf
28. The linker does not enforce any compatibility rules on assembly language modules or libraries The compiler encodes the memory model 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 includes the bit fields that contain the encoded 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 Register coloring is an optimization specific to DSP56800E development The compiler assigns two or more register variables to the same register if the code does not use the variables at the same time The code of Listing 6 6 does not use variables i and j at the same time so the compiler could store them in the same register Listing 6 6 Register Coloring Example short i int j 144 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Deadstripping and Link Order for i 0 i lt 100 i MyFunc i for j 0 j lt 100 j MyFunc j However if the code included the expressionMyFunc i 3 the variables would be in use at the same time The compiler would store the two variables in different registers For DSP56800E develop
29. This function does not set triggers for special counting functions Prototype int eonce SetTrigger unsigned int unit unsigned long options unsigned long valuel unsigned long value2 unsigned long mask unsigned int counter Parameters unitunsigned int Specifies which breakpoint unit to use optionsunsigned long Describes the behavior of the trigger For more information on the identifiers for this parameter please see the sub section Definitions on page 325 valuelunsigned long Specifies the address or data value to compare as defined by the options parameter value2unsigned long Specifies the address or data value to compare as defined by the options parameter maskunsigned long Specifies which bits of value2 to compare counterunsigned int Specifies the number of successful comparison matches to count before completing trigger sequence as defined by the options parameter Remarks 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 Targeting MC56F83xx DSP5685x Controllers 331 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Returns Error code as defined in the sub section Definitions on page 339 _eonce_SetCounterTrigger Sets a trigger condition used for special counting functions
30. because some or all of the data can be moved to program memory It can be handled exactly the same way as normal data This is almost completely transparent to the programmer with a few exceptions that will be presented in the next paragraphs The CPU architecture only allows post increment addressing of words 16 bit data in program memory While the compiler circumvents this restriction and allows full access to all data types in program memory the performance is decreased If placement of some variables in program memory is needed and at the same time the execution speed is important here are some pointers that can be used to organize the code e Try to keep all variables that are used in a loop the loop counter included in data memory This condition becomes more important as the loop nesting level increases e If possible place only int 16 bit data in program memory Data types with different dimensions are accessed via sequences of code rather than single instructions 16 bit data is fastest followed by 32 bit data and 8 bit data e Data in program memory can be loaded and stored in a limited number of DALU registers Because of this a number of register save restore sequences can appear if there are not enough available DALU registers This could be a problem with computational intensive code because the operations does not take place only in registers anymore and the code will be slower This can be avoided by using as many
31. for example PCI is determined by how you installed the CodeWarrior software To modify the protocol make changes in the Metrowerks Command Converter Server window Figure 9 3 180 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Essential Target Settings for Command Converter Server Before you can download programs to a target board for debugging you must specify the target settings for the command converter server e 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 Development Studio for Freescale 56800 E Hybrid Controllers 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 Setting Up a Remote Connection on page 185 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 185 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 se
32. new bean icons appear in the Processor Expert page c You may close the Bean Inspector window 5 Rename the eight beans GPIO_CO GPIO_C3 GPIO_D6 GPIO_D7 IRQA and IRQB a In the project window s Processor Expert page right click the name of the first BitIO bean A context menu appears b Select Rename Bean A change box appears around the bean name Targeting MC56F83xx DSP5685x Controllers 105 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial c Type the new name GPIO_Co then press the Enter key The list shows the new name as Figure 5 17 shows this name still ends with Bit IO Figure 5 17 New Bean Name LEDcontrol mcp o sdm external memory v B y A 5 Files Link Order Targets Processor Expert amp Configurations amp CPUs B Cpu DSP56F836 amp Beans a Fei Y Bit2Bito Z Bi2 Bi1o Y Bits Bitlo Y Bit Bit0 Y Bit Bitlo Y Elntl Extint Z Elnt2 Extint amp Documentation x E PESL 200000 d Repeat substeps a b and c for each of the other BitlO beans renaming them GPIO C1 GPIO C2 GPIO C3 GPIO D6 and GPIO D7 106 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial e Repeat
33. out the LSP portion Assumptions 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 252 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Prototype Word16 mult_r Word16 sinp1 Word16 sinp2 Example short sl 0x2000 0 25 short s2 0x2000 0 25 short result result mult_r sl1 s2 Expected value of result 0 0625 0x0800 L_mac Multiply two 16 bit fractional values and add to 32 bit fractional value generating a 32 bit result saturating if necessary 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 mac Word32 laccum Word16 sinpl Wordl6 sinp2 Example short sl 0xC000 0 5 short s2 0x4000 0 5 long result Acc 0x20000000 0 25 result L_mac Acc s1 s2 Expected value of result 0 Targeting MC56F83xx DSP5685x Controllers 253 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions L_msu Multiply two 16 bit fractional values and subtract this product from a 32 bit fractional value saturating
34. select Show Console 3 At the console command line in the Metrowerks Command Converter Server window shown in Figure 9 3 type the following command delete all 4 Press Enter 5 Type the following command config cc address substituting for address the name of the IP address of your CodeWarrior HTT NOTE If the software rejects this command your CodeWarrior HTI may be an earlier version Try instead the command config cc nhti address or the command config cc Panther address substituting for address the IP address of the HTL 6 Press Enter 7 Type the following command to save the configuration config save 8 Press Enter Changing the Command Converter Server Protocol to PCI To change the command converter server to a PCI Connection 184 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server 1 While the command converter server is running right click on the command converter server icon shown in Figure 9 1 or double click on it 2 From the menu shown in Figure 9 2 select Show Console 3 At the console command line in the Metrowerks Command Converter Server window shown in Figure 9 3 type the following command delete all 4 Press Enter 5 Type the following command config cc pci 6 Press Enter 7 Type the following command to save the configuration config save 8 Pres
35. 10 Check for success of previous call if err code printf _ mod _initintl6 failed n _ mod start Write modulo buffer with the result of the expression 1 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 i 100 i gt 0 i _ mod setintl16 M0 i 1 _ mod stop Points to Remember As you use modulo buffer intrinsic functions keep these points in mind 1 You must align modulo buffers properly per the constraints that the M56800E User s Manual explains There is no run time validation of alignment Using the modulo buffer API on unaligned buffers will cause erratic unpredictable behavior during data accesses 2 Calling mod start to write to the modulo control register effectively changes the hardware s global address generation state This change of state Targeting MC56F83xx DSP5685x Controllers 277 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions affects all user function calls run time supporting function calls standard library calls and interrupts 3 You must account for any side effects of enabling modulo addressing Such a side effect is that RO and Rlupdate in a modulo way 4 If you need just one modulo pointer is required use the RO address register Enabling th
36. 223 Targeting MC56F83xx DSP5685x Controllers 7 For More Information www freescale com Freescale Semiconductor Inc Table of Contents 10 Profiler 225 11 Inline Assembly Language and Intrinsics 227 Inline Assembly Language 1 ee ee ee 227 Inline Assembly Overview 2 2 2 ee 228 Assembly Language Quick Guide 2 2 2 2 229 Calling Assembly Language Functions from C Code 230 Calling Functions from Assembly Language 232 Intrinsic Functions 2 ee 233 Implementation 0 6 a fj eh a oe ee eK A ZOO Fractional Arithmetic 2 2 ee ee ee ee 234 Intrinsic Functions for Math Support 2 2 2 2 2 235 ADSS ta aoe A a lee at eta Za negate on oe Swe hE ee A A a 22387 LBS AA be Ee a We Ob Chet ah ae a Le LON EME oe cy Sete Ge ee a Ce le ow we Ate ete e ee DIS AMCs ae AS oy A rs at Bo Gg ESS ee GS 289 SUD its Me ae ORC eee ar Ho oe ed ek we A ee ot DAO Laddi on 20 4044 0 2 bite ae AAP EM bok ae a he oh we ZA LESUDA Gy atest a a ts da Gl we ge ee ea SlOP inet Bites Se eee HS Eee ee oy oO Go Gate a eee Be EAD Walle dl wales 2 Roe A ea ea RR a Re E eee ZAS tum_off_conv mdg 2 2 6 243 turn off Sates ae ke te oo ow o is DAS turn_on_conv_rndg 2 244 t rn OM Sats cs oe Seer axl Be e ee ae ee Be A a Oe a er aa xtract hi 2 het eh eR BL Boe eee a A Be AS extract ss Se at Lol
37. 3030 303D 3030 303D 3030 00000010 23030 303D 0A00 4172 6520 796F 7520 7265 Are you re 00000018 6164 7920 746F 2062 6520 6120 4453 5020 jady to be a DSP 00000020 5761 7272 696F 723F DADO 303D 303D 3030 00000028 303D 3030 3030 303D 3030 303D 3030 3030 00000030 303D 3030 3030 303D 3030 303D OAOA 0041 00000038 7272 6179 203D 2000 2564 2000 DADO 2049 00000040 4E46 0020 696E 6600 494E 4600 696E 6600 Word Size E y Page y Z 2 Select type of memory Locate the Page list box at the bottom of the View Memory window Select X for X Memory 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 0x0 196 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger NOTE 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 NOTE 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 NOTE On targets that have Flash ROM you cannot edit those values in the memory window that reside in Flash memory 1 Locate a particular address in program memory To view program
38. C1 h Hinclude GPIO C2 h Hinclude GPIO C3 h Hinclude GPIO D6 h Hinclude GPIO D7 h include IRQA h include IRQB h Include shared modules which are used for whole project include PE Types h include PE Error h include PE Const h include IO Map h Application Description LED program for the 56836 EVM Pattern Count from 0 to 63 using LEDs to represent the bits of the number Pressing the IRQA button flips LED order commands that previously went to LED1 go to LED6 and so forth Pressing the IRQB button reverses the enabled disabled LED states global used as bitfield to remember currently active bits used to enable disable all LEDs long num 0 short IRQA On IRQB On simple loop makes LED changes visible to the eye void wait int voide wait int count int i for i 0 i lt count i set the given LED void setLED int void setLED int num if IRQA On Targeting MC56F83xx DSP5685x Controllers 115 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial num 7 num if IRQB On switch num case 1 GPIO CO ClrVal break case 2 GPIO C1 ClrVal break case 3 GPIO C2 ClrVal break case 4 GPIO C3 ClrVal break case 5 GPIO D6 ClrVal break case 6 GPIO D7 ClrVal break else switch num case 1 GPIO CO SetVal
39. Data xi Select the way the memory is to be visualized Data Type unsigned 32 b y Data Units 10 r Memory Visualization Single location changing over time Address Ox 00005F30 C Memory Region chaning over time coca o Targeting MC56F83xx DSP5685x Controllers 173 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Data Target Dialog Boxes Data Type The Data Type list box lets you select the type of data to be plotted Data Unit The Data Units text field lets you enter a value for number of data units to be plotted This option is only available when you select Memory Region Changing Over Time Single Location Changing Over Time The Single Location Changing Over Time option lets you graph the value of a single memory address Enter this memory address in the Address text field Memory Region Changing Over Time The Memory Region Changing Over Time options lets you graph the values of a memory region Enter the memory addresses for the region in the X Axis and Y Axis text fields Registers The Target Registers dialog box lets you graph the value of registers in real time Figure 8 4 Target Registers Dialog Box Select registers for which the data is to be visualized a H General Purpose Regis H General Purpose Registers Tr D1 lt Back Cancel Help 174 Targeting MC56F83xx DSP5685x Controllers For More Information
40. Debugging Panel sdm Settings Target Settings Panels Remote Debugging Source Trees Connection Settings MB56800E Target l Language Settings Connection 56800E Local Hardware Connection w Edit Connection C C Language Remote download path C C Preprocessor fs gt C C Warnings M56800E Assembler TF Launch remote host application l Code Generation ELF Disassembler M56800E Processor Global Optimizations JTAG Clock Speed t Linker 500 M56800E Linker Editor Custom Keywords t Debugger Debugger Settings Factory Settings Revert Import Panel Export Panel OK Cancel Apply 2 Select the Connection For example select 56800E Local Hardware Connection CCS 3 Click OK button 4 Debug the project Use either of the following options From the Metrowerks CodeWarrior window select Project gt Debug e Click the Debug button in the project window Targeting MC56F83xx DSP5685x Controllers 189 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger 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 9 7 NOTE Source code is shown only for files that are in the project f
41. For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax 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 12 14 shows examples of valid decimal integers that you can write into your linker command file Listing 12 14 Sample Decimal Integers _dec_num 9999 _decimalNumber 1234 Hexadecimal base sixteen integers are specified as Ox or OX 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 12 15 Listing 12 15 Sample Hex Integers _somenumber 0x0F21 _fudgefactorspace OXFOOD _hexonyou Oxcafe NOTE When assigning a value to a pointer variable the value is in byte units despite that in the linked map xMAP file the variable value appears in word units File Selection When defining the contents of a SECTION block specify the source files that are contributing to their sections 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 andfile3 c files th
42. For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Table 11 3 Modulo Addressing Error Codes continued Code Meaning 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_initint1e is required for pointer initialization 23 Modulo increment value exceeds modulo buffer size 24 Attempted use of R1 as a modulo pointer without initializing RO for modulo use Table 11 4 Possible Error Codes Function Possible Error Code _ mod_init 11 12 13 14 15 16 17 18 21 _ mod stop none __ mod _getint16 11 14 20 22 24 _ mod _setint16 11 14 20 22 24 _ mod start none _ mod access 11 19 20 24 __ mod_update 11 14 20 23 24 _ mod_initintl6 11 12 13 14 15 16 17 Targeting MC56F83xx DSP5685x Controllers 279 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions 280 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 12 ELF Linker 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 c
43. Interface Your Code Warrior M IDE features a Processor Expert plug in interface for rapid development of embedded applications This chapter explains Processor Expert concepts and Processor Expert additions to the CodeWarrior visual interface This chapter includes a brief tutorial exercise This chapter contains these sections e Processor Expert Overview e Processor Expert Windows Processor Expert Tutorial Processor Expert Overview The Processor Expert Interface PEI is an integrated development environment for applications based on DSP56800 E or many other embedded microcontrollers It reduces development time and cost for applications Its code makes very efficient use of microcontroller and peripheral capabilities Furthermore it helps develop code that is highly portable Features include e Embedded Beans components Each bean encapsulates a basic functionality of embedded systems such as CPU core CPU on chip peripherals and virtual devices To create an application you select modify and combine the appropriate beans The Bean Selector window lists all available beans in an expandable tree structure The Bean Selector describes each bean some descriptions are extensive The Bean Inspector window lets you modify bean properties methods events and comments e Processor Expert page This additional page for the CodeWarrior project window lists project CPUs beans and modules in a tree
44. MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface HSST_raw_read A target application uses this function to read raw data from a communication channel without any automatic conversion for endianness while communicating Prototype size_t HSST_raw_read void ptr size_t length HSST_STREAM rs Parameters ptr Specifies the pointer that points to the buffer into which data is read length Specifies the size of the buffer in bytes rs Specifies a pointer to the communication channel Returns The number of bytes of raw data read NOTE This function is useful for sending data structures e g C type structures 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 Targeting MC56F83xx DSP5685x Controllers 167 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface Prototype size_t HSST_raw_write void ptr size_t length HSST_STREAM rs Parameters ptr Specifies the pointer that points to the buffer that holds the data to write length Specifies the size of the buffer in bytes rs Specifies a pointer to the communication channel Returns The number of data elements writ
45. Not available if the project window does not include a Processor Expert page Bean Inspector Opens the Bean Inspector window which gives you access to bean properties Bean Selector Opens the Beans Selector window which you use to choose the most appropriate beans Target CPU Package Opens the Target CPU Package window which depicts the processor As you move your cursor over the pins of this picture text boxes show pin numbers and signal names Target CPU Block Diagram Opens the Target CPU Package window but portrays the processor as a large block diagram Scroll bars let you view any part of the diagram As you move your cursor over modules floating text boxes identify pin numbers and signals Error Window Opens the Error Window which shows hints warnings and error messages Resource Meter Opens the Resource Meter window which shows usage and availability of processor resources View continued 86 Target CPU Structure Opens the CPU Structure window which uses an expandible tree structure to portray the processor Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 5 1 Processor Expert Menu Selections continued Item Subitem Action Peripherals Usage Opens the Peripherals Usage Inspector window
46. Radio Buttons The Save Restore Registers dialog box has two radio buttons e Save Registers e Restore Registers The default is Save Registers Targeting MC56F83xx DSP5685x Controllers 205 For More Information www freescale com Freescale Semiconductor Inc 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 Ese 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 selected 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 butt
47. S records that the linker generates Clear Does not enable byte address sorting Targeting MC56F83xx DSP5685x Controllers This checkbox is available only if the Generate S Record File checkbox is checked 69 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 11 M56800E Linker Panel Elements continued Element Purpose Comments Generate Byte Checked Enables the linker to generate This checkbox is available only if the Length text box records that the linker generates up to 256 bytes Addresses type S3 S records in bytes Generate S Record File checkbox is checkbox Clear Does not enable byte generation checked Max Record Specifies the maximum length of type S3 S The CodeWarrior debugger handles 256 byte S records If you use different software to load your embedded application This text box should specify that software s maximum length for S records This checkbox is available only if the Generate S Record File checkbox is checked EOL Character list box Specifies the end of line character for the type S3 S record file Mac DOS or UNIX format This checkbox is available only if the Generate S Record File checkbox is checked Entry Point text box Specifies the program starting point the first function the linker uses when the program runs Text after t
48. 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 Address Generation RO 24 Volatile non SOC 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 the compiler uses R5 as a pointer it becomes a volatile register its value can be saved over called functions N 24 Volatile non SOC Targeting MC56F83xx DSP5685x Controllers 123 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Calling Conventions and Stack Frames Table 6 3 Volatile and Non Volatile Registers continued Unit Register Size Type Comments Address Generation SP 24 Volatile non SOC Unit AGU continued N3 16 Volatile non SOC M01 16 Volatile non SOC Certain registers must keep specific values for proper C execution set this register to OxFFFF Program Controller PC 21 Volatile non SOC 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 Certain registers must keep specific values for proper C execution in this register set the CM bit SR 16 Volatile non SOC LC 16 Volatile non SOC LC2 16 Volatile n
49. Syntax asm inline assembly statement inline assembly statement asm inline assembly statement The inline assembly statement is any valid assembly language statement Listing 11 3 shows how to use the asm keyword with parentheses to specify that a single statement is in assembly language Note that a semicolon must follow the close parenthesis 228 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Inline Assembly Language Listing 11 3 Alternate Single Statement Syntax asm inline assembly statement NOTE If you apply the asm keyword to one statement or a block of statements within a function you must not define local variables within any of the inline assembly statements Assembly Language Quick Guide Keep these rules in mind as you write assembly language functions 1 Each statement must be a label or a function 2 A label can be any identifier not already declared as a local variable 3 All labels must follow the syntax LocalLabel Listing 11 4 illustrates the use of labels Listing 11 4 Labels in M56800E Assembly xl add x0 yl a x2 add x0 yl a x3 add x0 y1 a ERROR MISSING COLON 4 All instructions must follow the syntax instruction operands 5 Each statement must end with a new line Targeting MC56F83xx DSP5685x Controllers 229 For More Information
50. Target Library Interface 162 HSST_open 162 HSST_close 162 HSST_setvbuf 163 HSST_write 164 HSST_read 165 HSST_flush 166 HSST_size 166 HSST_raw_read 167 HSST_raw_write 167 HSST_set_log_ dir E 168 HSST Target Program Example 169 8 Data Visualization 171 Starting Data Visualization 171 Data Target Dialog Boxes 173 Memory 173 Registers 174 Variables 175 HSST ER 176 Graph Window Properties 177 9 Debugging for DSP56800E 179 Target Settings for Debugging 179 Command Converter Server ees d ees y A 180 Essential Target Settings for Command Converter Server 181 Changing the Command Converter Server Protocol to Parallel Port 181 Changing the Command Converter Server Protocol to HTI 184 Changing the Command Converter Server Protocol to PCI 184 Setting Up a Remote Connection 185 Debugging a Remote Target Board 188 6 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table of Contents Launching and Operating the Debugger 2 2 188 Setting Breakpoints and Watchpoints 2 2 2 192 Viewing and Editing Register Values 2 2 1 we a a 193 Viewing X Memory 2 2 2 2 2 2 195 Viewing P Memory 2 197 Load Save Memory 2 2 ee eee eee 200 Pull Memory 2 e a hae a ee eS ee ar Be ee ete 202 Save Restore
51. Target Setting Panels continued Target Settings Target Settings Overview Group Panel Name Use Debugger Debugger Settings Specifies settings for the CodeWarrior debugger Remote Debugging M56800E Target Debugging Remote Debug Options 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 Targeting MC56F83xx DSP5685x Controllers 45 For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview Figure 4 1 Target Settings Window sdm Settings Target Settings Panels Target Settings Target Target Name sdm Access Paths Build Extras Linker M56800E Linker y File Mappings Presinker None a Source Trees z MSES00E Target Postlinker None Language Settings Output Directory C C Language C C Preprocessor Project output C C Warnings M56800E Assembler Code Generation ELF Disassembler M56800E Processor Global Optimizations Linker M56800 E Linker Save project entries using relative paths Factory Settings Import Panel Export Panel OK Cancel The left side of the Target Settings window contains a list of target settings panels that apply to
52. a static library DSP M56800E CodeGen Options ldata largedata data space not limited to 64K Cpp_exceptions on off enable or disable C exceptions default is on dialect lang keyword specify source language E treat source as C unless its extension is lc h or pch default C treat source as C always g 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 318 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments full path store full paths to source files w arn ings keyword off on global warning options H turn off all warnings H turn on all warnings no cmdline command line parser warnings no err 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 s
53. addresses of interrupt vector fetches and target addresses of RTI instructions Subroutine Targeting MC56F83xx DSP5685x Controllers 211 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features 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 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 e Set trigger s Select this button to open the Set Trigger panel Figure 9 23 For more information on using this panel see Set Trigger Panel on page 212 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 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 9 23 lets you set triggers for all the EOnCE functions It can be accessed from the panels used to configure those functions The options available change depen
54. and r so that n 13 and r 10 for Macintosh MPW compatability msext keyword dis allow Microsoft VC extensions on enable extensions redefining macros 312 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments allowing XXX yyy syntax when declaring method yyy of class XXX H allowing extra commas ignoring casts to the same type treating function types with equivalent parameter lists but different return types as equal H allowing pointer to integer conversions H and various syntactical differences off disable extensions default on non x86 targets no multibyte aware enable multi byte character encodings for source text comments and strings once prevent header files from being processed more than once pragma define a pragma for the compiler such as pragma r equireprotos require prototypes relax pointers relax pointer type checking rules RTTI on off select run time typing information for C default is on som enable Apple s Direct to SOM implementation som_env_check enables automatic SOM environment and new allocation checking implies som stdkeywords on off allow only standard keywords default is off str ings keyword specify string constant options no reuse reuse strings equivalent strings are the same object default no pool
55. as sym full sym keyword global specify debugging options off do not generate debugging information default on turn on debugging information full path store full paths to source files w arn ings global for this tool keyword warning options off passed to all tools turn off all warnings passed to all tools turn on most warnings on Targeting MC56F83xx DSP5685x Controllers 315 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no cmdline passed to all tools command line driver parser warnings no err or passed to all tools no iserr or treat warnings as errors all turn on all warnings require prototypes no pragmas illegal pragmas no illpragmas no empty dec1 empty declarations no possible possible unwanted effects no unwanted no unusedarg unused arguments no unusedvar unused variables no unused same as w no unusedarg no unusedvar no extracomma extra commas no comma no pedantic pedantic error checking no extended no hidevirtual hidden virtual functions no hidden virtual no implicit conv implicit arithmetic conversions no notinlined inline functions not inlined no largeargs passing large arguments to unprototyped functions no structclass inconsistent use of class and struct no paddin
56. bean context menu 96 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Memory Map Window The Memory Map window Figure 5 10 depicts CPU address space and the map of internal and external memory To open this window select Processor Expert gt View gt Memory Map from the main window menu bar Figure 5 10 Memory Map Window i N Memory Map 56F8346 16bit FFFFFF FFFFOO FFFEFF 010000 OOFFFF DOFODO OOEFFF 002000 OO1FFF 001000 OOOFFF 000000 EXTERNAL EXTERNAL 1FFFFF 030000 O2FFFF 02F800 D20FFF 020000 O1FFFF 010000 DOFFFF 000000 The color key for memory blocks is e White Non usable space Dark Blue I O space e Medium Blue RAM Light Blue ROM Targeting MC56F83xx DSP5685x Controllers ol xj CODE EXTERNAL EXTERNAL 97 For More Information www freescale com Processor Expert Interface Processor Expert Windows Figure 5 11 CPU Types Overview Window CPU Types Overview 98 e Cyan FLASH memory or EEPROM e Black External memory Freescale Semiconductor Inc Pause your cursor over any block of the map to bring up a brief description CPU Types Overview The CPU Types Overview window Figure 5 11 lists supported processors in an expandable tree structure To open this window select Process
57. beans in category order in an expandable tree structure Green string bean symbols identify beans that have available licenses Grey string bean symbols identify beans that do not have available licenses The On Chip Peripherals page lists beans available for specific peripherals also in an expandable tree structure Yellow folder symbols identify peripherals fully available Light blue folder symbols identify partially used peripherals Dark blue folder symbols identify fully used peripherals Bean names are black bean template names are blue Double click a bean name to add it to your project Click the Quick Help button to add the explanation pane to the right side of the window as Figure 5 4 shows This pane describes the selected highlighted bean Use the scroll bars to read descriptions that are long Targeting MC56F83xx DSP5685x Controllers 89 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Click the two buttons at the bottom of the window to activate or deactivate filters If the all CPU filter is active the window lists only the beans for the target CPU If the license filter is active the window lists only the beans for which licenses are available Bean Inspector The Bean Inspector window Figure 5 5 lets you modify bean properties and other settings To open this window select Processor Expert gt View gt Bean Inspector from the main
58. channel starts in the blocking mode Prototype HRESULT hsst_block_mode size_t channel _id Parameters channel _ id Specifies the channel ID of the communication channel to set in blocking mode Targeting MC56F83xx DSP5685x Controllers 157 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface Returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_noblock_mode 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 Prototype HRESULT hsst_noblock mode size t channel_id Parameters channel _ id Specifies the channel ID of the communication channel to set in non blocking mode Returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_attach_listener Use this function to attach a host side client application as a listener to a 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 descriptor size_t size size_t nmemb HSST calls the Notifiable HSST Client Update function when data is available to read
59. filename then press the Enter key b The IDE opens the file in the editor window you are ready to edit file contents 34 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview This chapter describes the CodeWarrior IDE and explains application development using the IDE This chapter contains these sections e CodeWarrior IDE e Development Process If you are an experienced Code Warrior IDE user you will recognize the look and feel of the user interface However you must become familiar with the DSP56800E runtime software environment CodeWarrior IDE The Code Warrior IDE lets you create software applications It controls the project manager the source code editor the class browser the compiler linker and the debugger You use the project manager to organize all the files and settings related to your project You can see your project at a glance and easily navigate among 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
60. 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 200 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Load Save Memory NOTE By default the History combo box displays the most recent settings on subsequent viewings Radio Buttons The Load Save Memory dialog box has two radio buttons 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 P Memory Program Memory 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 ox 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 ox 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 sa
61. flow merge points SP is modified consistently along all paths from the beginning to the end of the function and is properly aligned Listing 6 2 Example 2 Illegal Modification of SP using Inline Assembly define EnterCritical asm adda 2 SP asm move l1 SR X SP asm bfset 0x0300 SR asm nop asm nop define ExitCritical asm deca 1 SP asm move l x SP SR 128 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E User Stack Allocation asm nop asm nop pragma check_inline sp effects on int func int a 1 b 1 c if a EnterCritical c a b else ExitCritical c D return b c This example will generate the following warning because the SP entering the ExitCritical macro is different depending on which branch is taken in the if Therefore accesses to variables a b or c may not be correct Warning Inconsistent inline assembly modification of SP in this function M56800E main c line 29 ExitCritical Listing 6 3 Example 3 Modification of SP by a Run time Dependent Amount define EnterCritical asm adda RO SP asm move l SR X SP asm bfset 0x0300 SR asm nop asm nop define ExitCritical asm deca 1 SP asm move 1 X SP SR asm nop Targeting MC56F83xx DSP5685x Controll
62. for DSP56800E Using the Command Window 2 Choose File gt Open and specify the file to load in the standard dialog box that appears Alternatively you can drag and drop a elf file onto the IDE 3 You may have to add additional access paths in the Access Path preference panel in order to see all of the source code 4 Choose Project gt Debug to begin debugging the application NOTE When you debug a elf 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 elf 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 el file is 56800E Default Project xml which is in the directory located in the path CodeWarrior bin plugins support You can create your own version of this file to use as a default setting when opening a elf file 1 Create a new project with the default setting you want 2 Export the project to xml format 3 Rename the xml format of the project to 56800E_Default_Project xml and place it in the support directory NOTE Back up or rename the original version of the default xml project before overwriting it with your own customized version Using the Command Window In addition to using the regular CodeWarrior IDE debugger windows you als
63. generates a different value for the case where the input 0x0000 Prototype Word16 norm_s Word16 ssrc Example short sl 0x2000 25 short result result norm_s s1 Expected value of result 1 ffs_l 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 NOTE Does not actually normalize the value Also see the intrinsic norm_1 which handles the case where the input 0x00000000 differently Prototype Word16 ffs 1 Word32 lsrc Targeting MC56F83xx DSP5685x Controllers 257 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example long 11 0x20000000 25 short result result ffs_1 11 Expected value of result 1 norm_l 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 NOTE 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 0x00000000 Prototype Word16 norm_1 Word32 1src Example long 11 0x20000000 25 short result result norm 1 11
64. global cased preprocess and send output to precompile file di preprocess prefix file S no stdinc file do not generate code generate precompiled header from source write HOH OH OH OH 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 U u ndefine name H source files global cased passed to all tools disassemble and send output to file global use standard system include paths specified by the environment variable SMWCIncludes added after all system I paths default cased undefine symbol name ansi keyword off on relaxed strict ARM on off 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 Targeting MC56F83xx DSP5685x Controllers 311 For More Information www freescale c
65. have a version of the Code Warrior IDE installed on your computer the Code Warrior installer adds the new files needed for building versions of MSL for DSP56800E The project directory for the DSP56800E MSL is Targeting MC56F83xx DSP5685x Controllers 321 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800E CodeWarrior M56800E Support msl1 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 msl1 MSL_C DSP_56800E ine 322 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 project 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 Referen
66. if necessary Generates a 32 bit result Assumptions OMR s SA bit was set to at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L_msu Word32 laccum Word16 sinpl Wordl16 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 Multiply two 16 bit fractional values generating a signed 32 bit fractional result Saturates only for the case of 0x8000 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 Word16 sinp1 Word16 sinp2 254 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short sl 0x2000 0 25 short s2 0x2000 0 25 long result result L mult s1 s2 Expected value of result 0 0625 0x08000000 L_mult_ls 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_1ls Word32 linp1 Word1 sinp2 Example long 11 0x
67. 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 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 Prototype HRESULT hsst_set_log dir size t cid const char log directory Parameters cid Specifies the channel ID of the communication channel from which to log data log directory Specifies the path to the directory in which to store temporary log files Returns S_OK if the call succeeds or S_ FALSE if the call fails HSST Host Program Example In Listing 7 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface NOTE Before launching the program the IDE plugin needs to be created and placed in the folder CodeWarrior bin Plugins Com Listing 7 1 Sample HSST Host Program include CodeWarriorCommands h include HSSTInterface h include lt cstdio gt inc
68. 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 NOTE If you use the phase locked loop PLL to change the system speed and you are using software or automatic breakpoints you will need to Targeting MC56F83xx DSP5685x Controllers 219 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Debugging in the Flash Memory enable the alternate flash download sequence as described by the target_code_sets_hfmclkd command in the following section Flash Memory Commands The following is a list of flash memory commands that can be included in your initialization file For more information on flash memory commmands and initialization of the flash see M56800E Target Debugging 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 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
69. lvarl Example long result 1 0xE0000000 0 25 result L negate s1 Expected value of result 0x20000000 0 25 Addition Subtraction The intrinsic functions of the addition subtraction group are e add e sub e L add e L sub add Addition of two 16 bit integer or fractional values returning a 16 bit result Assumptions OMR s SA bit was set to at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 add Word16 src_dst Wordl1l6 src2 Targeting MC56F83xx DSP5685x Controllers 239 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short sl 0x4000 0 5 short s2 0x2000 0 25 short result result add sl1 s2 Expected value of result 0x6000 0 75 sub 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 Wordl1 src2 Example short sl 0x4000 0 5 short s2 OxE000 0 25 short result result sub s1 s2 Expected value of result 0x6000 0 75 240 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions
70. one should declare the following 138 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Code and Data Storage long _ attribute packed aligned 2 lg packed long char attribute packed aligned 2 in packed pointer to char char attribute packed aligned 2 pin pointer to packed pointer to char char attribute packed aligned 2 attribute packed aligned 2 ppin packed pointer to packed pointer to char struct _ attribute packed aligned 2 STag _ attribute propagated to member level char c offset 0 long 1 offset 2 char cl offset 6 char pc assume LMM offset 8 J The compiler will issue an error if packed data is accessed by regular pointers For example long _ attribute _ packed aligned 2 11 long pl 11 results in error illegal implicit conversion Code and Data Storage The DSP56800E processor has a dual Harvard architecture with separate CODE P memory and DATA X memory memory spaces Table 6 4 shows the sizes and ranges of these spaces as well as the range of character data within X memory for both the small and large memory models You may need to use the ELF Linker and Command Language or M56800E Linker settings panel to specify how the project defined sections map to real memory Targeting MC56F83xx DSP5685x Controllers 139
71. output file Linker list box Specifies the linker Select M56800E Linker Pre linker list Specifies a pre linker Select None box No pre linker is available for the M56800E linker Post linker list Specifies a post linker Select None box No post linker is available for the M56800E linker Targeting MC56F83xx DSP5685x Controllers 49 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 3 Target Settings Panel Elements continued Element Purpose Comments Output Directory Tells the IDE where to save the executable Default the directory that contains text box file To specify a different output directory the project file click the Choose button then use the access path dialog box to specify a directory To delete such an alternate directory click the Clear button Save Project Controls whether multiple project files can Default Clear project entries must Entries Using have the same name have unique names Relative Paths e Clear Each project entry must checkbox have a unique name e Checked The IDE uses relative paths to save project entries entry names need not be unique M56800E Target Use the M56800E Target panel Figure 4 3 to specify the project type and the name of the output file Table 4 4 explains the elements of this panel Figure 4 3 M56800E Targe
72. point aligned on 16 bytes file c data 284 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Arithmetic Operations Standard C arithmetic and logical operations may be used to define and use symbols in the linker command file Table 12 1 shows the order of precedence for each operator All operators are left associative Table 12 1 Arithmetic Operators Precedence Operators highest 1 7 2 amp 3 nee 4 gt lt lt 5 gt lt lt gt 6 amp 7 8 amp amp 9 I operator performs division and rounding Comments Comments may be added by using the pound character or C style double slashes C style comments are not accepted by the LCF parser Listing 12 8 shows examples of valid comments Listing 12 8 Sample Comments This is a one line comment text This is a partial line comment Targeting MC56F83xx DSP5685x Controllers 285 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax 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
73. s manual of the particular processor that you are using NOTE 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 hfm_base which is where the flash control registers are mapped in X memory 220 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Debugging in the Flash Memory NOTE 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 address 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 page Size gt lt progMem gt lt boot gt lt interleaved gt This command adds a flash unit to the list and sets its parameters NOTE 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_erase_mode units pages all Th
74. set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 L shlfts Word32 lval2shft Word16 s shftamount Example long result 1 0x12345678 short sl 3 result shlfts 1 s1 Expected value of result 0x91A259E0 L_shr 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 NOTE 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 Targeting MC56F83xx DSP5685x Controllers 267 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions 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_shr Word32 lval2shft Word16 s shftamount Example long result 1 0x24680000 short s2 1 result L _shrtNs 1 82 Expected value of result 0x12340000 L_shr_r 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 ro
75. speed simultaneous transfer 153 170 host program example HSST 160 162 host side API hsst functions 153 160 HSST 153 170 host side API functions 153 160 target library API functions 162 169 visualization 171 HSST functions hsst_attach_listener 158 159 hsst_block_mode 157 158 HSST_close 162 163 hsst_close 154 hsst_detach_listener 159 HSST_flush 166 hsst_noblock_mode 158 HSST_open 162 hsst_open 153 HSST_raw_read 167 HSST_raw_write 167 168 HSST_read 165 hsst_read 155 HSST_set_log_dir 168 169 hsst_set_log_dir 160 HSST_setvbuf 163 164 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc HSST_size 166 hsst_size 157 HSST_write 164 165 hsst_write 156 HSST host program example 160 162 HSST target program example 169 170 hsst_attach_listener function 158 159 hsst_block_mode function 157 158 HSST_close function 162 163 hsst_close function 154 hsst_detach_listener function 159 HSST_flush function 166 hsst_noblock_mode function 158 HSST_open function 162 hsst_open function 153 HSST_raw_read function 167 HSST_raw_write function 167 168 HSST_read function 165 hsst_read function 155 HSST_set_log_dir function 168 169 hsst_set_log_dir function 160 HSST_setvbuf function 163 164 HSST_size function 166 hsst_size function 157 HSST_write function 164 165 hsst_write function 156 I IDE Code Warrior 13 14 35 36 IDE installing 23 IDE installing and regis
76. the main window menu bar select Project gt Make The IDE compiles and links your project generating executable code Debug your project as you would any other CodeWarrior project Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial This completes the Processor Expert tutorial exercise Downloading this code to a DSP56836E development board should make the board LEDs flash in a distinctive pattern Listing 5 1 File Events c k k ES Filename Events C Project LEDcontrol Processor DSP56F836 Beantype Events Version Driver 01 00 Compiler Metrowerks DSP C Compiler Date Time 3 24 2003 1 18 PM Abstract This is user s event module Put your event handler code here Settings Contents IRQB OnInterrupt void IRQB OnInterrupt void IRQA OnInterrupt void IRQA OnInterrupt void c Copyright UNIS spol s r o 1997 2002 UNIS spol s r o Jundrovska 33 624 00 Brno Czech Republic a http www processorexpert com mail info processorexpert com Targeting MC56F83xx DSP5685x Controllers 111 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial k k
77. the resulting action caused by the trigger Halt core Stops the processor Targeting MC56F83xx DSP5685x Controllers 207 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features 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 9 20 1 From the menu bar select DSP56800E gt Special Counter This panel is non modal and will update itself whenever the processor stops Figure 9 20 EOnCE Special Counter Panel xi Use 16 bit y counter to count peik clock cycles y Note Using the 40 bit counter will disable stepping in the debugger Set trigger s Perform action Halt core y On condition counter reaches zero before stop trigger occurs y Courter vals Set Close 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 NOTE Using the 40 bit counter will disable stepping in the debugger 208 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features e Counter function This pull down list allows you to choose which counting function to use e Set trigger s Pus
78. 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 NOTE To use HSST you must launch the target side application through the debugger Host Side Client Interface This section describes the API calls for using High Speed Simultaneous Transfer ASST from your host side client application At the end of this section an example of a HSST host side program is given Listing 7 1 on page 161 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 Targeting MC56F83xx DSP5685x Controllers 153 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface Prototype HRESULT hsst_open const char channel name size_t cid Parameters channel name Specifies the communication channel name cid Specifies the channel ID associated with the communication channel Returns S_OK if the call succeeds or S_ FALSE if the call fails
79. use of byte accesses is due to a compiler optimization that tries to generate the smallest possible memory access 148 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Working with Peripheral Module Registers Recommended Programming Style The use of a union of a member that can hold the whole register the Word member above and a struct that can access the bits of the register the Bits member above is a good idea What is recommended is to read the whole memory mapped register using the Word union member into a local instance of the union do the bit manipulation on the local and then write the result as a whole word in to the memory mapped register So the C code would look something like define word int union SCICR_union word Word struct word SBK 1 word RWU 1 word RE 1 word TE 1 word REIE 1 word RFIE 1 word TIIE 1 word TEIE 1 word PT 1 word PE 1 word POL 1 word WAKE 1 word M zl word RSRC 1 word SWAI 1 word LOOP 1 Bits SCICR Code union SCICR_union localSCICR localSCICR Word SCICR Word generated codes P 00000083 F0 7C022C move w X HSCICR A P 00000085 907F move w Al X SP 1 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com 149 Freescale Semiconductor Inc C for DSP56800E Generating MAC Instruction Set localSCICR Bit
80. ween CET fu CIA e Te en oe Figure 9 13 View P Memory Disassembly Window M56800E elf Memory 1 2 8 x Display 0x1 000 View Disassembly y P 00001000 YO A P 00001001 4440FFFF add w H1 A P 00001003 907A move A1 X SD 6 P 00001004 46COFFFF add w 1 YO P 00001006 8F05 tst w Yo P 00001007 A402 bye float2str O0x2b9 0x100a P 00001008 DF4BFFFA clr w X SP 6 P 0000100A SAB4FFDC adda 36 SP RO P 0000100C B020 move w X R0 4 P 0000100D 487A cmp w X SP 6 A P 0000100E A421 bye loat2str 0x2df 0x1030 P 0000100F SABGFFES adda 24 SP R2 P 00001011 B17A move w X SP 6 B Line 1 e Source Figure 9 14 198 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger Figure 9 14 View P Memory Source Window lolx Display 0 1 000 View Source v E Source C Program Files Metrowerks CodeWarrior_ 56900E_1 1 M56800E Suppor 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 i round _decimal dec dec sig length frac_digits Line 1350 Col3 4 e Mixed Figure 9 15 Figure 9 15 View P Memory Mixed Window ioli Display Joxt 000 View Mixed E Source C Program FilestMetrowerksiCodewWarrio
81. window menu bar Figure 5 5 Bean Inspector Window 90 Bean Inspector 4M1 AsynchroMaster Oo xj Bean Items Visibility Help roperties Methods Events Comment Bean name AM1 sco Channel Ssclo Interrupt se Enable Interrupt Interrupt Ax T_SCIO INT_SCIO_RxFull Interrupt Ax mediun gt 1 INT_SCIO_TxEmpty Interrupt Tx mediun gt 1 Interrupt Err INT_SCIO INT_SCIO_RxError Interrupt Err mediun gt 1 Interrupt Idhi NT_SC O Interrupt Idh mediun Input buffer 0 INT_SCIO_TxIdle Output buf O P Y v E v Y Y Interrupt Tx INT_SCIO v Y Y Y Y Y v H Settings Parity wake up Width 9 bits hardware wake up 9 bits Stop bit 1 X Y v Y Mode Normal 1 Fl Receiver Nicahle BASIC ADVANCED EXPERT This window shows information about the currently selected bean that is the highlighted bean name in the project window Processor Expert page The title of the Bean Inspector window includes the bean name The Bean Inspector consists of Properties Methods Events and Comment pages The first three pages have these columns Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface
82. 1 test e the compiler will signal an error when an implicit conversion between a pointer to data in data memory and a pointer to data in program memory is attempted For example using the previous definitions the compiler gives an error for this assignment 134 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Variables in Program Memory pxpl ppx1 Explicit conversions are allowed but they should be used with care An explicit conversion for the previous assignment that is accepted by the compiler is given below pxpl __pmem int ppxl Another consequence of this restriction is that an important part of the MSL functions that have at least an argument that is a pointer will not work with variables in program memory For example char c1 pointer in data memory to char in data memory char _ pmem c2 pointer in data memory to char in program memory streat cl c2 error the second argument can t be converted to const char If variable argument lists are used this problem is generally hidden The program is compiled with no errors from the compiler but it doesn t work as expected The most common example is the printf function char cl xmem pointer in data memory to char in data memory char _ pmem c2 pmem pointer in data memory to char in program memory printf s
83. 1 channel_ 2 int written_items 0 int read_items 0 for i 0 i lt buf size i test_buffer i i Targeting MC56F83xx DSP5685x Controllers 169 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface Opening 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 7 1 Restart HSST 138 Metrowerks CodeWarrior File Edit View Search Project Debug Data EOnCE Trace Buffer Window Help B Ss i Ky as By A A A MN NES amp Restart HSST Client ain SST_Target_1 NOTE For an HSST example see the HSST example in this path CodeWarrior path CodeWarrior Examples DSP56800E hsst_client to client 170 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Data Visualization Data visualization lets you graph variables registers regions of memory and HSST data streams as they change over time The Data Visualization tools can plot memory data register data global variable data and HSST data e Starting Data Visualization e
84. 2 1 CodeWarrior Registration Window EDI CodeWarrior Development Studio There are 15 days until the current license expires You must register your product to receive your permanent license keys If you have a registration card with your product please register by pressing the Register Now button below otherwise you can continue to use CodeWarrior Development Studio until it expires by pressing the Register Later button Contact license metrowerks com if you have any questions Register Later Buy Now NOTE To evaluate this product before purchasing it click Register Later and skip to Step 4 b Click Register Now the Metrowerks registration web page appears in the web browser window Targeting MC56F83xx DSP5685x Controllers 21 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE Figure 2 2 Metrowerks Registration Web Page 22 Metrowerks Registration and Licensing System Enter your registration code Mic ternet Ex joj x k d ode Microsoft Internet E a File Edit View Favorites Tools Help a Jer E gt x 2 search Peravortes Amei ED 62 AA Address http www metrowerks com mwjregister J Links gt here metrowerks About Metrowerks ContactUs Search MMM CO home products services buy downloads support Registration and Licensing System This online registrati e
85. 20000000 0 25 short s2 0x2000 0 25 long result result L mult 11 52 Expected value of result 0 625 0x08000000 Targeting MC56F83xx DSP5685x Controllers 255 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Normalization The intrinsic functions of the normalization group are e ffs_s e norm s e ffs_l e norm l ffs_s Computes the number of left shifts required to normalize a 16 bit value returning a 16 bit result finds Ist sign bit Returns a shift count of 31 for an input of 0x0000 NOTE Does not actually normalize the value Also see the intrinsic norm_s which handles the case where the input 0x0000 differently Prototype Word16 ffs s Wordl6 ssrc Example short sl 0x2000 25 short result result f s s s1 Expected value of result 1 norm_s 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 256 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions NOTE 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
86. 32 bit value Prototype Word32 L deposit _h Word16 ssrc Example short sl Ox3FFF long result result L deposit _h s1 j Expected value of result 0x3f ff0000 L_deposit_l Deposits 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 246 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short sl Ox7FFF long result result L deposit _1 s1 j Expected value of result 0x00007FFF Division The intrinsic functions of the division group are e div_s e div_s4q e div_Is e div_ls4q div_s Single quadrant division that is both operands are of positive 16 bit fractional values returning a 16 bit result If both operands are equal returns Ox7FFF occurs naturally NOTE Does not check for division overflow or division by zero Prototype Word16 div _s Word16 s numerator Word16 s denominator Targeting MC56F83xx DSP5685x Controllers 247 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short s1 0x2000 0 25 short s2 0x4000 0 5 short result result div_s sl s2 Expected value of result 0 25 0 5 0 5 0x4000
87. 323 MC56F8345 MC56F8346 MC56F8356 and MC56F8357 Next Page Finish Page 355 Freescale Semiconductor Inc DSP56800x New Project Wizard Overview Resulting Target Rules The rules governing possible final project configurations are shown in Table B 6 Table B 6 Resulting Target Rules Target Possible Targets 56800 Simulator Target with Non HostlO Library and Target with Host IO Library 56800E Simulator Small Data Model and Large Data Model DSP5680x External Memory and or Internal Memory with pROM to xRAM Copy DSP5682x External Memory and or Internal Memory with pROM to xRAM Copy DSP5685x Small Data Model and Small Data Model with HSST or Large Data Model and Large Data Model with HSST MC56F831 xx Small Data Model and Small Data Model with HSST or Large Data Model and Large Data Model with HSST MC56F832x Small Data Model or Large Data Model MC56F834x Small Data Memory External and or Small Data Memory Internal with PROM to xRAM Copy or Large Data Memory External and or Large Data Memory Internal with pROM to xRAM Copy Rule Notes Additional notes for the DSP36800x New Project Wizard rules are e The DSP56800x New Project Wizard uses the DSP56800x EABI Stationery for all projects Anything that is in the DSP56800x EABI Stationery will be in the wizard created projects depending on the wizard choices e The DSP56800x EABI Stationery has all possible targets streamlin
88. 4 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions NOTE 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 Prototype Word16 shrtNs Word16 sval2shft Word16 s shftamount Example short result short sl 0x2468 short s2 1 result shrtNs s1 s2 Expected value of result 0x1234 L_shl 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_shlftNs or L
89. 5 Registers peripheral module 146 remote debug options panel 77 79 remote debugging panel 72 73 requirements system 19 resource meter window 99 Restoring Target Settings 47 round intrinsic function 259 Targeting MC56F83xx DSP5685x Controllers runtime code 321 348 runtime initialization 325 328 S save restore registers dialog box 204 206 Saving new target settings stationery files 47 SECTIONS linker keyword 300 302 set hardware breakpoint EOnCE panel 207 208 set trigger EOnCE panel 212 214 set_hflkd flash debugger command 220 set_hfm_base flash debugger command 220 set_hfm_config_base flash debugger command 221 set_hfm_erase_mode flash debugger command 221 set_hfm_verify_erase flash debugger command 222 set_hfm_verify_program flash debugger command 222 settings panels 48 79 Access Paths 48 Build Extras 48 C C language 51 C C warnings 56 59 Custom Keywords 48 Debugger Settings 48 ELF disassembler 65 67 File Mappings 48 Global Optimizations 48 MS56800E assembler 60 62 MS6800E linker 67 71 M56800E processor 62 M56800E target 50 51 M56800E target debugging 73 77 remote debug options 77 79 remote debugging 72 73 Source Trees 48 target settings 49 50 settings target 43 79 shl intrinsic function 260 261 shlftNs intrinsic function 261 262 shlfts intrinsic function 262 263 shr intrinsic function 263 shr_r intrinsic function 264 shrtNs intrinsic function 264 265 simulator 214 simultaneous tra
90. 685x Controllers 363 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Figure B 8 DSP56800x New Project Wizard Program Choice x Select the example main program for this project Program Simple G Simple Mixed Assembly and C Simple Assembly C Blank lt Back Cancel When you click Next the Wizard jumps to the appropriate page determined by the Page Rules on page 353 364 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Data Memory Model Page If you select a DSP56800E processor 56F83xx or 5685x family then the Data Memory Model page appears Figure B 9 and you must select either the Small Data Model SDM or Large Data Model LDM Figure B 9 DSP56800x New Project Wizard 56800E Data Memory Model Page DSP56800x New Project Wizard 56800E Data Memory x Select the data memory model for this 56800E project Memory Large Data Model LDM lt Back Cancel When you click Next the Wizard jumps to the appropriate page determined by the Page Rules on page 353 Targeting MC56F83xx DSP5685x Controllers 365 For More Information www freescale com Freescale Semiconductor Inc DSP56800x
91. 6F8345 MC56F8346 MC56F8356 MC568357 MC568365 MC568366 351 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard Overview Table B 1 Supported DSP56800x Processors for the New Project Wizard DSP56800 DSP56800E MC568367 MC56F8122 MC56F8123 MC56F8145 MC56F8146 MC56F8147 MC56F8155 MC56F8156 MC56F8157 MC56F8165 MC56F8166 MC56F8167 Wizard rules for the DSP56800x New Project Wizard are described in the following sub sections e Page Rules e Resulting Target Rules Rule Notes Click on the following link for details about the DSP56800x New Project Wizard Graphical User Interface DSP56800x New Project Wizard Graphical User Interface 352 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Page Rules The page rules governing the wizard page flow for the simulator and the different DSP56800x New Project Wizard processors are shown in the Table B 2 Table B 3 Table B 4 and Table B 5 Table B 2 Page Rules for the Simulator DSP56F801 60 and 80 MHz and DSP56F802 Target Selection Page any simulator Next Page DSP56F801 60 MHz DSP56F801 80 MHz DSP56F802 Next Page Program Choice Page Finish Page Overview Table B 3 Page Rules for the DSP56F803 DSP56F805 DSP56F807 DSP56F826 and DSP56F827 Tar
92. A AND ANT 11 Quad_DecOf Quac e A ecel e TMRAO TMRBO H TMF i A ER ee APPO A NAAA BRASA LAA eee TMRAL TMRB1 TMRC1 TMF e e AE RAS AAA RRA Arana anna Other control buttons at the left edge of the window let you e Show bean icons attached to processor pins e Rotate the CPU picture clockwise 90 degrees e Toggle default and user defined names of pins and peripherals Print the CPU picture Targeting MC56F83xx DSP5685x Controllers 95 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows NOTE As you move your cursor over bean icons peripherals and modules text boxes or floating hints show information such as names descriptions and the allocating beans And note these additional mouse control actions for the Target CPU window e Clicking a bean icon selects the bean in the project window s Processor Expert page e Double clicking a bean icon open the Bean Inspector displaying information for that bean e Right clicking a bean icon a pin or a peripheral opens the corresponding context menu e Double clicking an ellipsis bean icon opens a context menu of all beans using parts of the peripheral Selecting one bean from this menu opens the Bean Inspector e Right clicking an ellipsis bean icon opens a context menu of all beans using parts of the peripheral Selecting one bean from this menu opens the
93. A interrupt procedure body here END Events AAA kk This file was created by UNIS Processor Expert 03 15 for the Freescale DSP56x series of microcontrollers k AO Targeting MC56F83xx DSP5685x Controllers 113 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial Listing 5 2 File LEDcontrol c HAAR HEE HEH HH HH HH HH HH HH HHH HHH Filename LEDcontrol C Project LEDcontrol Processor DSP56F836 Version Driver 01 00 Compiler Metrowerks DSP C Compiler Date Time 3 24 2003 1 18 PM Abstract Main module Here is to be placed user s code Settings Contents No public methods c Copyright UNIS spol s r o 1997 2002 UNIS spol s r o Jundrovska 33 624 00 Brno Czech Republic http WWW processorexpert com mail info processorexpert com HATA HEE HEH HH HH HH HE HEHE HEHE PEHE HEHE PEHE PEHE HH HHH FFAA MODULE LEDcontrol Including used modules for compilling procedure include Cpu h include Events h 114 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial include GPIO CO h Hinclude GPIO
94. AAA MODULE Events Including used modules for compilling procedure include Cpu h include Events h include GPIO CO h include GPIO C1 h include GPIO C2 h include GPIO C3 h include GPIO D6 h include GPIO D7 h include IRQA h include IRQB h Include shared modules which are used for whole project include PE Types h include PE Error h include PE Const h include IO Map h A A Be a E A E Event IRQB OnInterrupt module Events k k From bean IRQB ExtInt k Description This event is called when the active signal edge level EY occurs ER Parameters None Returns Nothing A E E E pragma interrupt called extern short IRQB On void IRQB OnInterrupt void IRQB On 1 place your IRQB interrupt procedure body here 112 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial kk ee Event IRQA OnInterrupt module Events From bean IROA ExtInt Description This event is called when the active signal edge level EX occurs A Parameters None Returns Nothing A A o et A AA pragma interrupt called extern short IRQA On void IRQA OnInterrupt void IRQA On 1 place your IRQ
95. C56F81 xx DSP56F803 MCS56FS3xx DSP56F805 Simulators DSP56F807 Back Cancel Targeting MC56F83xx DSP5685x Controllers 359 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Figure B 4 DSP56800x New Project Wizard Target Dialog Box DSP56F82x DSP56800x New Project Wizard Target x Select family and then processor for this project DSP56800x Family DSPS56F80 DSPS56F 82 DSP5685x MC56F81 xx MCSEFS3xx Simulators Processor DSP56F826 DSP56F827 Back Cancel 360 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Figure B 5 DSP56800x New Project Wizard Target Dialog Box DSP5685x x Select family and then processor for this project Processor DSP56852 DSP56853 DSP56854 DSP56855 DSP56857 DSP56858 DSP56800 Family DSP56F80x DSP56F82x MC5EFET xx MC56F83xx Simulators Cancel Targeting MC56F83xx DSP5685x Controllers 361 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Figure B 6 DSP56800x New Project Wizard Target Dialog Box MC56F83x DSP56800x New Project Wizard T
96. Clear Compiler does not select functions __option auto_inline command for inlining Bottom up Checked For a chain of function calls To check whether bottom up inlining Inlining the compiler begins inlining with the last is in effect use the checkbox function option inline_bottom_up Clear Compiler does not do bottom up command inlining ANSI Strict Checked Disables CodeWarrior compiler Extensions are C style comments checkbox extensions to C unnamed arguments in function Clear Permits CodeWarrior compiler definitions not and argument in extensions to C macros identifier after endif typecasted pointers as Ivalues converting pointers to same size types arrays of zero length in structures and the D constant suffix To check whether ANSI strictness is in effect use the __option ANSI_strict command 52 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 5 C C Language C Only Panel Elements continued Element Purpose Comments ANSI Keywords Checked Does not permit additional Additional keywords are asm use the characters per strict ANSI ISO standards Only checkbox keywords of CodeWarrior C compiler built in assembler and Clear Does permit additional keywords inline lets you declare a C function to be inline To che
97. Data Target Dialog Boxes e Graph Window Properties Starting Data Visualization To start the Data Visualization tool 1 Start a debug session 2 Select Data Visualization gt Configurator The Data Types window Figure 8 1 appears Select a data target type and click the Next button Targeting MC56F83xx DSP5685x Controllers 171 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Starting Data Visualization Figure 8 1 Data Types Window Select a target data type for which the data is to be visualized Types it a Registers abe Variables a HSST coca Heb 3 Configure the data target dialog box and filter dialog box 4 Run your program to display the data Figure 8 2 Figure 8 2 Graph Window lel ES short DataQut 10 te xX amp Value 4 45 5 55 6 65 7 75 8 85 9 Time 15 2 ZO dr 35 0 05 1 Targeting MC56F83xx DSP5685x Controllers 172 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Data Target Dialog Boxes Data Target Dialog Boxes There are four possible data targets Each target has its own configuration dialog e Memory e Registers e Variables e HSST Memory The Target Memory dialog box lets you graph memory contents in real time Figure 8 3 Target Memory Dialog Box Target Memory
98. E uses an optional hardware initialization file before downloading code Clear IDE does not use a hardware initialization file The Use initialization file text box specifies the file Text immediately after this table gives more information about initialization files Use initialization Specifies the initialization file Applicable only if the Use initialization file text box file checkbox is checked BreakpointMode Specifies the breakpoint mode Software breakpoints contain debug checkbox Automatic CodeWarrior instructions that the debugger writes software determines when to use into your code You cannot set such software or hardware breakpoints breakpoints in flash as it is read only e Software CodeWarrior software Hardware breakpoints use the on always uses software breakpoints chip debugging capabilities of the e Hardware CodeWarrior software DSP56800E The number of ae always uses the available available hardware breakpoints limits hardware breakpoints these capabilities Note Breakpoint Mode only effects HW targets Auto clear Checked Automatically clears the previous previous harware breakpoint hardware Clear Does not Automatically clears the breakpoint previous harware breakpoint Target OS list box Specifies the OS Selects the OS plug in The BareBoard option does not use an OS plug in Processor list box Specifies the processor Currently this s
99. Emit pragmas Controls whether pragmas encountered in the source text appear in the preprocessor output This option is essential for producing reproducible test cases for bug reports Show full paths Controls whether file changes show the full path or the base filename of the file Keep comments Controls whether comments are emitted in the output Use line Controls whether file changes appear in comments as before or in line directives 56 Keep whitespace Controls whether whitespace is stripped out or copied into the output C C Warnings Use the C C Warnings panel Figure 4 6 to specify C language features for the DSP56800E Table 4 7 explains the elements of this panel NOTE This is useful for keeping the starting column aligned with the original source though we attempt to preserve space within the line This doesn t apply when macros are expanded The Code Warrior compiler for DSP56800E does not support C Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Figure 4 6 C C Warnings Panel C C Warnings Diagnostics Enable All Disable All V Illegal Pragmas Portability V Possible Errors V Extra Commas V Extended Error Checking V Inconsistent class struct Usage Hidden Virtual Functions V Empty Declara
100. FF LENGTH 0x0000 X RAM RW ORIGIN 0x0001 LENGTH OX7FFE SDM xRAM limit is Ox7FFF SECTIONS application code text sections text rtlib text fp engine text user text data pmem program memory initalizeddata const data pmem program memory constant data bss pmem program memory uninitialized data gt p RAM data data sections 136 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Variables in Program Memory const data char used if Emit Separate Char Data Section enabled const data fp _state data rtlib data data char Section enabled data bss sections rtlib bss lo used if Emit Separate Char Data rtlib bss ALIGN 1 _START BSS bss char used if Emit Separate Char Data Section enabled bss _END BSS setup the heap address ALIGN 4 _HEAP ADDR _HEAP SIZE 0x100 HEAP END HEAP ADDR HEAP SIZE HEAP END setup the stack address _min_stack_size 0x200 _stack_addr _HEAP END _stack_end _stack_addr min _stack_size _stack_end export heap and stack runtime to libraries F_heap_addr _HEAP ADDR F_heap_end _HEAP END F_Lstack_addr _HEAP END F_start_bss _START_ BSS F end bss END BSS gt x_RAM Targeting MC56F83xx DSP5685x Control
101. Figure 9 26 Register Details Window x Description File Browse Register Name Format D efauit y 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 161151412 1211 10 9 81 716 51 4 3 21110 E ASIAN AENA Type the name of a register or a full path to a description file in the Description File field Head Reset Value Text View Auto X A 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 M56800E GPR 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 CodeWarrior IDE displays the registers Using the Text View list box in the Register Details window you can change the text information the CodeWarrior IDE displays Loading a elf File without a Project You can load and debug a e1f file without an associated project To load a el file for debugging without an associated project 1 Launch the CodeWarrior IDE Targeting MC56F83xx DSP5685x Controllers 217 For More Information www freescale com Freescale Semiconductor Inc Debugging
102. Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers MC56F83xx DSP5685x Family Targeting Manual metrowerks For More Information www freescale com Freescale Semiconductor Inc Metrowerks and the Metrowerks logo are registered trademarks of Metrowerks Corporation in the United States and or other countries CodeWarrior is a trademark or registered trademark of Metrowerks Corporation in the United States and or other countries All other trade names and trademarks are the property of their respective owners Copyright 2004 Metrowerks Corporation ALL RIGHTS RESERVED No portion of this document may be reproduced or transmitted in any form or by any means electronic or me chanical without prior written permission from Metrowerks Use of this document and related materials are governed by the license agreement that accompanied the product to which this manual pertains This document may be printed for non commercial personal use only in accordance with the aforementioned license agree ment If you do not have a copy of the license agreement contact your Metrowerks representative or call 1 800 377 5416 if outside the U S call 1 512 996 5300 Metrowerks reserves the right to make changes to any product described or referred to in this document without further notice Metrowerks makes no warranty representation or guarantee regarding the merchantability or fitness of its pr
103. HSST_read A target application uses this function to read data sent by the host Prototype size_t HSST_read void data size_t size size_t nmemb HSST_STREAM stream Parameters data Passes a pointer to the data buffer into which to read the data size Passes the size of the individual data elements to read nmemb Passes the number of data elements to read stream Passes a pointer to the communication channel Returns The number of data elements read Targeting MC56F83xx DSP5685x Controllers 165 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface HSST_flush A target application uses this function to flush out data buffered in a buffered output channel Prototype int HSST flush HSST_ STREAM stream Parameters stream Passes a pointer to the communication channel The High Speed Simultaneous Transfer HSST feature flushes all open buffered communication channels if this parameter is null Returns O if the call was successful or 1 if the call was unsuccessful HSST_ size 166 A target application uses this function to determine the size of unread data in bytes for the specified communication channel Prototype size_t HSST_ size HSST_STREAM stream Parameters stream Passes a pointer to the communication channel Returns The number of bytes of unread data Targeting
104. IONS keyword Prototype FORCE ACTIVE symbol symbol INCLUDE The INCLUDE command let you include a binary file in the output file Prototype INCLUDE filename Targeting MC56F83xx DSP5685x Controllers 297 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing KEEP_SECTION 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 sectionTypel sectionType MEMORY 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 it links the code and date The linker command file may only contain one MEMORY directive However within the confines of the MEMORY directive you may 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 accessF lags 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 298
105. Inspector which shows which bean allocates each peripheral Peripheral Initialization Opens the Peripherals Initialization Inspector Inspector window which show the initialization value and value after reset for all peripheral register bits Installed Beans Overview Opens the Beans Overview window which provides information about all beans in your project CPU Types Overview Opens the CPU Overview window which lists supported processors in an expandable tree structure CPU Parameters Overview Opens the CPU Parameters window which lists clock speed ranges number of pins number of timers and other reference information for the supported processors Memory Map Opens the Memory Map window which depicts CPU address space internal memory and external memory Tools lt tool name gt Starts the specified compiler linker or other tool You use the Tools Setup window to add tool names to this menu SHELL Opens a command line window Tools Setup Opens the Tools Setup window which you use to add tools to this menu Help Processor Expert Help Opens the help start page Introduction Opens the PEI help introduction Benefits Opens an explanation of PEI benefits User Interface Opens an explanation of the PEI environment Tutorial None available for the DSP56800 E Quick Start Opens PEI quick start instructions Help continued Embedded Beans Targeting MC56F83xx DSP5685x Contro
106. Linker Table 4 9 explains the elements of this panel Figure 4 8 M56800E Processor Panel M56800E Processor Hardware DO Loops No DO Loops y Small Program Model Large Data Model F Globals live in lower memory Zero initialized globals live in data instead of BSS Emit separate data section V Pad pipeline for debugger I Create assembly output Tl Generate code for profiling Pipeline Conflict Detection Inline Asm Not Detected C Language Not Detected 62 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 9 M56800E Processor Panel Elements Element Purpose Comments Hardware DO Loops list box Specifies the level of hardware DO loops e No Do Loops Compiler does not generate any No Nest DO Loops Compiler generates hardware DO loops but does not nest them e Nested DO Loops Compiler generates hardware Do loops nesting them two deep If hardware DO loops are enabled debugging will be inconsistent about stepping into loops Test immediately after this table contains additional Do loop information Small Program Model checkbox Checked Compiler generates a more efficient switch table provided that code fits into the range 0xO OxFFFF Clear Compiler generates an ordinary switch table Do n
107. M 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 amp Begin Data Block move from ROM to RAM memcpy unsigned long amp Begin Data const unsigned long amp ROMAddress dataLen a GlobalFlash return Utilizing Program Flash and Data RAM for Constant Data in C There are many advantages and one disadvantage if constant data in C is flashed to program flash memory pROM and copied to data flash memory xRAM at startup with the usual pROM to xRAM initialization The advantages are e constant data is defined and addressed conventionally via C language e pROM flash space is used for constant data pROM is usually larger than xROM e the pROM flash is now freed up or available Targeting MC56F83xx DSP5685x Controllers 291 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax The disadvantage is that the xRAM is consumed for constant data at run time If you wish to store constant data in program flash memory and have it handled by the p
108. MC56F83xx DSP5685x Controllers 269 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Figure 11 1 Example of a Modulo Buffer 270 Address Data 0x100 0 68 0x101 0 73 0x102 0 81 0x103 0 86 0x104 0 90 0x105 0 95 The Code Warrior C compiler for DSP56800E uses intrinsic functions to create and manipulate modulo buffers Normally a modulo operation such as the operator requires a runtime function call to the arithmetic library For normally timed critical DSP loops this binary operation imposes a large execution time overhead The Code Warrior implementation however replaces the runtime call with an efficient implementation of circular address modification either by using hardware resources or by manipulating the address mathematically Processors such as the DSP56800E have on chip hardware support for modulo buffers Modulo control registers work with the DSP pointer update addressing modes to access a range of addresses instead of a continuous linear address space But hardware support imposes strict requirements on buffer address alignment pointer register resources and limited modulo addressing instructions For example RO and R1 are the only registers available for modulo buffers Accordingly the CodeWarrior C compiler uses a well defined set of instrinsic APIs to implement modulo buffers Modulo Addre
109. MPY MAC MPYR and MACR The relationship between a 16 bit integer and a fractional value is Fractional Value Integer Value 2 The relationship between a 32 bit integer and a fractional value is similar Fractional Value Long Integer Value 2 Table 11 1 shows how 16 and 32 bit values can be interpreted as either fractional or integer values Table 11 1 Interpretation of 16 and 32 bit Values 234 Type Hex Integer Value Fixed point Value short int 0x2000 8192 0 25 short int OxE000 8192 0 25 long int 0x20000000 536870912 0 25 long int 0xE0000000 536870912 0 25 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions NOTE Intrinsic functions us these macros Word16 A macro for signed short Word32 A macro for signed long Intrinsic Functions for Math Support Table 11 2 lists the math intrinsic functions See section Modulo Addressing Intrinsic Functions on page 270 for explanations of the remaining intrinsic functions For the latest information about intrinsic functions refer to file intrinsics 56800E h Targeting MC56F83xx DSP5685x Controllers 235 For More Information www freescale com Inline Assembly Language and Intrinsics Intrinsic Functions Table 11 2 Intrinsic Functions for DSP56800E 236 Freescale Semiconductor I
110. N B1XA_N THEN B2PF B1XA_THEN _B2PF_N B2PF N THEN B1XA B2PF_THEN B1XA_N B1XW_N THEN B2PF B1XW B2PF_N_ B2PF_THEN_B1XW_N B1XR_N THEN B2PF B1XR_THEN_B2PF_N B2PF_N_THEN_B1XR THEN B2PF N _N THEN B1XW a g a B2PF_THEN B1XR_N B1PF_STB B2PF HTB B1PA_STB B2PF HTB B2PF_STB B1PA HTB Libraries and Runtime Code EOnCE Library Defined Identifier Key for Normal Trigger Modes Table 14 5 Defined Identifier Key Normal Trigger Modes Targeting MC56F83xx DSP5685x Controllers Identifier Fragments Description B1 breakpoint 1 value set in value1 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 WwW 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 341 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 5 Defined Identifier Key Normal Trigger Modes continued Listing 14 3 Counter Trigger Modes Identifier Fragments Description N the sub trigger it follows must occur N tim
111. Name AT loadAddress contents gt gt segmentName Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing sect ionName is the section name for the output section It must start with a period character For example mysection 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 Targeting MC56F83xx DSP5685x Controllers 301 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing Example SECTIONS text F_textSegmentStart footpad c text ALIGN 0x10 padfoot c text F_textSegmentEnd gt TEXT data data gt DATA bss bss gt BSS COMMON SIZEOF The SIZEOF function returns the size of t
112. New Project Wizard DSP56800x New Project Wizard Graphical User Interface External Internal Memory Page Depending on the processor that you select the External Internal Memory page may appear Figure B 10 and you must select either external or internal memory NOTE Multiple memory targets can be checked Figure B 10 DSP56800x New Project Wizard External Internal Memory Page DSP56800x New Project Wizard External Internal Mem x Select one or more memory configurations for this project V External Memory IV Internal Memory with pROM to xRAM copy Cancel When you click Next the Wizard jumps to the appropriate page determined by the Page Rules on page 353 366 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Finish Page When you click the Finish button on the Finish Page Figure B 11 the project creation process start NOTE All target choices end on this page Figure B 11 DSP56800x New Project Wizard Finish Page xl Click Finish to create the project lt Back i Cancel Targeting MC56F83xx DSP5685x Controllers 367 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface 368 Targeting MC56F83xx DSP5685x Controllers Fo
113. OMR 0x0003 PC 0x000082 RO 0x000866 R1 oxooose6s R2 oxoooooo R3 0x000000 R4 oxoooooo RS 0x000000 SP 0x000537 SR 0x0314 HWSO 0x000000 HWS1 0x000000 FIRA 0x000000 FISR 0x0000 xO OXFFFF Y 0x031E0000 yo oxoooo Yl 0x031E To edit values in the register window double click a register value Change the value as you wish 3 Exit the window The modified register values are saved NOTE To view peripheral registers select the appropriate processor form the processor list box in the M56800E Target Settings Panel Viewing X Memory You can view X memory space values as hexadecimal values with ASCII equivalents You can edit these values at debug time Targeting MC56F83xx DSP5685x Controllers 195 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger On targets that have Flash ROM you cannot edit those values in the memory window that reside in Flash memory 1 Locate a particular address in program memory From the menu bar of the Metrowerks CodeWarrior window select Data gt View Memory NOTE 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 9 11 Figure 9 11 View X Memory Window ioi x Display 0x0 View JRawdata y Hex 00000000 00001 000 00000000 Bait 3030 3030 3030 3030 3030 3030 00000008 13030 3030 3030
114. R Pe ot he a ee we oe Ha A EZ O ISE E oh heath te es BAe a tt itn Oo a Sk Be 200 ToShHttNs she a ts Se HOA RS SE A de 09 Modulo Addressing Intrinsic Functions 2 269 mod It cis lt b tiro y 3 PP A OS we EES ee os Meee ee S271 mod_initintl6 n o se aa ee 272 be MOG st it s ae to a Jap ee eke es By A A eke oe ke Ce a DTD MO ACCESS bo Bas tr Ek oe es tee oe oe ee LS mod Updater a oe i a Ae rr a ee oo 278 AMOS emanates eR Se o eee asa Sens As ert ee AEDT Targeting MC56F83xx DSP5685x Controllers 9 For More Information www freescale com Freescale Semiconductor Inc Table of Contents Mod SEM o ke ee as Gee a ee ee ae Se 7 MO SOHO er he ee eee ae oe 62274 2 MOd eroi o be we ds ee ee ek ee ee ee OT DTS 12 ELF Linker 281 Structure of Linker Command Files 2 a a a 2 2 ee 281 Memory Segment 2 2 2 281 Closure Blockss s 2 bai ae ee a a a Bee 282 Sections Segment 2 2 i ee 4 eee 283 Linker Command File Syntax 2 a 284 Alignment soo a coi doe ss e a 28 A Arithmetic Operations 2 2 e e 285 Comments sns e g a ee a A ea a ZOO Deadstrip Prevention 2 a ee ee a 286 Variables Expressions and Integral Types 2 286 Elle Selection 2 a8 a a poe ee he e Oe 288 Function Selection 2 2 2 ee 289 ROM to RAM Copying 2 2 ee ee ee 289 Utilizing Pr
115. ROM to xRAM startup process a simple change is necessary to the pROM to xRAM LCF Simply place the constant data references into the data_in_p_flash_ROM section after the __ xRAM_data_start variable like the other data references and remove the data in xROM section Please see Listing 12 19 Listing 12 19 Using the Typical pROM to xRAM LCF data_in p flash ROM AT __pROM data_start _ XRAM data_start const data char move constant data references here const char data char data etc Utilizing Program Flash for User Defined Constant Section in Assembler There are many advantages and one disadvantage in writing specific data to pROM with linker commands and accessing this data in assembly The advantages are e pROM flash space is used for user specified constant data pROM is usually larger than xROM where the constant data is defined and addressed by assembly language e part of the pROM flash is now freed up or available The disadvantage is that data is not defined or accessed conventionally via C language data is specifically flashed to pROM via the linker command file and fetched from pROM with assembly If you want to keep specific constant data in pROM and access it from there you can use the linker commands to explicitly store the data in pROM and then later access the data in pROM with assembly The next two sections describe putting data in the pROM flash at build and run time
116. Registers 2 a u a a a eee 204 EOnCE Debugger Features o a a a a a a 206 Set Hardware Breakpoint Panel 0 a a a a a aa 207 SpecialCounters 2 ea a a ee ee 208 Trace Bunter 06 hi ee eo ee OR Ate Bee a e209 Set Trigget Panel coo e 1212 Using the DSP56800E Simulator 2 a a ee 214 Cycle Instruction Count 2 a ee DTS Memory Map 2 2 aS Bo Se Bee we me ed ee 2 VO Register Details Window 2 a ee ee 216 Loading a elf File without a Project 2 2 ee eee 217 Using the Command Window 2 2 2 218 System Level Connect sss m ony a doep elata k s wa 219 Debugging in the Flash Memory a a a a a aaa 219 Flash Memory Commands oa a a a 220 set_hfmclkd lt value gt a a a aaa a 220 set_hfm_base lt address gt 2 4 220 set_hfm_config_base lt address gt 221 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 2 2 2 2 2 221 set_hfm_erase_mode units pages lall 221 set_hfm_verify_erase 110 2 2 222 set_hfm_verify_program 110 222 target_code_sets_hfmclkd 110 222 Flash Lock Unlock mes ahe a y 222 Notes for Debugging on Hardware 2 ee
117. 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 Table 14 10 Counter Unit Actions Options Mode Defined Identifiers 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_TRI interrupts to vector set for this unit GGER UNIT_ACTION_TRIGGER_BEFORE_ZERO enters debug mode is unit 0 else passes signal on to next unit INTERRUPT_CORE_TRIGGER_BEFORE__ interrupts to vector set for this unit ZERO Accumulating Trigger Options One of the defined identifiers in Table 14 11 must be OR ed into the options parameter of the _eonce_SetTrigger function when breakpoint unit 0 is being configured Table 14 11 Accumulating Trigger Options Mode with Breakpoint Unit 0 Defined Identifiers Description PREV_UNIT_OR_THIS_TRIGGER_OR_ a trigger is generated if the previous CORE_EVENT 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_ a trigger is generated if the previous CORE_EVENT breakpoint unit passes in a trigge
118. Source encoding ASCII y Use prefix text in precompiled headers Preprocessing Options V Emit file changes F Show full paths Use line V Emit Hpragmas Keep comments Keep whitespace Table 4 6 provides information about the options in this panel Table 4 6 C C Language Preprocessor Elements Element Purpose Comments Source encoding Allows you to specify the default encoding of source files Multibyte and Unicode source text is supported To replicate the obsolete option Multi Byte Aware set this option to System or Autodetect Additionally options that affect the preprocess request appear in this panel precompiled header Use prefix text in Controls whether a pch or pch file incorporates the prefix text into itself This option defaults to off to correspond with previous versions of the compiler that ignore the prefix file when building precompiled headers If any pragmas are imported from old C C Language C Only Panel settings this option is set to on Emit file changes Controls whether notification of file changes or line changes appear in the output Targeting MC56F83xx DSP5685x Controllers 55 For More Information www freescale com Target Settings DSP56800E Specific Target Settings Panels Freescale Semiconductor Inc Table 4 6 C C Language Preprocessor Elements continued Element Purpose Comments
119. TURE_CHANGE_OF_FLOW_ saves addresses of interrupt vector fetches and INTERRUPT target addresses of RTI instructions to the trace buffer SUBROUTINE CAPTURE_CHANGE_OF_FLOW_ saves the target addresses of JSR BSR and RTS instructions to the trace buffer Targeting MC56F83xx DSP5685x Controllers 347 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 14 Trace Buffer Capture Options continued Defined Identifiers Description CAPTURE_CHANGE_OF_FLOW_0O 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 14 15 describe what action to take when the trace buffer is full One of the following defined identifiers must be OR ed into the options parameter of the _eonce_SetupTraceBuffer function Table 14 15 Trace Buffer Full Options Defined Identifiers 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 vect
120. Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc a memory address an AFTER command Example memory code RWX overlayl RWX overlay2 RWX data RW ELF Linker Linker Command File Keyword Listing Specify a hex address such as 0x8000 Use the AFTER name name command to tell the linker to place the memory segment after the specified segment In the example below overlay1 and overlay2 are placed after the code segment When multiple memory segments are specified as parameters for AFTER the highest memory address is used ORIGIN 0x8000 LENGTH ORIGIN AFTER code LENGTH ORIGIN AFTER code LENGTH oooO ORIGIN 0x1000 LENGTH ORIGIN is the assigned address LENGTH is one of the following a value greater than zero autolength by specifying zero If you try to put more code and data into a memory segment than your specified length allows the linker stops with an error When the length is 0 the linker lets you put as much code and data into a memory segment as you want NOTE There is no overflow checking with autolength The linker can produce 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 fi
121. The third 16 bit integer value B provided that the compiler does not use this register for a 32 bit parameter value The compiler passes the remaining parameter values on the stack The system increments the stack by the total amount of space required for memory parameters This incrementing must be an even number of words as the stack pointer SP must be continuously long aligned The system moves parameter values to the stack from left to right beginning with the stack location closest to the SP Because a long parameter must begin at an even address the compiler introduces one word gaps before long parameter values as appropriate Targeting MC56F83xx DSP5685x Controllers 121 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Calling Conventions and Stack Frames Returning Values From Functions The compiler returns function results in registers A RO R2 and YO e 16 bit integer values YO e 32 bit integer or float values A All pointer values R2 e Structure results RO contains a pointer to a temporary space allocated by the caller The pointer is a hidden parameter value Additionally the compiler e Reserves R5 for the stack frame pointer when a function makes a dynamic allocation This is the original stack pointer before allocations Otherwise the compiler saves R5 across function calls e Saves registers C10 and D10 across function calls e Does not
122. 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 9 9 or double click on General Purpose Registers to view the registers as in Figure 9 10 Targeting MC56F83xx DSP5685x Controllers 193 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger Figure 9 9 General Purpose Registers for DSP56800E LI AS lolx J Register Value e A E al B sdm elf Thread oxo General Purpose Registers A oxoooo000000 AD 0x0000 Al 0x0000 Ee A2 0x00 B oxo000000000 BO Ox0000 B1 oxoooo B2 0x00 C 0x0000000000 co oxoooo c1 0x0000 C2 0x00 y D 0x0000000000 Lo 194 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger Figure 9 10 General Purpose Registers Window y General Purpose Registers Window 5 iol xj oxoooo000000 OxD000 0x0000 0x00 oxoooo000000 0x0000 0x0000 0x00 0xD000000000 0x0000 0x0000 0x00 oxoooo000000 OxD000 0x0000 0x00 0x000000 0x000000 0x0000 0x0000 OXFFFF 2 Edit register values sdm elf Thread 0x0 N3 0x0000 a N 0x000000
123. Warrior software is ready for use a Table 2 2 lists the directories created during full installation b To test your system follow the instructions of the next section to create a project Installation Directories CodeWarrior IDE for DSP56800E ect Directory Contents CodeWarrior_Examples Target specific projects and code Helper Apps Applications such as cwspawn exe and cvs exe bin The CodeWarrior IDE application and associated plug in tools ccs Command converter server executable files and related support files DSP56800x_EABI_Support Default files for the DSP56800x stationery DSP56800x_EABI_Tools Drivers to the CCS and command line tools plus IDE default files for the DSP56800x stationery Freescale_Documentation Documentation specific to the Freescale DSP56800E series Help Core IDE and target specific help files Access help files through the Help menu or F1 key License The registration program and additional licensing information M56800E Support Initialization files Metrowerks Standard Library MSL and Runtime Library M56800x Support Profiler libraries Other_Metrowerks_Tool MWRemote executable file ProcessorExpert Files for the Processor Expert Release_Notes Release notes for the CodeWarrior IDE and each tool Stationery Templates for creating DSP56800E projects Each template pertains to a specific debu
124. Window docked 26jMetrowerks CodeWarrior File Edit View Search Project Debug Processor Expert Data Vis Base EoecxhRGaAaTuas zix NewProj1 mco e Docked sam Files Gc MDI Child Cay gy P Close Code Data Qe HS code 0 0 m2 1 DSP56800 sim support 0 O gt z RE oa 5 This completes project creation You are ready to edit project contents according to the optional steps below NOTE Stationery projects include source files that are placeholders for your own files If a placeholder file has the same name as your file such as main c you must remove the placeholder file before adding your source file 6 Optional Remove files from the project a In the project window select highlight the files b Press the Delete key or right click the filename then select Remove from the context menu The filenames disappear 7 Optional Add source files to the project a Method 1 From the main window menu bar select Project gt Add Files Then use the Select files to add dialog box to specify the files Targeting MC56F83xx DSP5685x Controllers 33 For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project b Method 2 Drag files from the desktop or Windows Explorer to the project window 8 Optional Edit code in the source files a Double click the filename in the project window or select the
125. _int int i int j move w x r2 y0 move w x r3 x0 230 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Inline Assembly Language add x0 y0 int result returned in y0 rts Listing 11 7 shows the C calling statement for this inline assembly language function Listing 11 7 Sample Code Calling an Inline Assembly Language Function int x 4 y 2 y add_int amp x y Returns 6 Calling Pure Assembly Language Functions If you want C code to call assembly language files you must specify a SECTION mapping for your code for appropriate linking You must also specify a memory space location Usually this means that the ORG directive specifies code to program memory P space In the definition of an assembly language function the GLOBAL directive must specify the current section symbols that need to be accessible by other sections Listing 11 8 is an example of a complete assembly language function This function writes two 16 bit integers to program memory A separate function is required for writing to P memory because C pointer variables allow access only to X data memory The first parameter is a short value and the second parameter is the 16 bit address Listing 11 8 Sample Code Creating an Assembly Language Function my_asm asm SECTION user map to user
126. _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 Targeting MC56F83xx DSP5685x Controllers 265 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Prototype Word32 L_shl Word32 lval2shft Word16 s shftamount Example long result 1 0x12345678 short s2 1 result L_shl 1 s2 Expected value of result 0x2468ACFO L_shlftNs 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_shlftNs Word32 lval2shft Word16 s_shftamount Example long result 1 0x12345678 short s2 1 result L _shlftNs 1 82 Expected value of result 266 0x2468ACF0 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions L_shlfts Arithmetic left shift of 32 bit value by a specified shift amount Saturation does occur during a left shift if required NOTE This is not a bidirectional shift Assumptions Assumed s_shftamount is positive OMR s SA bit was
127. a Empty Project Location Fa Makefile Importer Wizard jc my_projects the_project Set de Processor Expert Examples Stationery dl Processor Expert Stationery Add Targets to Project Project z Cancel 2 Select DSP56800x New Project Wizard In the Project Name text box type the project name For example the_project 4 Inthe Location text box type the location where you want to save this project or choose the default location 5 Click OK The DSP56800x New Project Wizard Target dialog box Figure 2 4 appears Targeting MC56F83xx DSP5685x Controllers 25 For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project Figure 2 4 DSP56800x New Project Wizard Target Dialog Box DSP56800x New Project Wizard Target i xj Select family and then processor for this project Processor DSP56800_ simulator DSP56800E simulator Vor JUUUUA I aumy DSPS56F80x DSP56F82x DSP5685x MC56F81 xx MCS5EF83xx Simulators 6 Select the target board and processor a Select the family such as Simulators from the DSP56800x Family list b Select a processor or simulator such as DSP56800E_simulator from the Processors list 7 Click Next The DSP56800x New Project Wizard Program Choice dialog box Figure 2 5 appears 26 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freesc
128. 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 shlftNs or shlfts which are more optimal Assumptions OMR s SA bit was set to at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 shl Word16 sval2shft Word16 s_shftamount Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short result short sl 0x1234 short s2 1 result shl s1 s2 Expected value of result 0x2468 shliftNs 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 NOTE 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 Prototype Word16 shlftNs Word16 s
129. ad a global pointer variable at X 0x4567 into an address register in t gpl Table 6 6 Loading a Global Pointer Variable Large Data Globals live in Instruction Comments Model checkbox lower memory checkbox Clear Clear move w X 0x4567 r0 Default 16 bit addressing 16 bit pointer value Checked Clear move 24 bit addressing pointer X 0x004567 r0 value is 24 bit Clear Checked Combination not allowed Checked Checked move X 0x4567 r0 16 bit addressing pointer value is 24 bit Targeting MC56F83xx DSP5685x Controllers 143 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Optimizing Code External Library Compatibility If you enable the large data model when the compiler builds your main application external libraries written in C also must be built with the large data model enabled The linker enforces this requirement catching global objects located out of range for particular instructions A more serious compatibility problem involves pointer parameters Applications built with the large data memory model may pass pointer parameter values in two words of the stack But libraries built using the small memory model may expect pointer arguments to occupy a single word of memory This incompatibility will cause runtime stack corruption You may or may not build external libraries or modules written in assembly with extended addressing modes
130. ader information Clear Disassembled output does not include this information Show Symbol Checked Disassembled modules include and String symbol and string tables Clear Disassembled modules do not include these tables Verbose Info Checked ELF file includes additional For the symtab section additional Clear Disassembler does not output these sections Disables subordinate checkboxes checkbox information information includes numeric Clear ELF file does not include equivalents for some descriptive additional information constants For the line and debug sections additional information includes an unstructured hex dump Show Checked Shows relocation information Relocations for corresponding text rela text or data checkbox rela data section Clear Does not show relocation information Show Code Checked Disassembler outputs ELF Subordinate checkboxes are Use Modules code sections for the disassembled Extended Mnemonics Show checkbox module Enables subordinate checkboxes Addresses and Object Code Show Source Code and Show Comments Use Extended Checked Disassembler lists extended This checkbox is available only if the code Mnemonics mnemonics for each instruction of the Show Code Modules checkbox is checkbox disassembled module checked Clear Disassembler does not list extended mnemonics Show Addresses Checked Disassembler lists add
131. ale Semiconductor Inc Getting Started Creating a Project Figure 2 5 DSP56800x New Project Wizard Program Choice Dialog Box xl Select the example main program for this project m Program C Simple Mixed Assembly and C C Simple Assembly Blank lt Back Cancel 8 Select the example main program for this project such as Simple C 9 Click Next The DSP56800x New Project Wizard Finish dialog box Figure 2 6 appears Targeting MC56F83xx DSP5685x Controllers 27 For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project Figure 2 6 DSP56800x New Project Wizard Finish Dialog Box DSP56800x New Project Wizard Finish j x Click Finish to create the project Cancel 10 Click Finish to create the new project NOTE For more details of the DSP56800x new project wizard please see Appendix B This completes project creation You are ready to edit project contents according to the optional steps below NOTE Stationery projects include source files that are placeholders for your own files If a placeholder file has the same name as your file such as main c you must replace the placeholder file with your source file 11 Optional Remove files from the project a In the project window select highlight the files b Press the Delete key or right click the filename then select Remove from the context men
132. an 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 This chapter contains the following sections e Structure of Linker Command Files Linker Command File Syntax Linker Command File Keyword Listing Structure of Linker Command Files Linker command files contain three main segments 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 12 1 Targeting MC56F83xx DSP5685x Controllers 281 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Structure of Linker Command Files Listing 12 1 Sample MEMORY Segment MEMORY segment _1 RWX ORIGIN 0x8000 LENGTH 0x1000 segment 2 RWX ORIGIN AFTER segment_1 LENGTH 0 data RW ORIGIN 0x2000 LENGTH 0x0000
133. ange PE Windows none Restores the default arrangement of all open PEI windows 88 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Processor Expert Windows This section illustrates important Processor Expert windows and dialog boxes Bean Selector The Bean Selector window Figure 5 4 explains which beans are available helping you identify those most appropriate for your application project To open this window select Processor Expert gt View gt Bean Selector from the main window menu bar Figure 5 4 Bean Selector Window aio xi Bean Categories On Chip Peripherals lt Quick help CPU intemal peripherals Bean BitsIO G Communication Converter amp Interrupts gt Measurement Memory gt Peripheral beans Port 1 0 5 5 0 Bilo 1 Ifyou want to use 1 bit only select the O HN BitIO bean instead 2 If you want to use 8 bits select the S MM Butezio BytelO bean instead Ss Byte3l0 gt gt des Filter allfCPU Licensed This bean implements a multi bit input output It uses 1 to 8 contiguous pins of one port It is recommended to select this bean exclusively for 2 to 7 bit input output yf amp amp amp amp The Bean Categories page at the left side of this window lists the available
134. arget 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 Ox is interpreted as hex bytes Thus OxBE OXEF Targeting MC56F83xx DSP5685x Controllers 203 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Save Restore Registers would actually write OxBEEF on the target Optionally the string could have been set to 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 interpretation 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 fiel
135. arget y x Select family and then processor for this project DSP56800x Family Processor DSP56F80x MC56F8322 DSP56F82x MC56F8323 DSP5685x MC56F8345 MC56F81x MC56F8346 MC56F8347 MC56F8355 MC56F8356 MC56F8357 MC56F8365 MC56F8366 MC56F8367 MC56 iH Simulators lt Back Cancel 362 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Figure B 7 DSP56800x New Project Wizard Target Dialog Box Simulator DSP56800x New Project Wizard Target x Select family and then processor for this project DSP56800x Family DSPS56F80 DSP56F82x DSP5685x MC5EF83xx imulator Processor DSP56800_simulator DSP56800E _simulator Back Cancel One target family and one target processor or simulator must be selected before continuing to the next wizard page NOTE Depending on which processor you select different screens will appear according to the Page Rules on page 353 If you choose the simulator then the DSP56800x New Project Wizard Program Choice page appears see Program Choice Page on page 363 Program Choice Page If you chose either of the simulators then Figure B 8 appears and you can now choose what sort of main program to include in the project Targeting MC56F83xx DSP5
136. bals live in lower memory checkbox of the M56800E Processor settings panel This tells the compiler to access global and static data with 16 bit addresses but to use 24 bit addressing for all pointer and stack operations This arrangement combines the flexibility of the large data memory model with the efficiency of the small data model s access to globals and statics NOTE If you check the Globals live in lower memory checkbox be sure to store data in lower memory Accessing Data Objects Examples Table 6 5 and Table 6 6 show appropriate ways to access a global integer and a global pointer variable The first two columns of each table list states of two checkboxes Large Data Model and Globals live in lower memory Both checkboxes are in the M56800E Processor settings panel Note that the first enables the second Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Large Data Model Support Table 6 5 lists ways to access a global integer stored at address X 0x 1234 int gl Table 6 5 Accessing a Global Integer Large Data Globals live in Instruction Comments Model checkbox lower memory checkbox Clear Clear move w X 0x1234 y0 Default values Checked Clear move w X 0x001234 y0 Clear Checked Combination not allowed Checked Checked move w X 0x1234 y0 Global accesses use 16 bit addressing Table 6 6 lists ways to lo
137. bit of the operating mode register The IDE implements intrinsic functions as inline C functions in file intrinsics 56800E h inthe MSL directory tree These inline functions contain mostly inline assembly language code An example is the abs_s intrinsic defined as Listing 11 10 Example Code Definition of Intrinsic Function abs_s define abs_s a _ abs _ s a ABS S inline Word16 _ abs_s register Wordl16 svarl Defn Absolute value of a 16 bit integer or fractional value returning a 16 bit result Returns 7fff for an input of 8000 a DSP56800E instruction syntax abs FFF Allowed src regs FFF Targeting MC56F83xx DSP5685x Controllers 233 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Rx w asm abs svarl return svarl Allowed dst regs same Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code Fractional Arithmetic Many of the intrinsic functions use fractional arithmetic with implied fractional values An implied fractional value is a symbol declared as an integer type but calculated as a fractional type Data in a memory location or register can be interpreted as fractional or integer depending on program needs All intrinsic functions that generate multiply or divide instructions perform fractional arithmetic on implied fractional values These intrinsic functions are DIV
138. bj file On Windows targets the IDE stores and manages object files internally in the data folder A proprietary compiler architecture at the heart of the Code Warrior IDE handles multiple languages and platform targets Front end language compilers generate an intermediate representation IR of syntactically correct source code This IR is memory resident and language independent Back end compilers generate code from the IR for specific platform targets As Figure 3 4 depicts the Code Warrior IDE manages this whole process 40 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process Figure 3 4 CodeWarrior Build System Front end Language Project Manager C C Java Object Pascal Intermediate be w Representation TTA Back end CodeGen MIPS PPC YR x86 68K DSP SH 8xx This architecture means that 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 User benefits of this architecture include e An advance in the C C front end compiler means an immediate advance in all code generation e Optimizations in the IR mean that any new code generator is highly optimized e Targeting a new processor does not require compiler related changes in source code simplifying porting Metro
139. ble harvard architecture ensure R 0 required for C ensure SA 0 required for C 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 moveu w hws la nop nop Clear the hardware stack CALLMAIN Initialize compiler environment Initialize the Stack move l gt gt F_Lstack_addr r0 bftsth 0001 r0 bee noinc adda 1 r0 Targeting MC56F83xx DSP5685x Controllers 327 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library noinc tfra r0 sp set stack pointer too move w 0 r1 nop jsr move w r1 x sp adda 1 sp F_ init sections Call main 1 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 Fi F move w 0 r2 jsr Ffflush Flush File IO jsr Ffflush_ console Flush Console IO end of program halt CPU debughlt rts Finit M56852END endsec EOnCE Library 328 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 s
140. cale Semiconductor Inc C for DSP56800E Large Data Model Support Large Data Model Support The DSP56800E extends the DSP56800 data addressing range by providing 24 bit address capability to some instructions 24 bit address modes allow user accesses beyond the 64K word boundary of 16 bit addressing To control large data memory model support use the M56800E Processor panel Figure 6 2 See M56800E Processor for explanations of this panel s elements Figure 6 2 M56800E Processor Panel Large Data Model M56800E Processor Hardware DO Loops No DO Loops y Small Program Model IV Large Data Model 7 Globals live in lower memory Zero initialized globals live in data instead of BSS I Emit separate data section Y Pad pipeline for debugger T Create assembly output I Generate code for profiling m Pipeline Conflict Detection Inline Asm Not Detected X C Language Not Detected Extended data is data located beyond the 16 bit address boundary as if it exists in extended upper memory Memory located below the 64K boundary is lower memory The compiler default arrangement is using 16 bit addresses for all data accesses This means that 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 The compiler treats data pointers as 16 bit pointers that you may store in single word
141. cale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial Figure 5 15 Project Target CPU Windows File Edit view Search Project Debug Processor Expert Window Help pees Boeox haan SLE aa 8346 PE mcp C sdm ay or A EA EET ETO 29 Fies Link Order Targets Processor Expert Configurations EG CPUs lt Cpu56F8346 D Documentation x E PESL Bean Selector Bean Categories On Chip Peripherals Quick help gt CPU extemal devices E CPU intemal peripherals Communication Converter Interrupts Measurement Memory Peripheral beans BG Port 1 0 soz Bisio S Byte210 S Byte310 Filter al CPU Licensed 2 Select the sdm external memory target a Click the project window s Targets tab The Targets page moves to the front of the window b Click the target icon of the sdm external memory entry The black arrow symbol moves to this icon confirming your selection 3 Add six BitIO beans to the project a Click the project window s Processor Expert tab The Processor Expert page moves to the front of the window b Make the Bean Selector window visible e Minimize the Target CPU window e Select Processor Expert gt View gt Bean Selector from the main window menu bar c Inthe Bean Categories page expand the entry MCU internal peripherals Targeting MC56F83xx DSP5685x Controllers 103 For More Informatio
142. cale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Return Codes Every function except _eonce_Initialize returns one of the error codes in Table 14 4 Table 14 4 Error Codes Error Code Description EONCE_ERR_NONE No error EONCE_ERR_NOT_INITIALIZED The _eonce_lInitialize function has not been called before the current function EONCE_ERR_UNIT_OUT_OF_RANGE The unit parameter is greater than or equal to the number of units specified in _eonce_lInitialize EONCE_ERR_LOCKED_OUT The core cannot access the EOnCE registers 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 Normal Trigger Modes One of the defined identifiers listed in Listing 14 2 must be OR ed into the options parameter of the _eonce_SetTrigger function A key for the defined identifiers listed in Listing 14 2 is given in Table 14 5 Listing 14 2 Normal Trigger Modes B1PA_N B1PR_N B1PW_N B2PF_N B1XA_OR_B2PF_N B1XA_N_OR_B2PF B1PF_OR_B2PF_N B1PA_OR_B2PF_N B1PA N OR _B2PF B1PF_OR_N B2PF B1PA_OR_N B2PF B1XR_AND_N B2DR B1XW_AND N B2DW B1XA_ AND N B2DRW B1PF_N THEN B2PF B2PF_THEN B1PF _N B1PA N THEN B2PF 340 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc B1PA_THEN_B2PF_N B2PF_N THEN B1PA B2PF_THEN B1PA
143. ce 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 JTAG based Host I O 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800E NOTE DSP56800E stationery creates new projects with LDM and SDM targets and the appropriate libraries Below is a list of the DSP56800E libraries Metrowerks Standard Libraries MSL MSL C 56800E 1ib Standard C library support for Small Data Model MSL C 56800E 1lmm 1lib 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 1mm lib Low level functions for MSL support for Large Data Mo
144. cessor Expert Page e x xf NewProji mcp e sdm external memory E Y A A gt Files Link Order Targets Processor Expert E Configurations gt Operating System E CPUs HY Bes i B Cpu 5i k Cpu 56F8346 Beans ES User Modules Y ES NewProjl c main H Generated Modules External Modules E 2 Documentation x G PESL When you start code design the PEI generates commented code from the bean settings This code generation takes advantage of the Processor Expert CPU knowledge system and solution bank which consists of hand written tested code optimized for efficiency To add new functionalities you select and configure additional beans then restart code design Another straightforward expansion of PEI code is combining other code that you already had produced with different tools Processor Expert Beans Beans encapsulate the most required functionalities for embedded applications Examples include port bit operations interrupts communication timers and A D converters The Bean Selector Figure 5 2 helps you find appropriate beans by category processor MCU external devices MCU internal peripherals or on chip peripherals Targeting MC56F83xx DSP5685x Controllers 83 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview To open the bean selector select Processor Expert gt View gt Bean Selector fro
145. chniques 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 224 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 10 Profiler The profiler is a run time feature that collects information about your program It records the minimum maximum and total number of clock cycles spent in each function The profiler allows you to evaluate your code and determine which functions require optimization When profiling is enabled the compiler adds code to call the entry functions in the profiler library These profiler library functions do all of the data collection The profiler library with the help of the debugger create a binary output file which is opened and displayed by the CodeWarrior IDE NOTE For more information on the profiler library and its usage see the CodeWarrior Development Studio IDE 5 5 User s Guide Profiler Supplement To enable your project for profiling 1 Add the following path to your list of user paths in the Access Paths settings panel Compiler M56800x Support profiler 2 Add the following line to the file that contains the function main Q include Profiler h 3 Add the profiler library file to your project Select the lib
146. ck whether this keyword restriction is in effect use the __option only_std_keywords command Expand Checked C Compiler ignores trigraph Many common character constants Trigraphs characters resemble trigraph sequences checkbox Clear C Compiler does not allow trigraph especially on the Mac OS This extension lets you use these constants without including escape characters NOTE If this option is on be careful about initializing strings or multi character constants that include question marks To check whether this option is on use the __option trigraphs command Require Function Prototypes checkbox Checked Compiler does not allow functions that do not have prototypes Clear Compiler allows functions without prototypes This option helps prevent errors from calling a function before its declaration or definition To check whether this option is in effect use the __option require_prototypes command Enums Always Int checkbox Checked Restricts all enumerators to the size of a singed int Clear Compiler converts unsigned int enumerators to signed int then chooses an accommodating data type char to long int Targeting MC56F83xx DSP5685x Controllers To check whether this restriction is in effect use the __option enumalwasysint command 53 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Sett
147. ckbox is checked Annotate Byte Symbols Checked Linker includes B annotation for byte data types e g char in the Linker Command File Clear By default the Linker does not include the B annotation in the Linker Command File Everything without the B annotation is a word address For an example of the Linker Command File with and without the B annotation see Listing 4 3 Disable Deadstripping checkbox Checked Prevents the linker from stripping unused code or data Clear Lets the linker deadstrip Generate ELF Checked Linker includes and ELF Clear Linker does not generate an S record file Symbol Table symbol table and relocation list in the ELF checkbox executable file Clear Linker does not include these items in the ELF executable file Suppress Checked Linker does not display Warning warnings in the message window Messages Clear Linker displays warnings in the checkbox message window Generate S Checked Linker generates an output file For the DSP56800E this option Record File in S record format Activates subordinate outputs three S record files s both checkbox checkboxes P and X memory contents p P memory contents and x X memory contents The linker puts S record files in the output folder a sub folder of the project folder Sort By Address checkbox Checked Enables the compiler to use byte addresses to sort type S3
148. ct b You may close all windows except the project window Targeting MC56F83xx DSP5685x Controllers 109 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial 10 Update file Events c a Soa m m NOTE j Click the project window s Files tab The Files page moves to the front of the window Expand the User Modules folder Double click filename Events c An editor window opens displaying this file s text Listing 5 1 at the end of this tutorial shows this file s contents Find the line IROB_OnInterrupt Above this line enter the new line extern short IRQB On Inside IROB_OnInterrupt enter the new line IRQB On 1 Find the line IRQA OnInterrupt Above this line enter the new line extern short IRQA On A Inside IROA OnInterrupt enter the new line IRQA On 1 Listing 5 1 shows these new lines as bold italics Save and close file Events c 11 Update file LEDcontrol c a NOTE c In the project window s Files page double click filename LEDcontrol c or the actual c filename of your project An editor window opens displaying this file s text Add custom code to utilize the beans Listing 5 2 shows custom entries as bold italics Processor Expert software generated all other code of the file Save and close the file 12 Build and debug the project a b 110 From
149. ct 2 Specify a new DSP56800E project named NewProj1 a If necessary click the Project tab to move the Project page to the front of the window b From the project list select highlight DSP56800E EABI Stationery NOTE Stationery is a set of project templates including libraries and place holders for source code Using stationery is the quickest way to create a new project c In the Project name text box type NewProj1 When you save this project the IDE automatically will add the mcp extension to its filename 3 Inthe New window click the OK button The New Project window Figure 2 8 appears listing board specific project stationery Figure 2 8 New Project Window New Project q x Select project stationery N Project Stationery DSP5685x DSP56F80x DSP56F82x MCS5EF801x MC56F 81 xx MC5EF83xx Simulators E DSP56S0DE_Simulator DSP56800_Simulator 208 E E E 4 Select the simulator C stationery target a Click the expand control for the M56800E Simulator The tree expands to show stationery selections 30 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project b Select highlight Simple C Figure 2 9 shows this selection Figure 2 9 Simulator Simple C Selection New Project x Select project stationery MC56F801x MC56F81 xx MC56FS3xx Simulators DSP56800E_ Si
150. cute your program one statement at a time suspending 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 processor register contents and see the contents of memory e Metrowerks Standard Library MSL a set of ANSI compliant standard C libraries for use in developing DSP56800E applications Access the library sources for use in your projects A subset of those used for all platform targets these libraries are customized and the runtime adapted for DSP56800E development Development Process The Code Warrior IDE helps you manage your development work more effectively than you can with a traditional command line environment Figure 3 1 depicts application development using the IDE 36 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process Figure 3 1 CodeWarrior IDE Application Development Create Manage Project 7 Manage Files 1 Specify Target 2 Settings 2 Edit Files 3 Build Make Project H Li Compile Project no yes Link Project Debug Project yes Release Y End Targeting MC56F83xx DSP5685x Controllers Notes
151. d 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 From the menu bar of the Metrowerks Code Warrior window select Debug gt 56800E gt Save Restore Registers to display the Save Restore Registers dialog box Figure 9 18 204 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Save Restore Registers Figure 9 18 Save Restore Registers Dialog Box Save Restore Registers x History 4 Parameters Operation SaveRegistes Restore Registers General Purpose Registers Cancel Filename Browse P Overwrite Existing Progress Use this dialog box to save and restore register groups to and from a user specified 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
152. ddresses 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 Targeting MC56F83xx DSP5685x Controllers 213 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Using the DSP56800E Simulator 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 Data mask When a data compare trigger is selected this edit box becomes available This value specifies which bits of the data value are compared 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 Breakpoint counter This edit box specifies the number of times a sub trigger preceded by a see above must occur to cause a trigger 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 DEBUGEYV instruc
153. 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 Fpmemwrite MOVE Y1 RO Set up pointer to address NOP Pipeline delay for RO MOVE YO P RO Write 16 bit value to address Targeting MC56F83xx DSP5685x Controllers 231 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Inline Assembly Language 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 Listing 11 9 shows the C calling statement for this assembly language function Listing 11 9 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 Calling Functions from Assembly Language Assembly language programs can call functions written in either C or assembly language e From within assembly language instructions you can call C functions For example if the C function definition is void foot void Do something Your assembly language calling statement is jsr Ffoot e From within assembly
154. del 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 lmm lib Low level functions for MSL support for Large Data Model with Host I O via HSST 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 hsst_56800E 1lib 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 14 1 Targeting MC56F83xx DSP5685x Controllers 323 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800E Table 14 1 Host File Creation Location fopen Filename Parameter Host Creation Location filename with no path target project file folder full 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 for general LCF information See each specific target LCF in S
155. ding on the function being configured 212 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features Figure 9 23 Set Trigger Panel Set Trigger x Primary trigger type Program trigger y Advanced trigger Primary trigger core event Primary trigger E Program access i r Core events IV DEBUGEY trigger enabled Ox0 Program address IV Overflow trigger enabled 0x0 l Data compare length Use step counter to execute 0x1 instructions after trigger Note Using the step counter will disable single stepping in the debugger OxFFFFFFFF Data mask F Invert data compare 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 e Value options There are two edit boxes used to specify a
156. ditional information immediately after this table 63 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 9 M56800E Processor Panel Elements continued Element Purpose Comments Zero initialized globals live in data instead of BSS checkbox Checked Globals initialized to zero reside in the data section Clear Globals initialized to zero reside in the bss section Create Assembly Output checkbox Checked Assembler generates assembly code for each C file Clear Assembler does not generate assembly code for each C file The pragma asmoutput overrides this option for individual files Generate code for profiling Checked Compiler generates code for profiling Clear Compiler does not generate code for profiling For more details about the profiler see the Profiler on page 225 Pipeline Conflict Detection Inline ASM list box Specifies pipeline conflict detection during compiling of inline assembly source code e Not Detected compiler does not check for conflicts e Conflict error compiler issues error messages if it detects conflicts Conflict Error Hardware Stall Warning compiler issues error messages if it detects conflicts warnings if it detects hardware stalls For more information about pipeline conflicts see the explanations of pragma
157. dows 2 a a 89 Bean Selector 0 e a do SO Bean Inspector 2 iet ge T e 90 Target CPU Window 2 e 92 Memory Map Window 2 2 97 CPU Types Overview 2 2 e ee ee 98 Resource Meter 2 6 beach AM eS Woe Seb ee 2 5 ae Bb 99 Installed Beans Overview 2 100 Peripherals Usage Inspector 2 2 2 2 101 Processor Expert Tutorial 2 a a a eee 102 6 C for DSP56800E 119 Number Formats 2 2 ee ee 120 Calling Conventions and Stack Frames 2 2 12 Passing Values to Functions 2 121 Returning Values From Functions 2 2 2 2 122 Volatile and Non Volatile Registers 2 122 Stack Frame and Alignment 125 4 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table of Contents User Stack Allocation 2 2 2 2 ee 126 Data Alignment Requirements 2 a 131 Word and Byte Pointers tee De a Soe ded nde a Oe Reordering Data for Optimal ves Sos gel a a 182 Variables in Program Memory 2 133 Declaring Program Memory Variables 2 133 Using Variables in Program Memory 2 2 2 2 2 2 134 Linking with Variables in Program Memory 2 136 Packed Structures Support
158. e keyword does not include the text sections from those files again 288 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax 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 12 16 Listing 12 16 Sample Function Selection Using OBJECT Keyword SECTIONS program section OBJECT Fpad main c OBJECT Ffoot main c text gt ROOT NOTE If an object is written once using the OBJECT function selection keyword 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 prog
159. e appropriate file When you select the file the system puts its name in the Use initialization file text box Each text line of a command file begins with a command or the comment symbol The system ignores comment lines as well as blank lines Table 4 14 lists the supported commands and their arguments For a more detailed description of the Flash Memory commands see Flash Memory Commands Table 4 14 Initialization File Commands and Arguments Command Arguments 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 flash memory s clock divider value to the hfmclikd register 76 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 14 Initialization File Commands and Arguments continued Command Arguments Description set_hfm_base lt address gt Sets the address of hfm_base This is the map location of the flash memory control registers in X Memory add_hfm_unit lt startAddr gt lt endAddr gt Adds a flash memory unit to the lt bank gt lt numSecto
160. e DSP56800 and DSP56800E sub families are shown in Table 1 1 With this product the following Targeting Manuals are included e Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers DSP56F80x DSP56F82x Family Targeting Manual e Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers MCS56F83xx DSP5685x Family Targeting Manual NOTE Please refer to the Targeting Manual specific to your processor Table 1 1 Supported DSP56800x Processors for CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers DSP56800 DSP56800E DSP56F801 60 MHz DSP56852 DSP56F801 80 MHz DSP56853 DSP56F802 DSP56854 DSP56F803 DSP56855 DSP56F805 DSP56857 DSP56F807 DSP56858 DSP56F826 MC56F8322 DSP56F827 MC56F8323 MC56F8345 MC56F8346 MC56F8356 MC56F8357 MC56F8365 MC56F8366 Targeting MC56F83xx DSP5685x Controllers 15 For More Information www freescale com Freescale Semiconductor Inc Introduction References Table 1 1 Supported DSP56800x Processors for CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllersantine DSP56800 DSP56800E MC56F8367 MC56F8122 MC56F8123 MC56F8145 MC56F8146 MC56F8147 MC56F8155 MC56F8156 MC56F8157 MC56F8165 MC56F8166 MC56F8167 References e Your CodeWarrior IDE includes these manuals Code Warrior IDE User s Guide CodeWarrior Develop
161. e M56800E Processor settings panel large data model Large 24 0 to 16 777 215 Data Model is enabled 120 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Calling Conventions and Stack Frames Table 6 2 shows the sizes and ranges of the floating point types Table 6 2 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 Calling Conventions and Stack Frames The DSP56800E compiler stores data and call functions differently than the DSP56800 compiler does Advantages of the DSP56800E method include more registers for parameters and more efficient byte storage Passing Values to Functions The compiler uses registers A B R1 R2 R3 R4 YO and Y1 to pass parameter values to functions Upon a function call the compiler scans the parameter list from left to right using registers for these values The first two 16 bit integer values YO and Y1 The first two 32 bit integer or float values A and B The first four pointer parameter values R2 R3 R4 and R1 in that order e The third and fourth 16 bit integer values A and B provided that the compiler does not use these registers for 32 bit parameter values e
162. e R1 address register for modulo use also enables the RO address register for modulo use This is true evenif__ mod _ init or _ mod _initint16 have not explicitly initialized RO 5 A successful API call does not clear the error code from the error variable Only function mod_stop clears the error code Modulo Addressing Error Codes If you want to register a static variable for error code storage use__ mod_error In case of an error occur this static variable will contain one of the values Table 11 3 explains Table 11 4 lists the error codes possible for each modulo addressing intrinsic function Table 11 3 Modulo Addressing Error Codes 278 Code Meaning 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 made 13 R1 modulo pointer is already initialized An extraneous call to mod_init or _mod_initint1 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 Targeting MC56F83xx DSP5685x Controllers
163. e main window The CodeWarrior IDE automatically handles the dependencies among project files and stores compiler and linker settings for each build target The IDE tracks which files have changed since your last build recompiling only those files during your next project build Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process A Code Warrior project is analogous to a collection of makefiles as the same project can contain multiple builds Examples are a debug version and a release version of code both part of the same project As earlier text explained build targets are such different builds within a single project Editing Code The CodeWarrior text editor handles text files in MS DOS Windows UNIX and Mac OS formats To edit a source code file or any other editable project file either e Double click its filename in the project window or e Select highlight the filename then drag the highlighted filename to the CodeWarrior main window The IDE opens the file in the editor window Figure 3 3 This window lets you switch between related files locate particular functions mark locations within a file or go to a specific line of code Figure 3 3 Editor Window i51xi b m El dl Path C Program Files Metrowerks CodeWarrior Ex M56800E_main c lt gt a define SIZE 10 E i
164. e not on the system A part of the normal address space is mapped to I O ports A read write to that memory location triggers an access to the I O device though to the program it seems like a normal memory access Even if one byte is written to in the space allocated to a peripheral register the whole register is written to So the other byte of the peripheral register will not retain its data This may happen because the compiler generates optimal bit field instructions with a read byte mask writeback byte code sequence Compiler Generates Bit Instructions The compiler generates BFSET for I BFCLR for amp and BFCHG for operators Listing 6 7 shows a C source example and the generated sample code Listing 6 7 C Source Example int i int ip void main void i amp 1 146 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc generated codes P 00000082 8054022D0001 ip 1 generated codes P 00000085 F87C022C P 00000087 84400001 int 0x1234 1 generated codes P 00000089 E4081234 P 0000008B 82400001 generated codes P 0000008D E708 C for DSP56800E Working with Peripheral Module Registers bfclr 1 X 0x00022d moveu w X 0x00022c R0 bfchg 1 X RO move 1 4660 R0 bfset 1 X RO rts Note the following example define word int union word Word struc
165. e target settings panels Targeting MC56F83xx DSP5685x Controllers 43 For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview e Links identify the panels specific to DSP56800E projects Click the link to go to the explanation of that panel The Use column explains the purpose of generic IDE panels that also can apply to DSP56800E projects For explanations of these panels see the IDE User Guide Table 4 1 Target Setting Panels Group Panel Name Use Target Target Settings Access Paths Selects the paths that the IDE searches to find files of your project Types include absolute and project relative Build Extras Sets options for building a project including using a third party debugger File Mappings Associates a filename extension such as c with a plug in compiler Source Trees Defines project specific source trees root paths for your project M56800E Target Language Settings C C Language C Only C C Preprocessor C C Warnings M56800E Assembler Code Generation ELF Disassembler M56800E Processor Global Optimization Configures how the compiler optimizes code Linker M56800E Linker Editor Custom Keywords Changes colors for different types of text 44 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table 4 1
166. e the application to customers NOTE Another debugging feature of the CodeWarrior IDE is viewing preprocessor output This helps you track down bugs cause by macro expansion or another subtlety of the preprocessor To use this feature specify the output filename in the project window then select Project gt Preprocess from the main window menu bar A new window opens to show the preprocessed file Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 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 The target settings control e Compiler options Linker options e Assembler options e Debugger options 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 NOTE Use the DSP56800E project stationery when you create a new project Target Setting Panels Table 4 1 lists th
167. eck for updates click the Yes button the CodeWarrior updater opens 2 To check for updates NOTE If the updater already has Internet connection settings you may proceed directly to substep f a Click the Settings button the Updater Settings dialog box appears b Click the Load Settings button the updater loads settings from your Windows control panel c Modify the settings as appropriate d If necessary enter the proxy username and the password e Click the Save button the Updater Settings dialog box disappears f In the updater screen click the Check for Updates button g If updates are available follow the on screen instructions to download the updates to your computer h When you see the message Your version is up to date click the OK button the message box closes Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE i Click the updater Close button the installation resumes j At the prompt to restart the computer select the Yes option button k Click the Finish button the computer restarts completing installation 3 To register the CodeWarrior software a Select Start gt Programs gt Metrowerks CodeWarrior gt CodeWarrior for Freescale 56800 E Hybrid Controllers R7 0 gt Code Warrior IDE the registration window appears Figure
168. ection name is for your reference the section name must begin with a filename c text put the text section from filename c Targeting MC56F83xx DSP5685x Controllers 283 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax 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 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 12 6 Listing 12 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 12 7 Listing 12 7 Sample ALIGNALL Command Usage file c text ALIGNALL 0x10 everything past this
169. ed Linker includes full path names for source files Default Clear Linker uses only file names This checkbox is available only if the Generate Symbolic Info checkbox is checked Generate Link Map checkbox Checked Linker generates a link map Enables subordinate checkboxes List Unused Objects Show Transitive Closure and Annotate Byte Symbols Clear Linker does not generate a link map A link map shows which file provided the definition of each object and function the address of each object and function a memory map of section locations and values of linker generated symbols It also lists unused but unstripped symbols 68 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 11 M56800E Linker Panel Elements continued objects in the link map Element Purpose Comments List Unused Checked Linker includes unused objects This checkbox is available only if the Objects in the link map Generate Link Map checkbox is checkbox Clear Linker does not include unused checked Show Transitive Closure checkbox Checked Link map includes a list of all objects that main references Clear Link map does not include this list Text after this table includes an example list This checkbox is available only if the Generate Link Map che
170. ed and tuned with the DSP56800x New Project Wizard in mind The DSP56800x New Project Wizard creates the entire simulator project with all the available targets in context of Stationery as documentation and example 356 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface DSP56800x New Project Wizard Graphical User Interface This section describe the DSP56800x New Project Wizard graphical user interface The subsections in this section are Invoking the New Project Wizard New Project Dialog Box Target Pages Program Choice Page Data Memory Model Page External Internal Memory Page Finish Page Invoking the New Project Wizard To invoke the New Project dialog box from the Metrowerks CodeWarrior menu bar select File gt New Figure B 1 Figure B 1 Open Ctrl 0 nvoking the DSP56800x New Project Wizard la x Debug Proces Expert kaar m Y amp BE ip Open Workspace Save Workspace Save Workspace As rents Import Project Page Setup Brin Open Recent Exit I TOp a Targeting MC56F83xx DSP5685x Controllers 357 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface New Project Dial
171. ed variables will be incorrect It is the user s responsibility to enable pragma check inline sp effects if they desire to modify the SP with inline assembly and access local stack based variables Note this pragma has no effect in function level assembly functions or separate assembly only source files asm files In general inline assembly may be used to create arbitrary flow graphs and not all can be detected by the compiler For example REP 3 ADDA 2 SP This example would modify the SP by three but the compiler would only see a modification of one Other cases such as these might be created by the user using inline jumps or branches These are dangerous constructs and are not detected by the compiler Targeting MC56F83xx DSP5685x Controllers 127 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E User Stack Allocation In cases where the SP is modified by a run time dependent amount a warning is issued Listing 6 1 Example 1 Legal modification of SP Using Inline Assembly define EnterCritical asm adda 2 SP asm move l1 SR X SP asm bfset 0x0300 SR asm nop asm nop define ExitCritical asm deca 1 SP asm move l x SP SR asm nop asm nop pragma check _ inline sp effects on int func int a 1 b 1 Cc EnterCritical C a b ExitCritical This case will work because there are no control
172. eful 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 339 _eonce_StartTraceBuffer Resumes trace buffer capturing Prototype int _eonce StartTraceBuffer Parameters None Remarks This function causes the trace buffer to immediately start capturing Returns Error code as defined in the sub section Definitions on page 339 _eonce_HaltTraceBuffer Halts trace buffer capturing Prototype int _eonce HaltTraceBuffer Targeting MC56F83xx DSP5685x Controllers 337 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Parameters None Remarks Causes the trace buffer to immediately stop capturing Returns Error code as defined in the sub section Definitions on page 339 _eonce _ EnableDEBUGEV Allows or disallows a DEBUGEV instruction to cause a core event in breakpoint unit 0 Prototype int _eonce EnableDEBUGEV char enable Parameters enablechar If a non zero value allows the DEBUGEV instruction to cause a core event If a zero value prevents the DEBUGEYV instruction from causing a core event 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
173. elects the register layout An initialization file consists of text instructions telling the debugger how to initialize the hardware after reset but before downloading code You can use initialization file commands to assign values to registers and memory locations and to set up flash memory parameters The initialization files of your IDE are on the path CodeWarrior path M56800E Support initialization Targeting MC56F83xx DSP5685x Controllers 75 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels The name of each initialization file includes the number of the corresponding processor such as 568345 Each file with _ext enables the processor s external memory If the processor has Flash memory the initialization file with _flash enables both Flash and external memory To set up an initialization file 1 In the debugging M56800E Target panel check the Use initialization file checkbox 2 Specify the name of the initialization file per either substep a or b a Type the name in the Use initialization file text box If the name is not a full pathname the debugger searches for the file in the project directory If the file is not in this directory the debugger searches on the path CodeWarrior path M56800E Support initialization directory b Click the Choose button the Choose file dialog box appears Navigate to th
174. en though segmentNames are not required to start with the period character by the linker as is the case with sectionName ALIGN 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 location counter use an assignment such as Example ALIGN 0x10 update location counter to 16 byte alignment ALIGNALL 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 296 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing 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 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 SECT
175. eparate character data sections the compiler puts character data and structures containing character data into these sections e data char initialized static or global character data objects e bss char uninitialized static or global character data objects e const data char const qualified character objects and static string data You can locate these data sections in the lower half of the memory map making sure that the data can be addressed ELF Disassembler Use the ELF Disassembler panel Figure 4 9 to specify the content and display format for disassembled object files Table 4 10 explains the elements of this panel To view a disassembled module select Project gt Disassemble from the main window menu bar Figure 4 9 ELF Disassembler Panel ELF Disassembler V Show Headers TT Verbose Info J Show Symbol and String Tables M Show Relocations J Show Code Modules IV Use Extended Mnemonics I Show Source Code M Show Addresses and Object Code Y Show Comments Show Data Modules I Disassemble Exception Tables Show Debug Info Targeting MC56F83xx DSP5685x Controllers 65 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 10 ELF Disassembler Panel Elements Element Purpose Comments Show Headers Checked Disassembled output includes Tables checkbox checkbox ELF he
176. ers 129 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E User Stack Allocation asm nop pragma check _ inline sp effects on int func int a 1 b 1 c if a EnterCritical c a b else EnterCritical c b return b c This example will generate the following warning Warning Cannot determine SP modification value at compile time M56800E main c line 20 EnterCritical This example is not legal since the SP is modified by run time dependent amount If all inline assembly modifications to the SP along all branches are equal approaching the exit of a function it is not necessary to explicitly deallocate the increased stack space The compiler cleans up the extra inline assembly stack allocation automatically at the end of the function Listing 6 4 Example 4 Automatic Deallocation of Inline Assembly Stack Allocation pragma check _ inline sp effects on int func int a 1 b 1 Cc if a 130 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Data Alignment Requirements EnterCritical c a b else EnterCritical c D return b c This example does not need to call the ExitCritical macro because the compiler will automatically clean up the extra inline assembly stack allocation Data Ali
177. es as set in the count parameter if N follows an operation then the combination of the sub triggers must occur N 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 The defined identifiers listed in Listing 14 3 must be OR ed into the options parameter of the _eonce_SetCounterTrigger function A key for the defined identifiers listed in Listing 14 3 is given in Table 14 6 B1PA B1P B1PW B2P R zy B1XA_OR_B2PF B1P F OR_B2PF B1PA_OR_B2PF B1X R_AND_B2DR B1XW_AND_B2DW B1XA_AND_B2DRW B1PF_THEN_B2PF B1PA_THEN B2PF B2PF_THEN B1PA B1XA_THEN B2PF B2PF_THEN B1XA B1XW_THEN B2PF B2PF_THEN_B1XW B1XR_THEN_B2PF B2PF_THEN_B1XR B1PF_SC_B2PF_HC 342 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com B1PA_SC_B2PF_HC B2PF_SC_B1PA HC Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 6 Defined Identifier Key Counter Trigger Modes Identifier Fragments Description B1 breakpoint 1 value set in value 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 f
178. everal 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library To use the EOnCE library you must include it in your project The name of the file is eonce 56800E 1mm lib 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 _eonce_GetCounters e _eonce_GetCounterStatus e _eonce_SetupTraceBuffer e _eonce_GetTraceBuffer e _eonce ClearTraceBuffer e _eonce StartTraceBuffer e eonce HaltTraceBuffer _eonce EnableDEBUGEV e _eonce_EnableLimitTrigger The sub section Definitions on page 339 defines e Return Codes e Normal Trigger Modes e Counter Trigger Modes e Data Selection Modes e Counter Function Modes Normal Unit Action Options e Counter Unit Action O
179. existing project you can restore the 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 MC56F83xx DSP5685x Controllers 47 For More Information www freescale com Freescale Semiconductor Inc 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 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 IDE User Guide Custom Keywords Use this panel to change the colors that the CodeWarrior IDE uses for different types of text
180. fit into flash targets e Use the Flash stationery when creating a new project intended for ROM The default stationery contains the Flash configuration file and debugger settings required to use the Flash programmer 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 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 Targeting MC56F83xx DSP5685x Controllers 223 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Notes for Debugging on Hardware e The M56800E cannot single step over certain 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 te
181. g padding added between struct members no notused result of non void returning function not used no unusedexpr use of expressions as statements without side effects no ptrintconv conversions from pointers to integers and vice versa display dump display list of active warnings Linker Command Line Linker Options dis assemble global disassemble object code and do not link implies nostdlib L 1 path global cased add library search path default 316 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments is to search current working directory and then system directories see defaults search paths have global scope over the command line and are searched in the order given lr path 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 no defaults global same as no stdlib default nofail continue importing or disassembling after errors in earlier files no stdlib global use system library access paths specified by MWLibraries and add system H libraries specified by 1 file S MWLibraryFiles H default S global cased disassemble and send ou
182. g 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 NOTE Fill Memory does not support Flash Memory Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Fill Memory 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 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 that appears NOTE 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 t
183. g panel Figure 4 11 Figure 4 12 to set parameters for communication between a DSP56800E board or Simulator and the CodeWarrior DSP56800E debugger Table 4 12 explains the elements of this panel NOTE Communications specifications also involve settings of the debugging M56800E Target panel Figure 4 13 Figure 4 11 Remote Debugging Panel 56800E Simulator N Remote Debugging Connection Settings Connection 568006 Simulator v Edit Connection r Remote download path P Launch remote host application OE o Figure 4 12 Remote Debugging Panel 56800E Local Connection Remote Debugging r Connection Settings Connection 56800E Local Hardware Connection y Edit Connection m Remote download path 7 Launch remote host application _ 2 o la Clock Speed 600 72 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table 4 12 Remote Debugging Panel Elements Target Settings DSP56800E Specific Target Settings Panels Element Purpose Comments Connection list box Specifies the connection type e 56800E Simulator appropriate for testing code on the simulator before downloading code to an actual board 56800E Local Hardware Connection CSS appropriate for using your computer s command converter server connected to a DSP56800E board Selecting 56800E S
184. get Selection Page DSP56F803 DSP56F805 DSP56807 DSP56F826 DSP56F827 Next Page Program Choice Page Targeting MC56F83xx DSP5685x Controllers Next Page Next Page External Internal Finish Page Memory Page For More Information www freescale com 353 Freescale Semiconductor Inc DSP56800x New Project Wizard Overview Table B 4 Page Rules for the DSP56852 DSP56853 DSP56854 DSP56855 DSP56857 and DSP56858 354 Target Selection Page DSP56852 DSP56853 DSP56854 DSP56855 DSP56857 DSP56858 Next Page Program Choice Page Next Page Finish Page Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Selection Page MC56F8322 MC56F8323 MC56F8345 MC56F8346 MC56F8356 MC56F8357 MC56F8365 MC56F8366 MC56F8367 MC56F8122 MC56F8123 MC56F8145 MC56F8146 MC56F8147 MC56F8155 MC56F8156 MC56F8157 MC56F8165 MC56F8166 MC56F8167 For More Information www freescale com Next Page Program Choice Page Targeting MC56F83xx DSP5685x Controllers Next Page Data Memory Model Page DSP56800x New Project Wizard Next Page if Processor Expert Not Selected External Internal Memory Page Overview Table B 5 Page Rules for the MC56F8322 MC56F8
185. gging protocol To test software installation create a sample project Follow these steps For More Information www freescale com 23 Freescale Semiconductor Inc Getting Started Creating a Project 24 1 Select Start gt Metrowerks CodeWarrior gt CW for DSP56800 R7 0 gt CodeWarrior IDE The IDE starts the main window appears To create a DSP56800x project use either the e DSP56800x new project wizard e DSP56800x EABI stationery To create a new project with the DSP56800x new project wizard please see the sub section Creating a New Project with the DSP56800x New Project Wizard To create a new project with the DSP56800x EABI stationery please see the sub section Creating a New Project with the DSP56800x EABI Stationery Creating a New Project with the DSP56800x New Project Wizard In this section of the tutorial you work with the CodeWarrior IDE to create a project with the DSP56800x New Project Wizard To create a project 1 From the menu bar of the Metrowerks CodeWarrior window select File gt New The New dialog box Figure 2 3 appears Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project Figure 2 3 New Dialog Box New xl Project File Object dO DSP56800x EABI Stationery Project name KE DSP56800x Examples Stationery the_project dl DSP56800x New Project Wizard
186. gin 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 specified else 1 Targeting MC56F83xx DSP5685x Controllers 309 For More Information www freescale com Command Line Tools Arguments no defaults dis assemble E EP line ext extension gccinc ludes I i p ir path Freescale Semiconductor Inc global passed to linker same as no stdinc default global passed to all tools disassemble files to stdout global cased preprocess source files global cased preprocess and strip out 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 include only system paths are searched with include Se global cased appe
187. gn by defining application behavior rather than by focussing on how the microcontroller works Extensible beans library This library supports many microprocessors peripherals and virtual devices Beans wizard This external tool helps developers create their own custom beans Extensive help information You access this information either by selecting Help from the Program Expert menu or by clicking the Help button of any Processor Expert window or dialog box Processor Expert Code Generation The PEI manages your CPU and other hardware resources so that you can concentrate on virtual prototyping and design Your steps for application development are 1 Creating a CodeWarrior project specifying the Processor Expert stationery appropriate for your target processor Configuring the appropriate CPU bean Selecting and configuring the appropriate function beans Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview 4 Starting code design that is building the application As you create the project the project window opens in the IDE main window This project window has a Processor Expert page Figure 5 1 The Processor Expert Target CPU window also appears at this time So does the Processor Expert bean selector window although it is behind the Target CPU window Figure 5 1 Project Window Pro
188. gnment Requirements The data alignment rules for DSP56800E stack and global memory are e Bytes byte boundaries Exception bytes passed on the stack are always word aligned residing in the lower bytes e Words word boundaries Longs floats and doubles double word boundaries 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 odd e Structures word boundaries not byte boundaries NOTE A structure containing only bytes still is word aligned Targeting MC56F83xx DSP5685x Controllers 131 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Data Alignment Requirements e Structures double word boundaries if they contain 32 bit elements or if an inner structure itself is double word aligned e Arrays the size of one array element Word and Byte Pointers The alignment requirements explained above determine how the compiler uses DSP56800E byte and word pointers to implement C pointer types The compiler uses e Word pointers for all structures The SP to access the stack resident data of all types Bytes Shorts Longs
189. guage and Intrinsics Intrinsic Functions Prototype void _ mod stop int lt mod_desc __mod_getint16 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 Prototype int _ mod getintl16 int lt mod_desc gt int lt amount gt 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_ setint16 274 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 _setint16 int lt mod_desc gt int lt int_expr gt int lt amount gt di Example Write the modulo buffer with a value derived from an expression do not update modulo pointer Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions _ mod setintl6 0 getrandomint 0 __ mod_ error Set up a modulo error variable Th
190. he saturation requirements and the bidirectional capability See the intrinsic shrtNs which is 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 Word16 shr Word16 sval2shft Word16 s shftamount Example short result short sl 0x2468 short s2 1 result shr s1 s2 Expected value of result 0x1234 Targeting MC56F83xx DSP5685x Controllers 263 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions shr_r 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 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 shrtNs which is 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 Word16 shr_r Word16 s val2shft Word16 s_shftamount Example short result short sl 0x2468 short s2 1 result shr s1 s2 Expected value of result 0x1234 shrtNs 26
191. he 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 segmentName must start with the period character even though segmentNames are not required to start with the period character by the linker as is the case with sectionName 302 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing SIZEOFW 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 segmentName must start with the period character even though segmentNames are not required to start with the period character by the linker as is the case with sectionName WRITEB 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 WRITEH 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 Targeting MC56F83xx DSP5685x Controllers 303 For More Information www freescale com Freescale Semiconductor Inc ELF Linke
192. he special counting options are defined in the sub section Definitions on page 339 Carefully read the list of defined identifiers that can be OR ed into the options parameter Returns Error code as defined in the sub section Definitions on page 339 _eonce_ClearTrigger Clears a previously set trigger Prototype int _eonce ClearTrigger unsigned int unit Parameters unitunsigned int Specifies which breakpoint unit to use Remarks This function clears a trigger set with the _eonce_SetTrigger or _eonce_SetCounterTrigger functions Returns Error code as defined in the sub section Definitions on page 339 Targeting MC56F83xx DSP5685x Controllers 333 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library _eonce_GetCounters Retrieves the values in the two counter registers Prototype int _eonce GetCounters unsigned int unit unsigned int counter unsigned long counter2 Parameters unitunsigned int Specifies which breakpoint unit to use counterunsigned int Holds the value of the counter or the least significant 16 bits if the counter has been extended to 40 bits counter2unsigned long 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 Remarks This function retrieves the value of the counter of the
193. hing this button opens the Set Trigger panel For more information on using this panel see Set Trigger Panel on page 212 e 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 9 21 To open this panel 1 From the IDE menu bar select DSP56800E gt Setup Trace Buffer Targeting MC56F83xx DSP5685x Controllers 209 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features Figure 9 21 Trace Buffer Setup Panel Trace Buffer Setup xj m Capture Events I Change of flow not taken IV Interrupt M Subroutine M Forward branches and JCC backward branches JV Backward branches excluding JCC backward bra
194. his table includes additional information about the entry point Force Active Symbols text box Directs the linker to include symbols in the link even if those symbols are not referenced Makes symbols immune to deadstripping Separate multiple symbols with single spaces Check the Show Transitive Closure checkbox to have the link map include the list of objects main references Consider the sample code of Listing 4 1 If the Show Transitive Closure option is in effect and you compile this code the linker generates a link map file that includes the list of Listing 4 2 Listing 4 1 Sample Code for Show Transitive Closure void foot void void pad void int b int a 100 101 int main void foot pad return 1 70 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Listing 4 2 Link Map File List of main references 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 f
195. how 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 code with show verbose displays entire source file in output else shows only four lines around each function default no xtables H show exception tables default Targeting MC56F83xx DSP5685x Controllers 319 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no verbose show verbose information including hex dump of program segments in applications default Assembler Assembler Control Options no case identifiers are case sensitive default no debug generate debug information no macro_expand expand macro in listin output no assert_nop add nop to resolve pipeline dependency default no warn_nop emit warning when there is a pipeline dependency no warn_stall emit warning when there is a hardware stall no legacy allow legacy DSP56800 instructions imply data prog 16 no debug_workaround Pad nop workaround debuggin i
196. i wait 100000 Targeting MC56F83xx DSP5685x Controllers 117 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial void main void Processor Expert internal initialization DON T REMOVE THIS CODE PE low _level_init End of Processor Expert internal initialization kx Write your code here pragma warn possunwant off IRQA On IRQA GetVal IRQB On IRQB GetVal 2 1 0 1 0 for CLEARLEDS pattern pragma warn_possunwant reset END LEDcontrol e AA AH AHAHAHAH ROPA AHAHAHAH AHHAR PORRO RARA RRA de This file was created by UNIS Processor Expert 03 15 for the Freescale DSP56x series of microcontrollers kk iy HHEHHHHHHHHHHHEHHTHHHHHHHHEHHEHEHHEE HEHEHE HHEHEHEHHEHEHHE HEE RAR 118 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E This chapter explains considerations for using C with the DSP56800E processor Note that the DSP56800E processor does not support e The C language e Standard C trigonometric and algebraic floating point functions such as sine cosine tangent and square root Furthermore C pointers allow access only to X memory NOTE The DSP56800E MSL implements a few trigonometric and algebraic functions but these are mere examples that the DSP56800E does n
197. igned char buf int mode size t size Parameters rs Specifies a pointer to the communication channel Targeting MC56F83xx DSP5685x Controllers 163 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface buf Passes a pointer to an external buffer mode Passes the buffering mode as either buffered specified as HSSTFBUF or unbuffered specified as HSSTNBUF size Passes the size of the buffer Returns O if the call was successful or 1 if the call was unsuccessful 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 details see HSST_flush HSST write 164 A target application uses this function to write data for the host side client application to read Prototype size_t HSST_write void data size t size size_t nmemb HSST_ STREAM stream Parameters data Passes a pointer to the data buffer holding the data to write size Passes the size of the individual data elements to write Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface nmemb Passes the number of data elements to write stream Passes a pointer to the communication channel Returns The number of data elements written
198. imulator keeps the panel as Figure 4 11 shows Selecting Local Hardware Connection adds the JTAG Clock Speed text box to the panel as Figure 4 12 shows Remote Download Path text box Not supported at this time Launch Remote Host Application checkbox Not supported at this time JTAG Clock Speed text box Specifies the JTAG lock speed for local hardware connection Default is 500 kilohertz This list box is available only if the Connection list box specifies Local Hardware Connection CSS The HTI will not work properly with a clock speed over 500 kHz M56800E Target Debugging Use the debugging M56800E Target panel Figure 4 13 to set parameters for communication between a DSP56800E board or Simulator and the Code Warrior DSP56800E debugger Table 4 12 explains the elements of this panel NOTE Communications specifications also involve settings of the Remote Debugging panel Figure 4 11 Figure 4 12 Auto clear previous breakpoint on new breakpoint request This option is only available when you enable the Use hardware breakpoints option When you also enable the Auto clear previous hardware breakpoint and set a breakpoint the original breakpoint is automatically cleared and the new breakpoint is Targeting MC56F83xx DSP5685x Controllers 73 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels im
199. ing window appears Figure 9 24 Figure 9 24 Simulator Cycle Instruction Count mDSP568 Simulator Cycle Instructior x Machine cycles simulated 92 Machine instructions simulated 24 Reset 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 an interactive tool Press the Reset button to zero out the current machine cycle and machine instruction readings Targeting MC56F83xx DSP5685x Controllers 215 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Register Details Window Memory Map Figure 9 25 Simulator Memory Map 1FFFFF SFFFFFF Reserved FFCO Program Memory Space 7F Interrupt Vectors 0 0 P X NOTE Figure 9 25 is the memory map configuration for the simulator Therefore the simulator does not simulate each DSP568xx device s specific memory map but assumes the memory map of the DSP56824 Register Details Window From the menu bar of the Metrowerks CodeWarrior window select View gt Register Details or in the Registers window Figure 9 9 double click on the register The Register Details window appears Figure 9 26 216 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Loading a elf File without a Project
200. ings Panels Table 4 5 C C Language C Only Panel Elements continued Element Purpose Comments Use Unsigned Checked Compiler treats a char Chars checkbox declaration as an unsigned char declaration char declarations differently Clear Compiler treats char and unsigned such libraries Some libraries were compiled without this option Selecting this option may make your code incompatible with To check whether this option is in effect use the __option unsigned_char command checkbox Reuse Strings space Checked Compiler stores only one copy If you select this option changing one of identical string literals saving memory of the strings affects them all Clear Compiler stores each string literal 54 C C Preprocessor The C C Preprocessor Figure 4 5 panel controls how the preprocessor interprets source code By modifying the settings on this panel you can control how the preprocessor translates source code into preprocessed code More specifically the C C Preprocessor panel provides an editable text field that can be used to define macros set pragmas or include prefix files Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Figure 4 5 The C C Preprocessor Panel N C C Preprocessor Prefix Text
201. ings panels can affect debugging Table 9 1 lists these panels Targeting MC56F83xx DSP5685x Controllers 179 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Table 9 1 Setting Panels that Affect Debugging This panel Affects Refer to M56800E Linker symbolics linker Deadstripping and Link Order warnings M56800E Processor optimizations Optimizing Code Debugger Settings Debugging options Remote Debugging Debugging Remote Debugging communication protocol Remote Debug Debugging options Remote Debug Options Options 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 Command Converter Server The command converter server CCS handles communication between the Code Warrior 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 remote machine see Setting Up a Remote Connection on page 185 NOTE Projects are set to debug locally by default The protocol the debugger uses to communicate with the target board
202. int field in the M56800E Linker settings panel The project for the DSP56800E runtime is CodeWarrior M56800E Support runtime_56800E projects Runtime 56800E mcp Table 14 3 Library Names and Locations 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 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 Listing 14 1 Sample Initialization File DSP56852EVM 56852_init asm i Metrowerks a Freescale Company i sample description main entry point to C code i 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 326 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization section rtlib XREF F stack addr org p GLOBAL Finit M56852 __ SUBROUTINE Finit_M56852 Finit_M56852 Finit_M56852END Finit_M56852 Finit_M56852_ setup the OMr with the values required by C 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 ena
203. ints to remember 277 278 modulo buffer examples 275 277 msu_r intrinsic function 251 mult intrinsic function 252 mult_r intrinsic function 252 253 N negate intrinsic function 237 238 norm_l intrinsic function 258 norm_s intrinsic function 256 257 number formats 120 121 O OBJECT linker keyword 300 operating the debugger 188 195 optimizing code 144 145 overview development studio 35 42 overview target settings 45 P P memory viewing 197 199 panels Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C C language 51 C C warnings 56 59 ELF disassembler 65 67 M56800E assembler 60 62 M56800E linker 67 71 M56800E processor 62 M56800E target 50 51 MS56800E target debugging 73 77 remote debug options 77 79 remote debugging 72 73 target settings 49 50 panels settings 48 79 Peripheral Module Registers 146 peripherals usage inspector window 101 porting issues 349 Processor Expert beans 83 85 code generation 82 83 menu 85 88 overview 81 88 page 83 tutorial 102 118 Processor Expert interface 81 118 Processor Expert windows 89 101 bean inspector 90 91 bean selector 89 90 CPU types overview 98 installed beans overview 100 memory map 97 98 peripherals usage inspector 101 resource meter 99 target CPU 92 96 project creating 29 34 R REF_INCLUDE linker keyword 300 references 17 register details window 199 216 register values 193 19
204. ions parameter of the _eonce_SetCounterTrigger function Table 14 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 Counter Start Triggers PCLK_CLOCK_CYCLES count pclk cycles 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 14 9 must be OR ed into the options parameter of the _eonce_SetTrigger function Table 14 9 Normal Unit Actions Options Mode Defined Identifiers Description 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 UNIT_ACTION enters debug mode is unit 0 else passes signal on to next unit 344 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library 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 14 10 must be OR ed into the options parameter of the _eonce_
205. ions settings panel Deadstripping and Link Order The M56800E Linker deadstrips unused code and data only from files compiled by the CodeWarrior C compiler The linker never deadstrips assembler relocatable files or C object files built by other compilers Targeting MC56F83xx DSP5685x Controllers 145 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Working with Peripheral Module Registers Libraries built with the CodeWarrior C compiler contribute only the used objects to the linked program If a library has assembly files or files built with other C compilers the only files that contribute to the linked program are those that have at least one referenced object If you enable deadstripping the linker completely ignores files without any referenced objects The Link Order page of the project window specifies the order top to bottom in which the DSP56800E linker processes C source files assembly source files and archive a and lib files If both a source code file and a library file define a symbol the linker uses the definition of the file that appears first in the link order To change the link order drag the appropriate filename to a different place in this page s list Working with Peripheral Module Registers This section highlights the issues and recommends programming style for using bit fields to access memory mapped I O Memory mapped I O is a way of accessing devices that ar
206. ironment Variables Tool Library Description Compiler MWC56800E Includes Similar to Access Paths panel separate paths with and prefix a path with to specify a recursive path Linker MW56800E Libraries Similar to MWC56800E Includes List of library names to link with project MW56800E LibraryFiles 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 MWLibraryFiles 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 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 o out elf change output file name to out elf g generate debugging symbols 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 306 Targeting MC56F83xx DSP5685x Control
207. is information in output M56800E Linker Use the M56800E Linker panel Figure 4 10 to specify linker behavior of the linker This panel is only available if the current build target uses the M56800E Linker Table 4 11 explains the elements of this panel Targeting MC56F83xx DSP5685x Controllers 67 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Figure 4 10 M56800E Linker Panel N M56800E Linker V Generate Symbolic Info JV Store Full Path Names V Generate Link Map T List Unused Objects I Show Transitive Closure IV Annotate Byte Symbols Tl Generate S Record File Sort By Address 7 Generate Byte Addresses Entry Point Force Active Symbols Table 4 11 M56800E Linker Panel Elements Disable Deadstripping IV Generate ELF Symbol Table I Supress Waring Messages Max Record Lenath 252 EOL Character Finit_sim_ debugging information Element Purpose Comments Generate Checked Linker generates debugging If you select Project gt Debug from the Symbolic Info information within the linked ELF file main window menu bar the IDE checkbox Clear Linker does not generate automatically enables this option Clearing this checkbox prevents you from using the CodeWarrior debugger on your project it also disables the subordinate Store Full Path Names checkbox Store Full Path Names checkbox Check
208. is 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 al 1 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 Targeting MC56F83xx DSP5685x Controllers 221 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Debugging in the Flash Memory 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 target_code_sets_hfmclkd 110 If you set this to 1 the debugger uses an alternate launch sequence First the flash memory is loaded Next the processor is reset to clear the hfmclkd register to allow the correct divider to be set for the new system speed as set by the PLL Finally if needed the RAM is loaded When this option is enabled the hfmclkd register needs to be loaded in the startup code For more details on setting the hfmclkd register see the chapter Flash Memory i
209. is function registers a static 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 of the last error A successful 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 Listing 11 11 and Listing 11 12 are two modulo buffer examples Listing 11 11 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 Targe
210. isticated processor to display internal peripherals Figure 5 7 Target CPU Window Package and Peripherals Target CPU Cpu 56F8346 AO A AD A E Q E a lx Targeting MC56F83xx DSP5685x Controllers 93 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows In such a case you can click the Always show internal peripheral devices control button Figure 5 8 shows that this expands the picture size as necessary to allow the peripheral representations This view also includes bean icons blue circles attached to the appropriate processor pins Use the scroll bars to view other parts of the processor picture Figure 5 8 Target CPU Window Peripherals and Bean Icons Target CPU Cpu DSP56F836 T ja a a0 H an m ap o api Pweatim PuYMAtim 94 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Click the Show MCU Block Diagram to change the picture to a block diagram as Figure 5 9 shows Use the scroll bars to view other parts of the diagram You can bring up the block diagram as you open the Target CPU window by selecting Processor Expert gt View gt Target CPU Block Diagram from the main window menu bar Figure 5 9 Target CPU Window Block Diagram lol j PHASEB HOME PHAY PORT D PORTET PORTIA O ANO ANET
211. k reliably Clear Does not insert such NOPs If you select this option you should select the same option in the M56800E Processor Settings panel Selecting this option increases code size by 5 percent But not selecting this option risks nonrecovery after the debugger comes to breakpoint branch instructions Emit Warnings for odd SP Increment Decrement checkbox Checked Enables assembler warnings about instructions that could misalign the stack frame Clear Does not enable such warnings Targeting MC56F83xx DSP5685x Controllers 61 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 8 M56800E Assembler Panel Elements continued Element Purpose Comments Default Data Memory Model list box Specifies 16 or 24 bits as the default size Factory setting 16 bits Default Program Memory Model list box Specifies 16 19 or 21 bits as the default size Factory setting 19 bits Prefix File text box Specifies a file to be included at the beginning of every assembly file of the project Lets you include common definitions without using an include directive in every file M56800E Processor Use the M56800E Processor panel Figure 4 8 to specify the kind of code the compiler creates This panel is available only if the current build target uses the M56800E
212. ks available are e Symbol level 282 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Structure of Linker Command Files Use FORCE ACTIVE to include a symbol into the link that would not be otherwise included An example is shown in Listing 12 2 Listing 12 2 Sample Symbol level Closure Block FORCE ACTIVE break handler interrupt _handler my function e Section level Use KEEP_ SECTION when you want to keep a section usually a user defined section in the link Listing 12 3 shows an example Listing 12 3 Sample Section level Closure Block KEEP SECTION interruptl interrupt2 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 12 4 shows an example of this Listing 12 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 12 5 NOTE As shown in Listing 12 5 the bss section always needs to be put at the end of a segment or in a standalone segment because it is not a loadable section Listing 12 5 Sample SECTIONS Segment SECTIONS section name the s
213. language instructions you can call assembly language functions For example if pmemwrite is an assembly language function the assembly language calling statement is jsr Fpmemwrite 232 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Intrinsic Functions This section explains CodeWarrior intrinsic functions It consists of these sections Implementation Fractional Arithmetic Intrinsic Functions for Math Support Modulo Addressing Intrinsic Functions Implementation The CodeWarrior IDE for DSP56800E has intrinsic functions to generate inline assembly language instructions These intrinsic functions are a CodeWarrior extension to ANSI C Use intrinsic functions to target specific processor instructions For example Intrinsic functions let you pass in data for specific optimized computations For example ANSI C data representation rules may make certain calculations inefficient forcing the program to jump to runtime math routines Such calculations would be coded more efficiently as assembly language instructions and intrinsic functions Intrinsic functions can control small tasks such as enabling saturation One method is using inline assembly language syntax specifying the operation in an asm block every time that the operation is required But intrinsic functions let you merely set the appropriate
214. le Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions wait Generates a WAIT instruction which places the processor in the low power WAIT mode Prototype void wait void Usage wait turn_off_conv_rndg Generates a sequence for disabling convergent rounding by setting the R bit in the OMR register and waiting for the enabling to take effect NOTE If convergent rounding is disabled the assembler performs 2 s complement rounding Prototype void turn_off_conv_rndg void Usage turn off conv_rndg turn_off_sat 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 Targeting MC56F83xx DSP5685x Controllers 243 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Prototype void turn off sat void Usage turn _ off sat turn_on_conv_rndg Generates a sequence for enabling convergent rounding by clearing the R bit in the OMR register and waiting for the enabling to take effect Prototype void turn_on conv_rndg void Usage turn _on_conv_rndg turn_on_sat 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_
215. le 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 gt gt fileName Writes the segment to a new file Appends the segment to an existing file Targeting MC56F83xx DSP5685x Controllers 299 For More Information www freescale com ELF Linker Freescale Semiconductor Inc Linker Command File Keyword Listing OBJECT 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 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 300 A basic SECTIONS directive has the following form Prototype SECTIONS lt section_spec gt section_spec is one of the following e sectionName AT loadAddress contents gt segmentName e section
216. lers For More Information www freescale com 137 Freescale Semiconductor Inc C for DSP56800E Packed Structures Support Packed Structures Support This feature allows a better data layout for long data type members in structures It is actually a particular case for the feature that allows all long data types to be aligned only on 2 bytes of boundary The default alignment for this case is overridden so that their alignment is set to a word 2 bytes boundary instead of a long word 4 bytes boundary The reason behind the default alignment rule is that accessing a long data type at addresses that are not aligned on a 4 byte boundary results in an unaligned access exception The DSP56800E compiler only supports the following syntax _ attribute packed aligned 2 which allows data types that are 4 byte long to be aligned on a 2 byte boundary This is the case for long data type and pointers to any data type in the large memory model Consider the following two data structures with identical data members one packed and the other unpacked and assume compilation of the large data model struct attribute packed aligned 2 STagl char c long 1 char cl char pc S1 struct STag2 char c long 1 char cl char pc S2 The size of S1 is 12 bytes while the size of S2 is 16 bytes NOTE It is your responsibility to inform the compiler about pointer access to misaligned structure members For instance
217. lers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Sample Build Script 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 path to compiler REM set includes path set MWCIncludes COMPILER S M56800E Support set MWLibraries COMPILER S M56800E Support set MWLibraryFiles Runtime 56800E Lib MSL C 56800E 1lib REM add CLT directory to PATH set PATH PATHS COMPILER DSP56800E EABI Tools Command_Line Tools 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 SAFILELISTS mwld56800e SLOPTIONSS SLFILELISTS SLCF Arguments General Command Line Options General Command Line Options All the options are passed to the linker unless otherwise Please see help usage for details about the meaning of Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com noted this help 307 Freescale Semiconductor Inc Command Line Tools Arguments help keyword 1 global for this tool H display help usage H show usage information
218. les but unused variables option checkbox Clear Compiler does not perform such To check whether this option is in checks effect use the option warn_unusedvar command Unused Checked Compiler checks for declared The pragma unused overrides this Arguments but unused arguments option checkbox Clear Compiler does not perform such Another way to override this option is checks clearing the ANSI Strict checkbox of the C C Language C Only panel then not assigning a name to the unused argument To check whether this option is in effect use the option warn_unusedarg command 58 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 7 C C Warnings Panel Elements continued Element Purpose Comments Missing return Statements Checked Compiler checks for missing return statements Clear Compiler does not perform such checks See pragma warn_missingreturn Expression Has No Side Effect Checked Compiler issues warning if expression has no side effect Clear Compiler does not perform such checks See pragma warn_no_side_effect Extra Commas checkbox Checked Compiler checks for extra commas in enums Clear Compiler does not perform such checks To check whether this option is in effect use the
219. llers Opens the first page of a description database of all beans 87 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 5 1 Processor Expert Menu Selections continued Item Subitem Action Embedded Beans Opens the first page of a description database of Categories beans organized by category Supported CPUs Opens the list of processors and tools that the Compilers and Debuggers PEI plug in supports PESL Library User Manual Opens the Processor Expert System Library for advanced developers User Guide Opens a pdf guide that focuses on the DSP56800 E processor family Search in PDF Opens documentation of the target processor in Documentation of the a pdf search window Target CPU Go to Processor Expert Opens your default browser taking you to the Home Page PEI home page About Processor Expert Opens a standard About dialog box for the PEI Update Update Processor Exert Opens the Open Update Package window You Beans from Package can use this file selection window to add updated or new beans which you downloaded over the web to your project Check Processor Expert Checks for updates available over the web If Web for updates any are available opens your default browser so that you can download them Bring PE Windows to none Moves PEI windows to the front of your monitor Front screen Arr
220. lude lt cstdlib gt unsigned _stdcall HSSTClientMain void pArguments define buf size 1000 Data size 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 Targeting MC56F83xx DSP5685x Controllers 161 For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface return 0 Target Library Interface This section describes the API calls for using High Speed Simultaneous Transfer ASST from your target application At the end of this section an example of a HSST target program is given Listing 7 2 on page 169 HSST_open A target application uses this function to open a bidirectional communication channel with the hos
221. m the main window menu bar Figure 5 2 Bean Selector BeanSelector Selector a oj x Bean Categories On Chip Peripherals Quick help gt amp CPU E 5 CPU external devices 3 CPU internal peripherals 35 Communication gt Converter amp Interrupts gt Measurement E Memory amp Peripheral beans amp Port I O sO m5 S BitsiO S M Byte210 S M Byte3l0 Filter al CPU Licensed W7 The bean selector s tree structures list all available beans double clicking the name adds the bean to your project Clicking the Quick Help button opens or closes an explanation pane that describes the highlighted bean amp Once you determine the appropriate beans you use the Bean Inspector Figure 5 3 to fine tune each bean making it optimal for your application 84 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Figure 5 3 Bean Inspector Bean Inspector AM1 AsynchroMaster loj x Bean Items Visibility Help roperties Methods Events Comment Channel SCIO SCIO Interrupt se Disable Settings Parity wake up r hardware wake up Width Stop bit Receiver Transmitti Di Baud rate Stop in wait Initializatior BS e SSS e El Si BASIC ADVANCED EXPERT 7
222. m will register your Metrowerks product and maintenance and technical support agi nt If you have questions regarding registration or licensing click Step 1 Enter your registration code Items marked with an are required Do you have a Technical Support Certificate or Annual License Certificate for this product a 4 gt El Done ak 4 Internet 7 c Follow the instructions to complete the registration Metrowerks will send you the license authorization code to your e mail address d Close the web browser window e Check your e mail and retrieve the license authorization code NOTE If you encounter difficulty during the registration process send an e mail to License metrowerks com f From the CodeWarrior menu bar select Help gt License Authorization the License Authorization dialog box appears g Enter the license authorization code that Metrowerks sent you NOTE To avoid transcription errors we recommend that you copy and paste the license authorization code rather than typing it in Metrowerks license authorization codes do not contain the letters O or I h Click the OK button this completes the installation and registation Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Table 2 2 Creating a Project Targeting MC56F83xx DSP5685x Controllers Freescale Semiconductor Inc Getting Started Creating a Proj 4 Your Code
223. maxerrors max specify maximum number of errors to print zero search 308 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments 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 default gcc use GCC like message style IDE use CW IDE like message style parseable use context free machine parseable message style no stderr global use separate stderr and stdout streams if using nostderr stderr goes to stdout Compiler Preprocessing Precompiling and Input File Control Options cC global compile only do not link no codegen global generate object code no convertpaths global 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 cwd keyword specify include searching semantics before searching any access paths the path specified by this option will be searched proj be
224. me H SST Data Type signed 32 bit v signed 16 bit F signed 32 bit unsigned 8 bit unsigned 16 bit unsigned 32 bit Floating Point he Channel Name The Channel Name text field lets you specify the name of the HSST stream to be plotted Data Type coca mo The Data Type list box lets you select the type of data to be plotted Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Data Visualization Graph Window Properties Graph Window Properties To change the look of the graph window click the graph properties button to open the Format Axis dialog box Figure 8 7 Format Axis Dialog Box Axis Scale auto when checked Y Minimum Ea Y Major unit maa M Maximum a 1 Minor unit I Logarithmic scale Y Axis Scale auto when checked Y Minimum Pp MV Major unit 35 lv Maximum Minor unit a I Logarithmic scale rm Display Units _ Show display units on label No of Points fioo Cancel Scaling The default scaling settings of the data visualization tools automatically scale the graph window to fit the existing data points To override the automatic scaling uncheck a scaling checkbox to enable the text field and enter your own value To scale either axis logarithmically enable the Logarithmic Scale option of the corresponding axis Targeting MC56F83xx DSP5685x Co
225. mediately set If you disable the Auto clear previous hardware breakpoint option and attempt to set another breakpoint you will be prompted the following message Hardware Breakpoint Already Set x Clear the previous breakpoint and set the new one Yes to all No If you click the Yes button the previous breakpoint is cleared and the new breakpoint is set If you click the Yes to all button the Auto clear previous hardware breakpoint option is enabled and the previously set breakpoint is cleared out without prompting for every subsequent occurrence If you click the No button the previous breakpoint is kept and the new breakpoint request is ignored Figure 4 13 Debugging M56800E Target Panel MV Always reset on download Use initialization file Breakpoint Mode Hw Only Automatic y Auto clear previous hardware breakpoint Target OS BareBoard v Processor 74 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 13 Debugging M56800E Target Panel Elements Element Purpose Comments Always reset on download checkbox Checked IDE issues a reset to the target board each time you connect to the board Clear IDE does not issue a reset each time you connect to the target board Use initialization file checkbox Checked After a reset the ID
226. memory from the menu bar of the Metrowerks CodeWarrior window select Data gt View Memory The Memory window appears Figure 9 11 2 Select type of memory Locate the Page list box at the bottom of the View Memory window Select P for P Memory 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 4 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 9 12 Targeting MC56F83xx DSP5685x Controllers 197 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger Figure 9 12 View P Memory Raw Data Window Pies Display 0 82 View Raw data y N Hex 00000002 00001002 7B8C BSSA FSFF 4887 7800 SAEO OOF1 0B70 7CA6 OOE 7BS2 4887 0200 1FD8 9A14 7E9F 7B32 4837 2600 1FD8 54E2 7ES9F 7B32 4887 4A00 1FD8 54E2 9414 00000082 DODODOSA 00000092 DODODOSA Ha 2 e J n Te oe oo0000A2 DOODDODAA 00000062 DODODOBA oooo00c2 Word Size 16 y e Disassembly Figure 9 13 BESA FSFF 1FFO 7F30 7FBO 29E0 DOE 1FFO B7SA FSFF SAES 54E2 1049 1FFO B43A FSFF 2389 54E2 28E0 B6SA FSFF DECO 28E0 2489 0801 Page fp gt 4BDF 0000 B63A F5FF 14F0 564C 2289 7FBO 7FBO 0144 ee Ts sn Kann
227. ment you can instruct the compiler to 1 Store all local variables on the stack That is do not perform register coloring The compiler loads and stores local variables when you read them and write to them You may prefer this behavior during debugging because it guarantees meaningful values for all variables from initialization through the end of the function To have the compiler behave this way specify optimization Level 0 in the Global Optimizations settings panel Place as many local variables as possible in registers That is do perform register coloring To have the compiler behave this way specify optimization Level 1 or higher in the Global Optimizations settings panel NOTE Optimization Level 0 is best for code that you will debug after compilation Other optimization levels include register coloring If you compile code with an optimization level greater than 0 then debug the code register coloring could produce unexpected results Variables declared volatile or those that have the address taken are not kept in registers and may be useful in the presence of interrupts Run Peephole Optimization The compiler eliminates some compare instructions and improves branch sequences Peephole optimizations are small and local optimizations that eliminate some compare instructions and improve branch sequences To have the compiler behave this way specify optimization Levels 1 through 4 in the Global Optimizat
228. ment Studio IDE 5 6 Windows Automation Guide Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers DSP56F amp 0x DSP56F82x Family Targeting Manual Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers MC56F83xx DSP5685x Family Targeting Manual Code Warrior Builds Tools Reference for Freescale 56800 E Hybrid Controllers Code Warrior Development Studio IDE 5 5 User s Guide Profiler Supplement Code Warrior Development Studio HTI HostTarget Interface for Once JTAG Communication User s Manual Assembler Reference Manual MSL C Reference Metrowerks Standard C libraries 16 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Introduction References DSP56800 to DSP56800E Porting Guide Freescale Semiconductors Inc To learn more about the DSP56800E processor refer to the Freescale manual DSP56800E Family Manual To download electronic copies of these manuals or order printed versions visit http www freescale com Targeting MC56F83xx DSP5685x Controllers 17 For More Information www freescale com Introduction References 18 Freescale Semiconductor Inc Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started This chapter explains the setup and installation for the CodeWarrior IDE i
229. mmands in the Debug menu Setting Breakpoints and Watchpoints 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 9 8 confirming you have set your breakpoint Figure 9 8 Breakpoint in the Program Window o x Rextio hb ew valables All Value Location Symbolics Ke m Source C my_projects_folder new_project main c int main void gt t int are SIZE 46241234 AZAR Sh Sat 1 TE Print printf printf print_array arr SIZE for i 0 i lt SIZE 1 i for j i j lt SIZE j if arr il gt arr 3 gt swap amp arr i arr j Breakpoint Setting print_array arr SIZE printf n n program done n Line 27 Col 1 Source 192 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger NOTE To remove the breakpoint click the red dot The red dot disappears For more details on how to set breakpoints and use watchpoints see the CodeWarrior IDE User s Guide NOTE For the DSP56800E only one watchpoint is available This watchpoint is only available on hardware targets Viewing and Editing Register
230. mulator Blank Simple_Asm Simple_Asm_and_C Simple_C DSP56800_Simulator Cancel NOTE You should select a simulator target if your system is not connected to a development board If you do have a development board your target selection must correspond to the board s processor c Click the OK button A project window opens listing the folders for project NewProj1 mcp Figure 2 10 shows this project window docked in the IDE main window Targeting MC56F83xx DSP5685x Controllers 31 For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project Figure 2 10 Project Window docked Metrowerks CodeWarrior File Edit View Search Project Debug Processor Expert Data Visualization Window Help BSEeSEoe x RGAaARe TRL EE RA san Bey or A Files Link Order Targets Y 5 code mC DSP56800 sim support NOTE The IDE has the same functionality whether subordinate windows such as the project window are docked floating or child To undock the project window right click its title tab then select Floating or Child from the context menu Figure 2 11 shows this selection To dock a floating window right click its title bar then select Docked from the context menu 32 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project Figure 2 11 Project
231. mulator is the destination zeroes out the LSP portion Assumptions 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 msu_r Word32 laccum Word16 sinpl Word16 sinp2 Example short s1 0xXC000 0 5 short s2 0x4000 0 5 short result long Acc 0x20000000 result msu_r Acc s1 s2 Expected value of result 0x4000 Targeting MC56F83xx DSP5685x Controllers 251 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions mult 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 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 mult Word16 sinpl Word16 sinp2 Example short sl 0x2000 0 25 short s2 0x2000 0 25 short result result mult s1 s2 Expected value of result 0 625 0x0800 mult_r 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
232. n cl works as expected printf s n c2 doesn t work as expected Here the type of the arguments is lost because printf uses a variable argument list Thus the compiler can not signal a type mismatch and the program will compile without errors but it won t work as expected because printf assumes that all the data is stored in data memory Targeting MC56F83xx DSP5685x Controllers 135 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Variables in Program Memory Linking with Variables in Program Memory The compiler creates special sections in the output file for variables in program memory This is a description of all data in program memory sections e data pmem initialized program memory data e const data pmem constant program memory data e bss pmem uninitialized program memory data The following sections are also generated if you choose to generate separate sections for char data e data char pmem initialized program memory chars e const data char pmem constant program memory chars e bss char pmem uninitialized program memory chars These sections are used in the linker command file just like normal sections A typical linker command file for a program that uses data in program memory looks like this MEMORY p_RAM RWX ORIGIN 0x0082 LENGTH OxFF3E p_reserved regs RWX ORIGIN OxFFCO LENGTH 0x003F p_RAM2 RWX ORIGIN OxFF
233. n www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial d Expand the subentry Port I O e Double click the BitIO bean name six times Figure 5 16 depicts this bean selection The IDE adds these beans to your project new bean icons appear in the project window s Processor Expert page Figure 5 16 Bean Selector BitlO Selection o x Bean Categories On Chip Peripherals Quick help gt amp CPU 5 CPU extemal devices 2 CPU internal peripherals 3 Communication amp Converter amp Interrupts gt Measurement E Memory Peripheral beans amp Port 1 0 s Ji S BitsiO S MM Byte210 S M Byte310 Filter all CPU Licensed h 104 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial NOTE If new bean icons do not appear in the Processor Expert page the system still may have added them to the project Close the project then reopen it When you bring the Processor Expert page to the front of the project window the page should show the new bean icons 4 Add two ExtInt beans to the project a In the Bean Categories page of the Bean Selector window expand the Interrupts subentry b Double click the ExtInt bean name two times The IDE adds these beans to your project
234. n the MC56F8300 Peripheral User Manual For a demo of the proper use of this feature see the example code Flash Lock Unlock The Flash Lock and Flash Unlock commands let you control the Flash security state The Flash Lock command enables the Flash security state In this state you can not read the memory or the registers The Flash Unlock command disables the Flash security This results in all the Flash memory being erased NOTE The Flash Lock and Flash Unlock commands can only be enabled if the debugger session is not running 222 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Notes for Debugging on Hardware To use the Flash Lock or Flash Unlock command 1 Kill any open debugger sessions 2 Select a DSP56800E project with a Flash target NOTE A Flash target is a target using an initialization file containing Flash commands 3 Select a Flash target 4 Select either Debug gt 56800E gt Flash Lock or Debug gt 56800E gt Flash Unlock command Notes for Debugging on Hardware Below are some tips and some things to be aware of when debugging on a hardware target Ensure your Flash data size fits into Flash memory The linker command file specifies where data is written to There is no bounds checking for Flash programming The standard library I O function such as printf uses large amount of memory and may not
235. nc 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 add L_mac Subtraction i E msu L_add L_mult L_sub L_mult_ls Control stop Normalization ffs_s wait norm_s turn_off_conv_rndg ffs_l turn_off_sat norm_l turn_on_conv_rndg Rounding round turn_on_sat Shifting shl Deposit Extract extract_h shiftNs extract_ shifts L_deposit_h shr L_deposit_l shr_r Division div_s shriNs div_s4q L_shl div_ls L_shlftNs div_ls4q L_shlfts L_shr L_shr_r L_shrtNs Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Absolute Negate The intrinsic functions of the absolute value negate group are e abs_s e negate e L abs e L_negate abs_s Absolute value of a 16 bit integer or fractional value returning a 16 bit result Returns Ox7FFF for an input of 0x8000 Assumptions OMR s SA bit was set to at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 abs _s Word16 svarl Example int result sl OxE000 0 25 result abs _s s1 Expected value of result 0x2000 0 25 negate Negates a 16 bit i
236. nches Set triggers F Capture initially halted started by tigger Buffer full action No action oldest entries overwritten y Conos To view the contents of the trace buffer Figure 9 22 1 From the IDE menu bar select DSP56800E gt Dump Trace Buffer 210 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features Figure 9 22 Contents of Trace Buffer l0 x 2 Trace Buffer al ol vector c line JE address P 0x00000000 vector c line 42 y Y db M W Path CASDK dsp56838evm_ nos configwector c finclude configdefines h a A undef CFG_SECTION_ISR_DECLARATION archStart P O0x00 3 RESET 4 jar SDK _Interruptl P 0x02 3 COP Reset jsr SDK_illegal P 0x04 3 Illegal In jsr SDK_Interrupt3 P 0x06 3 Software I jar SDK_HWSOverf low P 0x08 3 Hardware S a Line 43 Colt Jal y To clear triggers set with the Trace Buffer Setup panel Figure 9 21 1 From the menu bar select DSP56800E gt Clear Triggers The Trace Buffer Setup panel options are 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
237. ncluding hardware connections and communications protocols This chapter contains these sections e System Requirements e Installing and Registering the CodeWarrior IDE e Creating a Project System Requirements Table 2 1 lists system requirements for installing and using the CodeWarrior IDE for DSPS56800E Table 2 1 Requirements for the CodeWarrior IDE Category Requirement Host Computer PC or compatible host computer with 133 megahertz Pentium Hardware compatible processor 64 megabytes of RAM and a CD ROM drive Operating System Microsoft Windows 98 2000 NT XP Hard Drive 1 2 gigabytes of free space plus space for user projects and source code DSP56800E 56800E EVM or custom 56800E development board with JTAG header Other Power supply Targeting MC56F83xx DSP5685x Controllers 19 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE Installing and Registering the CodeWarrior IDE 20 Follow these steps 1 To install the CodeWarrior software a Insert the CodeWarrior CD into the CD ROM drive the welcome screen appears NOTE If the Auto Install is disabled run the program Setup exe in the root directory of the CD b Click Launch CodeWarrior Setup the install wizard displays welcome page c Follow the wizard instructions accepting all the default settings d At the prompt to ch
238. nd access path to current include list see gccincludes and I global append a recursive access path to current include list OH e HE HE OE HE HE te no keepobj ects global keep object files generated after MM MD MMD make code 310 nofail 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 H include files global cased like M but write dependency H map to a file and generate object code global cased like MD but do not list system H include files global scan source files for dependencies and H emit Makefile do not generate object continue working after errors in earlier files Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com nolink noprecompile nosyspath o file dir P Freescale Semiconductor Inc Command Line Tools Arguments 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 H path lists specify output filename or directory for object file s or text output or output filename for linker if called
239. nker keyword 303 WRITEW linker keyword 304 X X memory viewing 195 197 XML files exporting and importing panel options 47 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com
240. no spaces H insert blank lines between options in H printout all show all standard options no normal show only standard options no obsolete show obsolete options no ignored show ignored options no deprecated show deprecated options no meaningless show options meaningless for this target no compatible show compatibility options opt ion name show help for a given option for name H maximum length 63 chars search keyword show help for an option whose name or help contains keyword case sensitive for keyword maximum length 63 chars group keyword show help for groups whose names contain keyword case sensitive for keyword maximum length 63 chars tool keyword categorize groups of options by tool default all show all options available in this tool this show options executed by this tool default other skipped show options passed to another tool both show options used in all tools version global for this tool show version configuration and build date timing global collect timing statistics progress global show progress and version v erbose global verbose information cumulative H 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 H functionality no wraplines H global word wrap messages default
241. ns The filename extension is Ist Expand Macros in Listing checkbox Checked Assembler macros expand in the assembler listing Clear Assembler macros do not expand This checkbox is available only if the Generate Listing File checkbox is checked Assert NOPs on pipeline conflicts checkbox Checked Assembler automatically resolves pipeline conflicts by inserting NOPs Clear Assembler does not insert NOPs it reports pipeline conflicts in error messages Emit Warnings for NOP Assertions checkbox Checked Assembler issues a warning any time it inserts a NOP to prevent a pipeline conflict Clear Assembler does not issue such warnings This checkbox is available only if the Assert NOPs on pipeline conflicts checkbox is checked Emit Warnings for Hardware Stalls checkbox Checked Assembler warns that a hardware stall will occur upon execution Clear Assembler does not issue such warnings This option helps optimize the cycle count Allow legacy instructions checkbox Checked Assembler permits legacy DSP56800 instruction syntax Clear Assembler does not permit this legacy syntax Selecting this option sets the Default Data Memory Model and Default Program Memory Model values to 16 bits Pad Pipeline for Debugger checkbox Checked Mandatory for using the debugger Inserts NOPs after certain branch instructions to make breakpoints wor
242. nsfer high speed 153 170 SIZEOF linker keyword 302 SIZEOFW linker keyword 303 Source Trees settings panel 48 TMP 373 For More Information www freescale com Freescale Semiconductor Inc special counters EOnCE panel 208 209 stack frames 125 126 stationery saving new target settings 47 stop intrinsic function 242 storage code and data 139 sub intrinsic function 240 system level connect 219 system requirements 19 T target CPU window 92 96 target library API hsst functions 162 169 target program example HSST 169 170 target settings 43 79 overview 45 target settings panel 49 50 Target Settings panels Access Paths 48 Build Extras 48 Custom Keywords 48 Debugger Settings 48 File Mappings 48 Global Optimizations 48 Source Trees 48 Target Settings window 46 target_code_sets_hfmclkd flash debugger command 222 trace buffer EOnCE panel 209 212 turn_off_conv_rndg intrinsic function 243 turn_off_sat intrinsic function 243 244 turn_on_conv_rndg intrinsic function 244 tutorial Processor Expert 102 118 U undocking windows 32 33 A4 values register 193 195 viewing memory 195 199 W wait intrinsic function 243 windows bean inspector 85 90 91 TMP 374 bean selector 84 89 90 CPU types overview 98 installed beans overview 100 memory map 97 98 peripherals usage inspector 101 Processor Expert 89 101 register details 199 216 resource meter 99 target CPU 92 96 WRITEB linker keyword 303 WRITEH li
243. nt arr SIZE 4 6 7 1 2 3 4 12 4 5 int id print_array arr SIZE for i 0 i lt SIZE 1 i for j i j lt SIZE j if arr i gt arr j swap amp arr i amp arr j print_array arr SIZE exit 0 Call Exit to flush all IO buffers Line 1 Colt ja ay Targeting MC56F83xx DSP5685x Controllers 39 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process NOTE Figure 3 3 shows a floating editor window Alternatively you can dock the editor window in the IDE main window or make it a child window Building Compiling and Linking For the CodeWarrior IDE building includes both compiling and linking To start building you select Project gt Make from the IDE main window menu bar The IDE compiler e Generates an object code file from each source code file of the build target incorporating appropriate optimizations e Updates other files of the build target as appropriate e Incase of errors issues appropriate error messages and halts NOTE It is possible to compile a single source file To do so highlight its filename in the project window then select Project gt Compile from the main window menu bar Another useful option is compiling all modified files of the build target select Project gt Bring Up to Date from the main window menu bar In UNIX and other command line environments the IDE stores object code in a binary o or o
244. nteger or fractional value returning a 16 bit result Returns Ox 7FFF for an input of 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 Targeting MC56F83xx DSP5685x Controllers 237 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Prototype Word16 negate Word16 svarl Example int result sl OxE000 0 25 result negate s1 Expected value of result 0x2000 0 25 L_abs Absolute value of a 32 bit integer or fractional value returning a 32 bit result Returns Ox7FFFFFFF for an input of 0x80000000 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 abs Word32 lvarl Example long result 1 0xE0000000 0 25 result L _abs s1 Expected value of result 0x20000000 0 25 L_negate Negates a 32 bit integer or fractional value returning a 32 bit result Returns Ox7FFFFFFF for an input of 0x80000000 Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled 238 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Prototype Word32 L negate Word32
245. ntrinsic function 238 L_add intrinsic function 241 L_deposit_h intrinsic function 246 L_deposit_l intrinsic function 246 247 L_mac intrinsic function 253 L_msu intrinsic function 254 L_mult intrinsic function 254 255 L_mult_ls intrinsic function 255 L_negate intrinsic function 239 L_shl intrinsic function 265 266 L_shlftNs intrinsic function 266 L_shlfts intrinsic function 267 L_shr intrinsic function 267 268 L_shr_r intrinsic function 268 269 L_shrtNs intrinsic function 269 L_sub intrinsic function 241 242 large data model support 141 144 libraries and runtime code 321 348 link order 145 linker command files keywords 294 304 structure 281 284 syntax 284 294 linker keywords location counter 294 295 ADDR 295 296 ALIGN 296 ALIGNALL 296 297 FORCE_ACTIVE 297 INCLUDE 297 KEEP_SECTION 298 MEMORY 298 299 OBJECT 300 REF_INCLUDE 300 SECTIONS 300 302 TMP 372 SIZEOF 302 SIZEOFW 303 WRITEB 303 WRITEH 303 WRITEW 304 load save memory dialog box 200 202 loading elf file 217 M MS5600E target panel 50 51 MS56800E assembler panel 60 62 MS56800E linker panel 67 71 MS56800E processor panel 62 MS56800E target debugging panel 73 77 mac_r intrinsic function 250 251 math support intrinsic functions 235 269 MEMORY linker keyword 298 299 memory map window 97 98 memory viewing 195 199 Metrowerks Standard Library MSL 321 325 modulo addressing error codes 278 279 intrinsic functions 269 279 po
246. ntrollers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Figure 9 5 New Connection Window x Name Remote Connection Debugger CCS 56800 Protocol Plugin y Show in processes list Connection T pe ccs Remote Connection y Port Server IP Address fi 27 0 0 1 ai 475 m Specify CCS Executable I Multi Core Debugging JTAG Configuration File Choose CCS Timeout jeo seconds Choose Factory Settings Revert Panel Cancel OK 2 In the Name edit box type in the connection name 3 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 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 Targeting MC56F83xx DSP5685x Controllers 187 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger 6 Click the OK button To Change an Existing Remote Connection To change an exi
247. ntrollers 177 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Graph Window Properties Display The Display settings let you change the maximum number of data points that are plotted on the graph NOTE For a data visualization example that uses HSST see the data visualization example in this path CodeWarrior path CodeWarrior Examples hsst_Data_Visualization 178 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 9 Debugging for DSP56800E This chapter which explains the generic features of the CodeWarrior debugger consists of these sections e Target Settings for Debugging Command Converter Server Launching and Operating the Debugger e Load Save Memory Fill Memory e Save Restore Registers EOnCE Debugger Features e Using the DSP56800E Simulator e Register Details Window e Loading a elf File without a Project e Using the Command Window System Level Connect e Debugging in the Flash Memory Notes for Debugging on Hardware Target Settings for Debugging 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 DSP36800E development The remaining settings panels are generic to all build targets Other sett
248. o can debug using Tcl scripts or the Command Window 218 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E System Level Connect For more information on Tcl scripts and the Command Window please see the CodeWarrior Development Studio IDE 5 6 Windows Automation Guide System Level Connect The CodeWarrior 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 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 target board To perform a system level connect 1 Select the Project window for the program you downloaded 2 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 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
249. ocking windows 32 33 DSP56800E simulator 214 E ELF disassembler panel 65 67 EOnCE debugger features 206 214 EOnCE library definitions 339 348 EOnCE library functions 328 339 _eonce_ClearTraceBuffer 336 337 _eonce_ClearTrigger 333 _eonce_EnableDEBUGEV 338 _eonce_EnableLimitTrigger 338 339 _eonce_GetCounters 334 _eonce_GetCounterStatus 334 335 _eonce_GetTraceBuffer 336 _eonce_HaltTraceBuffer 337 338 _eonce_Initialize 330 _eonce_SetCounterTrigger 332 333 _eonce_SetTrigger 331 332 _eonce_SetupTraceBuffer 335 _eonce_StartTraceBuffer 337 EOnCE panels set hardware breakpoint 207 208 set trigger 212 214 special counters 208 209 trace buffer 209 212 example HSST host program 160 162 example HSST target program 169 170 Exporting and importing panel options to XML Files 47 extract_h intrinsic function 245 extract_l intrinsic function 245 246 F ffs_l intrinsic function 257 258 ffs_s intrinsic function 256 File Mappings panel 48 TMP 370 fill memory dialog box 202 204 flash debugger commands add_hfm_unit 221 set_hfm_base 220 set_hfm_config_base 221 set_hfm_erase_mode 221 set_hfm_verify_erase 222 set_hfm_verify_program 222 set_hfmclkd 220 target_code_sets_hfmclkd 222 flash memory debugging 219 Flash ROM programming tips 223 floating windows 32 33 FORCE_ACTIVE linker keyword 297 formats number 120 121 G getting started 19 29 34 Global Optimizations settings panel 48 H hardware debugging notes 223 high
250. od ucts 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 fail ure malfunction or any inaccuracy of the application carries a risk of death serious bodily injury or damage to tangible property including but not limited to use in factory control systems medical devices or facilities nuclear facilities aircraft navigation or communication emergency systems or other applications with a simi lar degree of potential hazard How to Contact Metrowerks Corporate Headquarters Metrowerks Corporation 7700 West Parmer Lane Austin TX 78729 U S A World Wide Web http www metrowerks com Sales United States Voice 800 377 5416 United States Fax 512 996 4910 International Voice 1 512 996 5300 Email sales metrowerks com Technical Support United States Voice 800 377 5416 International Voice 1 512 996 5300 Email support metrowerks com For More Information www freescale com Freescale Semiconductor Inc Table of Contents 1 Introduction CodeWarrior IDE Freescale 56800 E Hybrid Controllers References 2 Getting Started System Requirements Installing and Registering the CodeWarrior IDE Creating a Pr
251. og Box After selecting File gt New from the Metrowerks CodeWarrior menu bar the New project Dialog Box Figure B 2 appears In the list of stationeries you can select either the DSP56800x New Project Wizard or any of the other regular stationery Figure B 2 New Project Dialog Box Le x Project File Object ff DSP56800x EAB Stationery d DSP56800x Examples Stationery DSP56800x New Project Wizard a Empty Project a Makefile Importer Wizard Fo Processor Expert Examples Stationery el Processor Expert Stationery 358 Project name the_project Location C my_projects_folder the_proje Set Add Targets to Project Project z Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Target Pages When invoked the New Project Wizard first shows a dynamically created list of supported target families and processors or simulators Each DSP56800x family is associated with a subset of supported processors and a simulator Figure B 3 Figure B 4 Figure B 5 Figure B 6 and Figure B 7 Figure B 3 DSP56800x New Project Wizard Target Dialog Box DSP56F80x xl Select family and then processor for this project DSP56800x Family DSP56F 80x Processor DSP56F801_60MHz DSP56F82x DSP56F801_80MHz DSP5685x DSP55F802 M
252. ogram Flash and Data RAM for Constant DatainC 291 Utilizing Program Flash for User Defined Constant Section in Assembler 292 Stack and Heap 2 2 2 02 2222 5 4 44 294 Writing Data Directly to Memory 2 2 2 294 Linker Command File Keyword Listing 2 2 2 0 294 location counter 2 2 a ee ee ee 294 ADDR 2 ut a Bg BR woke PS eh Fe ee ds he OS ALIGN ess op May al Bb ge Ee Ge ee Bay ae Pa on et 296 ALIGNADL o a ea acs ao ce he Ga ae ee we ce Ae 298 FORCE ACTIVE houad Boece Bek eB eh oe ee Se ee as 27 INGLUDE Hate pa See ee le oe ale a eg 297 KEEPSSECTION uc e o Pee le gt 2298 MEMORY ie S ag eaei aa ROA we ee a Se eg it LOS OBJECT a pal A ae RS RSA Eb a Aho es amp 3300 REF INCLUDE 0 2 boa ete Sie aoe a ae le et ate ee 498 300 10 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Table of Contents SECTIONS A ey phan we nag tke AO a eat noe 300 SIZEOR axe us 45 So UM oe he A ee A Gott Soo BA Ge 302 SIZEQFW o eo es e ee a a a03 WRTTEB lt ans ea o a a A A A we es 303 WRITER Lose to o a Se amp cd ae A AA 303 WRITEW Te fe srt a A o A oh e 304 13 Command Line Tools 305 Usager Ze ee E a ne ks ie Ge to ah nae ys 305 Response Bile cid Da oe wets Geiss AAA Se ke SSR 306 Sample Build Script 2 2 2 e 07 ATSUMEMS E a A e ats oh A A A 307 General Command Line Options
253. oject 3 Development Studio Overview CodeWarrior IDE Development Process Project Files Editing Code Building Compiling and Linking Debugging 4 Target Settings Target Settings Overview Target Setting Panels Changing Target Settings Exporting and Importing Panel Sach to XML Files Restoring Target Settings id CodeWarrior IDE Target Settings Panels DSP56800E Specific Target Settings Panels Target Settings M56800E Target C C Language C Only Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Table of Contents 13 13 15 16 19 19 20 23 35 35 36 38 4 39 40 42 43 43 43 45 47 47 48 48 49 50 51 Freescale Semiconductor Inc Table of Contents C C Preprocessor us ek Wage a EG na ee de Ge DA C CH Warmings se eo ae le ae eS ee 6 M56800E Assembler 2 2 ee ee 60 M56800E Processor 2 a eee ee ee 62 ELF Disassembler sos s s c eto sos s m emo a 65 M56800E Linker 2 2 a a a a a i e t a Taa 67 Remote Debugging oa a a a a a a a 72 M56800E Target Debugging 73 Remote Debug Options 77 5 Processor Expert Interface 81 Processor Expert Overview 81 Processor Expert Code Generation 2 2 2 82 Processor Expert Beans 2 2 ee ee ee 83 Processor Expert Menu 85 Processor Expert Win
254. older 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 190 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger Figure 9 7 Program Window Step Out Step Into Breakpoint Step Over Kill Watchpoint Break Symbolics Run i gsim elf REx Ooodbbe A No Variables All Value Location project main c prototypes void swap int a int b void print_array int arr int length int main void I at int arr SIZE 4 6 7 1 2 3 4 12 4 5 int 1 3 printf n n s PEIADEC printf Line 27 Col 1 5 Navigate through your code The Program window has three panes e Stack pane 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 Targeting MC56F83xx DSP5685x Controllers 191 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger The toolbar at the top of the window has buttons that allows you access to the execution co
255. ollowed by a type of access D value being read from or written to x memory A memory access R memory read Ww 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 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 14 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 Table 14 7 Data Selection Modes Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Defined Description Identifiers B2D_BYTE makes a comparison when the data being moved is of byte length 343 Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 7 Data Selection Modes Defined Description Identifiers 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 14 8 must be OR ed into the opt
256. om Freescale Semiconductor Inc Command Line Tools Arguments bool on off enable C bool type true and false constants default is off char keyword set sign of char signed chars are signed default unsigned chars are unsigned Cpp_exceptions on off passed to linker enable or disable C exceptions default is on dialect lang keyword passed to linker specify source language c treat source as C always C treat source as C always ec generate warnings for use of C features outside Embedded C subset implies dialect cplus dialect cplus enum keyword specify word size for enumeration types min use minimum sized enums default int use int sized enums inline keyword specify inline options on smart turn on inlining for inline functions default none off turn off inlining auto auto inline small functions without inline explicitly specified noauto do not auto inline default all turn on aggressive inlining same as inline on auto deferred defer inlining until end of compilation unit this allows inlining of functions in both directions level n cased inline functions up to n levels deep level 0 is the same as inline on for n range 0 8 iso templates on off enable ISO C template parser note this requires a different MSL C library default is off no mapcr reverse mapping of n
257. on www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 7 C C Warnings Panel Elements continued Element Purpose Comments Extended Error Checked Compiler issues warnings in Syntax problems are a non void checks Checking response to specific syntax problems function without a return statement checkbox Clear Compiler does not perform such an integer or floating point value checks assigned to an enum type or an empty return statement in a function not declared void To check whether this option is in effect use the __option extended_errorcheck command Hidden Virtual Leave clear Does not apply to C Functions Implicit Checked Compiler verifies that operation If this option is in effect the compiler Arithmetic destinations are large enough to hold all would issue a warning in response to Conversions possible results assigning a long value to a char checkbox Clear Compiler does not perform such variable To check whether this option is in effect use the __option warn_implicitconv command Pointer Integral Conversions Checked Compiler checks for pointer integral conversions Clear Compiler does not perform such checks See pragma warn_any_ptr_int_conv and pragma warn_ptr_int_conv Unused Checked Compiler checks for declared The pragma unused overrides this Variab
258. on SOC 124 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Calling Conventions and Stack Frames Stack Frame and Alignment Figure 6 1 depicts generation of the stack frame The stack grows upward so pushing data onto the stack increments the stack pointer s address value Figure 6 1 Stack Frame sp outgoing parameters status register calling function stack space The stack pointer SP is a 24 bit register always treated as a word pointer During a function execution the stable position for the SP 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 are available for both assembly language and 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 The compiler stores local data by size It stores smaller data closest to the SP exploiting SP addressing modes that have small offsets This means that the compiler packs all bytes two per word near the stack pointer It packs the block of words next then blocks of longs Aggregates structs and arrays are farthest from the stack pointer not sorted by size NOTE When a function make
259. on defined by __mod_error See __mod_error description for a complete list of error conditions Prototype void mod init int lt mod_desc gt void lt addr_expr gt int lt mod_sz gt int lt data_sz gt Example Initialize a modulo buffer pointer with a buffer size of 3 and where each element is a structure Targeting MC56F83xx DSP5685x Controllers 271 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions _ mod init 0 void amp struct_buf 0 3 sizeof struct mystruct __mod_initint16 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 Prototype 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_initint16 0 amp int_buf 9 10 __mod_start 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 MO1 depends on the size of the modulo buffer and which pointers have been initialized Prototype void mod start void 272 Targeting MC56F83xx DSP5685x Controllers For More Informa
260. on displays OPENFILENAME or SAVEFILENAME depending on whether you selected the Restore Registers or Save Registers radio button EOnCE Debugger Features 206 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E EOnCE Debugger Features NOTE 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 9 19 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 1 From the menu bar select DSP56800E gt Set Breakpoint Trigger s To clear triggers set with this panel 1 From the menu bar select DSP56800E gt Clear Triggers Figure 9 19 Set Hardware Breakpoint Panel Set Hardware Breakpoint x Set trigger Action The Set Hardware BreakPoint panel options are e Set trigger Select this button to open the Set Trigger panel Figure 9 23 For more information on using this panel see Set Trigger Panel on page 212 e Action This pull down list lets you select
261. on_sat void Usage turn_on sat 244 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Deposit Extract The intrinsic functions of the deposit extract group are e extract_h e extract_l e L_deposit_h e L_deposit_l extract_h 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 Prototype Word16 extract_h Word32 l1src Example long 1 0x87654321 short result result extract_h 1 Expected value of result 0x8765 extract_l 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 Prototype Word16 extract_1 Word32 l1src Targeting MC56F83xx DSP5685x Controllers 245 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example long 1 0x87654321 short result result extract_1 1 Expected value of result 0x4321 L_deposit_h 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
262. ong _foot void main void unsigned long i Lf bac i footy _foot value determined in LCF PLES ee 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 12 12 Listing 12 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 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 or unsigned 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 12 13 shows valid octal patterns that you can put into your linker command file Listing 12 13 Sample Octal Patterns _octal number 012 _octal number2 03245 Targeting MC56F83xx DSP5685x Controllers 287
263. ons F Enable GCC Extensions IPA Orr X I Enums Always Int Unsi h Hee Depth Sman gt J Use Unsigned Chars FT Auto nline Tl Pool Strings TI Bottom up Inlining IV Reuse Strings NOTE Always disable the following options which do not apply to the DSP56800E compiler Legacy for scoping and Pool Strings Targeting MC56F83xx DSP5685x Controllers 51 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800E Specific Target Settings Panels Table 4 5 C C Language C Only Panel Elements Element Purpose Comments IPA list box Specifies Interprocedural Analysis IPA Off IPA is disabled File inlining is deferred to the end of the file processing Inline Depth list box Together with the ANSI Keyword Only checkbox specifies whether to inline functions Don t Inline do not inline any Smart inline small functions to a depth of 2to4 1 to 8 Always inline functions to the number s depth Always inline inline all functions regardless of depth If you call an inline function the compiler inserts the function code instead of issuing calling instructions Inline functions execute faster as there is no call But overall code may be larger if function code is repeated in several places Auto Inline Checked Compiler selects the functions To check whether automatic inlining checkbox to inline is in effect use the
264. or Expert gt View gt CPU Types Overview from the main window menu bar amp Motorola amp 56800 56058 56857 q 56955 56854 Gh 56953 Y 56852 sere2 sere2 56F80 sereo sereo sereo sereo sereo Y 56F80 seres seres seres 3 56F83 seres 6 7 7 5 3 21480 21860 1FA80 1FAG0 45 55 46 56 22 Right click the window to open a context menu that lets you add the selected CPU to the project expand the tree structure collapse the tree structure or get help information Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Resource Meter The Resource Meter window Figure 5 12 shows the usage or availability of processor resources To open this window select Processor Expert gt View gt Resource Meter from the main window menu bar Figure 5 12 Resource Meter Window o xi Communication foots ts ts AAD channels Pins usage A RAR UI Compare regs Capture regs Bars of this window indicate Pausing your cursor over some fields of this window brings up details of specific The number of pins used The number of ports used Allocation of timer compare registers The number of timer capture registers used Allocation of serial communication channels Allocation of A D converter channels resou
265. or 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 348 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc A Porting Issues This appendix explains issues relating to successfully porting code to the most current version of the CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers This appendix contains the following sections e Converting the DSP56800E Projects from Previous Versions e Removing illegal object_c on pragma directive Warning Converting the DSP56800E Projects from Previous Versions When you open older projects in the CodeWarrior IDE the IDE automatically prompts you to convert your existing project Figure A 1 Your old project will be backed up if you need to access that project file at a later time The CodeWarrior IDE cannot open older projects if you do not convert them Figure A 1 Project Conversion Dialog Convert Project P x Project sample mcp needs to be converted Some target settings need to be updated to the current version Some prefe
266. ormation Targeting MC56F83xx DSP5685x Controllers 91 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Target CPU Window The Target CPU window Figure 5 6 depicts the target processor as a realistic CPU package as a CPU package with peripherals or as a block diagram To open this window select Processor Expert gt View gt Target CPU Package from the main window menu bar To have this window show the block diagram you may select Processor Expert gt View gt Target CPU Block Diagram from the main window menu bar Figure 5 6 Target CPU Window Package Target CPU Cpu 56F8346 ENE ePID I y 56F8346 ALL 3 gt 51 CAPI VCAPL NCC Core Power when the internal voltage regulator is disabled 7 Arrows on pins indicate input output or bidirectional signals As you move your cursor over the processor pins text boxes at the bottom of this window show the pin numbers and signal names 92 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Use the control buttons at the left edge of this window to modify the depiction of the processor One button for example changes the picture view the CPU package with peripherals However as Figure 5 7 shows it is not always possible for the picture of a soph
267. ot support This chapter contains these sections Number Formats e Calling Conventions and Stack Frames e User Stack Allocation e Data Alignment Requirements e Variables in Program Memory e Packed Structures Support e Code and Data Storage e Large Data Model Support e Optimizing Code Deadstripping and Link Order e Working with Peripheral Module Registers e Generating MAC Instruction Set Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com 119 Freescale Semiconductor Inc C for DSP56800E Number Formats Number Formats This section explains how the CodeWarrior compiler implements ordinal and floating point number types for 56800E processors For more information read Limits h and float h under the M56800E Support folder Table 6 1 shows the sizes and ranges of ordinal data types Table 6 1 56800E Ordinal Types Type Option Setting Size Range bits char Use Unsigned Chars is 8 128 to 127 disabled in the C C Language C Only settings panel Use Unsigned Chars is 8 0 to 255 enabled 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 Large 16 0 to 65 535 Data Model is disabled in th
268. ot check this checkbox unless the entire program code fits into the Ox0 OxFFFF memory range Large Data Model checkbox Checked Extends DSP56800E addressing range by providing 24 bit address capability to instructions Clear Does not extend address range 24 bit address modes allow access beyond the 64K byte boundary of 16 bit addressing Globals live in lower memory checkbox Checked Compiler uses 24 bit addressing for pointer and stack operations 16 bit addressing for access to global and static data Clear Compiler uses 24 bit addressing for all data access This checkbox is available only if the Large Data Model checkbox is checked Pad pipeline for debugger checkbox Checked Mandatory for using the debugger Inserts NOPs after certain branch instructions to make breakpoints work reliably Clear Does not insert such NOPs If you select this option you should select the same option in the M56800E Assembler panel Selecting this option increases code size by 5 percent But not selectins this option risks nonrecovery after the debugger comes to breakpoint branch instructions Emit separate character data section checkbox Checked Compiler breaks out all character data placing it in appropriate data sections data char bss char or const data char Clear Compiler does not break out this data Targeting MC56F83xx DSP5685x Controllers See ad
269. pert Interface Processor Expert Tutorial 7 Enable BitlO SetDir ClrVal and SetVal functions a In the Processor Expert page click the plus sign control for the GPIO_co bean The function list expands red X symbols indicate disabled functions green check symbols indicate enabled functions b Double click function symbols as necessary so that only SetDir Clr Val and SetVal have green checks Figure 5 20 shows this configuration Figure 5 20 GPIO_C3 Enabled Functions Beans OQ A E M GetDir Z M SetDir E M Getal E M Putval E M Cival Y M Setval E MM Neoval Y GPIO_C1 Bit10 Z GPIO_c2 Bit10 Renin canis 108 Click the GPIO_CO minus sign control The function list collapses d Repeat substeps a b and c for beans GPIO_C1 GPIO_C2 GPIO_C3 GPIO_D6 and GPIO_D7 8 Enable ExtInt OnInterrupt GetVal functions a In the Processor Expert page click the plus sign control for the IRQA bean The function list expands b Double click function symbols as necessary so that only OnInterrupt and GetVal have green check symbols c Click the IRQA minus sign control The function list collapses d Repeat substeps a b and c for bean IRQB 9 Design generate project code a From the main window menu bar select Processor Expert gt Code Design LEDcontrol mcp This selection shows the actual name of your project The IDE and PEI generate several new files for your proje
270. platform target These build targets can share files even though each build target uses its own settings After you debug the program the only actions necessary to generate a final version are selecting the project s optimized build target and using a single Make command The CodeWarrior IDE s extensible architecture uses plug in compilers and linkers to target various operating systems and microprocessors For example the IDE uses a GNU tool adapter for internal calls to DSP56800E development tools Most features of the CodeWarrior IDE apply to several hosts languages and build targets However each build target has its own unique features This manual explains the features unique to the CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers For comprehensive information about the CodeWarrior IDE see the CodeWarrior IDE User s Guide NOTE For the very latest information on features fixes and other matters see the CodeWarrior Release Notes on the CodeWarrior IDE CD Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Introduction Freescale 56800 E Hybrid Controllers Freescale 56800 E Hybrid Controllers The Freescale 56800 E Hybrid Controllers consist of two sub families which are named the DSP56F80x DSP56F82x DSP56800 and the MC56F83xx DSP5685x DSP56800E The DSP56800E is an enhanced version of the DSP56800 The processors in the th
271. ptions e Accumulating Trigger Options e Miscellaneous Trigger Options Targeting MC56F83xx DSP5685x Controllers 329 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library e Trace Buffer Capture Options e Trace Buffer Full Options e Miscellaneous Trace Buffer Option _eonce_lnitialize Initializes the library by setting the necessary variables Prototype void _eonce Initialize unsigned long baseAddr unsigned int units Parameters baseAddrunsigned long Specifies the location in X memory where the EOnCE registers are located unitsunsigned int Specifies the number of EOnCE breakpoint units available Remarks 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 Returns Nothing 330 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library _eonce_SetTrigger Sets a trigger condition used to halt the processor cause an interrupt or start and stop the trace buffer
272. r Compiler does not issue such __option warn_notinlined command warnings Treat All Checked System displays warnings as Warnings As error messages Errors checkbox Clear System keeps warnings and error messages distinct M56800E Assembler Use the M56800E Assembler panel Figure 4 7 to specify the format of the assembly source files and the code that the DSP56800E assembler generates Table 4 8 explains the elements of this panel Figure 4 7 M56800E Assembler Panel 60 N M56800E Assembler Generate Listing File Expand Macros in Listing IV Assert NOPs on pipeline conflicts IT Emit Warnings for NOP assertions TT Emit Warnings for Hardware Stalls T Allow legacy instructions IV Pad Pipeline for Debugger Emit Warnings for odd SP Increment Decrement Default Data Memory Model fi 6 bit Default Program Memory Model 19 bit v Prefix File e Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 8 M56800E Assembler Panel Elements Element Purpose Comments Generate Listing File checkbox Checked Assembler generates a listing file during IDE assembly of source files Clear Assembler does not generate a listing file A listing file contains the source file with line numbers relocation information and macro expansio
273. r Linker Command File Keyword Listing WRITEW 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 304 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 13 Command Line Tools This chapter contains the following sections Usage e Response File e Sample Build Script e Arguments Usage To call the command line tools use the following format Table 13 1 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 13 2 Targeting MC56F83xx DSP5685x Controllers 305 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Response File Table 13 2 Env
274. r More Information www freescale com Freescale Semiconductor Inc Index Symbols location counter linker keyword 294 295 elf file loading 217 __ mod_access intrinsic function 273 __ mod error intrinsic function 275 __mod_getint16 intrinsic function 274 __mod_init intrinsic function 271 272 __mod_init16 intrinsic function 272 __mod_setint16 intrinsic function 275 __mod_start intrinsic function 272 __mod_stop intrinsic function 273 __mod_update intrinsic function 273 _eonce_ClearTraceBuffer library function 336 337 _eonce_ClearTrigger library function 333 _eonce_EnableDEBUGEYV library function 338 _eonce_EnableLimitTrigger library function 338 339 _eonce_GetCounters library function 334 _eonce_GetCounterStatus library function 334 335 _eonce_GetTraceBuffer library function 336 _eonce_HaltTraceBuffer library function 337 338 _eonce_Initialize library function 330 _eonce_SetCounterTrigger library function 332 333 _eonce_SetTrigger library function 331 332 _eonce_SetupTraceBuffer library function 335 _eonce_StartTraceBuffer library function 337 A abs_s intrinsic function 237 Access Paths panel 48 add intrinsic function 239 240 add_hfm_unit flash debugger command 221 ADDR linker keyword 295 296 ALIGN linker keyword 296 ALIGNALL linker keyword 296 297 Auto clear previous breakpoint on new breakpoint release 73 B bean inspector window 85 90 91 bean selector window 84 89 90 breakpoints 192 193
275. r signal followed by either this breakpoint unit creating a trigger signal or a core event occurring Targeting MC56F83xx DSP5685x Controllers 345 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 11 Accumulating Trigger Options Mode with Breakpoint Unit 0 Defined Identifiers Description 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_ a trigger is generated if the previous THEN_CORE_EVENT 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 14 12 must be OR ed into the options parameter of the _eonce_SetTrigger function when a breakpoint unit other than unit 0 is being configured Table 14 12 Accumulating Trigger Options Mode Non 0 Breakpoint Unit Defined Identifiers 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 identifie
276. r_56800E_1 14M56800E Suppor Aprintf c case f case F _format if frac_digits dec exp dec sig length 1 lt 0 DODOOFF7 SAB4FFES 24 SP RO 00000FF9 B104 X RO 1 B 00000FFA 7C9F B OOO000FFB SAB4FFES 24 SP RO 00000FFD B820 X R0 4 00000FFE 7E82 4 0 00000FFF 7490 B YO 700001000 8005 YO A Gs Line 1350 Col3 4 Targeting MC56F83xx DSP5685x Controllers 199 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Load Save Memory Load Save Memory From the menu bar of the Metrowerks CodeWarrior window select Debug gt 56800E gt Load Save Memory to display the Load Save Memory dialog box Figure 9 16 Figure 9 16 Load Save Memory Dialog Box xi History ei r Parameters f Operation Load Memory Save Memory Memory Type P Memoy y Address hex E Cancel Offsetlhenintesd Size hex integer TAS y File name Browse F Ovyemwrite Existina File format 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
277. rage using inline assembly calls This invalidates all the stack frame offsets from the SP used to access local variables arguments on the stack etc With the User Stack Allocation feature you can use inline assembly instructions with some restrictions to modify the SP while maintaining accurate local variable compiler temps and argument offsets i e these variables can still be accessed since the compiler knows you have modified the stack pointer The User Stack Allocation feature is enabled with the pragma check inline sp effects on off reset pragma setting The pragma may be set on individual functions By default the pragma is off at the beginning of compilation of each file in a project The User Stack Allocation feature allows you to simply add inline assembly modification of the SP anywhere in the function The restrictions are straight forward 1 The SP must be modified by the same amount on all paths leading to a control flow merge point 2 The SP must be modified by a literal constant amount That is address modes such as SP N and direct writes to SP are not handled 3 The SP must remain properly aligned Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E User Stack Allocation 4 You must not overwrite the compiler s stack allocation by decreasing the SP into the compiler allocated stack space Point 1 above is required
278. ram and you want to copy all your initialized data into RAM at runtime Listing 12 17 shows the LCF you use to set up for writing data to ROM Targeting MC56F83xx DSP5685x Controllers 289 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Listing 12 17 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 SECTIONS main_application text sections text rtlib text fp engine txt user text gt text ill El E __ ROM Address 0x2000 data AT __ROM Address ROM Address definition H data 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 12 18 copy all variables in the data section from ROM to RAM in C code 290 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Listing 12 18 ROM to RA
279. rary that matches your target from this path CodeWarrior path M56800x Support profiler lib Targeting MC56F83xx DSP5685x Controllers 225 For More Information www freescale com Freescale Semiconductor Inc Profiler 4 Add the following function calls to main ProfilerInit ProfilerClear ProfilerSetStatus ProfilerDump ProfilerTerm For more details of these functions see the CodeWarrior Development Studio IDE 5 5 User s Guide Profiler Supplement 5 It may be necessary to increase the heap size to accommodate the profiler data collection This can be set in the linker command file by changing the value of __heap_size 6 Enable profiling by setting the Generate code for profiling option in the M56800E Processor settings panel or by using the profile on off pragma to select individual functions to profile NOTE For a profiler example see the profiler example in this path CodeWarrior path CodeWarrior Examples SimpleProfiler 226 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 11 Inline Assembly Language and Intrinsics The Code WarriorTM compiler supports inline assembly language and intrinsic functions This chapter explains the IDE implementation of Freescale assembly language with regard to DSP56800E development It also explains the relevant intrinsic functions This chapter contains these sections e Inline Assembl
280. rces Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Figure 5 13 Installed Beans Overview Window l0 x 100 Installed Beans Overview The Installed Beans Overview window Figure 5 13 shows reference information about the installed beans To open this window select Processor Expert gt View gt Installed Beans Overview from the main window menu bar BytelO Capture CiDParser CIDTypel CIDType12 General Byte Input Output 8 bits Status encrypted compressed Author Processor Expert SA Current version 02 046 CallProgressT oneDetection Call Progress Tone Detection Status encrypted compressed Author Processor Expert PA Current version 01 014 Timer capture encapsulation Status encrypted compressed Author Processor Expert RH Current version 02 082 The Type 1 and 2 Telephony Parser Library Status encrypted compressed Author Processor Expert ACh Current version 01 008 The Type 1 Telephony Features Library Status encrypted compressed Author Processor Expert ACh Current version 01 009 The Type 1 and 2 Telephony Features Library Status encrypted compressed Author Processor Expert ACh Current version 01 008 56800 BytelO dmo 56800 BytelO drv ml 56800 CallProgressT oneDetection dmo 56800 CallProgressT oneDetection dry 56800 Capture dmo 56800 Captu
281. re drv 56800 CIDParser dmo 56800 CIDParser drv S6800 CIDTypel dmo 56800 CIDTypel drv 56800 CIDType12 dmo S6800 CIDTypel2 drv sl This window s View menu lets you change the display contents such as showing driver status and information restricting the kinds of beans the display covers and so one Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Peripherals Usage Inspector Processor Expert Interface Processor Expert Windows The Peripherals Usage window Figure 5 14 shows which bean allocates each peripheral To open this window select Processor Expert gt View gt Peripherals Usage Inspector from the main window menu bar Figure 5 14 Peripherals Usage Window Peripheral Usage View Help 120 Interrupts Timers Channels GPIOD GPIODO_CS2B GPIOD1_C53B GPIODE_TxD1 GPIOD _RxD1 Always _OutputDir Pin 1 Always_InputDir GPIOE GPIDEO_TxDO Dutput GPIDE1_AxDO Input GPIDE2_46 Used by more beans Used by bean AM1 Asynchro Dutput Used by bear AM1 Asynchro GPIOE3_A GPIDE4_SCLKO GPIDES_MOSIO GPIOE6_MISOO GPIOE _SSOB GPIOF GPIOFO_D GPIOF1_D8 GPIDF2_D9 The pages of this window reflect the peripheral categories 1 O interrupts timers and GPIOF3 D10 channels The columns of each page list peripheral pins signal names and
282. rence panels have changed and the target settings need to be updated to the new format The project will be backed up as sample old mcp Do you want to convert the project I Use For All Remaining Projects Cancel Targeting MC56F83xx DSP5685x Controllers 349 For More Information www freescale com Freescale Semiconductor Inc Porting Issues Removing illegal object_c on pragma directive Warning Removing illegal object_c on pragma directive Warning If after porting a project to DSP56800E 7 x you get a warning that says illegal object_c on pragma directive you need to remove it To remove this warning 1 Open the project preference and go to the C C Preprocessor 2 Remove the line pragma objective_con from the prefix text field 350 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc B DSP56800x New Project Wizard This appendix explains the high level design of the new project wizard Overview The DSP56800x New Project Wizard supports the DSP56800x processors listed in Table B 1 Table B 1 Supported DSP56800x Processors for the New Project Wizard Targeting MC56F83xx DSP5685x Controllers DSP56800 DSP56800E DSP56F801 60 MHz DSP56852 DSP56F801 80 MHz DSP56853 DSP56F802 DSP56854 DSP56F803 DSP56855 DSP56F805 DSP56857 DSP56F807 DSP56858 DSP56F826 MC56F8322 DSP56F827 MC56F8323 MC5
283. rent 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 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing A period may appear 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 words past the symbol FSTART Example data data bss FSTART FSTART_ 0x1000 end gt DATA ADDR 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 Targeting MC56F83xx DSP5685x Controllers 295 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing ___rootbasecode ADDR ROOT text gt ROOT NOTE In order to use segmentName with this command the segmentName must start with the period character ev
284. ress and This checkbox is available only if the and Object Code object code for the disassembled module Show Code Modules checkbox is checkbox Clear Disassembler does not list this checked Show Source Code checkbox 66 Checked Disassembler lists source code for the current module Clear Disassembler does not list source code Source code appears in mixed mode with line number information from the original C source file This checkbox is available only if the Show Code Modules checkbox is checked Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Table 4 10 ELF Disassembler Panel Elements continued Element Purpose Comments ShowComments Checked Disassembler comments This checkbox is available only if the checkbox appear in sections that have comment Show Code Modules checkbox is columns checked Clear Disassembler does not produce comments Show Data Checked Disassembler outputs ELF Modules data sections such as data and bss for checkbox the disassembled module Clear Disassembler does not output ELF data sections Disassemble Leave clear Does not apply to C Exception Table checkbox Show Debug Checked Disassembler includes Info checkbox DWARF symbol information in output Clear Disassembler does not include th
285. rget application can read without stopping the core Prototype HRESULT hsst_write void data size t size size_t nmemb size_t channel_id size t written Parameters data Specifies the data buffer that holds the data to write size Specifies the size of the individual data elements to write nmemb Specifies the number of data elements to write channel _ id Specifies the channel ID of the communication channel to write to written Contains the number of data elements written Returns S_OK if the call succeeds or S_ FALSE if the call fails 156 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Host Side Client Interface hsst_size A host side client application uses this function to determine the size of unread data in bytes in the communication channel Prototype HRESULT hsst_size size_t channel _ id size t unread Parameters channel_id Specifies the channel ID of the applicable communication channel unread Contains the size of unread data in the communication channel Returns S_OK if the call succeeds or S_ FALSE if the call fails hsst_block_mode 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
286. rom pROM at address rl into x0 Targeting MC56F83xx DSP5685x Controllers 293 For More Information www freescale com ELF Linker Freescale Semiconductor Inc Linker Command File Keyword Listing 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 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 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 12 22 Embedding Data Directly Into Output example data_section WRITEB 0x48 H WRITEB 0x69 i WRITEB 0x21 Linker Command File Keyword Listing This section explains the keywords available for use when creating CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers application objects with the linker command file Valid linker command file functions keywords directives and commands are location counter 294 The period character always maintains the cur
287. rs gt list and sets its parameter lt pageSize gt lt progMem gt values lt boot gt lt interleaved gt set_hfm_programmer_base lt address gt Specifies the address where the onboard flash programmer will be loaded in P Memory set hfm prog buffer base lt address gt Specifies where the data to be programmed will be loaded in X Memory set hfm prog buffer size lt size gt Specifies the size of the buffer in X Memory which will hold the data to be programmed set_hfm erase mode lt units pages all gt Sets the erase mode set_hfm verify erase lt 1 1 0 gt Sets the flash memory erase verification mode set_hfm verify program lt 110 gt Sets the flash program verification mode unlock flash_on_connect lt 1 0 gt Unlocks and erases flash memory immediately upon connection Remote Debug Options Use the Remote Debug Options panel Figure 4 14 to specify different remote debug options Targeting MC56F83xx DSP5685x Controllers 77 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Figure 4 14 Remote Debug Options N Remote Debug Options rm Program Download Options Initial Launch Successive Runs Section Type Download Verify Download Verify Executable Iv i Constant Data Iv i Initialized Data Iv E Unitialized Data Iv i lt I lt I lt I lt I LLM YI m Memory Configuration Options
288. rs in Table 14 13 are optional 346 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Table 14 13 Miscellaneous Trigger Options Defined Identifiers 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 1 0 before the counter is read because the OSCNTR is needed for stepping and would corrupt the counter Trace Buffer Capture Options The options in Table 14 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 Table 14 14 Trace Buffer Capture Options Defined Identifiers Description CAPTURE_CHANGE_OF_FLOW_ saves target addresses of conditional branches NOT_TAKEN and jumps that are not taken to the trace buffer CAP
289. rver 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 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 Development Studio for Freescale 56800 E Hybrid Controllers you can change the port Change the parallel port Targeting MC56F83xx DSP5685x Controllers 181 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server 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 9 1 Figure 9 1 Command Converter Server Icon E A menu appears Figure 9 2 Figure 9 2 Command Converter Server Menu Show console Hide console About CCS Quit CCS 2 Select Show console from the menu The Metrowerks Command Converter Server window appears Figure 9 3 182 Targeting MC56F83xx DSP5685x Controller
290. s Error code as defined in the sub section Definitions on page 339 Targeting MC56F83xx DSP5685x Controllers 335 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library _eonce_GetTraceBuffer Retrieves the contents of the trace buffer Prototype int _eonce GetTraceBuffer unsigned int count unsigned long buffer Parameters countunsigned int 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 bufferunsigned long Points to an array in which the contents of the trace buffer are returned starting with the oldest entry Remarks 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 Returns Error code as defined in the sub section Definitions on page 339 _eonce_ClearTraceBuffer Clears the contents of the trace buffer Prototype int _eonce ClearTraceBuffer 336 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Parameters None Remarks This function clears the trace buffer and is us
291. s For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Figure 9 3 Metrowerks Command Converter Server Window iB Metrowerks Command Converter Server S loj x File Edit Show History Debug Help Metrowerks Command Converter Server console display active O Parallel Port LPT 1 CC software ver 3 0 Server listening on port 41475 Server listening on port 41475 Clients accepted from all hosts Connection 1 accepted from PETERAHN mtwk sps mot com at Wed Feb 04 12 34 34 200 4 Connection 1 from PETERAHN mtwk sps mot com closed at Wed Feb 04 12 38 25 2004 bin 1 3 On the console command line type the following command delete all 4 Press Enter 5 Type the following command substituting the number of the parallel port to use for example 1 for LPT1 config cc parallel 1 6 Press Enter 7 Type the following command to save the configuration config save 8 Press Enter Targeting MC56F83xx DSP5685x Controllers 183 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Changing the Command Converter Server Protocol to HTI To change the command converter server to an HTI Connection 1 While the command converter server is running right click on the command converter server icon shown in Figure 9 1 or double click on it 2 From the menu shown in Figure 9 2
292. s 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 9 4 appears Targeting MC56F83xx DSP5685x Controllers 185 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Command Converter Server Figure 9 4 Remote Connections Panel m IDE Preferences 3 2 xl Q IDE Preference Panels N Remote Connections Build Settings IDE Extras 56800 Local Hardware Connection CCS Remote Connection Plugin Settings 56800 Simulator Simulator Shielded Folders 56800E Local Hardware Connection CCS Remote Connection Source Trees 56800 Simulator Simulator E Editor Code Completion Code Formatting Editor Settings Font amp Tabs Text Colors Debugger Display Settings Window Settings Global Settings Remote Connections RAD Tools Factory Settings Import Panel Export Panel OK Cancel Apply To Add a New Remote Connection To add a new remote connection 1 Click the Add button The New Connection window appears as shown in Figure 9 5 186 Targeting MC56F83xx DSP5685x Co
293. s TE 1 generated codes P 00000086 8AB4FFFF adda H 1 SP RO P 00000088 F0E00000 move b X RO A P 0000008A 83500008 bfset H8 Al P 0000008C 9800 move b A1 X RO Ef localSCICR Bits PE 1 generated codes P 0000008D F0E00001 move b X RO 1 A P 0000008F 83500002 bfset H2 A1 P 00000091 9804 move b Al x RO 1 e SCICR Word localSCICR Word generated codes P 00000092 B67F022C move w X SP 1 XX HSCICR Generating MAC Instruction Set The compiler generates the imac 1 instruction if the C code performs multiplication on two long operands which are casted to short type and the product is added to a long type For example the following code short a short b long c long d c long a long b generates the following assembly move w X 0x000000 YO Fa move w X 0x000000 B Fb move l X 0x000000 A Fe 150 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Generating MAC Instruction Set imac 1 B1 Y0 A Targeting MC56F83xx DSP5685x Controllers 151 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Generating MAC Instruction Set 152 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 7 High Speed Simultaneous Transfer High Speed Simultaneous Transfer HSST facilitates data
294. s a dynamic allocation the compiler reserves RS as a stack frame pointer This is the stack pointer before allocations Targeting MC56F83xx DSP5685x Controllers 125 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E User Stack Allocation The compiler always must operate with the stack pointer long aligned This means that The start up code in the runtime first initializes the stack pointer to an odd value Atall times after that the stack pointer must point to an odd word address 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 User Stack Allocation 126 The 56800E compilers build frames for hierarchies of function calls using the stack pointer register SP to locate the next available free X memory location in which to locate a function call s frame information There is usually no explicit frame pointer register Normally the size of a frame is fixed at compile time The total amount of stack space required for incoming arguments local variables function return information register save locations including those in pragma interrupt functions is calculated and the stack frame is allocated at the beginning of a function call Sometimes you may need to modify the SP at runtime to allocate temporary local sto
295. s check_c_src_pipeline and check_inline_asm_pipeline Pipeline Conflict Detection C Language list box Specifies pipeline conflict detection during compiling of C source code e Not Detected compiler does not check for conflicts e Conflict error compiler issues error messages if it detects conflicts For more information about pipeline conflicts see the explanations of pragmas check_c_src_pipeline and check_inline_asm_pipeline The compiler generates hardware DO loops for two situations 1 Aggregate array and structure initializations and for struct copy under any of these conditions 64 Targeting MC56F83xx DSP5685x Controllers e The aggregate is byte aligned and the aggregate size is greater than four bytes e The aggregate is word aligned and the aggregate size is greater than four words For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels e The aggregate is long aligned the aggregate size is greater than eight words and the Global Optimizations panel specifies Optimize for Smaller Code Size e The aggregate is long aligned the aggregate size is greater than 32 words and the Global Optimizations panel specifies Optimize for Faster Execution 2 Counted loops in C provided that the loop counter value is less than 65536 and that there are no jumps to subroutines inside the loop If you enable s
296. s of memory If the large data memory model is enabled the compiler accesses all data by 24 bit addressing modes It treats data pointers as 24 bit quantities that you may store in two words of memory Absolute addressing occurs as 24 bit absolute addresses Thus you may access the entire 24 bit data memory locating data objects anywhere Targeting MC56F83xx DSP5685x Controllers 141 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Large Data Model Support You do not need to change C source code to take advantage of the large data memory model Examples in DSP56800E assembly code of extended data addressing are Extended Data Addressing Example Consider the code of Listing 6 5 Listing 6 5 Addressing Extended Data move w x 0x123456 A1 move int using 24 bit absolute address tst 1 x RO 0x123456 test a global long for zero using 24 bit pointer indexed addressing move l r0 x RO rO stored as 24 bit quantity cmpa r0 rl compare pointer registers as 24 bit Quantities 142 The large data memory model is convenient because you can place data objects anywhere in the 24 bit data memory map But the model is inefficient because extended data addressing requires more program memory and additional execution cycles However all global and static data of many target applications easily fits within the 64 KB word memory boundary With this in mind you can check the Glo
297. save registers C2 and D2 across function calls Volatile and Non Volatile Registers Values in non volatile registers can be saved across functions calls Another term for such registers is saved over a call registers SOCs Values in volatile registers cannot be saved across functions calls Another term for such registers is non SOC registers Table 6 3 lists both the volatile and non volatile registers Table 6 3 Volatile and Non Volatile Registers Unit Register Size Type Comments Arithmetic Logic Unit Y1 16 Volatile non SOC ALU YO 16 Volatile non SOC Y 32 Volatile non SOC XO 16 Volatile non SOC A2 4 Volatile non SOC Al 16 Volatile non SOC AO 16 Volatile non SOC 122 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Calling Conventions and Stack Frames Table 6 3 Volatile and Non Volatile Registers continued Unit Register Size Type Comments Arithmetic Logic Unit A10 32 Volatile non SOC ALU continued 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 16 Non Volatile SOC Co 16 Non Volatile SOC C10 32 Non Volatile SOC C 36 Volatile non
298. 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 Returns Error code as defined in the sub section Definitions on page 339 _eonce_GetCounterStatus 334 Retrieves the status of the breakpoint counter Prototype int _eonce GetCounters char counterlsZero char Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library counterIsStopped Parameters counterIsZero char Returns a if the breakpoint counter has reached zero counterIsStopped char Returns a 1 if the breakpoint counter has been stopped by a Counter Stop Trigger Remarks This function returns the state of the breakpoint counter when using the special counting function Returns Error code as defined in the sub section Definitions on page 339 _eonce_SetupTraceBuffer Configures the behavior of the trace buffer Prototype int _eonce SetupTraceBuffer unsigned int options Parameters optionsunsigned int Describes the behavior of the trace buffer Please see the section Definitions for more information on the identifiers for this parameter Remarks Sets the behavior of the trace buffer Triggers can also be set to start and stop trace buffer capture using the _eonce_SetTrigger function Return
299. ssing Intrinsic Functions The intrinsic functions for modulo addressing are e _mod_init e _mod_initintl6 e _ mod start e _ mod access e _ mod_update e _ mod stop e _ mod getintl6 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions e mod setintl6 e _ mod error _ mod_ init Initialize a modulo buffer pointer with arbitrary 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 locati
300. ssue in some implementation default data keyword data memory compatibility 16 16 bit default 24 24 bit prog keyword program memory compatibility 16 16 bit default 19 19 bit 21 21 bit 320 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc 14 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 This chapter contains the following sections e MSL for DSP56800E Runtime Initialization e EOnCE Library MSL for DSP56800E This section explains the Metrowerks Standard Library MSL that has been modified for use with DSP56800E Using MSL for DSP56800E Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers 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 Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers along with the project files for different configurations of MSL If you already
301. sting 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 9 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 9 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 1 Connect the target board to the remote machine 2 Launch the command converter server CCS on the remote machine with the local settings configuration using instructions described in the section Essential Target Settings for Command Converter Server on page 181 3 In the Target Settings gt Remote Debugging panel for your project make sure the proper remote connection is selected 4 Launch the debugger Launching and Operating the Debugger NOTE Code Warrior IDE automatically enables the debugger and sets debugger related settings within the project 188 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Launching and Operating the Debugger 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 Figure 9 6 Remote
302. structure Selecting or double clicking items of the page opens or changes the contents of related Processor Expert windows Targeting MC56F83xx DSP5685x Controllers 81 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview 82 Target CPU window This window depicts the target microprocessor as a simple package or a package with peripherals As you move the cursor over this picture s pins the window shows pin numbers and signals Additionally you can have this window show a scrollable block diagram of the microprocessor CPU Structure window This window shows the relationships of all target microprocessor elements in an expandable tree representation CPU Types Overview This reference window lists all CPUs that your Processor Expert version supports Memory Map This window shows the CPU address space plus mapping for internal and external memory Resource Meter This window shows the resource allocation for the target microprocessor Peripheral Usage Inspector This window shows which bean allocates each on chip peripheral Installed Beans Overview This reference window provides information about all installed beans in your Processor Expert version Driver generation The PEI suggests connects and generates driver code for embedded system hardware peripherals and algorithms Top Down Design A developer starts desi
303. substeps a b and c for the two ExtInt beans renaming them IRQA and IRQB Figure 5 18 shows the Processor Expert page at this point Figure 5 18 New Bean Names xi LEDcontrol mcp l sdm external memory y ny A 5 gt Files Link Order Targets Processor Expert 3 Configurations CPUs Y D Cpu DSP56F836 amp Beans Y GPIO_co Bitlo Z GPI0_C1 Bit10 lt GPIo_c2 Bito Z GPIO_c3 Biti0 Y GPIO_DE Bitlo Y GPIO_D7 Bitlo Y 8 IRGA ExtInt va 8 BAOB Extlnt Documentation x E PESL 232000006 6 Update pin associations for each bean a In the Processor Expert page double click the bean name GPIO_Co The Bean Inspector window opens displaying information for this bean b Use standard window controls to make the middle column of the Properties page about 2 inches wide c In the Pin for I O line click the triangle symbol of the middle column list box The list box opens Targeting MC56F83xx DSP5685x Controllers 107 For More Information www freescale com Processor Expert Interface Processor Expert Tutorial Freescale Semiconductor Inc d Use this list box to select GPIOCO_SCLK1_TB0_PHASEA1 Figure 5 19 depicts this selection Figure 5 19 New Pin Association Bean Inspector GPIO_CO BitIO Bean Items Visibility Help Properties Methods Events Comment 10 x
304. t word SBK word RWU word RE word T word REIE word RFIE word TIIE word TEIE word PT word PE word POL word WAKE word M word RSRC mi mj PRP PP PPP PPP Ppp Targeting MC56F83xx DSP5685x Controllers 147 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Working with Peripheral Module Registers word SWAI 1 word LOOP 1 Bits SCICR Code SCICR Bits TE 1 SCICR content is 0x0800 SCICR Bits PE 1 SCICR content is 0x0002 Explanation of Undesired Behavior If SCICR is mapped to a peripheral register the code that is used to access the register is not portable and might be unsafe like in DSP56800E at present Bit field behavior in C is almost all implementation defined So generating the following code is legal SCICR Bits TE 1 SCICR content is 0x0800 generated codes P 00000082 874802c moveu Ww SCICR RO P 00000084 F0E0000 move b X RO A P 00000086 8350008 bfset H8 Al P 00000088 9800 move b A1 X RO 7 SCICR Bits PE 1 SCICR content is 0x0002 generated codes P 00000089 F0E00001 move b X RO 1 A P 0000008B 83500002 bfset 2 A1 P 0000008D 9804 move b A1 X RO 1 However since the writes at P 0x88 and at P 0x8D are byte instructions and only 16 bits can be written to the SCICR register the other bytes look like they are filled with zero s before the SCICR is overwritten The
305. t 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 Prototype HSST_STREAM HSST_ open const char stream Parameters stream Passes the communication channel name Returns The stream associated with the opened channel HSST_close A target application uses this function to close a communication channel with the host 162 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface Prototype int HSST_ close HSST_ STREAM stream Parameters stream Passes a pointer to the communication channel Returns O if the call was successful or 1 if the call was unsuccessful HSST_setvbuf 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 NOTE This can greatly improve performance e Resize the buffer in an existing buffered channel opened in write mode 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 either internal or external at any time are indeterminate Prototype int HSST_setvbuf HSST_ STREAM rs uns
306. t Panel E MB56800E Target Project Type Application X m Application Info Dutput File Name same Table 4 4 M56800E Target Panel Elements Element Purpose Comments Project Type list Specifies an Application or Library Application is the usual selection box project Output File Specifies the name of the output file End application filenames with the elf Name text box extension end library filenames with the lib extension 50 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels NOTE Be sure to name libraries with the extension 1ib It is possible to use a different extension but this requires a file mapping entry in the File Mappings panel For more information see the IDE User Guide C C Language C Only Use the C C Language C Only panel Figure 4 4 to specify C language features Table 4 5 explains the elements of this panel that apply to the DSP56800E processor which supports only the C language Figure 4 4 C C Language Panel C Only J Force C Compilation P ANSI Strict F ISO C Template Parser I ANSI Keywords Only F Use Instance Manager T Expand Trigraphs F Enable C Exceptions Legacy for scoping F Enable ATTI V Require Function Prototypes F Enable bool Support 7 Enable wehar_t Support F EG Compatibility Mode Enable C99 Extensi
307. target various operating systems and microprocessors The CodeWarrior CD includes a C compiler for 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 The IDE includes Targeting MC56F83xx DSP5685x Controllers 35 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process e CodeWarrior Compiler for DSP56800E an ANSI compliant C compiler based on the same compiler architecture used in all CodeWarrior C compilers Use this compiler with the CodeWarrior linker for DSP56800E to generate DSP56800E applications and libraries NOTE The CodeWarrior compiler for DSP56800E does not support C e CodeWarrior Assembler for DSP56800E an assembler that features easy to use syntax It assembles any project file that has a asm filename extension For further information refer to the Code Warrior Development Studio Freescale DSP36800x Embedded Systems Assembler Manual e CodeWarrior Linker for DSP56800E a linker that lets you generate either Executable and Linker Format ELF or S record output files for your application e CodeWarrior Debugger for DSP56800E a debugger that controls your program s execution letting you see what happens internally as your program runs Use this debugger to find problems in your program The debugger can exe
308. tationery for specific LCF information See Table 14 2 for the variables defined in each Stationery LCF Table 14 2 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 _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 NOTE Ensure that the stack and heap memories reside in data memory 324 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization 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 memory 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
309. ten NOTE This function is useful for sending data structures e g C type structures HSST_set_log_dir 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 Prototype int HSST_set_log dir HSST_ STREAM stream char dir name 168 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc High Speed Simultaneous Transfer Target Library Interface Parameters stream Passes a pointer to the communication channel dir name Passes a pointer to the path to the directory in which to store temporary log files Returns O if the call was successful or 1 if the call was unsuccessful HSST Target Program Example In Listing 7 2 the HSST target program runs in parallel with the host plugin The target communicates with the host side your computer NOTE To restart the program after execution click on Restart HSST as shown in Figure 7 1 Listing 7 2 Sample HSST Target Program include lt stdio h gt include lt stdlib h gt include HSST h define buf_size 1000 Data size long i test_buffer buf_size int main HSST_ STREAM channel
310. tering 20 INCLUDE linker keyword 297 initialization runtime 325 328 inline assembly calling functions 230 232 overview 228 229 quick guide 229 230 inline assembly language 227 232 installation directories 23 installed beans overview window 100 installing and registering the CodeWarrior IDE 20 installing the CodeWarrior IDE 23 intrinsic functions 233 279 __mod_access 273 __mod error 275 __mod_getintl6 274 Targeting MC56F83xx DSP5685x Controllers __mod_init 271 272 __mod_initl6 272 __mod_setintl6 275 __mod_start 272 __mod_stop 273 __mod_update 273 abs_s 237 add 239 240 div_Is 248 249 div_ls4q 249 div_s 247 248 div_s4q 248 extract_h 245 extract_ 245 246 ffs_1 257 258 ffs_s 256 fractional arithmetic 234 235 implementation 233 234 L_abs 238 L_add 241 L_deposit_h 246 L_deposit_1 246 247 L_mac 253 L_msu 254 L_mult 254 255 L_mult_ls 255 L_negate 239 L_shl 265 266 L_shlftNs 266 L_shlfts 267 L_shr 267 268 L_shr_r 268 269 L_shrtNs 269 L_sub 241 242 mac_r 250 251 msu_r 251 mult 252 mult_r 252 253 negate 237 238 norm_l 258 norm_s 256 257 round 259 shl 260 261 shlftNs 261 262 shlfts 262 263 shr 263 shr_r 264 shrtNs 264 265 stop 242 TMP 371 For More Information www freescale com Freescale Semiconductor Inc sub 240 turn_off_coonv_rndg 243 turn_off_sat 243 244 turn_on_conv_rndg 244 wait 243 introduction 13 17 K KEEP_SECTION linker keyword 298 L L_abs i
311. the allocating beans Pausing your cursor over various parts of this window brings up brief descriptions of items This windows View menu lets you expand or collapse the display Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial Processor Expert Tutorial This tutorial exercise generates code that flashes the LEDs of a DSP56858 development board Follow these steps 1 Create a project a b a ma a oe 102 Start the CodeWarrior IDE if it is not started already From the main window menu bar select File gt New The New window appears In the Project page select highlight Processor Expert Examples Stationery In the Project name text box enter a name for the project such as LEDcontrol Click the OK button The New Project window replaces the New window In the Project Stationery list select TestApplications gt Tools gt LED gt 56858 Click the OK button Click the OK button The IDE Opens the project window docking it the left of the main window This project window includes a Processor Expert page Opens the Target CPU window as Figure 5 15 shows This window shows the CPU package and peripherals view Opens the Bean Selector window behind the Target CPU window Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Frees
312. the current build target 2 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 3 Change the settings in the panel 4 Click OK 46 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview 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 1 Click the Export Panel button 2 Assign a name to the XML file and save the file in the desired location Importing Panel Options from XML File 1 Click the Import Panel button 2 Locate the XML file to where you saved the options for the current settings panel 3 Open the file to import the options Saving New Target Settings in Stationery To create stationery files with new target settings 1 Create your new project from an existing stationery 2 Change the target settings in your new project for any or all of the build targets in the project 3 Save the new project in the Stationery folder Restoring Target Settings After you change settings in an
313. 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 12 9 shows examples of valid lines for a command file Listing 12 9 Valid Command File Lines _dec num 99999999 _hex num _ 0x9011276 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 F prepended to the symbol name This is because the compiler adds an F prefix to externally defined symbols Listing 12 10 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 Listing 12 10 Using a Global Variable in the LCF F_ foot 7 286 If you use a global symbol in an LCF as in Listing 12 10 you can access it from C program sources as shown in Listing 12 11 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Listing 12 11 Accessing a Global Symbol From C Program Sources extern unsigned l
314. ting MC56F83xx DSP5685x Controllers 275 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions pragma section DATA INT MODULO begin int int_buf 10 pragma section DATA INT_ MODULO end Convenient defines for modulo descriptors Hdefine MO 0 Hdefine 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 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 buf 9 The pointer is updated by 1 unit each time through the loop for i 0 i lt 100 i int mod_access MO __mod_update MO 1 Reset modulo control register to linear addressing mode _ mod stop 276 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Listing 11 12 Modulo Buffer Example 2 Set up a static location to save error codes if _ mod error serr_codes printf _ mod error set up failed n Initialize a modulo buffer pointer pointing to an array of 10 ints _ mod initint16 M0O int buf 9
315. tion www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions ___mod_access 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 Prototype void _ mod access int lt mod_desc gt Example Assign a value to the modulo buffer at the current pointer char mod access 0 char i __mod_update 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 update 0 2 __mod_stop 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 Targeting MC56F83xx DSP5685x Controllers 273 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Lan
316. tion causes a core event Overflow trigger enabled When this checkbox is selected overflow and saturation conditions in the processor cause core events Use step counter to execute 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 The CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers includes the Freescale DSP56800E Simulator This software lets you run and debug 214 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Using the DSP56800E Simulator code on a 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 NOTE The simulator also enables the DSP56800E menu for retrieving the machine cycle count and machine instruction count when debugging NOTE The data memory of the 56800E simulator is read only from X 0xFF80 to X OxFFFF Cycle Instruction Count From the menu bar of the Metrowerks CodeWarrior window select 56800E gt Display Cycle Instruction count The follow
317. tions Implicit Arithmetic Conversions Include File Capitalization E E la Pad Bytes Added E F Undefined Macro In if Pointer Integral Conversions ort i Optimization Unused Variables Non hnlined Functions l Unused Arguments T Missing retum Statements Treat All Warnings As Errors Expression Has No Side Effect Note likely to generate many spurious warnings Table 4 7 C C Warnings Panel Elements Element Purpose Comments Illegal Pragmas checkbox Checked Compiler issues warnings about invalid pragma statements Clear Compiler does not issue such warnings According to this option the invalid statement pragma near_data off would prompt the compiler response WARNING near data is nota pragma To check whether this option is in effect use the __option warn_illpragma command Possible Errors checkbox Checked Compiler checks for common typing mistakes such as for Clear Compiler does not perform such checks Targeting MC56F83xx DSP5685x Controllers If this option is in effect any of these conditions triggers a warning an assignment in a logical expression an assignment in a while if or for expression an equal comparison ina statement that contains a single expression a semicolon immediately after a while if or for statement To check whether this option is in effect use the __option warn_possunwant command 57 For More Informati
318. tions for code generation debugging and navigation of your project Unlike command line development tools the CodeWarrior IDE organizes all files related to your project You can see your project at a glance so organization of your source code files is easy Navigation among those files is easy too When you use the CodeWarrior IDE there is no need for complicated build scripts of makefiles To add files to your project or delete files from your project you use your mouse and keyboard instead of tediously editing a build script For any project you can create and manage several configurations for use on different computer platforms The platform on which you run the CodeWarrior IDE is called he host From the host you use the CodeWarrior IDE to develop code to target various platforms Note the two meanings of the term target e Platform Target The operating system processor or microcontroller fin which on which your code will execute Targeting MC56F83xx DSP5685x Controllers 13 For More Information www freescale com Freescale Semiconductor Inc Introduction CodeWarrior IDE 14 e Build Target The group of settings and files that determine what your code is as well as control the process of compiling and linking The CodeWarrior IDE lets you specify multiple build targets For example a project can contain one build target for debugging and another build target optimized for a particular operating system
319. tput to file do not link implies nostdlib no dead strip enable dead stripping of unused code default force active specify a list of symbols as undefined useful symbol to force linking of static libraries keep local on off keep local symbols such as relocations and output segment names generated during link default is on m ain symbol set main entry point for application or shared library use main to specify no entry H point for symbol maximum length 63 chars H default is FSTART_ map keyword generate link map file closure calculate symbol closures unused list unused symbols 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 Targeting MC56F83xx DSP5685x Controllers 317 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments mac Macintosh r dos DOS r n default unix H 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 t 8rect o file specify output filename DSP M56800E Project Options application global generate an application default library global generate
320. trigger using the _eonce_SetTrigger or _eonce_SetCounterTrigger functions Returns Error code as defined in the sub section Definitions on page 339 _eonce_EnableLimitTrigger 338 Allows or disallows a limit trigger to cause a core event in breakpoint unit 0 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code EOnCE Library Prototype int _eonce EnableLimitTrigger char enable Parameters enablechar If a non zero value allows this instruction to cause a core event If a zero value prevents this instruction from causing a core event 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 339 Definitions This sub section defines e Return Codes Normal Trigger Modes e Counter Trigger Modes e Data Selection Modes e Counter Function Modes Normal Unit Action Options e Counter Unit Action Options e Accumulating Trigger Options e Miscellaneous Trigger Options e Trace Buffer Capture Options e Trace Buffer Full Options e Miscellaneous Trace Buffer Option Targeting MC56F83xx DSP5685x Controllers 339 For More Information www frees
321. u The filenames disappear 28 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Project 12 Optional Add source files to the project a Method 1 From the main window menu bar select Project gt Add Files Then use the Select files to add dialog box to specify the files b Method 2 Drag files from the desktop or Windows Explorer to the project window 13 Optional Edit code in the source files a Double click the filename in the project window or select the filename then press the Enter key b The IDE opens the file in the editor window you are ready to edit file contents Creating a New Project with the DSP56800x EABI Stationery To create a sample project Follow these steps 1 From the menu bar select File gt New The New window Figure 2 7 appears Figure 2 7 New Window A x Project File Object af DSP56800x EAB Stationery Project name kel DSP56800x Examples Stationery NewProjl a DSP55800x New Project Wizard a Empty Project Location E Makefile Importer Wizard CAmy_projects NewProjl Amy_projectsiNewProjl Set kel Processor Expert Examples Stationery Sa Fo Processor Expert Stationery HIT Add to Project Project Targeting MC56F83xx DSP5685x Controllers 29 For More Information www freescale com Freescale Semiconductor Inc Getting Started Creating a Proje
322. unc global found in MSL C 56800E 1lib mem o 5 F_ fill mem func global found in MSL C 56800E 1lib mem _funcs o 1 Finit_sim_ func global found in 56800E init asm Use the Entry Point text box to specify the starting point for a program The default function this text box names is in the startup code that sets up the DSP56800E environment before your code executes This function and its corresponding startup code depend on your stationery selection For hardware targeted stationery the startup code is on the path support lt name of hardware e g M56852E gt startup For simulator targeted stationery the startup code is on the path support M56800E init The startup code performs such additional tasks as clearing the hardware stack creating an interrupt table and getting the addresses for the stack start and exception handler The final task for the startup code is call your main function Check the Annotate Byte Symbols checkbox to have the link map include the B annotation for byte addresses and no B annotation for word addresses Listing 4 3 Listing 4 3 Example of Annotate Byte Symbols int myint char mychar B 0000049C 00000001 bss Fmychar main c 0000024F 00000001 bss Fmyint main c Targeting MC56F83xx DSP5685x Controllers 71 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800E Specific Target Settings Panels Remote Debugging Use the Remote Debuggin
323. unding performed on result Saturation may occur during a left shift 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 _shr _r Word32 lval2shft Word16 s shftamount 268 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example long 11 0x41111111 short s2 1 long result result L shr r 11 s2 Expected value of result 0x20888889 L_shrtNs 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 Word16 s shftamount Example long result 1 0x24680000 short s2 1 result L _shrtNs 1 82 Expected value of result 0x12340000 Modulo Addressing Intrinsic Functions A modulo buffer is a buffer in which the data pointer loops back to the beginning of the buffer once the pointer address value exceeds a specified limit Figure 11 1 depicts a modulo buffer with the limit six Increasing the pointer address value to 0x106 makes it point to the same data it would point to if its address value were 0x100 Targeting
324. val2shft Word16 s_shftamount Targeting MC56F83xx DSP5685x Controllers 261 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short result short sl 0x1234 short s2 1 result shlftNs s1 s2 Expected value of result 0x2468 shifts 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 Word16 s shftamount 262 Targeting MC56F83xx DSP5685x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Intrinsic Functions Example short result short sl 0x1234 short s2 3 result shlfts s1 s2 Expected value of result 0x91a0 shr 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 NOTE This operation is not optimal on the DSP56800E because of t
325. variables in data memory as possible Declaring Program Memory Variables A program memory variable is declared using the pmem qualifier Here are some examples Targeting MC56F83xx DSP5685x Controllers 133 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800E Variables in Program Memory typedef struct simple structure declaration int i char p long 1 test _ pmem int ipl 5 initialized int in program memory _ pmem int ip2 uninitialized int in program memory int pmem ppx1 pointer in program memory to int in data memory _ pmem int _pmem ppp1 pointer in program memory to int in program memory _ pmem int parr 100 array in program memory __pmem tests sp structure in program memory __pmem int aap 2 2 1 two dimensional array in program memory __pmem int pxp1 pointer in data memory to int in program memory Using Variables in Program Memory Variables in program memory can be used almost exactly like variables in data memory The exceptions are presented below e the _pmem qualifier can t be used in a structure declaration because a structure can have all its members either in program memory or in data memory but not in both memory spaces The compiler will issue an error message in this case For example typedef struct simple structure declaration int i char _ pmem p error _ pmem not allowed here long
326. ve 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 Targeting MC56F83xx DSP5685x Controllers 201 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800E Fill Memory 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 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 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 Load Memory or Save Memory radio button Fill Memory From the menu bar of the Metrowerks CodeWarrior window select Debug gt 56800E gt Fill Memory to display the Fill Memory dialog box Figure 9 17 Figure 9 17 Fill Memory Dialog Box 202 Fill Memory x History v r Parameters Memory Type P Memoy y Address hex SS Cancel Size hex integer A Fill Expr hex integer gt z r Progress Use this dialo
327. werks builds all compilers as plug in modules The compiler and linker components are modular plug ins Metrowerks publishes this API so that developers can create custom or proprietary tools For more information go to Metrowerks Support http www metrowerks com MW Support When compilation succeeds building moves on to linking The IDE linker e Links the object files into one executable file You use the M56800E Target settings panel to name the executable file Incase of errors issues appropriate error messages and halts Targeting MC56F83xx DSP5685x Controllers 41 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process 42 The IDE uses linker command files to control the linker so you do not need to specify a list of object files The Project Manager tracks all the object files automatically it lets you specify the link order When linking succeeds you are ready to test and debug your application Debugging To debug your application select Project gt Debug from the main window menu bar The debugger window opens displaying your program code Run the application from within the debugger to observe results The debugger lets you set breakpoints and check register parameter and other values at specific points of code execution When your code executes correctly you are ready to add features to release the application to testers or to releas
328. when you think about an if then else type statement If one branch of a decision point modifies the SP one way and the other branch modifies SP another way then the value of the SP is run time dependent and the compiler is unable to determine where stack based variables are located at run time To prevent this from happening the User Stack Allocation feature traverses the control flow graph recording the inline assembly SP modifications through all program paths It then checks all control flow merge points to make sure that the SP has been modified consistently in each branch converging on the merge point If not a warning is emitted citing the inconsistency Once the compiler determined that inline SP modifications are consistent in the control flow graph the SP s offsets used to reference local variables function arguments or temps are fixed up with knowledge of inline assembly modifications of the SP Note you may freely allocate local stack storage 1 As long as it is equally modified along all branches leading to a control flow merge point 2 The SP is properly aligned The SP must be modified by an amount the compiler can determine at compile time A single new pragma is defined pragma check_inline sp effects on off reset will generate a warning if the user specifies an inline assembly instruction which modifies the SP by a run time dependent amount If the pragma is not specified then stack offsets used to access stack bas
329. www freescale com Freescale Semiconductor Inc Data Visualization Data Target Dialog Boxes Select registers from the left column and click the gt button to add them to the list of registers to be plotted Variables The Target Globals dialog box lets you graph the value of global variables in real time See Figure 8 5 Figure 8 5 Target Globals Dialog Box xi Select globals which are to be visualized H long main a H H long _ mem _limit H long_ receive gt H long send B long __sendnreceive e H long size H long stack_safety lt lt H long syscall H Innn alreadu que b coca eee Select global variables from the left column and click the gt button to add them to the list of variables to be plotted Targeting MC56F83xx DSP5685x Controllers 175 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Data Target Dialog Boxes HSST The Target HSST dialog box lets you graph the value of an HSST stream in real time See Figure 8 6 NOTE To plot HSST data the data visualization tool needs its own HSST channel Make sure your program opens a separate channel exclusively for the data visualization window This will avoid impacting data transmissions on other channels Figure 8 6 Target HSST Dialog Box 176 Target Memory Data xi Select the channel name and data size to be visualized m HSST Visualization Channel Na
330. www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Inline Assembly Language 6 Assembly language directives instructions and registers are not case sensitive The following two statements are the same add x0 y0 ADD X0 YO 7 Comments must have the form of C or C comments they must not begin with the or characters Listing 11 5 shows the valid syntax for comments Listing 11 5 Valid Comment Syntax move w x r3 y0 H ERROR add w x0 y0 OK move w r2 x sp ERROR adda r0 r1 n OK 8 To optimize a block of inline assembly source code use the inline assembly directive optimize iasm on before the code block Then use the directive optimize iasm off at the end of the block Omitting optimize iasm off means that optimizations continue to the end of the function Calling Assembly Language Functions from C Code You can call assembly language functions from C just as you would call any standard C function using standard C syntax Calling Inline Assembly Language Functions Listing 11 6 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 Notice that you are passing two 16 bit addresses to the add_int function You pick up those addresses in R2 and R3 passing the sum back in YO Listing 11 6 Sample Code Creating an Inline Assembly Language Function asm int add
331. y Language e Intrinsic Functions Inline Assembly Language This section explains how to use inline assembly language It contains these sections e Inline Assembly Overview e Assembly Language Quick Guide e Calling Assembly Language Functions from C Code e Calling Functions from Assembly Language Targeting MC56F83xx DSP5685x Controllers 227 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsics Inline Assembly Language Inline Assembly Overview To specify assembly language interpretation for a block of code in your file use the asm keyword and standard DSP56800E instruction mnemonics NOTE To make sure that the C compiler recognizes the asm keyword you must clear the ANSI Keywords Only checkbox of the C C Language C Only settings panel Differences in calling conventions mean that you cannot re use DSP56800 assembly code in the DSP56800E compiler Listing 11 1 shows how to use the asm keyword with braces to specify that an entire function is in assembly language Listing 11 1 Function Level Syntax asm lt function header gt lt assembly instructions gt The function header can be any valid C function header the local declarations are any valid C local declarations Listing 11 2 shows how to use the asm keyword with braces to specify that a block of statements or a single statement is in assembly language Listing 11 2 Statement Level
Download Pdf Manuals
Related Search
Related Contents
König CSGCGALS4MBL mobile phone case COIFA ILHA VE 580 - Domyos Copyright © All rights reserved.
Failed to retrieve file