Home
CodeWarrior™ Development Studio for Freescale™ 56800/E Hybrid
Contents
1. Y ER code 0 Do me aim 0 O m g E support 0 Do exi amp CyDSP56F805 0 Oe ad Y q startup 0 Do exi e AB DSPS6FS05_init c 0 Do e ad Y interrupt vectors 0 Oe ni Ye AB DSP56F805_vector_pRAM asm 0 De oem AB DSP56F805_vector_pROM asm n a n a a g E linker command files 0 0 zi g AB DSP56F805_extermal_mem_linker cmd n a n a zi AB DSP56F805_ ROM x RAM_linker cmd n a n a a Bib 0 0 a Y AS FP56800 lib 0 0 zi Y AE MSL C 56800 Lib 0 0 a Debug Column 14 Compile the code using either of the following options From the menu bar of the Metrowerks CodeWarrior window select Project gt Make e In the project window click the Make icon The above step updates all files that need to be compiled and re linked in the project The IDE tracks these dependencies automatically NOTE The Make command in the menu bar of the Metrowerks CodeWarrior window compiles selected files not all changed files The Bring Up To Date command in the menu bar compiles all changed files but does not link the project into an executable When you select the Make command the IDE compiles all of the code This may take some time as the IDE locates the files opens them and generates the object code When the compiler completes the task the linker creates an executable from Targeting DSP56F80x DSP56F82x Controllers 57 For More Information www freescale com Freescale Semiconduc
2. projectimain c prototypes void swap int a int b void print_array int arr int length int main void I int arr SIZE 4 6 7 1 2 3 4 12 4 5 ant i printf printf 0 Line 27 Colt Source 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 Targeting DSP56F80x DSP56F82x Controllers 227 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger The Source pane displays source or assembly code The toolbar at the top of the window has buttons that allows you access to the execution commands in the Debug menu Setting Breakpoints 1 Locate the code line Scroll through the code in the Source pane of the Program window until you come across the main function 2 Select the code line Click the gray dash in the far left hand column of the window next to the first line of code in the main function A red dot appears Figure 9 8 confirming you have set your breakpoint 228 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger Figure 9 8 Breakpoint in the Program Window Dx Rex tod be ww
3. 9 Examine the build target settings The CodeWarrior IDE allows your project to have several different configurations contained within the project These are called build targets When you work with a new CodeWarrior project you will want to examine your build target settings a To specify a build target double click the Settings icon in the Project window see Figure 4 9 for location of icons in the Project window The Target Settings window external RAM mode 3 Settings in sample appears Figure 4 12 This window contains several different panels In Figure 4 12 the Target Settings Panels is displayed in the Target Settings window Targeting DSP56F80x DSP56F82x Controllers 53 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 12 Target Settings Window i gexternal memory Settings lt 21xj N Target Settings Panels Target Settings B Target Target Settings Target Name extemal memon SSS Access Paths Build Extras Linker M56800 Linker Preinkerlijone o Postlinker None y File Mappings Source Trees Dutput Directory M56800 Target E Language Settings C C Language C C Preprocessor C C Warnings M56800 Assembler E Code Generation ELF Disassembler M56800 Processor Global Optimizations E Linker M56800 Linker Choose Clear Project output
4. IV Save project entries using relative paths Factory Settings Revert Import Panel Export Panel DK Cancel Apply b If itis not already visible click Target from the tree structure in the Target Settings Panels pane to expand the hierarchical view c Click Target Settings from the hierarchical tree The Target Settings panel appears which displays all the options related to selecting a build target NOTE By selecting M56800 Linker from the Linker list box the CodeWarrior IDE recognizes that the code you are writing is intended for DSP56800 processors and populates the Target Settings Panel with the DSP56800 specific panels The Target Settings window is the location for all options related to the build target Every panel and option is explained in the CodeWarrior documentation Most of the general settings panels are explained in the IDE User Guide DSP56800 target specific panels are explained in this targeting manual 54 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 10 Set build target options a In the Target Settings Panels panel click Target in the tree structure to expand the hierarchical view b Click M56800 Target from the hierarchical tree The M56800 Target panel appears Figure 4 13 Figure 4 13 M56800 Target S
5. GOSE ate Save Workspace Save Workspace As Imp Glos a Import Project Export Project Page Setup Print Gtrl P Open Recent Exit 352 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface New Project Dialog 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 xl Project File Object 45 DSP56800x EABI Stationery Project name d DSP56800x Examples Stationery the_project DSP56800x New Project Wizard a Empty Project Location a Makefile Importer Wizard C my_projects_folder the_proje A Processor Enel Examples Stationery eo A oen Doe 2 ff Processor Expert Stationery Add Targets to Project Project Ra Cancel Targeting DSP56F80x DSP56F82x Controllers 353 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 or simulators a
6. 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 DSP56F80x DSP56F82x Controllers Opens the first page of a description database of all beans 111 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 6 1 Processor Expert Menu Selections continued Beans from Package 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 can use this file selection window to add updated or new beans which you downloaded over the web to your project
7. ___ Patt sere IP Address 1270 01 fan 475 I Specify CCS Executable JTAG Configuration File Choose r ECS Timeout 60 seconds Factory Settings Revert Panel Cancel OK 6 Specify the name and path of the JTAG initialization file in the JTAG Configuration File text field 7 Click OK to close the connection panel 8 Inthe Remote Debugging panel specify the index of the core to debug by enabling the Multi Core Debugging checkbox and changing the Core Index selection 9 Select Project gt Run The IDE downloads the program to the specified core You can begin debugging JTAG Initialization File Although you may debug only one single chip at a time you must create a JTAG initialization file that specifies the type and order of all the chips in the chain To specify DSP56800 chips you must specify DSP56800 as the name of a the chip you are debugging For example Listing 9 1 shows a JTAG initialization file for three 56800 chips an SC140 and an MCore210 in a JTAG chain Targeting DSP56F80x DSP56F 82x Controllers 259 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Debugging on a Complex Scan Chain NOTE Device 0 is the device closest to the TDO signal on the Command Converter Server Listing 9 1 Example JTAG Initialization File for DSP56800 SC140 and MCore210 Boards J
8. filename c data then the text section from filename2 c 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 you 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 A sample is 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 point aligned on 16 bytes 280 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax file c data Arithmetic Operations Standard C arithmetic and logical operations may be used to define a
9. 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 224 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger 1 Set debugger preferences Select Edit gt external memory Settings from the menu bar of the Metrowerks Code Warrior window The IDE displays the Remote Debugging window Figure 9 6 Remote Debugging Panel i gexternal memory Settings ax N Target Settings Panels N Remote Debugging Language Settings r Connection Settings C C Language f Connection 56800 Local Hardware Connection y Edit Connection C C Preprocessor C C Warnings r Remote download path M56800 Assembler A Code Generation ELF Disassembler M56800 Processor Global Optimizations Linker M56800 Linker Editor Custom Keywords Debugger Debugger Settings Remote Debugging M56800 Target Remote Debug Opt ST Launch remote host application JT Multi Core Debugging G Clock Speed Core Index 0 4 800 Factory Settings Revert Import Panel Export Panel OK Cancel Apply 2 Select the Connection For exam
10. Description address where row 0 zero starts first flash memory address last flash memory address 0 data X 1 program memory P location in data memory map where the control registers are mapped erase time 101 www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Argument Description TME mass erase time Tnvs PROG ERASE to NVSTR set up time Tpgs NVSTR to program set up time Tprog program time Tnvh NVSTR hold time Tnvh1 NVSTR hold time mass erase Trev recovery time A sample flash configuration file for DSP56F803 and DSP56F805 is in Listing 5 4 Do not change the contents of this file Listing 5 4 Sample Flash Configuration File for DSP56F803 5 0 0x0004 0x7d f 1 0x0f40 0x0002 0x0006 Ox001A 0x0033 0x0066 Ox001A Ox019A 0x0006 0 0x8000 0x87ff 1 0x0 80 0x0002 0x0006 0x001A 0x0033 0x0066 0x001A 0x019A 0x0006 0 0x1000 ox1fff 0 0x0f60 0x0002 0x0006 0x001A 0x0033 0x0066 0x001A 0x019A 0x0006 NOTE You cannot use Flash ROM with the board set in development mode Ensure the Debugger sets OMR on launch is not enabled if you are using this feature Remote Debug Options Use the Remote Debug Options panel Figure 5 15 to specify different remote debug options 102 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Fi
11. Generates a STOP instruction which places the processor in the low power STOP mode Prototype void _ stop void Usage _ stop 180 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Conversion The following intrinsics are provided to convert between various integer and fixed point types The appropriate intrinsic should always be used when referencing an integer constant in fixed point context i e assignment and comparisons e _ fixed2int e _ fixed2long e __ fixed2short e _ int fixed e _ labs e _ long2fixed e __ short2fixed __ fixed2int Definition Converts a 16 bit__fixed__ value to a 16 bit integer Prototype int _fixed2int _ fixed_ Targeting DSP56F80x DSP56F 82x Controllers 181 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example int i inte 3 fixed i fix 0 645 i fixed2int i fix Returns 21135 j _fixed2int 0 645 if i j printf PASSED n if i fixed2int 0 645 printf PASSED n if j 21135 printf PASSED n __fixed2long Definition Converts a 32 bit __longfixed__ value to a 32 bit long integer Prototype long _
12. MODULE Events Including used modules for compilling procedure include Cpu h include Events h include GPIO CO h include GPIO Cl h include GPIO C2 h include GPIO C3 h include GPIO D6 h include GPIO D7 h include IRQA h include IROB 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 ceti Se Se Be eS a tte 22 Hesesszss ex Event IRQB OnInterrupt module Events kk From bean IRQB ExtInt Description This event is called when the active signal edge level ee occurs ER Parameters None Returns Nothing Suse ea ea stessesesdecsasess o tsc s3t s 2 ssa Senza pragma interrupt called extern short IRQB On void IRQB OnInterrupt void IRQB On 1 place your IRQB interrupt procedure body here 136 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial kk dx Event IRQA OnInterrupt module Events xk xk From bean x IRQA ExtInt k Description This event is called when the active signal edge level xx occurs EE Parameters None Returns Nothing A A A A A ee pragma interrupt called extern short IRQA On
13. Pausing your cursor over various parts of this window brings up brief descriptions of items This window s View menu lets you expand or collapse the display Targeting DSP56F80x DSP56F 82x Controllers 125 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 MC56F8346E development board Follow these steps 1 Create a project a b G ma a 9 126 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 6 15 shows This window shows the CPU package and peripherals view Opens the Bean Selector window behind the Target CPU window Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconduc
14. To check 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 DSP56F80x DSP56F82x Controllers To check whether this restriction is in effect use the __option enumalwasysint command 79 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800 Specifi
15. 2000 Machines 2 a wee ae Bo ae ee eu a oa 4838 A Porting Issues 341 Converting the DSP56800 Projects from Previous Versions 341 Removing illegal object_c on pragma directive Warning 342 Setting up Debugging Connections 342 Using XDEF and XREF Directives 0 342 Using the ORG Directive ee 343 Targeting DSP56F80x DSP56F82x Controllers 11 For More Information www freescale com Freescale Semiconductor Inc Table of Contents B DSP56800x New Project Wizard 345 OVEIVIEW y s ovale da Ce Gow Ye Boke A e e ea a 345 Pape Rules parta a atea e Ro ok Sk SE Ses S Resulting Target Rules 2 2 2 ee 350 RuleNotes suite ele ee A Ge Sk la A ee ee ee 3391 DSP56800x New Project Wizard Graphical User Interface 351 Invoking the New Project Wizard 2 2 2 352 New Project Dialog Box 2 ee 353 Target Pages sud a Soe ea OA Program Choice Page 2 2 ee ee ee ee 398 Data Memory Model Page 2 2 360 External Internal Memory Page 2 361 Finish Page 4 2 40 na A Be a 002 Index 363 12 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Introduction This manual explains how to use the Code Warrior M Integrated Development Environment IDE to develop code for the DSP56800 family of processors
16. 92 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels information This information is included within the linked ELF file This setting does not generate a separate file If you select Project gt Debug the Code Warrior IDE enables the Generate Symbolic Info option for you If the Generate Symbolic Info option is not enabled the Store Full Path Names option is not available NOTE If you decide to disable the Generate Symbolic Info option you cannot debug your project using the CodeWarrior debugger For this reason the compiler enables this option by default Store Full Path Names The Store Full Path Names option controls how the linker includes path information for source files when generating debugging information If this option is enabled the linker includes full path names to the source files If this option is disabled the linker uses only the file names By default this option is enabled This option is available only if you enable the Generate Symbolic Info option e Generate Link Map The Generate Link Map option controls whether the linker generates a link map Enable this option to let the linker generate a link map The file name for the link map adds the extension xMAP to the generated file name The linker places the link map in the same folder as the output el file For e
17. After you change settings in an existing project you can restore the previous settings by using any of the following methods Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings CodeWarrior IDE Target Settings Panels 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 CodeWarrior IDE Target Settings Panels Table 5 2 lists and explains the CodeWarrior IDE target settings panels that can apply to DSP56800 Table 5 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 DE 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
18. The Max Record Length field specifies the maximum length of the S record generated by the linker This field is available only if the Generate S Record File option is enabled The maximum value for an S record length is 256 bytes Targeting DSP56F80x DSP56F 82x Controllers 95 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800 Specific Target Settings Panels 96 NOTE Most programs that load applications onto embedded systems have a maximum length for S records The CodeWarrior debugger can handle S records as large as 256 bytes If you are using something other than the CodeWarrior debugger to load your embedded application you need to determine its maximum length EOL Character The EOL Character list box defines the end of line character for the S record file This list box is available only if you enable the Generate S Record File option Entry Point The starting point for a program is set in the Entry Point field in the M56800 settings panel The Entry Point field specifies the function that the linker first uses when the program runs The default function found in this field is located within the startup code that sets up the DSP56800 environment before your code executes This function and its corresponding startup code will be different depending upon which stationery you have selected In the case of hardware targeted stationery the startup code can be found in the
19. 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 M56800_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 154 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Sections Generated by the Compiler Listing 7 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 EnterCritical c a b else EnterCritical c b 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 Sections Generated by the Compiler The compiler creates certain sections by default when compiling C source files These default secti
20. e Loading a elf File without a Project e Using the Command Window e System Level Connect e Debugging on a Complex Scan Chain e Debugging in the Flash Memory e Setting up the Debugger for Flash Programming e Notes for Debugging on Hardware e Flash Programming the Reset and Interrupt Vectors Target Settings for Debugging This section explains how to control the debugger by modifying the appropriate settings panels Targeting DSP56F80x DSP56F82x Controllers 215 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Command Converter Server To properly debug DSP56800 software you must set certain preferences in the Target Settings window The M56800 Target panel is specific to DSP56800 development The remaining settings panels are generic to all build targets Other settings panels can affect debugging Table 9 1 lists these panels Table 9 1 Setting Panels that Affect Debugging This panel Affects Refer to M56800 Linker symbolics linker M56800 Linker warnings M56800 Processor optimizations Optimizing Code Debugger Settings Debugging options Remote Debugging Debugging Remote Debugging communication protocol Remote Debug Debugging options Remote Debug Options Options The M56800 Target panel is unique to DSP56800 debugging The available options in this panel depend on the DSP56800 hardware you are using and ar
21. void IRQA OnInterrupt void IRQA On 1 place your IRQA interrupt procedure body here END Events AAA k k This file was created by UNIS Processor Expert 03 15 for the Freescale DSP56x series of microcontrollers Kk AO E Targeting DSP56F80x DSP56F82x Controllers 137 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial Listing 6 2 File LEDcontrol c HATH HEHE EH HH HH HH HH HH HH HHH HEHE PEHE HH HH 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 AAA HH FE FE HH HH HH HH HH HHH HEHE HEHE HHH MODULE LEDcontrol Including used modules for compilling procedure include Cpu h include Events h 138 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface P
22. 0000100F B033 moves X 0x0033 X0 00001010 7C79 macr Y1 Y0 X0 00001011 9033 moves X0 X 0x0033 00001012 DE02 lea R2 00001013 DEO3 lea R3 160 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Compiler or Linker Interactions Compiler or Linker Interactions This section explains important concepts about how the DSP56800 compiler and linker interact Deadstripping Unused Code and Data The DSP56800 linker deadstrips unused code and data only from files compiled by the Code Warrior C compiler Assembler relocatable files and C object files built by other compilers are never deadstripped Libraries built with the Code Warrior C compiler only contribute the used objects to the linked program If a library has assembly or other C compiler built files only those files that have at least one referenced object contribute to the linked program Completely unreferenced object files are always ignored when deadstripping is enabled Deadstripping is enabled by default in the Linker gt M56800 Linker Target Settings panel Link Order The DSP56800 linker always processes C and assembly source files as well as archive files a and 11b in the order specified under the Link Order tab in the project window This is important in the case of symbol duplication For example if a symbol is defined in a source code file and a library the linker uses the def
23. 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 specify optimization options off none suppress all optimizations default on same as opt level 2 all full same as opt speed level 4 no space no speed 1 evel num 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 HHHHHHHHHHH HHH HHH HHH HHH H level 3 adds loop transformations Targeting DSP56F80x DSP56F82x Controllers 315 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no cse no commonsubs no deadcode no deadstore no lifetimes no loop invariants no strength no dead display dump H HH H OH OH OH it strength reduction loop invariant code motion level 4 subexpression elimination and loop invariant code motion for num common subexpression elimination adds repeated common range 0 4 default is 0 removal of dead code removal of dead assignments computation of variable lifetimes removal of loop invariants no prop lagation propagation of constant and copy assignments strength reduction reducing multiplication by an index variable into addition H HHH H sa
24. Calling Inline Assembly Language Functions You can call inline assembly language functions just like you would call any standard C function Listing 8 7 demonstrates how to create an inline assembly language function in a C source file This example adds two 16 bit integers and returns the result Notice that you are passing two 16 bit addresses to the add_int function You pick up those addresses in R3 and R2 and in YO pass back the result of the addition Listing 8 7 Sample Code Creating an Inline Assembly Language Function asm int add_int int i int 3 move x r2 y0 move x r3 x0 add x0 y0 int result returned in y0 rts Now you can call your inline assembly language function with standard C notation as in Listing 8 8 Listing 8 8 Sample Code Calling an Inline Assembly Language Function int x 4 y 2 y add int x amp y Returns 6 168 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Calling Assembly Language Functions from C Code Calling Stand alone Assembly Language Functions In order for your assembly language files to be called from C code you need to specify a SECTION mapping for your code so that it is linked appropriately You must also specify a memory space location Code is usually specified to program memory P space with the ORG dire
25. Click the Kill icon in the toolbar of the Program window This will stop code execution and close the Program window if the project is running In this case it will simply close the Program window as we are currently halted References You have completed the tutorial and used the basic elements of the Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers Refer to the IDE User Guide to learn more about the features available to you Targeting DSP56F80x DSP56F82x Controllers 67 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 68 Targeting DSP56F80x DSP56F82x 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 DSP36800 software development The settings that you select affect the DSP56800 compiler linker assembler and debugger This chapter contains the following sections e Target Settings Overview e CodeWarrior IDE Target Settings Panels e DSP56800 Specific Target Settings Panels Target Settings Overview The target settings control e Compiler options Linker options e Assembler options e Debugger options e Error and warning messages When you create a project using stationery the build targets which are part of
26. DSP56F80x and the DSP56F82x This chapter contains the following sections e CodeWarrior IDE e Freescale 56800 E Hybrid Controllers e 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 options for code generation debugging and navigation of your project Unlike command line development tools the CodeWarrior IDE organizes all files related to your project You can see your project at a glance so organization of your source code files is easy Navigation among those files is easy too When you use the CodeWarrior IDE there is no need for complicated build scripts 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 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 Build Target The group of setti
27. Debugging for DSP56800 Debugging in the Flash Memory 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 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 262 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Setting up the Debugger for Flash Programming set_hfm_erase_mode units pag
28. Downloading Code to DSP Hardware Fails If you are unable to download code to the target DSP hardware verify that the communications to the target hardware are working correctly The CodeWarrior IDE Crashes When Running My Code Use one of the samples provided with CodeWarrior IDE for DSP56800 to verify that your system is working correctly The Debugger Acts Strangely Sometimes DSP hardware can become corrupted and unusable even after a soft reset If the debugger has problems executing code you might have to perform a hard reset of the DSP hardware To reset the EVM board follow these steps 1 Disconnect the power cable from the board 2 Wait at least 5 seconds Targeting DSP56F80x DSP56F82x Controllers 337 For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips 338 3 Reconnect the power supply to the EVM board This reconnection step resets the board and clears its RAM To reset the ADS board follow these steps 1 Disconnect the power cable from the ADS board 2 Wait at least 5 seconds 3 Reconnect the power supply to the ADS board This reconnection step resets the board and clears its RAM Problems With Notebook Computers If you experience any problems downloading using the parallel port interface while using a notebook computer ensure that the parallel port is set in bidirectional mode On Dell Latitudes the ECP setting in CMOS has not em
29. Types it E Registers coca e 3 Configure the data target dialog box and filter dialog box 4 Run your program to display the data Figure 10 2 Figure 10 2 Graph Window i short DataOut 10 Ea x mx 8948 6948 4948 2948 4 948 44 1052 3052 5052 7052 9052 Value 005 115 2 25 3 35 4 45 5 55 6 65 7 75 8 85 9 Time 268 Targeting DSP56F80x DSP56F82x Controllers 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 Memory The Target Memory dialog box lets you graph memory contents in real time Figure 10 3 Target Memory Dialog Box Select the way the memory is to be visualized Data Type unsigned 32 b Data Units 10 Memory Visualization Single location changing over time Address Ox 0000sF30 C Memory Region chaning over time coca mo Targeting DSP56F80x DSP56F82x Controllers 269 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 dat
30. U u ndefine name HEHEH de e HHHHHH HHH HH HE 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 specify options affecting the preprocessed output emit file line breaks emit line directives else comments emit full path of file else base filename keep pragma directives else strip them default keep comments else strip them keep whitespace else strip it default prefix text file or precompiled header onto all 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 MWCIncludes added after all system paths default cased undefine symbol t I name ansi keyword off on relaxed strict ARM on off bool on off char keyword signed unsigned 312 th te te te te t FF ote He t tHe HOH HE HE OH specify ANSI conformance options overriding the given settings same as stdkeywords off enum min and strict off default same as stdkeywords on and strict on same as stdkeywords on and strict on enum min enum int check code for ARM Annotated C Reference Manual conformance default is off enable C bool type true and false constants default is off set sign of char ch
31. Word16 sinp2 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples 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 Definition Multiply two 16 bit fractional values round into a 16 bit fractional result Saturates only for the case of 0x8000 x 0x8000 When an accumulator is the destination zeroes out the LSP portion 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 _ mult_r Word16 sinpl Wordl6 sinp2 Targeting DSP56F80x DSP56F82x Controllers 197 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short sl 0x2000 0 25 short s2 0x2000 0 25 short result result _ mult_r sl s2 Expected value of result 0 0625 0x0800 _L mac 198 Definition Multiply two 16 bit fractional values and add to 32 bit fractional value generating a 32 bit result satura
32. 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 282 If you use a global symbol in an LCF as in Listing 12 10 it can be accessed from C program sources as shown in Listing 12 11 Targeting DSP56F80x DSP56F82x 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 long _foot void main void unsigned long i P sai i _foot _foot value determined in LCF Lf oss Expressions and Assignments You can create symbols and assign addresses to those symbols by using the standard assignment operator An assignment may only be use
33. 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 Targeting DSP56F80x DSP56F82x Controllers 151 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 User Stack Allocation For example REP 3 LEA 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 In cases where the SP is modified by a run time dependent amount a warning is issued Listing 7 1 Example 1 Legal modification of SP Using Inline Assembly define EnterCritical asm lea SP asm move SR X SP asm bfset 0x0300 SR asm nop asm nop define ExitCritical asm lea SP asm move X SP SR asm nop asm nop pragma check inline sp effects on int func int a 1 b 1 c EnterCritical C a b ExitCritical This case will work because there are no control flow merge points SP is modified consistently along all path
34. 0 i lt 0b111111 i showNumberWithLEDs i wait 100000 Targeting DSP56F80x DSP56F82x Controllers 141 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 x Write your code here pragma warn possunwant off IRQA On IRQB On IRQA GetVal IRQB GetVal 0 1 1 0 for CLEARLEDS pattern pragma warn possunwant reset END LEDcontrol 4 444 HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH HEHE de This file was created by UNIS Processor Expert 03 15 for the Freescale DSP56x series of microcontrollers Kk a 44 444 4444 4444 HH HH 44 HH HH HH HH HH HH HH HH HH HH HH HH HH HH HH 142 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 This chapter explains the Code Warrior M compiler for DSP56800 This chapter contains the following sections General Notes on C Number Formats Calling Conventions Stack Frames User Stack Allocation Sections Generated by the Compiler Optimizing Code eCompiler or Linker Interactions General Notes on C Note the following on the DSP56800 processors C la
35. 145 145 145 146 149 150 195 156 157 157 158 159 161 161 161 163 163 164 166 166 Freescale Semiconductor Inc Table of Contents Creating Labels for M56800 Inline Assembly 167 Using Comments in M56800 Inline Assembly 167 Calling Assembly Language Functions from C Code 168 Calling Inline Assembly Language Functions 168 Calling Stand alone Assembly Language Functions 169 Calling Functions from Assembly Language 170 Intrinsic Functions for DSP56800 171 An Overview of Intrinsic Functions 171 Fractional Arithmetic 171 Macros Used with Intrinsics 172 List of Intrinsic Functions Definitions and Examples 2 2 2 173 Absolute Negate 174 _ abs 174 __negate 174 _L_negate 175 Addition Subtraction 176 _ add 176 _ sub 177 _L add 177 _L sub 178 Control 180 stop 180 Conversion 181 _ fixed2int 181 _ fixed2long 182 __ fixed2short 183 __int2fixed 183 _ labs 184 _ long2fixed 185 __ short2fixed 185 Copy 187 __memcpy 187 __strepy 188 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Deposit Extract 2 2 aa extract AM te e ae ed 4 AS A Ma ou ale hehe ek RO BOA eek e ul dSpositi o cy ee ae Qt ela e Oe ah a A aE deposit i
36. 2 1 262 set_hfm_erase_mode units pages lall 263 set_hfm_verify_erase 110 263 set_hfm_verify_program 110 a a a aa a a 263 Setting up the Debugger for Flash Programming 2 2 263 Use Flash Config File pos cn age ere i Be Ge ee ge a 204 Notes for Debugging on Hardware 265 Flash Programming the Reset and Interrupt Vectors 266 10 Data Visualization 267 Starting Data Visualization 2 267 Data Target Dialog Boxes 2 2 2 269 Memory i ili pe we gow e a a 269 Registets ilo sii a a Ab aos Gad ee de 270 Variables Loa Os A See Dee ee e a 271 Graph Window Properties 2 2 ee ee 272 11 Profiler 275 12 ELF Linker 277 Structure of Linker Command Files 2 277 Memory Segment 0 20 278 Closure Blocks 2 gt 2 4 0 ee eb p os ee ee eee ee ee a 278 Sections Segment s so o soso iero a ia a 279 Linker Command File Syntax a a a aa 280 Alignment e io e e e Mee te bla A 280 Arithmetic Operations 2 e 281 Comments e 281 Deadstrip Prevention 2 u a a 282 Variables Expressions and Integral Types 282 File Selection ci ota a E O Re e a 284 Function Selection 2 ee 284 Targeting DSP56F80x DSP56F 82x Controllers 9 For More Information www freescale com Freescale Semiconductor Inc
37. 229 Viewing X Memory 2 e 232 Viewing P Memory 2 2 ee 233 Load Save Memory e i a e Be a oe ee a Be ey 238 Pull Memory PA od et cis ali Vai AU oe 295240 Save Restore Registers 2 2 2 a a a 242 OnCE Debugger Features 2 244 Watchpoints and Breakpoints 2 245 Trac Buffer vias th AA a A eo oe 251 Using the DSP56800 Simulator 2 2 252 Cycle Instruction Count 2 a e e 293 Memory Map 2 cod es rai a a e 2 254 Register Details Window 2 a a 2 255 Loading a elf File without a Project 2 2 u a ee 256 Using the Command Window 2 257 System Level Connect 2 2 ee 257 Debugging on a Complex Scan Chain 2 2 257 Setting Opi sn eo ae eh A RA A E DO JTAG Initialization File 2 2 2 259 Debugging in the Flash Memory 261 Flash Memory Commands 2 2 261 set_hfmclkd lt value gt s s ao eoe ace e oaoa ee 261 set_hfm_base lt address gt 2 0 262 8 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Table of Contents set_hfm_config_base lt address gt 2 2 2 262 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
38. 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 Arrange PE Windows none Restores the default arrangement of all open PEI windows 112 Targeting DSP56F80x DSP56F82x 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 6 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 6 4 Bean Selector Window ain x Bean Categories On Chip Peripherals lt Quick help E amp CPU internal peripherals Bean BitsIO E Communication gt Converter E Interrupts EE Measurement aS Memory 13 Peripheral beans pS SO 1 If you want to use 1 bit only select the 5 omi BitIO bean instead 2 If you want to use 8 bits select the S 1 Bytezi0 Byte3l0 BytelO bean instead Po 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 e
39. Converter Converter 25 pin parallel port interface cable 25 pin OCD ribbon cable Target Interface Module e JTAG 14 pin ribbon interface cable PCI Command Converter All 56800 targets Installing and Registering the CodeWarrior IDE Follow these steps 1 To install the Code Warrior software a Insert the Code Warrior 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 Code Warrior Setup the install wizard displays welcome page c Follow the wizard instructions accepting all the default settings d At the prompt to check for updates click the Yes button the Code Warrior updater opens 2 To check for updates 20 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE 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
40. D000007C D000007E 00000080 00000081 00000082 00000083 00000084 00000085 00000086 NA o o Bankan odo TEA 1 E E AA L O A 0 AL O A E pa r Line 1 Col 1 E98410B1 E98410B1 E98410B1 E98410B1 E98410B1 E98410B1 E98410B1 E98410B1 BD38 DEOB DD1F BD39 DEOB DD1F CCOA 4 Targeting DSP56F80x DSP56F82x Controllers jmp jmp IMP jmp jmp IMP jmp IMP noves lea nove noves lea nove novel 0x0010b1 0x0010b1 Dx0010b1 0x0010b1 0x0010b1 Dx0010b1 0x0010b1 0x0010b1 X 0x0038 N SP N X SP X 0x0039 N 235 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger e Source Figure 9 14 Figure 9 14 View P Memory Source Window pexternal_memory elf Memory 1 236 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc e Mixed Figure 9 15 Figure 9 15 View P Memory Mixed Window i gexternal_memory elf Memory 1 Display main 00000080 00000081 00000082 00000083 00000084 00000085 00000086 00000087 Y Do DoD Mood ood BIT SR Gh el segs Me ga 00000088 00000089 0000008B 0000008D D000008E CANARIA Line 29 int arr S Col 1 BD38 DEOB DD1F BD39 DEOB DD1F CCOA DEOF 880 DE40FFF 87D12003 C104 F001 4 Targeting DSP56F80x DSP5
41. Expert Tutorial 5 Rename the eight beans GPIO_C0 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 Bit O bean A context menu appears b Select Rename Bean A change box appears around the bean name Targeting DSP56F80x DSP56F82x Controllers 129 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial c Type the new name GPIO_C0 then press the Enter key The list shows the new name as Figure 6 17 shows this name still ends with Bit IO Figure 6 17 New Bean Name LEDcontrol mcp o sdm external memory a y A 5 gt Files Link Order Targets Processor Expert 3 Configurations CPUs Z Opu DSP56F836 amp Beans 7 lt RIGO lt Bi2 Bito Z Bia Bao Y Bits Bitlo Y pisitilo Z Bit Bitlo lt Elntl Extint lt Elnt2 Extint amp Documentation x E PESL 234000006 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 130 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial e Repeat substeps a b and c for the two ExtInt beans renaming them IRQA
42. For More Information www freescale com Freescale Semiconductor Inc Table of Contents 14 Libraries and Runtime Code 323 MSE Tor DSPS6800 os ae a te e Bk a ii 329 Using MSL for DSP56800 ie eR eS tee ES 2323 Allocating Stacks and Heaps for the DSP56800 326 Runtime Initialization 2 327 15 Troubleshooting 333 Troubleshooting Tips 200339 The Debugger Crashes or Freezes When Seion A a REP Statement 334 Can t Locate Program Entry On Start or Fstart c Undefined 334 When Opening a Recent a ect the CodeWarrior IDE Asks If My Target Needs To Be Rebuilt O E a ee 94 Timing values not found in FLASH configuration file Please upgrade your configuration file On chip e values will be used which may result in programming errors VO Bus Seca gi E e 109999 IDE Closes Immediately After dani is se OR os 2 a a 339 Errors When Assigning Physical Addresses With The Org Directive 335 The Debugger Reports a Plug in Error LL 335 Windows Reports a Failed Service Startup 2 2 2 336 No Communication With The Target Board 337 Downloading Code to DSP Hardware Fails pope ei a SST The CodeWarrior IDE Crashes When Running My Code 337 The Debugger Acts Strangely 2 n 2 2 2 ee 337 Problems With Notebook Computers 2 338 How to make Parallel Port Command Converter work on Windows
43. General Purpose Registers A 0x0400DB0000 AO 0x0000 AL 0x0DDB A2 0x04 B OXOFBAMADODO BO 0x0000 B1 OxBAAA B2 OxOF xo 0x0000 ry 0x03570000 z YO nxnnnn Zs 230 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger Figure 9 10 General Purpose Registers Window i m General Purpose Registers Window lol xj external_memory elf A 0x04000E0000 OMR 0x0103 2 AD 0x0000 HWS 0x0040 Al 0x0DDE LE Ox0001 AZ 0x04 LA 0x0160 B OXODFBAAADOOO PCRO OXDOFF BO 0x0000 PCR1 OxOOFF B1 OXBAAA MRO 0xDD43 B2 OxOF MR1 0x61D7 x0 0x0000 MR2 0X32AA Y 0x03570000 MR3 O0xE609 yo oxooo0 MR4 0x9716 SL 0x0357 MRS OxOB6B RO 0x0000 MRE OxEO70 R1 0x221B MRF OxDACC R2 Ox2002 MRS OXDADE R3 Ox2002 MRS OxSAD4 N 0xBD38 MR10 Ox3E72 MO1 OXFFFF MR11 Ox10E2 SP Ox321E MR12 Oxscc2 PC 0x0080 MR13 0x4190 IPR 0x0000 MR14 0x4A4D3 BCR OxOOFF MR15 0x3218 SR Ox0114 2 Editregister values 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 M56800 Target Settings Panel Targeting DSP56F80x DSP56F82x Controllers 231 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launch
44. Information www freescale com Freescale Semiconductor Inc 15 Troubleshooting This chapter explains common problems encountered when using the Code WarriorTM IDE for DSP56800 and their possible solutions Troubleshooting Tips This chapter contains the following sections e The Debugger Crashes or Freezes When Stepping Through a REP Statement e Can t Locate Program Entry On Start or Fstart c Undefined e When Opening a Recent Project the CodeWarrior IDE Asks If My Target Needs To Be Rebuilt Timing values not found in FLASH configuration file Please upgrade your configuration file On chip timing values will be used which may result in programming errors IDE Closes Immediately After Opening Errors When Assigning Physical Addresses With The Org Directive e The Debugger Reports a Plug in Error e Windows Reports a Failed Service Startup e No Communication With The Target Board e Downloading Code to DSP Hardware Fails The CodeWarrior IDE Crashes When Running My Code e The Debugger Acts Strangely e Problems With Notebook Computers If you are having trouble with CodeWarrior Development Studio for Freescale 56800 and this section does not help you e mail technical support at support metrowerks com Targeting DSP56F80x DSP56F82x Controllers 333 For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips The Debugger Crashes or Freezes When Stepping Thro
45. J Check System Includes TT Pad Bytes Added TT Undefined Macro In Hif m Optimization IV Nor Inlined Functions TT Treat All Warnings As Errors Note likely to generate many spurious warnings Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 5 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 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 Extended Error Checked Compiler issues war
46. 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 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 110 Target CPU Structure Opens the CPU Structure window which uses an expandible tree structure to portray the processor Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Fre
47. Modules checkbox 88 Show Comments checkbox 89 Show Data Modules checkbox 89 Show Debug Info checkbox 89 Show Headers checkbox 88 Show Relocations checkbox 88 Show Source Code checkbox 89 Show Symbol and String Tables checkbox 88 Use Extended Mnemonics checkbox 89 Verbose Info checkbox 88 Enable Debugger command 39 enabling the debugger 56 Exporting and importing panel options to XML Files 72 expressions in LCF 283 __extract_h 189 __extract_1 189 F F 282 failed service startup in Windows 336 File Mappings panel 73 fill memory dialog box 240 242 fixed type 145 fixed__ 145 181 _ fixed2long 182 __fixed2short 183 fixed point formats for DSP 56800 145 fixed 145 long fixed 145 short fixed 145 fixed point formats for DSP 56800short fixed 145 flash configuration file format 102 flash debugger commands add_hfm_unit 262 set_hfm_base 262 set_hfm_config_base 262 set_hfm_erase_ mode 263 set_hfm_verify_erase 263 set_hfm_verify_program 263 set_hfmclkd 261 262 flash memory debugging 261 Flash ROM debugger configuration 263 initializing variables in P or X memory 285 programming tips 265 ROM to RAM copy 285 287 Targeting DSP56F80x DSP56F82x Controllers float size 144 floating point formats for DSP 56800 144 Force Active Symbols text box 96 force_active 279 282 292 format flash configuration file 102 fractional arithmetic 171 equation for converting 172 Freescale Documentation 17 FSTART troubleshooting ent
48. PES My Network P Files of type y Cancel For more information on the Flash Configuration File Line Format see M56800 Target Debugging Notes for Debugging on Hardware Below are some tips and somethings to be aware of when debugging on a hardware target e 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 e The standard library I O function such as printf uses large amount of memory and may not 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 M56800 Target panel watchpoints and OnCE triggers Only one of these may be set at a time Targeting DSP56F80x DSP56F82x Controllers 265 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Flash Programming the Reset and Interrupt Vectors Flash Programming the Reset and Interrupt Vectors The first four P program memory locations in Flash ROM are actually mirrored from the first four memory locations of Boot Flash Therefore when Flash programming the reset vectors write the reset vectors to the
49. Settings Connection 56800 Local Hardware Connection y Edit Connection m Remote download path JT Launch remote host application p _ Multi Core Debugging G Clock Speed Core Index fo E 800 Targeting DSP56F80x DSP56F82x Controllers 97 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 6 Remote Debugging Panel Elements Element Purpose Comments Connection list Specifies the connection type Selecting 56800 Simulator box 56800 Simulator keeps the panel as Figure appropriate for testing code 5 11 shows on the simulator before Selecting 56800 Local downloading code to an actual Hardware Connection adds board the JTAG Clock Speed text 56800 Local Hardware box to the panel as Figure Connection CSS 5 12 shows appropriate for using your computer s command converter server connected to a DSP56800 board Remote Not supported at this time Download Path text box Launch Remote Host Application Not supported at this time Speed text box local hardware connection Default is 600 kilohertz checkbox Multi Core Allows debugging of multiple boards For more details see Debugging on a complex scan chain Debugging on a Complex Scan Chain JTAG Clock Specifies the JTAG lock speed for This list box is available only if the
50. Symbolics IS varlables All Value Location E E ar 0x3221 0x3221 i D MR9 i D MR8 int main void int arr SIZE st DE printfi printf print_array for 1 0 i lt SIZE 1 i for j i j lt SIZE j if arr i gt arr j A Breakpoint swap amp arr i amp arr j Setting print_array arr SIZE printf nun program done n Line 27 Col 1 NOTE To remove the breakpoint click the red dot The red dot disappears Setting Watchpoints For details on how to set and use watchpoints see the OnCE Debugger Features on page 244 NOTE For the DSP56800 only one watchpoint is available This watchpoint is only available on hardware targets Targeting DSP56F80x DSP56F82x Controllers 229 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger Viewing and Editing Register Values Registers are platform specific Different chip architectures have different registers 1 Access the Registers window From the menu bar of the Metrowerks CodeWarrior window select View gt Registers Expand the General Purpose Registers tree control to view the registers as in Figure 9 9 or double click on General Purpose Registers to view the registers as in Figure 9 10 Figure 9 9 General Purpose Registers for DSP56800 l0 x A Register Value 56800 Local Hardware Connection i E A external_memory elf 4
51. 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 Targeting DSP56F80x DSP56F82x Controllers 241 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Save Restore Registers 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 would actually write 0xBEEF 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 field is updated with the current progress of the operation When this is in progress the entire dialog box grays out except the Cancel button
52. a build target When you use the Targets view in the project window you see the name entered in the Target Name field Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels The name you specify here is not the name of your final output file It is instead a name for your personal use that you assign to the build target You specify the name of the final output file in the Output File Name field of the M56800 Target panel Linker Select a linker from the items listed in the Linker menu For DSP36800 projects you must select the M56800 Linker The selected linker defines the build targets After you select a linker only the panels appropriate for your build target in this case DSP56800 are available Pre Linker Some build targets have pre linkers that perform additional work such as data format conversion before the final executable file is built Code Warrior Development Studio for Freescale 56800 does not require a pre linker so set the Pre Linker menu to None Post Linker Some build targets have post linkers that perform additional work such as data format conversion on the final executable file Code Warrior Development Studio for Freescale Freescale 56800 does not require a post linker so set the Post Linker menu set to None Output Directory This field shows the directory to which the IDE sav
53. a company of Freescale sample code e linker command file for DSP56805EVM using external pRAM external xRAM internal xRAM 0x30 40 for compiler regs mode 3 EXT 0 H OH OH e revision history Targeting DSP56F80x DSP56F82x Controllers 299 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Sample M56800 Linker Command File 011020 R4 1 a h first version 030220 R5 1 a h improved comments C E a A OE o cla ia see end of file for additional notes H additional reference Freescale docs H for this LCF interrupt vectors gt external pRAM starting at zero program code gt external pRAM constants gt external xRAM dynamic data gt external xRAM stack size is set to 0x1000 for external RAM LCF requirements Mode 3 and EX 0 note there is a mode OB but any Reset or COP Reset resets the memory map back to Mode 0A DSP56805EVM eval board settings OFF gt jumper JG7 mode 0 upon exit from reset ON gt jumper JG8 enable external board SRAM CodeWarrior debugger Target option settings OFF gt Use Hardware Breakpoints ON gt Debugger sets OMR at Launch option note with above option on CW debugger sets OMR as OMR 0 gt EX bit stay in Debug processing state 1 gt MA bit 1 gt MB bit 56805 mode 3 development EX 0 MEMORY p interrupts RAM RWX ORIGIN 0x0000
54. abs e _ negate e _L negate _abs Definition Computes and returns the absolute value of a 16 bit integer Generates an ABS instruction Assumption Prototype int _ abs int Example int di De i _ abs i _ negate Definition Negates a 16 bit integer or fractional value returning a 16 bit result Returns 0x7FFF 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 174 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Prototype Word16 __negate Wordl6 svarl Example int result sl 0xE000 0 25 result negate sl Expected value of result 0x2000 0 25 _L_negate Definition 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 Prototype Word32 _L negate Word32 lvarl Example long result sl 0xE0000000 0 25 result _L_negate s1 Expected value of result 0x20000000 0 25 Targeting DSP56F80x DSP56F82x Controllers 175 For More Information www freescale com Freescale Semiconductor Inc I
55. also can debug using Tcl scripts or the Command Window For more information on Tel scripts and the Command Window please see the CodeWarrior Development Studio IDE 5 6 Windows Automation Guide System Level Connect The CodeWarrior DSP56800 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 on a Complex Scan Chain This section describes the procedure for debugging a chip connected on a complex JTAG chain Setting Up The general steps for debugging a DSP56800 chip connected on a complex scan chain are Targeting DSP56F80x DSP56F82x Controllers 257 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Debugging on a Complex Scan Chain 1 Set up and connect your JTAG chain of target boards Write a JTAG initialization fil
56. and text files are handled differently because DSP56800 char character is 16 bits and x86 host char is 8 bits e Text file I O operations are 1 to 2 mapping e Binary file I O operations are 1 to 1 mapping Files are created with fopen on the host machine as shown in Table 14 2 Table 14 2 Host File Creation Location file opened as host elements target elements text 8 bit 16 bit binary 16 bit 16 bit Text File I O DSP56800 host I O does 16 bit to 8 bit mapping for host text files The host text file is handled as 8 bit elements with conversion to 16 bit elements on the target side For example if you open the host file with the fopen mode w the file opens as new text file or a truncated existing text file of the file name When fwrite is called the host file writes the DSP56800 buffer of 16 elements of the host file as 8 bit elements Targeting DSP56F80x DSP56F 82x Controllers 325 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800 Binary File I O DSP56800 host I O does 16 bit to 16 bit mapping for binary files The host binary file is handled as 16 bit elements Allocating Stacks and Heaps for the DSP56800 Stationery linker command files LCF define heap stack and BSS locations LCFs are specific to each target board When you use M56800 stationery to create a new project CodeWarrior automatically adds the LCF to the new
57. beginning of Boot Flash The interrupt vectors are located in Program Flash Write the interrupt vectors normally starting at P 0x0004 The Flash targets in the stationery demonstrate how the source linker command file and flash configuration file look NOTE It is important that you use the flash configuration file provided in the stationery Using a flash configuration file with extra sections can lead to multiple erases of the same flash unit resulting in Flash programming errors 266 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 10 Data Visualization Data visualization lets you graph variables registers and regions of memory as they change over time The Data Visualization tools can plot memory data register data and global variable data e Starting Data Visualization e 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 10 1 appears Select a data target type and click the Next button Targeting DSP56F80x DSP56F82x Controllers 267 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Starting Data Visualization Figure 10 1 Data Types Window Data Types xi Select a target data type for which the data is to be visualized
58. by MWLibraries and add system libraries specified by MWLibraryFiles default global cased disassemble and send output 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 H library use main to specify no entry point for symbol maximum length 63 chars 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 mac Macintosh r dos DOS r n default unix Unix n sreclength length specify length of S records should be a H multiple of 4 implies srec for H length range 8 252 default is 64 Targeting DSP56F80x DSP56F82x Controllers 319 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments usebyteaddr use byte address in S record file implies srec o file specify output f
59. command 67 load save memory 238 240 OnCE features 244 operating 224 231 problems with behavior 337 save restore registers 242 244 setting preferences 59 setting up for Flash programming 263 system level connect 257 toolbar 61 using 58 Debugger Settings panel 73 debugging 39 215 connecting to a loaded target 257 flash memory 261 per file 56 projects 60 target settings 215 216 Targeting DSP56F80x DSP56F82x Controllers watchpoint status 245 See also IDE User Guide Debugging a loaded target 257 defining an inline assembly function 166 definition BSS 326 heap 326 stack 326 development tools 39 dialog boxes fill memory 240 242 load save memory 238 240 save restore registers 242 244 Directive XDEF 342 directories installation 25 Disable Deadstripping checkbox 94 _ div 192 _ div_ls 192 DO instructions allowing 91 Domain Technologies SB 56K installing 28 double size 144 downloading code problems 337 DSP code and data storage 155 156 installing hardware 25 linker 161 DSP hardware system requirements 19 DSP56800 calling conventions 145 fixed point formats 145 floating point formats 144 integer formats 144 stack frame 149 DSP56800E simulator 252 E editing code 37 project contents 58 source files 58 See also IDE User Guide editor of IDE 58 ELF Disassembler settings panel 87 Show Addresses and Object Code checkbox 89 364 For More Information www freescale com Freescale Semiconductor Inc Show Code
60. files containing assembly language statements and having the file mapping suffix associated with the stand alone assembler usually asm are handled with an explicit stand alone assembler plugin called the asm_m56800 d11 This plugin assembler supports a feature rich assembly language syntax The exact syntax of the assembly language statements and directives are found in the DSP56800x_Assembly pdf Inline assembly language on the other hand is a DSP56800 instruction syntax handled directly by an internal compiler assembly language syntax parser and Targeting DSP56F80x DSP56F82x Controllers 163 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Working With DSP56800 Assembly Language 164 assembler Inline assembly is normally distinguished by asm constructs within a C language function or as an explicit assembly language function in C such as asm int functionname The inline assembler is meant for light duty enhancements or changes to instructions emitted by the compiler The following outlines a few of the key differences between stand alone and inline assembly e Inline assembly statements are restricted to simple mnemonics and operand syntax as documented in the DSP56800 Family manual e Directives are not supported in inline assembly e Single and dual parallel move syntax is supported in both assemblers e Labels may be defined in inline assembl
61. fixed2long _ longfixed _ 182 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long 1 _ longfixed__ 1fix 0 645 l fixed2long lfix Returns 1385126952 _ fixed2short Definition Converts a 16 bit __shortfixed__ value to a 16 bit short integer Prototype short _ fixed2short _ shortfixed_ Example short s _ shortfixed__ sfix 0 645 s fixed2short sfix Returns 21135 __int2fixed Definition Converts a 16 bit integer value to a 16 bit __fixed__ value Prototype fixed _ int2fixed int Targeting DSP56F80x DSP56F82x Controllers 183 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example int i 0x2000 _ fixed ifix _ fixed jfix Returns 0 25 ifix int2fixed i jfix int2fixed 0x2000 if ifix jfix printf PASSED n if ifix int2fixed 0x2000 printf PASSED n if jfix 0 25 printf PASSED n _ labs Definition Computes and returns the absolute value of a 32 bit long integer Generates an ABS instruction Prototype long _ labs long 184 Targeting DSP56F80x DSP56F82x Controllers For More Informat
62. followed by an instruction that accesses X memory using the RO pointer The following example shows a warning is generated NORM RO A MOVE X RO A Cannot reference RO after NORM 2 Any jump branch or branch on bit field may not specify the instruction at LA or LA 1 of a hardware DO loop as their target addresses DO 7 LABEL BCC LABEL Cannot branch to LA instruction LABEL Targeting DSP56F80x DSP56F82x Controllers 211 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Pipeline Restrictions 3 Any jump branch or branch on bit field instructions may not be located in the last two locations of a hardware DO loop that is at LA or at LA 1 DO 7 LABEL BCC ULABEL Cannot branch in LA instruction LABEL NOTE A warning will be emitted when pipeline conflicts are detected 4 Ifa MOVE instruction changes the value in one of the address registers RO R3 then the contents of the register are not available for use until the second following instruction That is the instruction immediately following the MOVE instruction does not use the modified register to access X memory or update an address This also applies to the SP register and MO1 register MOVE X SP 2 R1 MOVE X R1 A R1 is not available In addition it applies if a 16 bit immediate value is moved to the N register and the option for Compiler adjusts for delayed
63. for DSP 155 156 CodeWarrior compiler architecture 38 39 components 39 debugging for DSP 215 getting started 19 introduction 13 tools listed 39 troubleshooting 333 tutorial 41 41 67 using the debugger 58 using the IDE 41 CodeWarrior IDE 14 installing 25 installing and registering 20 introduction 13 CodeWarrior IDE Target Settings Panels 73 command converter server 216 224 commands Add Files 58 Bring Up To Date 38 Compile 37 Enable Debugger 39 M56800 Settings 59 Make 39 Preprocess 39 comments for linker command file 281 communications with target board problems 337 Compile command 37 compiler architecture 38 39 363 For More Information www freescale com Freescale Semiconductor Inc back end for DSP 143 intermediate representation IR 38 plug in modules explained 39 support for inline assembly 163 See also C Compilers Reference compiling 37 code 57 See also IDE User Guide compress 294 Console 324 Console and File I O 324 converting CodeWarrior projects 341 core tools tutorial 41 67 CPU types overview window 122 Create Assembly Output checkbox 91 creating labels for DSP56800 Assembly 167 Custom Keywords settings panel 73 Cycle Instruction Count 253 D Data Visualization 267 data deadstripping unused 161 deadstripping prevention 278 282 deadstripping unused code and data 161 debug information generating 56 debugger command converter server 216 224 fill memory 240 242 Kill
64. freescale com Overview Table B 5 Page Rules for the MC56F8322 MC56F8323 MC56F8345 MC56F8346 MC56F8356 and MC56F8357 Next Page Finish Page 349 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 350 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Rule Notes Additional notes for the DSP56800x New Project Wizard rule
65. freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger 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 Figure 9 12 View P Memory Raw Data Window i gexternal_memory elf Memory 1 lol x Display main 00000080 OBDE 1FDD 3980 OBDE 1FDD 00000086 OFDE 0F88 40DE F7FF D187 D000008C DACI D1FO 0000 1364 7CAG 00000092 0020 OBDE 1FD8 C8E9 060E 00000098 0087 3820 OBDE 1FD8 C8E9 DODODOSE 1BDE D087 SE20 OBDE 1FD8 000000A4 O60E 1BDE OFSA 42DE F7FF DOODODAA DAC1 C8E9 EFOO B947 0000 2649 000000B0 23980 3890 1FA9 0F88 40DE F7FF 00000086 39BD 40E0 44F1 0F88 40DE F7FF OOOOOOBC 38860 40E0 44F0 437 1047 39B0 0000002 0956 008D 0F88 40E0 04DE 1084 000000C8 3860 0956 008D 0F88 40E0 04DE DOODOOCE 1086 C8E9 2201 B84A 38B0 DASE 00000004 SEAS B94A 39B0 095E 57A5 OFSA Word Size 16 y Page P Memory y i 234 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc e Disassembly Figure 9 13 Debugging for DSP56800 Launching and Operating the Debugger Figure 9 13 View P Memory Disassembly Window gexternal_memory elf Memory 1 Display main Views f J Source C Documents and Settings sopella Desktop 00000070 00000072 00000074 00000076 00000078 D000007A
66. 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 e Linker Command File Syntax e Linker Command File Keyword Listing e Sample M56800 Linker Command File Structure of Linker Command Files Linker command files contain three main segments e Memory Segment e Closure Blocks e Sections Segment A command file must contain a memory segment and a sections segment Closure segments are optional Targeting DSP56F80x DSP56F82x Controllers 277 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Structure of Linker Command Files Memory Segment In the memory segment available memory is divided into segments Listing 12 1 shows a sample memory segment format Listing 12 1 Sample MEMORY Segment MEMORY segment 1 RWX ORIGIN 0x1000 LENGTH 0x1000 segment 2 RWX ORIGIN AFTER segment_1 LENGTH 0 data RW ORIGIN 0x2000 LENGTH 0x0000 segment name RW ORIGIN memory address LENGTH segment length Hand so on The RWX portion consists of ELF access permission flag
67. issues relating to successfully porting code to the most current version of the CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers This appendix lists issues related to successfully porting sources from the Suite56 M toolset and differences that occur between the Code Warrior IDE and the Suite56 tools This appendix contains the following sections e Converting the DSP56800 Projects from Previous Versions e Removing illegal object_c on pragma directive Warning e Setting up Debugging Connections Using XDEF and XREF Directives e Using the ORG Directive Converting the DSP56800 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 Targeting DSP56F80x DSP56F 82x Controllers 341 For More Information www freescale com Freescale Semiconductor Inc Porting Issues Removing illegal object_c on pragma directive Warning Figure A 1 Project Conversion Dialog Convert Project x Project sample mcp needs to be converted Some target settings need to be updated to the current version Some preference 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
68. of P Memory e Raw Data e Disassembly e Source e Mixed d Enter the memory address in the Display field Enter a hexadecimal address in standard C hex notation for example 0x1000 Figure 4 22 shows Raw Data Figure 4 22 View P Memory Window 2101 Display 0x1 000 View Raw data y 00001000 00001006 00001002 00001012 00001018 00000101E 00001024 00001024A 00001030 F4FF 394A 39BE 5542 3ABO 3842 3890 F9BE 84E2 870F 1FFA 40E0 82B0 F990 FSBO 145E 0247 F9A6 1400 FOBA 40E0 8381 F9B0 5174 F990 F9BE 1AA7 F9B0 3164 3990 30C0 03A9 38B8 B84A 1400 394A 39BE 7AA2 FOBA F9B1 83B0 4364 8391 F985 8781 0637 FBB4 CEFO 12 Run the debugger Use either of the following options a 66 Select Project gt Run Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial b Click the Run icon in the toolbar of the Program window In this simple example the debugger will halt at a debug instruction after printing out messages to the console window This debug instruction is the portion of the startup code which handles the program s exit 13 Quit the application From the menu bar of the Metrowerks Code Warrior window select Debug gt Kill This stops the code execution and quits debugging Use either of the following options a Select Debug gt Kill b
69. resolve the restrictions in pipeline dependencies Targeting DSP56F80x DSP56F82x Controllers 91 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Write const data to rodata section This option allows the compiler to write all constant data to a read only memory section rodata You must add rodata section in the linker command file This option is overridden by the use_rodata pragma Generate code for profiling This option allows the compiler to generate code for profiling For more details about the profiler see the Profiler on page 275 M56800 Linker The M56800 Linker panel Figure 5 10 controls the behavior of the linker This panel is only available if the current build target uses the M56800 Linker Figure 5 10 M56800 Linker Settings Panel N M56800 Linker IV Generate Symbolic Info TT Disable Deadstripping Y Store Full Path Names MW Generate ELF Symbol Table V Generate Link Map IT Suppress Warning Messages IT List Unused Objects Show Transitive Closure IT Generate S Record File I Sot By Addtes Max Record Length TO Generate Byte Addresse EOL Character Entry Point Finit_M56805_ Force Active Symbols The M56800 Linker panel options are e Generate Symbolic Info The Generate Symbolic Info option controls whether the linker generates debugging information If the option is enabled the linker generates debugging
70. stationery generated project s startup folder The startup code performs other tasks such as clearing the hardware stack creating an interrupt table and getting the stack start and exception handler addresses The final task performed by the startup code is to call your main function Force Active Symbols The Force Active Symbols field instructs the linker to include symbols in the link even if the symbols are not referenced In essence it is a way to make symbols immune to deadstripping When listing multiple symbols use a single space between them as a separator Remote Debugging Use the Remote Debugging panel Figure 5 11 Figure 5 12 to set parameters for communication between a DSP56800 board or Simulator and the Code Warrior DSP56800 debugger Table 5 6 explains the elements of this panel NOTE Communications specifications also involve settings of the debugging M56800 Target panel Figure 5 13 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Figure 5 11 Remote Debugging Panel 56800 Simulator q Remote Debugging r Connection Settings Connection 56800 Simulator v Edit Connection Remote download path Tr Launch remote host application p ______ Figure 5 12 Remote Debugging Panel Local Connection N Remote Debugging r Connection
71. supported at this time Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 6 Processor Expert 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 Code Warrior 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 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 propert
72. 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 DSP56800 project stationery when you create a new project Target Setting Panels Table 5 1 lists the target settings panels e Links identify the panels specific to DSP56800 projects Click the link to go to the explanation of that panel Targeting DSP56F80x DSP56F82x Controllers 69 For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview The Use column explains the purpose of generic IDE panels that also can apply to DSP56800 projects For explanations of these panels see the IDE User Guide Table 5 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 M56800 Target Language Settings C C Language C only C C Preprocessor C C Warnings M56800 Assembler Code Generation ELF Disassembler M56800 Processor Global Optimiza
73. to OxFFFF for proper execution of C code Program PC 21 Volatile non Controller SOC LA 16 Volatile non SOC HWS 16 Volatile non SOC OMR 16 Volatile non In certain registers SOC values must be kept for proper C execution For example set the CM bit See OMR Settings on page 156 SR 16 Volatile non SOC LC 16 Volatile non SOC Page 0 MRO 16 Volatile non SOC MR1 16 Volatile non SOC MR2 16 Volatile non SOC MR3 16 Volatile non SOC MR4 16 Volatile non SOC Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Calling Conventions Stack Frames Table 7 4 Volatile and Non Volatile Registers continued Unit Register Size Type Comments Name MR5 16 Volatile non SOC MR6 16 Volatile non SOC MR7 16 Volatile non SOC MR8 16 Non volatile non SOC MR9 16 Non volatile non SOC MR10 16 Non volatile non SOC MR11 16 Non volatile non SOC MR12 16 Non volatile non SOC MR13 16 Non volatile non SOC MR14 16 Non volatile non SOC MR15 16 Non volatile non SOC Stack Frame The stack frame is generated as shown in Figure 7 1 The stack grows upward meaning that pushing data onto the stack increments the address in the stack pointer Targeting DSP56F80x DSP56F82x Controllers 149 For More Information www fre
74. warnings err or passed to all tools no iserr or treat warnings as errors turn on all warnings require prototypes pragmas illegal pragmas no illpragmas empty dec1 empty declarations possible possible unwanted effects no unwanted unusedarg unused arguments unusedvar unused variables unused same as w no unusedarg no unusedvar extracomma extra commas no comma pedantic pedantic error checking no extended hidevirtual hidden virtual functions Targeting DSP56F80x DSP56F82x Controllers no no no implicit conv impl_ int2float impl float2int H HHH implicit arithmetic conversions warn impl float2int impl signedunsigned implicit integral to floating conversions implicit floating to integral conversions 317 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no impl signed unsigned implicit signed unsigned conversions no notinlined inline functions not inlined no largeargs passing large arguments to unprototyped functions no structclass inconsistent use of class and struct no padding padding added between struct members no notused result of non void returning function not used no missingreturn return without a value in a H non void returning function no unusedexpr use of expressions as statements without side effects no ptrintconv loss
75. window Figure 6 5 lets you modify bean properties and other settings To open this window select Processor Expert gt View gt Bean Inspector from the main window menu bar Figure 6 5 Bean Inspector Window 114 Bean Inspector AM1 AsynchroMaster 0 xj Bean Items Visibility Help roperties Methods Events Comment Bean name AM1 Channel SCIO ga Interrupt se Enable E Y Y E Interrupt InterruptRxINT_SCIOINT_SCIO RxFull Interrupt Rx mediun Ji Interrupt Ta INT_SCIOINT_SCIO_TxEmpty Y Y Y Y Y Y Y T Interrupt Tx mediun 1 Interrupt Er INT_SCIO INT_SCIO_RxError Interrupt Err mediun w 1 Interrupt dl 1 T_SCIO INT_SCIO_TxIdle Interrupt Idh Input buffer Output buffi Settings hardware wake up Stop bit Mode Normal w ASIS ISI Rereiver Nisahle 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 DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows e Item names Items
76. 00E project 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 347 360 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x 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 xj Select one or more memory configurations for this project V External Memory Y Intemal 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 347 Targeting DSP56F80x DSP56F82x Controllers 361 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 DSP56800x New Proje
77. 0x1234 __shr_r Definition 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 DSP56800 because of the saturation requirements and the bidirectional capability 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 Targeting DSP56F80x DSP56F82x Controllers 207 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short result short sl 0x2468 short s2 1 result _ shr sl s2 Expected value of result 0x1234 _L_shl 208 Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion Note This operation is not optimal on the DSP56800 because of the saturation requirements and the bidirectional c
78. 115 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Target CPU Window The Target CPU window Figure 6 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 6 6 Target CPU Window Package Target CPU Cpu 56F8346 find INS ENE soe Pillo 56F8346 f a o 0 gt r j a 51 vCaPi WCAP1 YCC Core Power when the internal voltage regulator is disabled DA 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 Targeting DSP56F80x DSP56F82x 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 6 7 shows it is not always possible for the picture of a
79. 2 17 10 sf ef 7 6 5 4 3 2 1 0 AAA E A A A A Type the name of a register or a full path to a description file in the Description File field Read Reset Value Text Views Auto v W 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 M56800 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 Targeting DSP56F80x DSP56F 82x Controllers 255 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Loading a elf File without a Project 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 Code Warrior IDE 2 Choose File gt Open and specify the file to load in the standard dialog box that appears Alternatively yo
80. 56800 assembler to specify physical addresses for program P and data X memory The Debugger Reports a Plug in Error When the CodeWarrior IDE debugger reports a plug in error a dialog box appears that reads Embedded DSP Plug in Error Can t connect to board If you see this dialog box check the following Targeting DSP56F80x DSP56F82x Controllers 335 For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips e Verify that the hardware cards are installed and seated properly e Verify that all of the cables are connected properly e Verify that power is being supplied to the DSP hardware Windows Reports a Failed Service Startup When the Windows Service Control Manager reports a failed service startup the message box shown in Figure 15 2 appears Figure 15 2 Service Control Manager Message Box Service Control Manager x 2 At least one service or driver failed during system startup Use Event Viewer to examine the event log for details If you see the above message box check the following Ensure that you have not selected a conflicting address for use with the DSP hardware The Resources Manager can help you determine whether or not there is a conflict e Check input output addresses according to the operating system you are using Windows 98 1 To access the Resources Manager open the Control Panel and click the Device Manager tab 2 Clic
81. 6800 Simulator i Simulator Shielded Folders 56800E Local Hardware Connection CCS Remote Connection Source Trees 56800E Simulator Simulator Editor Code Completion Code Formatting Editor Settings Font amp Tabs Text Colors E Debugger Display Settings Window Settings Global Settings i Remote Connections Pharma yrs Add Change Remove E RAD Tools Add Import Panel Export Panel OK Cancel Apply Factory Settings 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 222 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Command Converter Server Figure 9 5 New Connection Window x Name i _ _ ___ _eeo lt Debugger CCS 56800 Protocol Plugin y I Show in processes list Connection T ype CCS Remote Connection se Use Remote CCS Server IP Address fi 27 0 0 1 T Specify CCS Executable IT Multi Core Debugging JTAG Configuration File r CCS Timeout eo seconds Factory Settings Revert Panel Cancel OK 2 Inthe 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 con
82. 6854 DSP56F803 DSP56855 DSP56F805 DSP56857 DSP56F807 DSP56858 DSP56F826 MC56F8322 DSP56F827 MC56F8323 MC56F8345 MC56F8346 MC56F8356 MC56F8357 MC56F8365 MC56F8366 345 Freescale Semiconductor Inc DSP56800x New Project Wizard Overview Table B 1 Supported DSP56800x Processors for the New Project Wizard DSP56800 DSP56800E MC56F8367 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 e Rule Notes Click on the following link for details about the DSP56800x New Project Wizard Graphical User Interface e DSP56800x New Project Wizard Graphical User Interface 346 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Page Rules DSP56800x New Project Wizard Overview The page rules governing the wizard page flow for the simulator and the different 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 Page any simulator DSP56F801 60 MHz DSP56F801 80 MHz Target Selection Next Page Program Choice Page Finish Page DSP56F802 Next Page Table B 3 Page Rules for
83. 6F81 xx DSP56855 MC5EF83xx DSP56857 Simulators DSP56858 Cancel 356 Targeting DSP56F80x DSP56F82x Controllers 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 MC56F8322x DSP56800x New Project Wizard Target x Select family and then processor for this project DSP56800x Family Processor DSPS6F80x MC56F8322 DSPS6F82x MC56F8323 DSP5685x MC56F 8345 MC56F 8346 MC56F 8347 MC56F 8355 MC56F 8356 MC56F 8357 MC56F8365 MC56F8366 MC56F8367 MC56F81 xx Simulators Cancel Targeting DSP56F80x DSP56F82x Controllers 357 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 Simulators DSP56800x New Project Wizard Target x Select family and then processor for this project Processor DSP56800_simulator DSP56F82x DSP56800E_simulator DSP5685x MCS6F834x DSP56800x Family DSPS6F80x imulators Cancel One target family and one target processor 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 347
84. 6F82x Controllers IZE E F moves lea move noves lea nove novel lea db 21 294 124 5 nove lea novel novel nove Debugging for DSP56800 Launching and Operating the Debugger X 0x0038 N SP N X SP X 0x0039 N SP N X SP 10 N SP N SP RO R0 9 8195 R1 10 YO X R1 X0 237 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Load Save Memory Load Save Memory From the menu bar of the Metrowerks Code Warrior window select Debug gt 56800 gt Load Save Memory to display the Load Save Memory dialog box Figure 9 16 Figure 9 16 Load Save Memory Dialog Box x History x y Parameters Operation Load Memory C Save Memory Memory Type P Memoy y Address hex lic Cancel Offset hexinteae 0 Size hex integer fi File name rosea Browse F Oyenyrite Existing File format Binary Raw y r Progress Use this dialog box to load and save memory at a specified location and size with a user specified file You can associate a key binding with this dialog box for quick access Press the Tab key to cycle through the dialog box displays which lets you quickly make changes without using the mouse History Combo Box The History combo box displays a list of recent loads and saves If this is the first time you load or save the History combo box is empty If you load save more th
85. 7 ClrVal break else switch num case 1 GPIO CO 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 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 C0 ClrVal break case 2 GPIO C1 ClrVal break case 3 GPIO C2 ClrVal break case 4 GPIO C3 ClrVal break 140 Targeting DSP56F80x DSP56F82x 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 CO 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 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
86. 8 save restore registers dialog box 242 244 Saving new target settings stationery files 72 SB 56K Emulator installing 28 SECTION mapping in assembly language 169 sections 279 295 segment location specifier 296 set_hflkd flash debugger command 261 262 set_hfm_base flash debugger command 262 set_hfm_config_base flash debugger command 262 set_hfm_erase_mode flash debugger command 263 set_hfm_verify_erase flash debugger command 263 set_hfm_verify_program flash debugger command 263 setting a build target 75 breakpoints 62 debugger preferences 59 settings panels Access Paths 73 Build Extras 73 C C warnings 81 84 Custom Keywords 73 Debugger Settings 73 ELF Disassembler 87 Targeting DSP56F80x DSP56F82x Controllers File Mappings 73 Global Optimizations 73 M56800 Assembler 85 87 M56800 Linker 92 M56800 Processor 90 91 M56800 Target 75 M56800 Target Settings 98 remote debug options 102 104 remote debugging 96 98 Source Trees 73 Settings window 53 __shl 205 short double size 144 short fixed type 145 short size 144 _ short2fixed 185 Show Addresses and Object Code checkbox 89 Show Code Modules checkbox 88 Show Comments checkbox 89 Show Data Modules checkbox 89 Show Debug Info checkbox 89 Show Headers checkbox 88 Show Relocations checkbox 88 Show Source Code checkbox 89 Show Symbol and String Tables checkbox 88 Show Transitive Closure checkbox 94 __shr 206 _ shr r 207 signed char size 144 simulator 252 sizeof 297
87. 800 e Remote Settings If you specify that the Code Warrior 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 221 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 221 This is necessary if the CCS is configured to a port other than 41475 After you have specified the correct settings for the command converter server or verified that the default settings are correct you can download programs to a target board for debugging The CodeWarrior IDE starts the command converter server at the appropriate time if you are debugging on a local target Before debugging on a board connected to a remote machine ensure the following e The command converter server is running on the remote host machine e Nobody is debugging the board connected to the remote host machine 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 you can change the port Change the parallel port Targeting DSP56F80x DSP56F82x Controllers 217 For More Information www freescale com Freescale Semico
88. A bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 __shl Word16 sval2shft Word16 s shftamount Targeting DSP56F80x DSP56F82x Controllers 205 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short result short sl 0x1234 short s2 1 result _ shl sl s2 Expected value of result 0x2468 __shr Definition 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 DSP56800 because of the saturation requirements and the bidirectional capability 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 206 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short result short sl 0x2468 short s2 1 result _ shr sl s2 Expected value of result
89. Application and Library Use this menu to select the project type that reflects the kind of project you are building Figure 5 3 Output File Name The Output File Name field specifies the name of the executable file or library to create This file is also used by the CodeWarrior debugger By convention application names must end with the extension el without the quotes and library names must end with the extension lib without the quotes 76 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels NOTE When building a library ensure that you use the extension 1ib as this is the default file mapping entry for libraries If you wish to change an extension you must add a file mapping entry in the File Mappings settings panel C C Language C only Use the C C Language C Only panel Figure 5 4 to specify C language features Table 5 3 explains the elements of this panel that apply to the processor which supports only the C language Figure 5 4 C C Language Panel C only J Force C Compilation I ANSI Strict J 150 G Template Parser TT ANSI Keywords Only 7 Use Instance Manager TT Expand Trigraphs F Enable C Exceptions TT Legacy for scoping J Enable ATTI V Require Function Prototypes IF Enable boo Support Enable weohar_t Support J EC Compatibility Mod
90. 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 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 CW for DSP56800 R7 0 gt CodeWarrior IDE the registration window appears Targeting DSP56F80x DSP56F 82x Controllers 21 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE Figure 2 1 CodeWarrior Registration Window A wg PA Y Wa Y DH 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 L
91. Connection list box specifies 56800 Local Hardware Connection CSS The HTI will not work properly with a clock speed over 800 kHz M56800 Target Debugging The M56800 Target Settings panel lets you set communication protocols for interaction between the DSP56800 board and the CodeWarrior debugger 98 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Figure 5 13 M56800 Target Settings Panel simulator Settings a 2 x N Target Settings Panels 3 Language Settings C C Language IV Always reset on download C C Preprocessor C C Waminos I Use Flash Config File M56800 Assembler Code Generation Breakpoint mode Automatic y ELF Disassembler M56800 Processor TT Auto clear previous hardware breakpoint Global Optimizations Linker FF Initialize OMA for program memory M56800 Linker Editor Program memory mode intemal v Custom Keywords Debugger Debugger Settings Remote Debugaing Processor D SP56800_Simulator Remote Debug Opt w Factory Settings Revert Import Panel Export Panel DK Cancel Apply Table 5 7 Debugging M56800 Target Panel Elements Element Purpose Comments Always reseton Checked IDE issues a download reset to the target board each checkbox time you connect to the boar
92. DSP56F80x DSP56F82x Controllers 89 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels M56800 Processor The M56800 Processor settings panel Figure 5 9 determines the kind of code the compiler creates This panel is available only when the current build target uses the M56800 Linker Figure 5 9 M56800 Processor Settings Panel TT Peephole Optimization T Instruction Scheduling I Allow Rep Instructions TT Allow DO Instructions I Make Strings ReadOnly TT Create Assembly Output V Compiler adjusts for delayed load of N register I Write constant data to rodata section IT Generate code for profiling The items in this panel are Peephole Optimization This option controls the use of peephole optimizations The peephole optimizations are small local optimizations that eliminate some compare instructions and optimize some address register updates for more efficient sequences Instruction Scheduling This option determines whether the compiler rearranges instructions to take advantage of the M56800 s scheduling architecture This option results in faster execution speed but is often difficult to debug 90 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels NOTE Instruction Scheduling can make source level debugging dif
93. Do you want to convert the project Use For All Remaining Projects Cancel Removing illegal object_c on pragma directive Warning If after porting a project to DSP56800 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 Setting up Debugging Connections In the DSP56800 7 x debugging connections to the hardware or simulator are made using the Remote Debugging panel Older versions of the DSP56800 connected using other settings If you open a project created using a previous version of the CodeWarrior IDE you must now set up the debugging connections using the new settings For more information on the Remote Debugging panel see Remote Debugging Using XDEF and XREF Directives The XDEF and XREF directives are not used with the CodeWarrior assembler Use the GLOBAL directive to make symbols visible outside of a section 342 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Porting Issues Using the ORG Directive Using the ORG Directive Memory space and location counters cannot be updated with the ORG directive You must use the linker command file to specify exact memory addresses rather than in the assembler For example if you declare
94. Expert Windows Bean Selector Bean Inspector Target CPU Window For More Information www freescale com 58 67 69 69 69 71 72 72 73 74 74 75 SAI 80 81 85 87 90 92 96 98 102 105 105 106 107 109 113 113 114 116 Targeting DSP56F80x DSP56F82x Controllers Freescale Semiconductor Inc Memory Map Window CPU Types Overview Resource Meter Installed Beans Overview Peripherals Usage Inspector Processor Expert Tutorial 7 C for DSP56800 General Notes on C Number Formats DSP56800 Integer Formats DSP56800 Floating Point Formats DSP56800 Fixed Point Formats Calling Conventions Stack Frames Calling Conventions tak Volatile and Non Volatile Registers Stack Frame User Stack Allocation i Sections Generated by the Compiler OMR Settings Optimizing Code Page 0 Register Assignment Array Optimizations a Multiply and Accumulate MAC Otri zaloha Compiler or Linker Interactions Deadstripping Unused Code and Data Link Order 8 Inline Assembly Language and Intrinsic Functions Working With DSP56800 Assembly Language Inline Assembly Language Syntax for DSP56800 Adding Assembly Language to C Source Code General Notes on Inline Assembly Language Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Table of Contents 121 122 123 124 125 126 143 143 143 144 144
95. Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers DSP56F80x DSP56F82x 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 Code Warrior 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 O 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 p
96. Hardware NOTE You can use the DSP56800 Simulator provided with the Code Warrior IDE instead of installing additional DSP568xx hardware However the DSP56800 Simulator is a core simulator and will not give you product specific features such as peripherals specialized memory maps etc Using Parallel Port Connect the parallel port cable to your DSP568xxEVM board as described below Connecting via the on board Parallel Command Converter on DSP568xxEVM Board 1 Connect the 25 pin male connector at one end of a parallel port cable to the 25 pin female connector on your computer Figure 2 3 2 Connect the 25 pin female connector at the other end of the parallel port cable to the 25 pin male connector on the DSP568xxEVM 3 Plug the power supply into a wall socket 4 Connect the power supply to the power connector on the DSP568xxEVM board The green LED next to the power connector lights up 26 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware Figure 2 3 Connecting Parallel Port Cable to DSP568xxEVM Board DSP568xxEVM 25 pin Parallel Port Cable Parallel Port Connector Power Supply Connecting via the Suite56 Parallel Port Command Converter Module and DSP568xxEVM Board 1 Enable the JTAG port See the Hardware Manual or Kit Installation Guide for the jumpers that you need to change from the default
97. If you choose the simulator then the DSP56800x New Project Wizard Program Choice page appears see Program Choice Page on page 358 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 358 Targeting DSP56F80x DSP56F82x Controllers 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 Target Choice x Select the example main program for this project Program Simple 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 347 Targeting DSP56F80x DSP56F82x Controllers 359 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 or x Select the data memory model for this 568
98. Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Rounding __ round _ round Definition 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 1 Expected value of result 0x1235 204 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Shifting e shl e shr e shrr e L shl e L shr e L shrr _shl Definition Arithmetic shift of 16 bit value by a specified shift amount If the shift count is positive a left shift is performed Otherwise a right shift is performed Saturation may occur during a left shift When an accumulator is the destination zeroes out the LSP portion Note This operation is not optimal on the DSP56800 because of the saturation requirements and the bidirectional capability Assumptions OMR s S
99. LENGTH 0x0080 p external RAM RWX ORIGIN 0x0080 LENGTH 0x0000 x compiler regs RAM RW ORIGIN 0x0030 LENGTH 0x0010 300 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc x_internal RAM RW ORIGIN x_reserved R ORIGIN x_peripherals RW ORIGIN x_flash_ ROM R ORIGIN x external RAM RW ORIGIN X_core regs RW ORIGIN we ensure the interrupt vector section KEEP SECTION interrupt vectors text ELF Linker Sample M56800 Linker Command File 0x0040 LENGTH 0x07C0 0x0800 LENGTH 0x0400 0x0C00 LENGTH 0x0400 0x1000 LENGTH 0x1000 0x2000 LENGTH 0xDF80 OxFF80 LENGTH 0x0080 is not deadstripped here place all executing code amp data in external memory SECTIONS interrupt vectors for p ram from 56805 vector asm interrupt vectors text gt p interrupts RAM executing code text sections text rtlib text fp _engine text user text gt p_external RAM A data data sections const data fp_state data rtlib data data RECO OA Targeting DSP56F80x DSP56F82x Controllers 301 For More Information www freescale com ELF Linker Sample M56800 Linker Command File 302 Freescale Semiconductor Inc bss sections rtlib bss __bss_start bss _ bss end _ bss size setup the lo
100. MS bss end bss start heap address _ heap addr _ heap size 0x1000 larger heap for hostIO heap end heap _addr heap size heap end setup the stack address _min stack size 0x0200 _ stack addr _ stack end _ heap end Sstack addr min stack size stack end set global vars MSL uses these globals F_heap_addr F_heap_end F_stack_addr stationery F bss size F_bss_ addr heap addr heap end stack addr init code globals _ bss size _ bss start next not used in this LCF we define anyway so init code will link Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com H e OE FE e Hb HOHE HX H x e Freescale Semiconductor Inc ELF Linker Sample M56800 Linker Command File these can be removed with removal of rom to ram copy code in init file F_data_size 0x0000 F_data_RAM addr 0x0000 F_data_ROM_addr 0x0000 F_rom to ram 0x0000 zero is no rom to ram copy gt x external RAM additional notes about the reserved sections for this external RAM only LCF p_interrupts RAM reserved in external pRAM memory space reserved for interrupt vectors interrupt vectors must start at address zero interrupt vector space size is 0x80 x compiler regs iRAM reserved in internal xRAM The compiler uses page 0 address locations 0x30 0x40 as register variables See the Target
101. MSL C 56800 lib This library provides standard C library support without standard I O A minimal thin printf is provided but other stdio is stripped out in order to maximize performance The printf sends characters to the CodeWarrior console window via the debugger Use this library when you need minimal printf support for debugging and saving space MSL C 56800 host I O lib This library adds ANSI ISO standard I O support through the debugger The standard C library I O is supported including stdio h sdderr h and stdin h Use this library when you want to perform stdio calls including CodeWarrior console stdout stdin and host machine file I O for debugging Host File Location Files are created with fopen on the host machine as shown in Table 14 1 324 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800 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 Binary and Text Files stdio call fopen can open files as text or binary depending on the open mode For DSP56800 host I O file operations subsequent stdio calls treat the file as text or binary depending on how the file was originally opened with fopen NOTE You must decide whether to open the file as text or binary Binary
102. Macros Used with Intrinsics These macros are used in intrinsic functions e Wordl6 A macro for signed short e Word32 A macro for signed long For More Information www freescale com Targeting DSP56F80x DSP56F82x Controllers Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples List of Intrinsic Functions Definitions and Examples The intrinsic functions supported by the DSP56800 are shown in Table 8 2 Table 8 2 Intrinsic Functions for DSP56800 Category Function Category Function Absolute Negate __abs Multiplication __mac_r __negate MAG __msu_r _L_negate __mult Addition _ add __mult_r Subtraction sib a _L_add _L_msu _L sub _L_mult Control __stop _L_mult_ls Conversion __fixed2int Normalization __norm_l _ fixed2long __norm_s _ fixed2short Rounding _ round _ int2fixed Shifting __shl __labs __shr __long2fixed __shr_r _ Short2fixed _L_shl Copy __memcpy _L_shr __strcpy _L_shrr Deposit Extract __extract_h _ extract_l _L_deposit_h _L_deposit_ Division __div _ div_ls Targeting DSP56F80x DSP56F82x Controllers 173 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Absolute Negate e
103. Modules option is enabled Show Addresses and Object Code The Show Addresses and Object Code option determines whether the disassembler lists the address and object code for the disassembled module This option is available only if the Show Code Modules option is enabled Show Source Code The Show Source Code option determines whether the disassembler lists the source code for the current module Source code is displayed in mixed mode with line number information from the original C source This option is available only if the Show Code Modules option is enabled Show Comments The Show Comments option displays comments produced by the disassembler in sections where comment columns are provided This option is available only if the Show Code Modules option is enabled Show Data Modules The Show Data Modules option determines whether or not the disassembler outputs any ELF data sections such as data and bss for the disassembled module Disassemble Exception Tables The Disassemble Exception Tables option determines whether or not the disassembler outputs any C exception tables for the disassembled module This option is available when you select Show Data Modules NOTE Disassemble Exception Tables is not available for DSP56800 since it does not support C e Show Debug Info The Show Debug Info option directs the disassembler to include DWARF symbol information in the disassembled output Targeting
104. Motorola 56800 56858 56857 56855 56854 56853 56052 56F926 56F827 sere07 56F805 56F803 5eFS02TA80 56F902TA60 56F801FA80 56F801FAGO 56F9345 56F8355 56F8346 56F8356 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 122 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Resource Meter The Resource Meter window Figure 6 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 6 12 Resource Meter Window lolxi Pins usage Port usage ccoo cc cnn tion Compareregs Captureregif Communication ii i A Dehannelsif Bars of this window indicate e The number of pins used e The number of ports used e Allocation of timer compare registers e The number of timer capture registers used e Allocation of serial communication channels e Allocation of A D converter channels Pausing your cursor over some fields of this window brings up details of specific resources Targeting DSP56F80x DSP56F 82x Controllers 123 For More Information www freescale com Freescale Semicon
105. NO AN7 ANO AN7 un Quad_DecO Quac e i 4 ecel e TMRAO TMRBO o TMF ceecceecee ceeeCe eeeeee eee TMRAI TMRB1 TMRCI TMF e e e A ARAS A A AL DLL amp ah LL gt 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 e Print the CPU picture Targeting DSP56F80x DSP56F 82x Controllers 119 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 be
106. OP 3 instructions required after POP OLABEL End of outer loop 7 If the CLR instruction changes the value in one of the address registers RO R3 then the contents of the register are not available for use until the second following instruction That is the instruction immediately following the CLR instruction does not use the modified register to acccess X memory or update an address This also applies to the SP register and the MOI register CLR RO MOVE X R0 A Cannot reference RO after NORM In addition it applies if the 16 bit immediate value is moved to the N register and the option for Compiler adjusts for delayed load of N register in the M56800 Processor target settings panel is enabled clr N MOVE X SP N Y0 N is not available Targeting DSP56F80x DSP56F82x Controllers 213 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Pipeline Restrictions 214 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 9 Debugging for DSP56800 This chapter which explains the generic features of the Code WarriorTM debugger consists of these sections e Target Settings for Debugging e Command Converter Server e Launching and Operating the Debugger e Load Save Memory Fill Memory e Save Restore Registers OnCE Debugger Features e Using the DSP56800 Simulator e Register Details Window
107. ORG P 0020 SECTION myISR_20 rtr ENDSEC SECTION myISR_30 jsr foot rti ENDSEC You would need to change your ORG directive to ORG P and your linker command file would be changed as follows MEMORY text RWX ORIGIN 0x1000 LENGTH 0x0 data RW ORIGIN 0x2000 LENGTH 0x0 text2 RWX ORIGIN 0x20 LENGTH 0x0 SECTIONS location specific code 0x20 myISR 20 text 0x30 myISR 30 text gt text2 main application text rtlib text fp engine text user text gt text main application data Targeting DSP56F80x DSP56F82x Controllers 343 For More Information www freescale com Freescale Semiconductor Inc Porting Issues Using the ORG Directive data fp _state data rtlib data rtlib bss lo bss gt data 344 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard This appendix explains the high level design of the new project wizard Overview B 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 DSP56F80x DSP56F82x Controllers For More Information www freescale com DSP56800 DSP56800E DSP56F801 60 MHz DSP56852 DSP56F801 80 MHz DSP56853 DSP56F802 DSP5
108. P56800 Assembly Language e Assembly language directives instructions and registers are not case sensitive add x0 y0 ADD X0 YO Creating Labels for M56800 Inline Assembly A label can be any identifier that you have not already declared as a local variable A label must end with a colon Listing 8 5 Labels in M56800 Assembly x1 add x0 yl a x2 add x0 yl a x3 add x0 y1 a ERROR MISSING COLON Using Comments in M56800 Inline Assembly Comments in inline assembly language can only be in the form of C and C comments You cannot begin the inline assembly language comments with a semicolon nor with a pound sign the preprocessor uses the pound sign You can use the semicolon for comments in asm sources The proper comment format is shown in Listing 8 6 Listing 8 6 Comments Allowed in M56800 Inline Assembly Language move x r3 y0 ERROR add x0 y0 OK move r2 x sp ERROR adda rO rl n OK Targeting DSP56F80x DSP56F82x Controllers 167 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Calling Assembly Language Functions from C Code Calling Assembly Language Functions from C Code You can call assembly language functions from C just like you would call any standard C function You need to use standard C syntax for calling inline assembly language functions and stand alone assembly language functions in asm files
109. Project J 21x Save in Gl my _projects_folder e e EJ File name sample Save as type Project Files mcp y Cancel IV Create Folder y b Use the standard navigation controls in the Create New Project dialog box to specify the path where you want the project file to be saved c Click the Save button The CodeWarrior IDE closes the Create New Project dialog box If you want to use the default location for your project go to step 5 In either case the CodeWarrior IDE creates a folder with the same name as your project in the directory you select NOTE Enable the Create Folder checkbox in the Create New Project file dialog box to create a new folder for your project in the selected location 5 Click OK in the New window The New Project window appears Figure 4 8 with a list of board specific project stationeries Targeting DSP56F80x DSP56F 82x Controllers 49 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 8 New Project Window New Project x Select project stationery DSP56F802 DSP56F803 DSP56F805 Blank Simple_ Asm_and C Simple_Asm Simple_C DSP56F807 E DSP56F826 DSP56F827 0 6 Select DSP56F805 as the Project Stationery for your target Click the hierarchical control for the Project Stationery to expand the hierarch
110. Prototype Word16 _ div s Word16 s denominator Word16 s numerator Example short s1 0x2000 0 25 short s2 0x4000 0 5 short result result _ div _s s2 s1 Expected value of result 0 25 0 5 0 5 0x4000 Targeting DSP56F80x DSP56F82x Controllers 193 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Multiplication MAC e _ mac r e __msu_r e mult e multr e L mac e L msu e L mult e L mult Is __mac_r Definition 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 Wordl sinpl Wordl6 sinp2 194 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short sl 0xC000 0 5 short s2 0x4000 0 5 short result long Acc 0x0000FFFF res
111. RITEB 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 WRITES 298 The WRITES command is a string of variables with maximum length of 255 characters You can use DATE and TIME in conjunction with the WRITES command DATE returns the current date as a C string must be within parentheses TIME returns the current time as a C string must be within parentheses Prototype WRITES string Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Sample M56800 Linker Command File string is any string within parentheses Examples WRITES Hello World WRITES Today is DATE WRITES The time is TIME 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 Sample M56800 Linker Command File A sample M56800 linker command file is in Listing 12 20 This is the typical linker command file Listing 12 20 Sample Linker Command File DSP56805EVM Metrowerks
112. SP56F80x DSP56F82x 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 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 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 DSP56F80x DSP56F82x Controllers 15 For More Information www freescale com Introduction References Freescale Semiconductor Inc Table 1 1 Supported DSP56800x Proces
113. Settings Import Panel Export Panel OK Cancel Apply 3 Set protocol specific options e Always reset on download Select this option to reset the board every time you download code to the board If unchecked the board is reset only before the initial download Targeting DSP56F80x DSP56F82x Controllers 59 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial NOTE This option is not displayed if you select Simulator from the Protocol menu e Breakpoint Mode From the pull down menu select Software e Initialize OMR for Program Memory Enable OMR For Program Memory checkbox and select External memory 4 Debug the project by using either of the following options e From the Metrowerks Code Warrior window select Project gt Debug e Click the Debug button in the project window This command instructs the IDE to compile and link the project An ELF file is created in the process ELF is the file format created by the CodeWarrior linker for DSP56800 The ELF file contains the information required by the debugger and prepared by the IDE When you debug the project on DSP hardware the debugger displays the following message Resetting hardware Please wait This reset step occurs automatically only once per debugging session To reset the boards manually press the Reset button on your board Next th
114. TAG Initialization File Has an index value of 0 in the JTAG chain DSP56800 Has an index value of 1 in the JTAG chain DSP56800 Has an index value of 2 in the JTAG chain DSP56800 Has an index value of 3 in the JTAG chain SC140 Has an index value of 4 in the JTAG chain MCore210 NOTE See the sample initialization file in the DSP56800x EABI Tools JTAG folder In addition you can specify other chips to debug on the JTAG chain To do so you use the following syntax to specify the chip as a generic device Generic instruct_reg length data reg bypass length JTAG bypass instruction Table 9 5 shows the definitions of the variables that you must specify for a generic device Table 9 5 Syntax Variables to Specify a Generic Device on a JTAG Chain instruct reg length Length in bits of the JTAG instruction register data _reg bypass length Length in bits of the JTAG bypass register JTAG bypass _instruct Hexadecimal value that specifies the JTAG bypass instruction Listing 9 2 shows a JTAG initialization file that includes a DSP56800 chip and a generic device in a JTAG chain 260 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Debugging in the Flash Memory Listing 9 2 Example JTAG Initialization File with a Generic Device JTAG Initialization File H Has an index value of 0 in the JTAG chain DSP56800 H Has an i
115. TT Generate S Record File C C Language nisi Max Record Length C C Preprocessor C C Warnings EOL Character c M56800 Assembler Entry Point Fini M56805 ss Ss ode Generation ELF Disassembler Force Active Symbols M56800 Processor Global Optimizations Linker Factory Settings Revert Import Panel Export Panel OK Cancel Apply 12 Examine the default settings and select the options according to your 13 56 requirements Close the Target window when you are finished by clicking the OK button Verify debugging information is generated For the debugger to work it needs certain information from the CodeWarrior IDE so that it can connect object code to source code You must instruct the CodeWarrior IDE to produce this information There is a debug related column in the project window Figure 4 15 Every file for which the IDE generates debugging information has a dot in the Debug column To enable symbolic information for a file click the Debug column next to the file A dot appears confirming that debugging information is generated for that file Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 15 Turning on Debugging Per File xxi o extemal memory y B gt Files Link Order Targets
116. Table of Contents ROM to RAM Copying o 285 Stack and Heap LL 287 Writing Data Directly to Memory 2 wat 288 Linker Command File Keyword Listing 288 location counter 2 2 che a A ee oe 289 ADDR oa gi Gy o e Bove tek who Se es 290 ALIGNE sa fra Ara e Soe we oe Matar e T gf ag gels ke Ba 290 ALIGNALI a e a es OE ee aS io te ee a 201 FORCE_ACTIVE 22 4 il o na ee OD INCLUDE 0 0 o omo o e ara a e a A Soe a a ZO KEEP SECTIONS dita amp o ds a te 298 MEMORY La Woh SRE Re ee O Bok eho 293 OBJECT eas eh eee O bo ab ee Boake Sop 295 REE INCEUDE sen dp Hoes Gl oe nn eM 205 SECTIONS 0 ti s t el ghee gd he 299 SIZEOE L idea De ROLE Sed 2S a Speer A SIZEOEW ciliege A de site Yen ey E OY WRITEB 3 oi a es poe oe ce ee Vy Bik al 298 WRITERS fiale Stel sa elia ee py Ub e cere e298 WRITES lt co e 98 oe cate patate amp Efe tr e s af Prato te ge ZOO WRITEW 3 Lr ob o e we Mie wy ine go Sop e299 Sample M56800 Linker Command File 0282 299 13 Command Line Tools 305 Usase fd pri Se e Ra i ce e PRESCRITTE 305 Response File be ot at etree Cate ee a te Pas at eas 306 Sample Build Script 2 2 a e 307 Arguments i wo ie kok eo i eo el Oe o a Lu fh ls 49307 General Command Line Options 2 307 Linkers Y o TE p E AE o oP dike Sl ee a ay E 318 Assembler i o 4 5 8 a A rt A 2322 10 Targeting DSP56F80x DSP56F82x Controllers
117. a 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 10 4 Target Registers Dialog Box Select registers for which the data is to be visualized s H General Purpose Regis a General Purpose Registers Tr DI lt Back Cancel Help 270 Targeting DSP56F80x DSP56F82x Controllers For More Information 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 10 5 Figure 10 5 Target Globals Dialog Box Target Globals x Select globals which are to be visualized Fi long main H long___mem_limit Fi long __ receive A 7 H long send Fi long___sendnreceive Ri Fi long___size Fi long___st
118. access Program Address 19 bit program memory address Bus PAB bus 248 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Table 9 3 Options for Breakpoint Unit 2 continued Setting Value Comment Value The hexadecimal To read full value set Mask to value read from the OxFFFF specified Bus Mask Mask value in C Specify a value of OxFFFF for full hex notation from value specified by Value Specify 0x0 to OxFFFF other hex value to exclude bits For example if you wanted to stop at any value where bit 15 is set you would specify 0x8000 in both the Mask and Value fields Occurrence Counter and Sequence Options This section explains how the debugger uses the Occurrence Counter hardware breakpoint counter and Sequence Options when halting the debugger Occurrence Counter The Occurrence Counter uses the OnCE breakpoint counter OCNTR for stopping on the nth iteration of a program loop or when the nth occurrence of a data memory access occurs When you specify a value from to 256 in the Occurrence Counter text box it sets ONCTR to that value minus 1 Refer to OnCE Breakpoint Counter OCNTR in the DSP56800 Family Manual for more information NOTE Once the Occurrence Counter is decremented and a breakpoint is reached the counter is not reset Hence the Occurrence Counter
119. access paths for source files HH e e e e e e e HH H H H specified on the command line may specify object code and libraries as well this option provides the IDE s access paths Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc no wraplines maxerrors max maxwarnings max msgstyle keyword mpw std gcc IDE parseable no stderr HHHHHHHHHHHH HHH HH HH Command Line Tools Arguments functionality global word wrap messages default specify maximum number of errors to print zero means no maximum default is 0 specify maximum number of warnings to print zero means no maximum default is 0 global set error warning message style use MPW message style use standard message style default use GCC like message style use CW IDE like message style use context free machine parseable message style global use separate stderr and stdout streams if using nostderr stderr goes to stdout Compiler Preprocessing Precompiling and Input File Control Options c no codegen no convertpaths cwd keyword HHHHHHHHHH global compile only do not link global generate object code 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 probl
120. ach object and function in the output file the link map shows which file provided the definition The link map also shows the address given to each object and function a memory map of where each section resides in memory and the value of each linker generated symbol Although the linker aggressively strips unused code and data when the CodeWarrior IDE compiles the relocatable file it never deadstrips assembler relocatable files or relocatable files built with other compilers If a relocatable file was not built with the CodeWarrior C compiler the link map lists all of the unused but unstripped symbols List Unused Objects The List Unused Objects option controls whether the linker includes unused objects in the link map Enable the option to let the linker include unused objects in the link map The linker does not link unused code in the program Targeting DSP56F80x DSP56F 82x Controllers 93 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Usually this option is disabled However you might want to enable it in certain cases For example you might discover that an object you expect to be used is not actually used This option is not available unless you enable the Generate Link Map option Show Transitive Closure The Show Transitive Closure option recursively lists in the link map file all of the objects referenced by main Listing 5 1 sh
121. ack_safety Fi long syscall H Inna alreadu y gt coca o Select global variables from the left column and click the gt button to add them to the list of variables to be plotted Targeting DSP56F80x DSP56F82x Controllers 271 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 10 6 Format Axis Dialog Box Axis Scale auto when checked Minimum MW Major unit e M Maximum a IV Minor unit fessi TT Logarithmic scale Y Axis Scale auto when checked IV Minimum MW Major unit Vv Maximum IM Minor unit TT Logarithmic scale rm Display Units El 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 272 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Data Visualization Graph Window Properties Display The Display settings l
122. ad Only checkbox 91 M56800 Settings command 59 M56800 Target Settings 55 59 Use Flash Config File option 264 M56800 Target Settings panel 98 M56800 Target settings panel Output File Name 76 Project Type 76 M56800 Target settings panels 75 _ mac r 194 Make command 39 Make Strings Read Only checkbox 91 makefiles 37 __memcpy 187 memory 293 295 367 For More Information www freescale com Freescale Semiconductor Inc P 278 X 278 memory map window 121 122 memory viewing 232 237 Metrowerks Standard Library MSL for DSP 323 using 323 modifier register 328 modulo addressing 328 __msu_r 195 __mult 196 __mult_r 197 N navigating code 61 __negate 174 New Project window 50 New window 47 None option in Post Linker pop up menu 75 in Pre Linker pop up menu 75 non volatile registers 146 158 __norm_l 202 __norm_s 203 number formats for DSP 143 145 O OBJECT 284 object 284 295 OnCE debugger features 244 operating the debugger 224 231 optimizing page 0 register assignment 157 ORG directive 169 memory space location 169 Output Directory field 75 overview target settings 70 P P memory 278 P memory viewing 233 237 page 0 register assignment 157 non volatile registers 157 volatile registers 157 panels C C warnings 81 84 Targeting DSP56F80x DSP56F82x Controllers remote debug options 102 104 remote debugging 96 98 peripherals usage inspector window 125 plug in error 335 porting iss
123. ails of your chip see your chip manual Optimizing Code Optimizations that are specific to DSP56800 development with the Code Warrior IDE are Page 0 Register Assignment eArray Optimizations Multiply and Accumulate MAC Optimizations Page 0 Register Assignment The compiler uses page 0 address locations X 0x0030 0x003F as register variables Frequently accessed local variables are assigned to the page 0 registers instead of to stack locations so that load and store instructions are shortened Targeting DSP56F80x DSP56F 82x Controllers 157 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Optimizing Code Addresses X 0x0030 0x0037 page 0 registers MRO MR7 are volatile registers and can be overwritten The remaining registers page O registers MR8 MR15 are treated as non volatile and if used by a routine must be saved on entry and restored on exit Array Optimizations Array indexing operations are optimized when optimizations are turned on in the Global Optimizations settings panel In Listing 7 5 the i index is optimized out and the operation performs with address registers Listing 7 5 C Code Example for Array Optimizations void main void short a 100 b 100 int i other code for i 0 i lt 100 i ArrayA i ArrayBlil other code It is easier to understand the optimization process by viewing the assembler code mixed
124. an from this menu opens the bean context menu 120 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Memory Map Window The Memory Map window Figure 6 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 6 10 Memory Map Window loj xj DATA CODE FFFFFF 1FFFFF FFFFOO FFFEFF EXTERNAL 030000 02FFFF 010000 OOFFFF ee ee 020FFF 00F000 ODEFFF 020000 EXTERNAL O1FFFF 002000 EXTERNAL OO1FFF 010000 to DOFFFF ODOFFF 000000 000000 The color key for memory blocks is e White Non usable space e Dark Blue I O space e Medium Blue RAM e Light Blue ROM Targeting DSP56F80x DSP56F82x Controllers 121 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows e Cyan FLASH memory or EEPROM e Black External memory Pause your cursor over any block of the map to bring up a brief description CPU Types Overview The CPU Types Overview window Figure 6 11 lists supported processors in an expandable tree structure To open this window select Processor Expert gt View gt CPU Types Overview from the main window menu bar Figure 6 11 CPU Types Overview Window oix amp
125. an 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 238 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 e Load Memory e Save Memory The default is Load Memory Memory Type Combo Box The memory types that appear in the Memory Type Combo box are P Memory Program Memory e X Memory Data Memory Address Text Field Specify the address where you want to write the memory If you want your entry to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Size Text Field Specify the number of words to write to the target If you want your entry to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Dialog Box Controls Cancel Esc and OK In Load and Save operations all controls are disabled except Cancel for the duration of the load or save The status field is updated with the current progress of the operation Clicking C
126. ancel 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 DSP56F80x DSP56F 82x Controllers 239 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 Code Warrior window select Debug gt 56800 gt Fill memory to display the Fill Memory dialog box Figure 9 17 Figure 9 17 Fill Memory Dialog Box Fill Memory xl History v m Parameters i Memory Type P Memoy y Address hex _ Cancel Size hex integer fly Fill Expr hex integer iii r Progress E Use this dialog box to fill memory at a specified location and size with user specified raw memory data You can a
127. and IRQB Figure 6 18 shows the Processor Expert page at this point Figure 6 18 New Bean Names xi LEDcontrol mcp sdm external memory BL g pb Files Link Order Targets Processor Expert amp Configurations amp CPUs H D Cpu DSP56F836 5 Beans 2 v 6PIO_co Bitlo Z GPIO_C1 Biti0 Y GPIO_C2 Bi10 Y GPI0_C3 Bit10 Y GPIO_DE BHO Y aPI0_D7 8it10 8 IRGA ExtInt L gd EROB Extint amp Documentation x E PESL 2000006 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 DSP56F80x DSP56F82x Controllers 131 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial d Use this list box to select GPIOCO_SCLK1_TB0_PHASEA1 Figure 6 19 depicts this selection Figure 6 19 New Pin Association Bean Inspector GPIO_CO BitIO j loj x Bean Items Visibility Help Properties Methods Events Comment Beanname GPIO_CO Pin for 0 riOCO SCLK1_TBO PHASEAI GPIOCO_SCLK1_TBO_P Pin
128. and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long result 1 0x24680000 short s2 1 result L shr 1 s2 Expected value of result 0x12340000 _L shrr Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed If a right shift is performed then rounding 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 210 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Pipeline Restrictions Example long 11 0x41111111 short s2 1 long result result L shr r 11 s2 Expected value of result 0x20888889 Pipeline Restrictions This section gives an overview of how the pipeline restrictions are handled by the DSP56800 compiler The following list contains pipeline restrictions that are detected and handled If any of these cases are detected by the compiler s inline assembler the compiler generates a warning and inserts a NOP instruction to correct the violation of the pipeline restriction 1 A NORM instruction cannot be immediately
129. and breakpoints 334 Targeting DSP56F80x DSP56F 82x Controllers tutorial core tools 41 67 tutorial Processor Expert 126 142 U unsigned char size 144 unsigned int size 144 unsigned long size 144 unsigned short size 144 unused code and data deadstripping 161 Use Extended Mnemonics checkbox 89 Use Flash Config File checkbox 264 using the CodeWarrior debugger 58 the CodeWarrior IDE 41 using comments in M56800 assembly 167 V values register 229 231 variables in LCF 282 Variables Stationery Linker Command Files 327 Verbose Info checkbox 88 viewing memory 232 237 volatile registers 146 158 page 0 register assignment 157 W watchpoint status 245 watchpoints 229 web site 17 Windows failed service startup error 336 windows bean inspector 109 114 115 bean selector 108 113 114 CPU types overview 122 installed beans overview 124 memory map 121 122 peripherals usage inspector 125 Processor Expert 113 125 register details 237 255 resource meter 123 target CPU 116 120 writeb 288 298 writeh 288 298 writew 288 299 370 For More Information www freescale com Freescale Semiconductor Inc X X memory 278 X memory viewing 232 233 XDEF directive 342 XML files exporting and importing panel options 72 XREF directive 342 Targeting DSP56F80x DSP56F82x Controllers 371 For More Information www freescale com Freescale Semiconductor Inc Targeting DSP56F80x DSP56F82x Controllers 372 For M
130. apability See the intrinsic _L_shl or result shlfts 1 s1 which are more optimal Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 _L shl Word32 lval2shft Word16 s shftamount Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long result 1 0x12345678 short s2 1 result L shl 1 s2 Expected value of result 0x2468ACFO result shlfts l sl Expected value of result 0x91A259E0 _L_shr Definition Arithmetic shift of 32 bit value by a specified shift amount If the shift count is positive a right shift is performed Otherwise a left shift is performed Saturation 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 DSP56800 because of the saturation requirements and the bidirectional capability 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 Targeting DSP56F80x DSP56F82x Controllers 209 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language
131. ars are signed default chars are unsigned Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments Cpp_exceptions onloff 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 c99 compile with c99 extensions enum keyword specify word size for enumeration types min H use minimum sized enums default int use int sized enums for_scoping on off control legacy non standard for scoping behavior when enabled varaibles declared in for loops are visible to the enclosing scope when disabled such variables are scoped to the loop only default is off fl ag pragma specify an on off compiler pragma flag foo is the same as pragma foo on flag no foo is the same as pragma foo off use pragma option for other cases 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 tu
132. asm extension in the project For information on features and syntax of the assembler refer to the Code Warrior Development Studio Freescale DSP56800x Embedded Systems Assembler Manual For opcode listings refer to the DSP56800 Family Manual CodeWarrior Linker for DSP56800 The CodeWarrior linker for Freescale DSP56800 is in an Executable and Linker Format ELF linker This linker lets you generate an ELF file the default output file format for your application and generate an S record output file for your application CodeWarrior Debugger for DSP56800 The CodeWarrior debugger controls your program s execution and lets you see what happens internally as your program runs Use the debugger to find problems in your program s execution The debugger can execute your program one statement at a time and suspend execution when control reaches a specified point When the debugger stops a program you can view the chain of function calls examine and change the values of variables inspect the contents of the processor s registers and see the contents of memory Metrowerks Standard Library The Metrowerks Standard Library MSL is a set of standard C libraries for use in developing DSP56800 applications These libraries are ANSI compliant Access the library sources for use in your projects These libraries are a subset of the same ones 34 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Se
133. assembly language source For example you can call your function in Listing 8 9 on page 169 as jsr Fpmemwrite Intrinsic Functions for DSP56800 This section explains issues related to DSP56800 intrinsic functions and using them with DSP56800 projects An Overview of Intrinsic Functions e Fractional Arithmetic e Macros Used with Intrinsics An Overview of Intrinsic Functions Code Warrior C for DSP56800 has intrinsic functions to generate inline assembly language instructions Intrinsic functions are used to target specific processor instructions They can be helpful in accomplishing a few different things e Intrinsic functions let you pass in data to perform specific optimized computations For example some calculations may be inefficient if coded in C because the compiler has to follow ANSI C rules to represent data and this may cause the program to jump to runtime math routines for certain computations In such cases it probably is better to code these calculations using assembly language instructions and intrinsic functions e Intrinsic functions can control small tasks For example with intrinsic functions you can set a bit in the operating mode register to enable saturation This is more convenient than using inline assembly language syntax and specifying the operation in an asm block every time that the operation is required NOTE Support for intrinsic functions is not part of the ANSI C standard They comprise an ex
134. ater and skip to Step 4 b Click Register Now the Metrowerks registration web page appears in the web browser window 22 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE Figure 2 2 Metrowerks Registration Web Page A Metrowerks Registration and Licensing System Enter your registration code Microsoft al oj x Fie Edit view Favorites Tools Help n LEA gt gt x a A a Search ve Favorites A media amp TRA X amp Address http waw metrowerks com mujregister gt co Links gt metrowerks About Metrowerks Contact Us seach MO products services Registration and Licensing System our Metrowerks product and maintenance and questions regarding registration or licensing click This online registratic technical support ag here Step 1 Enter your registration code Items marked with an are required product y 4 gt E Done 49 Internet 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 me
135. avigate among your source code files The CodeWarrior IDE automatically manages build dependencies A project can have multiple build targets A build target is a separate build with its own settings that uses some or all of the files in the project For example you can have both a debug version and a release version of your software as separate build targets within the same project The CodeWarrior IDE has an extensible architecture that uses plug in compilers and linkers to target various operating systems and microprocessors The CodeWarrior CD includes a C compiler for the DSP56800 family of processors Other CodeWarrior software packages include C C and Java compilers for Win32 Linux and other hardware and software combinations Targeting DSP56F80x DSP56F 82x Controllers 33 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview CodeWarrior IDE CodeWarrior Compiler for DSP56800 The Code Warrior compiler for DSP56800 is an ANSI compliant C compiler This compiler is based on the same compiler architecture used in all CodeWarrior C compilers When it is used together with the Code Warrior linker for DSP56800 you can generate DSP56800 applications and libraries NOTE The Code Warrior compiler for DSP56800 does not support C CodeWarrior Assembler for DSP56800 The Code Warrior assembler for DSP56800 has an easy to use syntax The Code Warrior IDE assembles any file with an
136. ble click the file in the project window e Click the file The file is highlighted Drag the file to the Metrowerks CodeWarrior IDE window The editor window has excellent navigational features that allow you switch between related files locate any particular function mark any location within a file or go to a specific line of code Compiling To compile any source code file in the current build target select the source code file in the project window and then select Project gt Compile from the menu bar of the Metrowerks CodeWarrior window Targeting DSP56F80x DSP56F82x Controllers 37 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process To compile all the files in the current build target that were modified since they were last compiled select Project gt Bring Up To Date from the menu bar of the Metrowerks CodeWarrior window In UNIX and other command line environments object code compiled from a source code file is stored in a binary file a o or obj file On Windows targets the Code Warrior IDE stores and manages object files internally in the data folder A proprietary compiler architecture is at the heart of the Code Warrior IDE This architecture handles multiple languages and platform targets Front end language compilers generate an intermediate representation IR of syntactically correct source code The IR is memory resident and language inde
137. c Target Settings Panels Table 5 3 C C Language C Only Panel Elements continued Element Purpose Comments Use Unsigned Checked Compiler treats a char Some libraries were compiled without Chars checkbox declaration as an unsigned char this option Selecting this option may declaration make your code incompatible with Clear Compiler treats char and unsigned such libraries char declarations differently To check whether this option is in effect use the __option unsigned_char command Reuse Strings checkbox 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 C C Preprocessor The C C Preprocessor Figure 5 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 Figure 5 5 The C C Preprocessor Panel 80 C C Preprocessor Prefix Text Source encoding ASCII Preprocessing Options V Emit file changes V Emit Hpragmas y I Use prefix text in precompiled headers Show full paths Use line Keep comments Keep w
138. category processor MCU external devices MCU internal peripherals or on chip peripherals To open the bean selector select Processor Expert gt View gt Bean Selector from the main window menu bar Figure 6 2 Bean Selector AZER Bean Selector z D x Bean Categories On Chip Peripherals Quick help gt amp CPU amp CPU extemal devices CPU internal peripherals amp Communication 5 Converter amp Interrupts amp Measurement amp Memory gt Peripheral beans amp Port 140 SO 50 S BitsiO S MM Byte210 S M Byte310 Filter alliCPU Licensed 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 Once you determine the appropriate beans you use the Bean Inspector Figure 6 3 to fine tune each bean making it optimal for your application 108 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Figure 6 3 Bean Inspector Bean Inspector AM1 AsynchroMaster Bean Items Visibility Help Properties Methods Events Comment Processor Expert Interface Processor Expert Overview 10 x Channel SCIO Scio Interrupt se Disable T Setting
139. configuration for your particular hardware 2 Connect the 25 pin male connector at one end of a parallel port cable to the 25 pin female connector on your computer Figure 2 4 Targeting DSP56F80x DSP56F82x Controllers 27 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware Figure 2 4 Connecting Parallel Port Cable to Suite56 Parallel Command JTAG OnCE port 28 Converter Module and DSP568xxEVM Board Host 25 pin Parallel Computer 14 pin Ribbon DSP568xxEVM Cable Port Cable Suite56 Parallel Command Converter Module Parallel Port Connector 3 Connect the 25 pin female connector at the other end of the parallel port cable to the 25 pin male connector on the Suite56 Parallel Port Command Converter module Power Supply 4 Locate the 14 pin ribbon cable hanging from the Suite56 Parallel Port Command Converter module Connect the 14 pin female connector of the ribbon cable to the 14 pin JTAG male connector on the DSP568xxEVM board Ensure that the red stripe on the ribbon cable corresponds to pin on the DSP568xxEVM card 5 Plug the power supply into a wall socket 6 Connect the power supply to the power connector on the DSP568xxEVM board The green LED next to the power connector lights up Installing the PCI Command Converter Connect the PCI Command Converter and your Freescale DSP568xxEVM board to your c
140. ct Wizard Finish x Click Finish to create the project i Cancel lt Back 362 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Index Symbols elf file loading 256 A _ abs 174 Access Paths panel 73 access permission flags 278 293 _ add 176 Add Files command 58 add_hfm_unit flash debugger command 262 adding assembly language 166 addr 290 after 294 align 290 alignall 291 alignment 280 Allocating Memory and Heaps for DSP56800 326 Allow DO Instructions option 91 Allow Rep Instructions checkbox 91 Application option of Project Type pop up menu 76 asm keyword 165 assembly language 163 create output option 91 statements adding 166 AT keyword for ROM location 285 Auto clear previous breakpoint on new breakpoint release 98 102 B back end compiler See compiler bean inspector window 109 114 115 bean selector window 108 113 114 bool size 144 bootstrap code 327 breakpoints 62 228 229 Bring Up To Date command 38 Build Extras panel 73 Build System 38 build targets setting in project 53 Targeting DSP56F80x DSP56F82x Controllers C C C warnings panel 81 84 calling assembly functions from C code 168 calling conventions for DSP 149 Case Insensitive Identifiers checkbox 86 changing 161 Changing Target Settings 71 char size 144 code compiling 57 deadstripping unused 161 editing 58 navigation 61 code and data storage
141. ctive When defining an assembly language function use the GLOBAL directive to specify the list of symbols within the current section You can then define the assembly language function An example of a complete assembly language function is shown in Listing 8 9 In this function two 16 bit integers are written to program memory A separate function is needed to write to P memory because C pointer variables cannot be employed C pointer values only allow access to X data memory The first parameter is a short value and the second parameter is the 16 bit address where the first parameter is written Listing 8 9 Sample Code Creating an Assembly Language Function SECTION user ORG P GLOBAL Fpmemwrite Fpmemwrite MOVE Y1 RO NOP MOVE YO P RO my _ assym asm imap to user defined section in CODE put the following program in P memory This symbol is defined within the Current section and should be accessible by all sections Set up pointer to address Pipeline delay for RO Write 16 bit value to address pointed to by RO in P memory and post increment RO rts return to calling function ENDSEC End of section END End of source program Targeting DSP56F80x DSP56F82x Controllers 169 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Calling Functions from Assembly Language NOTE The compiler prepends the le
142. cumentation Documentation specific to the Freescale DSP56800 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 Lint Support for PCLint M56800 Support Initialization files Metrowerks Standard Library MSL and Runtime Library M56800x Support Profiler libraries Other_Metrowerks_Tools MWRemote executable files 24 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware Table 2 3 Installation Directories CodeWarrior IDE for DSP56800 Directory Contents ProcessorExpert Files for the Processor Expert Release_Notes Release notes for the CodeWarrior IDE and each tool Stationery Templates for creating DSP56800 projects Each template pertains to a specific debugging protocol Installing DSP56800 Hardware This section explains how to connect the DSP568xx hardware to your computer Parallel port connections are explained in the Kit Installation Guide for each individual DSP568xxEVM board All descriptions assume the default jumper settings as explained in the Hardware Manual for your product unless otherwise stated Targeting DSP56F80x DSP56F82x Controllers 25 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800
143. d Clear IDE does not issue a reset each time you connect to the target board Use flash config Checked When the Use If the full path and file name file checkbox Flash Config File option is are not specified the default enabled you can specify location is the same as the the use of a flash project file You can click the configuration file Listing Choose button to specify the 5 3 in the text box file The Choose File dialog Clear Debugger assumes box appears Figure 5 14 no flash on the target Targeting DSP56F80x DSP56F82x Controllers 99 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 7 Debugging M56800 Target Panel Elements continued Element Purpose Comments BreakpointMode Specifies the breakpoint Software breakpoints contain debug checkbox mode instructions that the debugger writes Automatic into your code You cannot set such CodeWarrior software breakpoints in flash as it is read only determines when to Hardware breakpoints use the on use software or chip debugging capabilities of the hardware DSP56800 The number of available breakpoints hardware breakpoints limits these Software capabilities CodeWarrior software Note Breakpoint Mode only effects always uses software HW t t breakpoints argels e Hardware CodeWarrior software always uses the ava
144. d 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 H 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 you could put into your linker command file Listing 12 13 Sample Octal Patterns _octal number 012 _octal number2 03245 Targeting DSP56F80x DSP56F82x Controllers 283 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 fr
145. ductor Inc Processor Expert Interface Processor Expert Windows Installed Beans Overview The Installed Beans Overview window Figure 6 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 Figure 6 13 Installed Beans Overview Window Installed Beans Overview l0 x BytelD CallProgressT oneDetection Capture CIDParser CIDTypel CIDType12 General Byte Input Output 8 bits Status encrypted compressed Author Processor Expert SA Current version 02 046 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 l 56800 CallProgressT oneDetection dmo 56800 CallProgressT oneDetection dry 56800 Capture dmo 56800 Capture dry 56800 CIDParser dmo 56800 CIDParser drv 56800 CIDType1 dmo 56800 CIDT y
146. e I Enable C99 E 7 Enable GCC Extensions IPA Off X TT Enums Always Int Inline Depth fra sl an I Use Unsigned Chars T Auto Inline TT Pool Strings T Bottom up Inlining IV Reuse Strings Targeting DSP56F80x DSP56F82x Controllers 77 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800 Specific Target Settings Panels NOTE Table 5 3 C C Language C Only Panel Elements Always disable the following optionw which do not apply to the DSP56800 compiler Legacy for scoping and Pool Strings 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 eff
147. e default no extended H show extended mnemonics implies show H code default no data show data with show verbose show hex dumps of sections default no debug no sym show symbolics information default no exceptions show exception tables implies show data default no headers show ELF headers default no hex show addresses and opcodes in code disassembly implies show code default no names show symbol table default no relocs show resolved relocations in code and relocation tables default no source show source in disassembly implies show 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 no verbose show verbose information including hex dump of program segments in applications default Targeting DSP56F80x DSP56F82x Controllers 321 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments Assembler Assembler Control Options no case H identifiers are case sensitive default no debug generate debug information no macro_expand expand macro in listin output no lassert_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 allo
148. e This behavior can be overridden by using the pragma explicit zero data or by using the pragma use rodata which put all constant data into a special rodata section Table 7 5 shows the memory map Table 7 5 Memory Map Section Size Range Hexadecimal PROGRAM 64K x 16 bit 0000 FFFF DATA 64K x 16 bit 0000 FFFF OMR Settings The Operating Mode Register OMR is part of the program controller of the DSP56800 core This register is responsible for the majority of how the core operates 156 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Optimizing Code NOTEFor general details about the OMR see the DSP56800 Family Manual For specific register details of your chip see your chip manual The Code Warrior compiler has some requirements about the value contained within this register and the mode in which the DSP56800 core operated These requirements are described in Table 7 6 Table 7 6 OMR Bit Requirements Bit Number Bit Name Requirements 4 Saturation or SA bit This bit must be cleared for the compiled code to work properly 5 Rounding or R bit This bit must be cleared for the compiled code to work properly 8 Condition code orCC This bit must be set for the bit compiled code to work properly NOTEFor general details about the OMR see the DSP56800 Family Manual For specific register det
149. e same as the relocation address contents Made up of statements These statements can e assign a value to a symbol e describe the placement of an output section including which input sections are placed into it segmentName is the predefined memory segment into which you want to put the contents of the section The two variants are gt segmentName Places the section contents at the beginning of the memory segment segmentName gt gt segmentName Appends the section contents to the memory segment segmentName Here is an example section definition 296 Targeting DSP56F80x DSP56F82x Controllers 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 data data bss bss COMMON SIZEOF The SIZEOF function returns the size of the given segment or section The return value is the size in bytes Prototype SIZEOF segmentName sectionName SIZEOFW The SIZEOFW function returns the size of the given segment or section The return value is the size in words Targeting DSP56F80x DSP56F82x Controllers 297 For More Information www freescale com ELF Linker Freescale Semiconductor Inc Linker Command File Keyword Listing Prototype SIZEOFW segmentName sectionName W
150. e com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger 2 Select type of memory Locate the Page list box at the bottom of the View Memory window Select X Memory 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 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 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 Memory 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 Targeting DSP56F80x DSP56F82x Controllers 233 For More Information www
151. e debugger displays this message Download external memory elf When the download to the board is complete the IDE displays the Program window external_memory elf in sample shown in Figure 4 17 NOTE Source code is shown only for files that are in the project folder or that have been added to the project in the project manager and for which the IDE has created debug information You must navigate the file system in order to locate sources that are outside the project folder and not in the project manager such as library source files 60 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 17 Program Window Kill Step Over Step Into Step Out Break Run ipext rna mejor elf RE xT od AA Location 0x3221 0x3221 5165 MR9 55 MR8 RE Source C m prototypes void swap int a int b void print_array int arr int length projects_foldersamp int main void int arr SIZE 4 6 7 1 2 3 4 12 4 5 int 1 35 printf printf Coll 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 Source pane The Source panel displays sou
152. e described in detail in the section on Remote Debug Options Command Converter Server 216 The command converter server CCS handles communication between the CodeWarrior debugger and the target board An icon in the status bar indicates the CCS is running The CCS is automatically launched by your project when you start a CCS debug session if you are debugging a target board using a local machine However when debugging a target board connected to a remote machine see Setting Up a Remote Connection on page 221 NOTE Projects are set to debug locally by default The protocol the debugger uses to communicate with the target board 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 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 LPT 1 that you specified when you installed CodeWarrior Development Studio for Freescale 56
153. e that describes the items on the JTAG chain Open a project to debug E A A In the project you are debugging open the Remote Debugging preference panel Figure 9 28 Figure 9 28 Remote Debugging Preference Panel i external memory Settings d 2 xj Target Settings Panels Q Remote Debugging Source Trees Connection Settings M56800 Target E Language Settings Connection 56800 Local Hardware Connection y Edit Connection C C Language r Remote download path C C Preprocessor C C Wamings M56800 Assembler ST Launch remote host application E Code Generation ELF Disassembler born pen IT Multi Core Debugging JTAG Clock Speed ___ E Linker Core Index fo 5 eooo M56800 Linker E Editor Custom Keywords E Debugger Debugger Settings Remote Debugging y Factory Settings Import Panel Export Panel DK Cancel Apply 5 Click the Edit Connection button and enable the Multi Core Debugging checkbox Figure 9 29 258 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Debugging on a Complex Scan Chain Figure 9 29 56800 Local Hardware Connection with Multi Core Debugging Enabled x Name 56800 Local Hardware Connection Show in processes list Debugger CCS 56800 Protocol Plugin y M Connection Type CCS Remote Connection y P Use Remote CCS
154. ead of the previous default values These settings do not carry over from previous debugging sessions Breakpoint Unit 1 Breakpoint unit 1 BPU1 of the watchpoint status window allows you to monitor address values and access type for any X or P memory location Options for setting BPUI are in the Breakpoint Unit 1 group box shown in Figure 9 20 and listed in Table 9 2 246 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Figure 9 20 Breakpoint Unit 1 Options Debugging for DSP56800 OnCE Debugger Features i Breakpoint Unit 1 Bus Executed program fetch y Value o0 Mode Read Table 9 2 Options for Breakpoint Unit 1 Setting Value Comment Bus Execute program fetch When a P memory instruction is executed Mode defaults to Read Useful when only interest is opcode instructions Any P memory access Any time a P memory address is accessed depending on the value of Mode Useful when writing or reading data from P memory X Address Bus 1 Access for all X address values through XAB1 internal or external memory depending on the Mode you select Value C hexadecimal or decimal Range 0x0 to OxFFFF notation Mode Read Write Read and Write NOTE If Breakpoint Unit 2 is disabled in use by the debugger then the occurrence counter is set to as the default Breakpoint Unit 2 Breakpoin
155. ebugger This tutorial assumes that you have already started the CodeWarrior IDE and have opened a sample project 58 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial NOTE Code Warrior IDE automatically enables the debugger and sets debugger related settings within the project 1 Access the Target Settings window Figure 4 13 2 Set debugger options a In the Target Settings Panels pane click Debugger in the tree structure to expand the hierarchical view b Click M56800 Target Settings from the hierarchical tree The M56800 Target Settings panel appears Figure 4 16 Figure 4 16 Selecting Debugger Settings i external memory Settings 24x Target Settings Panels Lanquage Settings C C Language C C Preprocessor C C Warnings M56800 Assembler Code Generation ELF Disassembler M56800 Processor Global Optimizations Linker M56800 Linker Editor Custom Keywords Debugger Debugger Settings Remote Debugging M56800 Target Set Remote Debug Opt N M56800 Target Settings IV Always reset on download TT Use Flash Config File Breakpoint mode Automatic y TT Auto clear previous hardware breakpoint IV Initialize OMA for program memory Program memory mode Extemal y Processor psP56F805 Factory
156. ect use the 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 lvalues 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 78 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 3 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
157. ed data to ROM NOTE If you want to write initialized data to program ROM use the WRITE commands in the LCF Also write your own P to X memory copy routine in assembly to copy data from program ROM to data RAM at runtime Targeting DSP56F80x DSP56F82x Controllers 285 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Listing 12 17 LCF File to Prepare Data Copy From ROM to RAM MEMORY text RWX ORIGIN 0x8000 LENGTH data RW ORIGIN 0x3000 LENGTH 0x0 code P 0x0 H data X gt RAM SECTIONS F__ROM Address 0x1000 ROM Starting Address main application text sections text rtlib text fp_engine txt user text gt text El ia ll data AT F_ ROM Address Start data at 0x1000 gt ROM data sections F Begin Data Get start location for RAM 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 gt data To make the runtime copy the section from ROM to RAM you need to know where the data startin ROM __ROM Address and the size of the block in ROM you want to copy to RAM In Listing 12 18 all variables in the data section from ROM to RAM in C code are copied Listing 12 18 ROM to RAM Copy From C After Data Flash Write include lt stdio h gt 286 Targe
158. ed in CodeWarrior IDE for DSP56800 along with the project file and targets for different MSL configurations If you already have a version of CodeWarrior IDE installed on your computer the CodeWarrior installer adds the new files needed for building versions of MSL for DSP56800 Do not modify any of the source files that support MSL Targeting DSP56F80x DSP56F82x Controllers 323 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code MSL for DSP56800 Console and File I O DSP56800 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 in addition to such standard C calls such as memory functions malloc and free A minimal thin printf via console_write and fflush_console is provided in addition to standard I O See the MSL C Reference manual Metrowerks Standard Library MSL Configurations for DSP56800 There are two DSP56800 MSL libraries available Both support standard C calls with optional I O functionality One library has a minimal printf function providing console output using debugger The other library has full ANSI ISO standard I O support including host machine console and file I O for debugging sessions The memory functions malloc and free are also supported for both libraries The two provided DPS56800 MSL libraries are
159. efined mask Breakpoint 2 occurs once then Breakpoint 1 occurs COUNTER times Useful for monitoring the status of recursive or nested algorithms Breakpoint 2 occurs COUNTER times then Breakpoint 1 occurs once Useful for monitoring the status of recursive or nested algorithms Setting and Clearing Watchpoint Status You can set and clear a watchpoint only through the Watchpoint Status window Use the following commands e Set Watchpoint Enables a watchpoint for the values specified by BPU1 and BPU2 Hardware breakpoints are not available when a watchpoint is set e Clear Watchpoint Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Disables the current watchpoint and returns all values in the Watchpoint Status window to their default values Trace Buffer From the menu bar of the Metrowerks Code Warrior window select DSP56800 gt Dump Trace Buffer to see the most recent changes in the program flow and a reconstructed program trace Figure 9 23 Use this feature to query the Trace Buffer located in the On Chip Emulation module of a hardware target This buffer stores the eight most recent changes in the program flow The debugger retrieves these addresses and attempts to reconstruct a trace of the program flow This occurs both when the window is opened and whenever debugging stops wh
160. em on Win32 since these characters are already disallowed in filenames it is safe to leave the option on default specify include searching semantics before searching any access paths the path specified by this option will be searched proj begin search in current working directory default source begin search in directory of source file explicit no implicit directory only search I or ir paths include begin search in directory of referencing file Targeting DSP56F80x DSP56F 82x Controllers 309 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments D d efine name value no defaults dis assemble E EP enc oding no no no multibyte no no no no no no no no no ascii autodetect mb ascii system UTF 8 8 SJIS Shift JIS ShiftJIS EUC JP JP IsO 2022JP 2022 JP ext extension gccinc ludes 310 keyword HHHHHHHHHHHHHH e HHH H H H HHH HHHHHHH HH HH cased define symbol name to value if specified else 1 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 line directives specify default source encoding compiler will automatically detect UTF 8 header or UCS 2 UCS 4 encodings regardless of s
161. ement 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 based variables will be incorrect It is the user
162. er the memory address in the Display field Enter a hexadecimal address in standard C hex notation for example 0x100 The window displays the contents of X memory If you are using the EVM hardware type the address 0x2000 in the Display text field and press Enter You see the memory starting at that location This is the beginning of the data section The memory address location for data section or any other section are set through a combination of the Memory Segment and Sections Segment of the linker command file Note that you see both the hexadecimal and ASCII values for X memory The contents of this window are editable as well 11 View Program P Memory a To view the memory address range of a variable select Data gt View Memory from the menu bar of the Metrowerks CodeWarrior window TIP If Data gt View Memory is greyed out make sure that you have the Program window as the highlighted window and that you Targeting DSP56F80x DSP56F 82x Controllers 65 For More Information www freescale com Tutorial Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial either have the cursor in the Source pane or have a function selected in the Stack pane The Memory window appears Figure 4 22 b Locate the Page list box at the bottom of the View Memory Select P Memory from the Page list box c Using the View list box you have the option to view four types
163. es all This command sets the erase mode as units pages or a11 If you set this to units the units that are programmed are mass erased If set this to pages the pages that are programmed are erased If you set this to a11 all units are mass erased including those that have not been programmed If you omit this command the erase mode defaults to the unit mode set_hfm_verify_erase 110 If you set this to 1 the debugger verifies that the flash memory has been erased and alerts you if the erase failed If this command is omitted the flash erase is not verified set_hfm_verify program 110 If you set this to 1 the debugger verifies that the flash has been programmed correctly and alerts you if the programming failed If you omit this command flash programming is not verified Setting up the Debugger for Flash Programming In order for the debugger to download into Flash the Use Flash Config File option is required in the M56800 Target panel and must be enabled Figure 9 30 shows the M56800 Target panel when you use minimum requirements for Flash programming Targeting DSP56F80x DSP56F82x Controllers 263 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Setting up the Debugger for Flash Programming Figure 9 30 M56800 Target Panel for Programming Flash internal memory with xROM to xRAM copy Settings a ax N Target Settings Panels N M56800 Target Settings E Langua
164. es the executable file that is built from the current project The default output directory is the same directory in which the project file is located If you want to save the executable file to a different directory click the Choose To erase the contents of this field click Clear M56800 Target The M56800 Target panel Figure 5 3 instructs the compiler and linker about the environment in which they are working such as available memory and stack size This panel is only available when the current build target uses the M56800 Linker Targeting DSP56F80x DSP56F82x Controllers 75 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800 Specific Target Settings Panels Figure 5 3 M56800 Target Panel i pexternal memory Settings i b 2 x N M56800 Target Project Type Application v N Target Settings Panels B Target Target Settings Access Paths Build Extras File Mappings Source Trees M56800 Target Language Settings C C Language C C Preprocessor C C Warnings M56800 Assembler Code Generation ELF Disassembler M56800 Processor Global Optimizations Linker M56800 Linker Output File Name external memory elf Factory Settings Import Panel Export Panel DK Cancel Apply The items in the M56800 Target panel are Project Type The Project Type menu determines the kind of project you are creating The available project types are
165. escale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 6 1 Processor Expert Menu Selections continued Item Subitem Action Peripherals Usage Opens the Peripherals Usage Inspector window 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
166. escale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 5 C C Warnings Panel Elements continued Capitialization include file capitialization Clear Compiler does not perform such checks Element Purpose Comments 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 See pragma warn_undefmacro Errors checkbox Clear System keeps warnings and error messages distinct 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 Clear Compiler does not issue such _ option warn_notinlined command warnings Treat All Checked System displays warnings as Warnings As error messages M56800 A
167. escale com Freescale Semiconductor Inc C for DSP56800 User Stack Allocation Figure 7 1 The Stack Frame SP called function user locals compiler locals nonvolatile status registers return address parameters volatile register SP size calling function The stack pointer register SP is a 16 bit register used implicitly in all PUSH and POP instructions The software stack supports structured programming such as parameter passing to subroutines and local variables If you are programming in both assembly language and high level language programming use stack techniques Note that it is possible to support passed parameters and local variables for a subroutine at the same time within the stack frame User Stack Allocation 150 The 56800 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 storage using inline assembly calls This inva
168. et you change the maximum number of data points that are plotted on the graph Targeting DSP56F80x DSP56F82x Controllers 273 For More Information www freescale com Freescale Semiconductor Inc Data Visualization Graph Window Properties 274 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 11 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 Code Warrior 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 include Profiler h 3 Add the profiler library file to your project Select the library that matches your target f
169. etting ASCII default scan file for multibyte encoding slower ASCII use system locale UTF 8 shift JIS EUC JP ISO 2022 JP 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 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com code Freescale Semiconductor Inc I ip include file ir path no keepobj ects MM MD MMD make nofail nolink noprecompile nosyspath o file dir P Command Line Tools Arguments include only system paths are searched with include SPERO NI global cased append access path to current include list see gccincludes and I prefix text file or precompiled header onto all source files global append a recursive access path to current include list global keep object files generated after invoking linker if disabled intermediate object files are temporary and deleted after link stage objects are always ke
170. ettings Panel i gexternal memory Settings 2 x N Target Settings Panels N M56800 Target E Target Project Type Application v Target Settings Application Info Access Paths Output File Name extemal memory elf Build Extras File Mappings Source Trees E Language Settings C C Language C C Preprocessor C C Warnings M56800 Assembler E Code Generation ELF Disassembler M56800 Processor Global Optimizations Linker M56800 Linker Factory Settings Revert Import Panel Export Panel OK Cancel Apply 11 Set linker options a In the Target Settings Panels pane click Linker in the tree structure to expand the hierarchical view b Click M56800 Linker from the hierarchical tree The M56800 Linker panel appears Figure 4 14 Targeting DSP56F80x DSP56F 82x Controllers 55 For More Information www freescale com Tutorial Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 14 M56800 Linker Settings i gexternal memory Settings E ax Target Settings Panels N M56800 Linker B Target Target Settings MV Generate Symbolic Info J Disable Deadstripping Access Paths IV Store Full Path Names MV Generate ELF Symbol Table Build Extras File Mappings Source Trees MV Generate Link Map I Suppress Warning Messages List Unused Objects M56800 Target I Show Transitive Closure Language Settings
171. f file to winnt inf Copy the mac_mot sys file to winnt system32 drivers Copy the windrvr sys file to winnt system32 drivers Install the raptor inf file by right clicking on this file and selecting the Install button From the command prompt change to the following directory CodeWarrior DSP_EABI_Tools ADS_PCI_drivers Win_NT Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware Type the following wdreg file mac_mot remove wdreg remove wdreg install wdreg file mac_mot install Shut down your computer Turn on your computer Connecting the PCI Command Converter to the DSP568xxEVM Board To connect the PCT Command Converter to your DSP368xxEVM board follow the steps explained in Installing the PCI Command Converter on page 28 before performing the steps in this section Connect the PCI Command Converter to your DSP568xxEVM board 1 Enable the JTAG port See the Hardware Manual or Kit Installation Guide for the jumpers that you need change from the default configuration for your particular hardware 2 Locate the 14 pin ribbon cable hanging from the OCDemon Wiggler Connect the 14 pin female connector of the ribbon cable to the 14 pin JTAG male connector on the DSP568xxEVM board Ensure that the red stripe on the ribbon cable corresponds to pin on the DSP568xxEVM card 3 Plug the power su
172. ficult because the source code might not correspond exactly to the underlying instructions Disable this option when debugging code Allow REP Instructions This option controls REP instruction usage Such instructions are generally more efficient but they prevent you from servicing any incoming interrupts inside a REP construct If you are using interrupts or writing a time critical real time application avoid using REP instructions Allow DO Instructions This option controls the compiler s support for the DO instruction Since the compiler never nests DO instructions interrupt routines are always free to use those instructions Make Strings ReadOnly This option determines whether you can specify a location to store string constants If this option is disabled the compiler stores string constants in the data section of the ELF file If this option is enabled the compiler stores string constants in the read only rodata section Create Assembly Output This option allows the compiler to produce a asm assembler compatible file for each C source file in the project The asm file is located in the same path as the Project Debug file and has the same name as the c file containing main For example MyProgram c would produce the assembly output MyProgram asm Compiler adjusts for delayed load of N registers When N register offset registers are used consecutively this option allows the compiler to send NOP instruction to
173. file selection 284 force_active 292 function selection 284 heap size 287 include 292 integral types 282 keep_section 293 memory 278 293 295 memory attributes 278 object 284 295 ref_ include 295 sections 279 295 sizeof 297 stack size 287 symbols 282 variables 282 writeb 298 writeh 298 writew 299 writing data 288 Linker pop up menu 75 linking 39 See also IDE User Guide List Unused Objects checkbox 93 load save memory dialog box 238 240 loading elf file 256 long double size 144 Targeting DSP56F80x DSP56F 82x Controllers long fixed type 145 long size 144 __long2fixed 185 longfixed__ 145 _L_sub 178 M M01 328 M56800 Assembler settings panel 85 87 Case Insensitive Identifiers checkbox 86 Generate Listing File checkbox 86 Prefix File 87 M56800 Linker Disable Deadstripping checkbox 94 Force Active Symbols text box 96 Generate ELF Symbol Table checkbox 95 Generate Symbolic Info checkbox 92 List Unused Objects checkbox 93 Show Transitive Closure checkbox 94 Store Full Path Names checkbox 93 M56800 Linker option in Linker pop up menu 75 M56800 Linker settings panel 92 Generate Link Map checkbox 93 Generate S Record File checkbox 95 Max Record Length field 95 S Record EOL Character list menu 96 Suppress Warning Messages checkbox 95 M56800 Processor settings panel 90 91 Allow DO Instructions 91 Allow Rep Instructions checkbox 91 Create Assembly Output checkbox 91 Instruction Scheduling checkbox 90 Make Strings Re
174. final executable file Multiple linkers are available for some platform targets to support different object code formats Linking To link object code into a final binary file select Project gt Make from the menu bar of the Metrowerks CodeWarrior window The Make command brings the active project up to date then links the resulting object code into a final output file The CodeWarrior IDE controls the linker through the use of linker command files There is no need to specify a list of object files The Project Manager tracks all the object files automatically You can also use the Project Manager to specify link order The Target gt M56800 Target settings panel lets you set the name of the final output file Debugging To debug a project select Project gt Debug from the menu bar of the Metrowerks CodeWarrior window Viewing Preprocessor Output To view preprocessor output select the file in the project window and select Project gt Preprocess from the menu bar of the Metrowerks CodeWarrior window The CodeWarrior IDE displays a new window that shows you what your file looks like after going through the preprocessor You can use this feature to track down bugs caused by macro expansion or other subtleties of the preprocessor Targeting DSP56F80x DSP56F82x Controllers 39 For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process 40 Targeting DSP56F80x DSP56F82
175. g symbols The above response file can used in a command such as mwccs6800 file main c It would be the same as using the following command mwcc56800 o out elf g main c 306 Targeting DSP56F80x DSP56F82x Controllers 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 M56800 Support set MWLibraries COMPILER amp M56800 Support set MWLibraryFiles MSL C 56800 lib FP56800 lib REM add CLT directory to PATH set PATH PATHS SCOMPILER DSP56800 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 mwcc56800 SCOPTIONS SCFILELISTS mwasm56800 SAFILELISTS mwld56800 SLOPTIONS S SLFILELISTS LCF 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 DSP56F80x DSP56F82x Controllers For More Informatio
176. ge Settings IV Always reset on download C C Language C C Preprocessor IV Use Flash Config File 56805_flash cfg Choose Breakpoint mode Automatic X C C Warnings TT Auto clear previous hardware breakpoint M56800 Assembler Code Generation ELF Disassembler M56800 Processor Global Optimizations Linker M56800 Linker Editor Custom Keywords E Debugger Debugger Settings Remote Debugging M56800 Target Set Remote Debug Opt w JM Initialize OMA for program memory Program memory mode internal Processor psP56F805 y Factory Settings Import Panel Export Panel OK Cancel Apply Use Flash Config File When the Use Flash Config File option is enabled you can specify the use of a flash configuration file Listing 5 3 in the text box If the full path and file name are not specified the default location is the same as the project file You can click the Choose button to specify the file The Choose File dialog box appears Figure 9 31 264 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Notes for Debugging on Hardware Figure 9 31 Choose File Dialog Box Look in a sample 4 ey Ed Icf output sample _Data startup a MS6800_main c M56800_main_hostio c W sample mcp My Documents My Co uter File name
177. gger Features The following OnCE Debugger features are discussed in this section e Watchpoints and Breakpoints e Trace Buffer 244 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Watchpoints and Breakpoints The Code Warrior DSP36800 debugger allows you to monitor the status of a watchpoint Since the OnCE port only supports either a hardware breakpoint or a watchpoint you cannot have both active at the same time Watchpoints are useful for monitoring memory and processes where software breakpoints cannot be set such as in Flash ROM or a data or address bus If the watchpoint status is used as a trace counter it can also be helpful to debug sections of code that do not have a normal flow or are hung up in infinite loops Watchpoints are available regardless of whether you have checked Use Hardware Breakpoints The watchpoint status window does not report the status of hardware breakpoints OnCE hardware only supports one hardware breakpoint or watchpoint at a time If a watchpoint is in place you cannot use a breakpoint and vice versa The Code Warrior watchpoint debugger can monitor e Program memory addresses e Data memory addresses e The value on the Core Global Data Bus e The value on the Program Address Bus e Specified number of occurrences NOTE If you are debugging Flash ROM enable the Use Ha
178. gisters Targeting DSP56F80x DSP56F82x Controllers 243 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Register Group List This list is only available when you have selected Save Registers If you have selected Restore Registers the items in the list are greyed out Select the register group that you wish to save Dialog Box Controls Cancel Esc and OK In Save and Restore operations all controls are disabled except Cancel for the duration of the load or save The status field is updated with the current progress of the operation Clicking Cancel halts the operation and re enables the controls on the dialog box Clicking Cancel again closes the dialog box Pressing the Esc key is same as clicking the Cancel button With the Restore Registers radio button selected clicking OK restores the registers from the specified file and writes it to the registers until the end of the file or the size specified is reached If the file does not exist an error message appears With the Save Register radio button 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 button displays OPENFILENAME or SAVEFILENAME depending on whether you selected the Restore Registers or Save Registers radio button OnCE Debu
179. guage To ensure that the C compiler recognizes the asm keyword you must disable the ANSI Keywords Only option in the C C Language C Only panel You can use the M56800 inline assembly language to specify that an entire function is in assembly language by using the syntax displayed in Listing 8 1 Listing 8 1 Function level Syntax asm lt function header gt lt assembly instructions gt The function header is any valid C function header and the local declarations are any valid C local declarations Statement level Inline Assembly Language The M56800 inline assembly language supports single assembly instructions as well as asm blocks within a function using the syntax in Listing 8 2 The inline assembly language statement is any valid assembly language statement Listing 8 2 Statement level Syntax asm inline assembly statement inline assembly statement asm inline assembly statement inline assembly statement There are two different ways to represent statement level assembly In the first way you use braces to contain the block Within this type of block the semicolon that separates statements is optional In the second way you use parentheses to contain the block and the semicolon between statements is mandatory Targeting DSP56F80x DSP56F82x Controllers 165 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Func
180. gure 5 15 Remote Debug Options N Remote Debug Options m Program Download Options Initial Launch Successive Runs Section Type Download Verify Download Verify Executable Iv n Constant Data Iv n Initialized Data Iv n Unitialized Data Iv n lt I lt I lt I lt I CANAL m Memory Configuration Options la Use Memory Configuration File Targeting DSP56F80x DSP56F 82x Controllers 103 For More Information www freescale com Target Settings DSP56800 Specific Target Settings Panels Table 5 9 Remote Debug Options Panel Elements 104 Freescale Semiconductor Inc Element Purpose Comments Program Checked Download Section types Download checkboxes specify the Options area section types to be downloaded on initial launch and on successive runs Checked Verify checkboxes specify the section types to be verified that is read back to the linker Executable program code sections that have X flags in the linker command file Constant Data program 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 Configuration File checkbox Not
181. he Object Keyword SECTIONS 284 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax 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 you can prevent the same object from being written again using 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 given two addresses One address is its resident location in ROM defined by the linker command file The other is its intended location in RAM defined in C code where you do the actual copying To create a section with the resident location in ROM and an intended location in RAM you define the two addresses in the linker command file Use the MEMORY segment to specify the intended RAM location and the AT address parameter to specify the resident ROM address NOTE This method only works for copying from data ROM to data RAM For example you have a program and you want to copy all your initialized data into RAM at runtime Listing 12 17shows you the LCF used to set up for writing initializ
182. he linker command file The two types of closure blocks available are e Symbol level Use FORCE ACTIVE to include a symbol into the link that would not be otherwise included An example is 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 is 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 is an example Listing 12 4 Sample Section level Closure Block With File Dependency REF INCLUDE version Sections Segment In the Sections segment you define the contents of memory segments and any global symbols to be used in the output file The format of a typical sections block is in Listing 12 5 Listing 12 5 Sample SECTIONS Segment SECTIONS section name the section name is for your reference the section name must begin with a Targeting DSP56F80x DSP56F82x Controllers 279 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax filename c text filename2 c text put the text section from filename c
183. he listing file When a listing file is output the file is created in the same directory as the assembly file it is listing with a 1st extension appended to the end of the file name Detects pipeline errors for delays to N register loads Checking this option enables the assembler to generate error messages In the following instruction move X Rn offset N Nis not available in the instruction following immediately This option allows the assembler to flag error for pipeline dependencies Prefix File The Prefix File field contains the name of a file to be included automatically at the beginning of every assembly file in the project This field lets you include common definitions without using an include directive in every file ELF Disassembler The ELF Disassembler panel Figure 5 8 appears when you disassemble object files To view the disassembly of a module select Project gt Disassemble Targeting DSP56F80x DSP56F82x Controllers 87 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Figure 5 8 ELF Disassembler Panel M Show Headers I Verbose Info M Show Symbol and String Tables M Show Relocations JW Show Code Modules M Use Extended Mnemonics M Show Source Code IV Show Addresses and Object Code Y Show Comments MM Show Data Modules I Disassemble Exception Tables Show Debug Info The ELF Disassembler panel opti
184. hich functions are placed in the output file Prototype OBJECT function sourcefile c It is important to note that if an object is written to the outfile using the OBJECT keyword the IDE does not allow the same object to be written again by using the wildcard selector 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 sectionTypel SECTIONS A basic SECTIONS directive has the following form Targeting DSP56F80x DSP56F 82x Controllers 295 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing Prototype SECTIONS lt section_spec gt section spec is one of the following sectionName AT loadAddress contents gt segmentName sectionName AT loadAddress contents gt gt segmentName sectionName The section name for the output section It must start with a period character For example mysection AT loadAddress An optional parameter that specifies the address of the section The default if not specified is to make the load address th
185. hitespace Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Table 5 4 provides information about the options in this panel Table 5 4 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 preprocessing request appear in this panel Use prefix text in precompiled header 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 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 f
186. ia oho SP eee ch A ae Se Divisioni 2 ty ado eee Khe A ds Sia IVS te a ts Tie LA ie MAC ce Aa e ee OR OM RA ts MM mult to ag soli del A ha BS Eemultels crzta ca Reina ani a E ig Normalization lt round e ia a a aaa a da 9 Debugging for DSP56800 Target Settings for Debugging Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Table of Contents 189 189 189 St Soe Bye t 190 Bees hots dee Py 191 cd A 192 TRENO 192 192 o RE a 194 iaia A 194 ee eee 195 pe ae oh 196 o lh etd 197 eet Bagge A 198 we ew 2s 199 Bee rg 199 pa Stl Be 3 200 202 Bote BEG CRE 202 be BONG BS a 203 woe ee ce 204 taste ook ie A 204 Se thy Ge atte ne 205 Freescale Semiconductor Inc Table of Contents Command Converter Server 2 ee 216 Essential Target Settings for Command Converter Server 217 Changing the Command Converter Server Protocol to Parallel Port 217 Changing the Command Converter Server Protocol to HTI 220 Changing the Command Converter Server Protocol to PCI 220 Setting Up a Remote Connection 221 Debugging a Remote Target Board n a 224 Launching and Operating the Debugger 2 1 224 Setting Breakpoints 2 2 ee ee 228 Setting Watchpoints 2 2 2 2 ee 229 Viewing and Editing Register Values 2 2 2 2 1
187. ical view Then select Simple_C language from the hierarchical tree 7 Click OK in the New Project window A project window appears Figure 4 9 This window displays all the files and libraries that are part of the project stationery 50 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 9 CodeWarrior Project Window Target Settings Project Inspector cessi external memory iE Files Link Order Targets Debug Synchronize Make Modification Dates EC support The project window is the central location from which you control development You can use this window to e Add or remove source files e Add libraries of code e Compile code e Generate debugging information and much more e Confirm that the Files tab is selected in the project window it should be selected by default e Click the hierarchical controls next to code and support to expand and view their contents Figure 4 10 Targeting DSP56F80x DSP56F82x Controllers 51 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 10 CodeWarrior Project Window with Expanded Hierarchical Folders xi sample mcp o ex
188. ies methods events and comments e Processor Expert page This additional page for the Code Warrior project window lists project CPUs beans and modules in a tree structure Selecting or double clicking items of the page opens or changes the contents of related Processor Expert windows Targeting DSP56F80x DSP56F 82x Controllers 105 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview 106 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 Dr
189. ilable hardware breakpoints Auto clear Checked Automatically previous clears the previous harware hardware breakpoint breakpoint Clear Does not Automatically clears the previous harware breakpoint Initialize OMR Checked Choose the for program program memory mode memory external or internal at checkbox connect Clear OMR is unchanged Processor list Specifies the processor Currently this selects the register box layout 100 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Figure 5 14 Choose File Dialog Box cf x output History sample _Data r support aaj main c Desktop ta main_hostio c amp sa sample mep My Documents a My Computer fo File name My Network F Files of type Look in E sample E ex EE Target Settings DSP56800 Specific Target Settings Panels 2x Cancel Eh Listing 5 3 Flash Configuration File Line Format baseAddr TME Tnvs startAddr Tpgs endAddr Tprog Tnvh progMem Terase Tnvhl regBaseAddr Trcv Each text line of the configuration file specifies a flash unit on the target The prototype is shown in Listing 5 3 and its arguments are shown in Table 5 8 Table 5 8 Flash Configuration File Line Format Argument baseAddr startAddr endAddr progMem regBaseAddr Terase Targeting DSP56F80x DSP56F82x Controllers For More Information
190. ile 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 Keep whitespace Controls whether whitespace is stripped out or copied into the output C C Warnings Use the C C Warnings panel Figure 5 6 to specify C language features for the DSP56800 Table 5 5 explains the elements of this panel Targeting DSP56F80x DSP56F82x Controllers 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 81 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels NOTE Figure 5 6 C C Warnings Panel 82 The Code Warrior compiler for DSP56800 does not support C C C Warnings Diagnostics IV Illegal Pragmas I Possible Errors IV Extended Error Checking TT Hidden Virtual Functions TT Implicit Arithmetic Conversions JS Float Tolnteger F Signed Y Unsigned Integer To Float TT Pointer Integral Conversions TT Unused Variables TT Unused Arguments Missing retum Statements TT Expression Has No Side Effect Enable All Disable All Portability IV Extra Commas IV Inconsistent class struct Usage IV Empty Declarations Tl Include File Capitalization
191. ile Registers Unit Register Size Type Comments Name Arithmetic Y1 16 Volatile non Logic Unit SOC ALU YO 16 Volatile non SOC Y 32 Volatile non SOC X0 16 Volatile non SOC A2 4 Volatile non SOC A1 16 Volatile non SOC 146 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Calling Conventions Stack Frames Table 7 4 Volatile and Non Volatile Registers continued Targeting DSP56F80x DSP56F82x Controllers Unit Register Size Type Comments Name AO 16 Volatile non SOC A10 32 Volatile non SOC A 36 Volatile non SOC B2 4 Volatile non SOC BI 16 Volatile non SOC BO 16 Volatile non SOC B10 32 Volatile non SOC B 36 Volatile non SOC Address RO 16 Volatile non Generation SOC Unit AGU R1 16 Volatile non SOC R2 16 Volatile non SOC R3 16 Volatile non SOC N 16 Volatile non SOC SP 16 Volatile non SOC For More Information www freescale com 147 C for DSP56800 Calling Conventions Stack Frames Freescale Semiconductor Inc Table 7 4 Volatile and Non Volatile Registers continued 148 Unit Register Size Type Comments Name M01 16 Volatile non In certain registers SOC values must be kept for proper C execution Set
192. ile the window is open The Trace Buffer menu item is enabled when the IDE is debugging a hardware target and debugging has stopped Figure 9 23 Trace Buffer Window 3 Trace Buffer Trace Buffer al ie address P 0x00000145 DSP56F805_init c line 69 FE address P 0x00000145 DSP56F805 init c line 69 MPa A 3 x Y b M df Path C Documents and Settings DSP56F805_inite lt gt 7 or we reach ti a decw x0 decrement our tstw x0 test for zero be 11_timeout 44 if timed out pllsr init x PLLSR pll test lock pll_tineout pll locked move pllcr_proceed x PLLCR set lock detec nove x PLLSR x0 7 clear pending _ nove x0 x PLLSR 7 setup exception handler and interrupt levels Line 70 Colt S Targeting DSP56F80x DSP56F82x Controllers 251 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Using the DSP56800 Simulator The trace buffer lets you view the target addresses of change of flow instructions that the program executes To view the contents of the trace buffer Figure 9 24 1 From the IDE menu bar select DSP56800 gt Dump Trace Buffer Figure 9 24 Contents of Trace Buffer iol xi 2 Trace Buffer ol address P 0x00000000 vector c line 42 FE address P 0x00000000 vector c line 42 v LA Y bh 1 M gi Path C SDK dsp56838evm_ nos config
193. ilename application global generate an application default library global generate a static library 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 c treat source as C unless its extension is t c h or pch default C treat source as C always Debugging Control Options 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 full path store full paths to source files Warning Options 320 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments w arn ings global warning options keyword off turn off all warnings on turn on all warnings no cmdline command line parser warnings no err or H 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 H cod
194. ing and Operating the Debugger Viewing X Memory You can view X memory space values as hexadecimal values with ASCII equivalents You can edit these 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 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 lol Display fox2030 View Raw data y N Hex 00001C34 00002C34 00002030 0030 0030 003D 0030 003D 0030 00002036 000A 0000 0020 0020 0041 0072 D000203 0065 0020 0079 006F 0075 0020 00002042 0072 0065 0061 0064 0079 0020 00002048 0074 006F 0020 0062 0065 0020 0000204E 0061 0020 0044 0053 0050 0020 00002054 0057 0061 0072 0072 0069 006F 0000205A 0072 PER 000A 0000 003D 0030 00002060 0030 0030 0030 0030 003D 0030 00002066 0030 0030 0030 0030 0030 0030 0000206 0030 0030 0030 0030 0030 0030 00002072 0030 0030 0030 0030 0030 0030 00002078 0030 0030 0030 0030 0030 0030 D000207E 0030 0030 0030 0030 0030 0030 00002084 JO00A DODA 0000 DODA DODA 002E Word Size fi 6 y Page fx Memory y 4 232 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescal
195. inition which appears first in the link order If you want to change the link order select the Link Order tab in the project window and drag your source or library file to the preferred location in the link order list Files that appear at the top of the list are linked first Targeting DSP56F80x DSP56F82x Controllers 161 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Compiler or Linker Interactions 162 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 8 Inline Assembly Language and Intrinsic Functions This chapter explains the support for assembly language and intrinsic functions that is built into the CodeWarrior compiler This chapter only covers the CodeWarrior IDE implementation of Freescale assembly language Working With DSP56800 Assembly Language This section explains how to use the CodeWarrior compiler and assembler for assembly language programming including assembly language syntax This chapter contains the following sections e Working With DSP56800 Assembly Language e Calling Assembly Language Functions from C Code e Calling Functions from Assembly Language e Intrinsic Functions for DSP56800 General Notes on Stand Alone Assembly and Inline Assembly The CodeWarrior IDE for the DSP56800 distinguishes between stand alone assembly language and inline assembly language Stand alone assembly language files
196. ion www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long 1 2 1 _ labs 1 Returns 2 __long2fixed Definition Converts a 32 bit long integer to a 32 bit __longfixed__ type Prototype __longfixed__ __long2fixed long Example long 1 2 _ longfixed__ 1fix Returns 9 31e 10 273 lfix long2fixed 1 __short2fixed Definition Converts a 16 bit short integer to a 16 bit __shortfixed__ type Prototype _ shortfixed _ short2fixed short Targeting DSP56F80x DSP56F82x Controllers 185 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short s 2 _ shortfixed__ sfix Returns 0 0000610 2 14 sfix short2fixed s 186 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Copy e _ memcpy e _ Strcpy __memcpy Definition Copy a contiguous block of memory of n characters from the item pointed to by source to the item pointed to by dest The behavior of memcpy is undefined if the areas pointed to by dest and source overlap Prototype void _
197. itted enough voltage through the parallel port Increasing the ECP value may solve this problem How to make Parallel Port Command Converter work on Windows 2000 Machines If you encounter problems connecting to your Windows 2000 machine using the parallel port command converter check the following settings 1 Verify LPT Port number matches the parallel port a Launch CCS b Select File gt Configure c Ensure that the LPT port is set to parallel port and correct LPT number d Click Save 2 Verify Enable legacy Plug and Play is enabled for the parallel port a Access the Device Manager b Access the LPT port settings window c Click the Properties button d In the Properties window click the Enable Legacy Plug and Play box Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips 3 Verify the parallel port is set for fast bi directional transfer a Access the BIOS settings b Set the parallel port for fast bi directional transfers EEP or ECP instead of just bi directional Targeting DSP56F80x DSP56F82x Controllers 339 For More Information www freescale com Troubleshooting Troubleshooting Tips 340 Freescale Semiconductor Inc Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc A Porting Issues This appendix explains
198. iver generation The PEI suggests connects and generates driver code for embedded system hardware peripherals and algorithms Top Down Design A developer starts design 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 DSP56F80x DSP56F82x 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 6 1 The Processor Ex
199. ject which will make copies of the specific target board files such as the LCF Variables defined by Stationery Linker Command Files Each Stationery LCF defines variables which are used by runtime code and MSL You can see how the values for these variables are calculated by examining any of the Stationery LCFs See Table 14 3 for the variables defined in each Stationery LCF Table 14 3 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 Additional Information and Specific Target Implementation Details See each Stationery specific target board LCF for additional comments and implementation details Perform a search for the variable name for quick access Depending on the target implementation will be different between LCFs For example for targets using Host I O considerably more heap size is allocated in the LCF Runtime Initialization The default init function is the bootstrap or glue code that sets up the DSP56800 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 Targeting DSP56F80x DSP56F82x Controllers 327 For More Informati
200. k Properties to display the Computer Properties window 3 Click the View Resources tab in the Computer Properties window 4 Click the Input Output radio button to view all active input output addresses Windows NT 1 To access the Resources Manager select Start gt Programs gt Administrative Tools gt Windows NT Diagnostics 2 Click the Resources tab in the Windows NT Diagnostics window 3 Click I O Port at the bottom of the tab to view all currently active input output addresses 336 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips No Communication With The Target Board If you are unable to establish communication with the target DSP hardware check the following e Verify that the hardware boards are properly connected to the computer Follow the installation instructions in Getting Started e If you are using the Freescale ADS hardware with the ISA bus interface ensure that you select the correct I O address for the ISA card If you have another device attempting to use this address you must reconfigure that device to use another address or disable that device e Verify that all the hardware boards have power A green LED lights up on both the ADS and EVM boards Ared LED and a yellow LED illuminate on the Domain Technologies SB 56K Emulator e Verify that all target settings are correct
201. lidates 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 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 User Stack Allocation 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 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 when you think about an if then else type stat
202. load of N register in the M56800 Processor target settings panel is enabled MOVE 3 n MOVE X SP N YO N is not available 5 Ifa bit field instruction changes the value in one of the address registers RO R3 then the contents of the register are not available for use until the second following instruction That is the instruction immediately following the MOVE instruction does not use the modified register to access X memory or update an address This applies to the SP and MOI registers BFCLR 1 R1 MOVE X R1 A R1 is not available In addition it applies to the N register when the Compiler adjusts for delayed load of N register option in the M56800 Processor target settings panel is enabled BFCLR 1 N MOVE X RO N YO N is not available 212 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Pipeline Restrictions 6 For the case of nested hardware DO loops it is required that there be at least two instructions after the pop of the LA and LC registers before the instruction at the last address of the outer loop DO 3 OLABEL Beginning of outer loop PUSH LC PUSH LA DO X0 ILABEL Beginning of inner loop instructions REP YO Skips ASL if yO 0 ASL A instructions ILABEL End of inner loop POP LA POP LC NOP 3 instructions required after POP NOP 3 instructions required after POP N
203. m s _ norm_l Definition 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 DSP56800 because of the case of returning 0 for an input of 0x00000000 Prototype Word16 _ norm 1 Word32 lsrc Example long 11 0x20000000 25 short result result norm 1 11 Expected value of result 1 202 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples __Norm_s Definition 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 Note Does not actually normalize the value This operation is NOT optimal on the DSP56800 because of the case of returning 0 for an input of 0x0000 See the intrinsic__norm_l which is more optimal but generates a different value for the case where the input 0x0000 Prototype Word16 __norm s Wordl6 ssrc Example short sl 0x2000 25 short result result _ norm s sl Expected value of result 1 Targeting DSP56F80x DSP56F82x Controllers 203 For More Information www freescale com Freescale Semiconductor Inc
204. manual for more info notes program memory p memory RWX read write execute for pRAM RX read execute for flashed pROM data memory X memory RW read write for xRAM R read for data flashed xROM LENGTH next start address previous LENGTH 0x0000 means use all remaining memory Targeting DSP56F80x DSP56F82x Controllers 303 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Sample M56800 Linker Command File 304 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 13 Command Line Tools This chapter contains the following sections e 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 mwcc56800 exe compiler options linker options file list Linker mwld56800 exe linker options file list Assembler mwasm56800 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 Y
205. me as opt no deadcode and opt no deadstore display complete list of active no no no no no no no segchardata asmout peep NDelay sched REP cmp32 rodata optimizations for this tool specify hardware DO loops for this tool segregate character data for this tool assembly file output for this tool active peepholer for this tool adjust for delayed load of N register for this tool activate scheduler for this tool specify REP instruction for this tool emit 32 bit compare for this tool write constant data to rodata section 316 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Debuggin sym k off on ful wlarn keyw off on all no no no no no no no no no no no Freescale Semiconductor Inc no hidden virtual Command Line Tools Arguments g Control Options global cased generate debugging information same as sym full eyword global specify debugging options do not generate debugging information default turn on debugging information 1 path H store full paths to source files rning Options ings global for this tool ord H warning options H passed to all tools turn off all warnings passed to all tools turn on most warnings cmdline passed to all tools command line driver parser
206. memcpy void dest const void source size tn Example const int len 9 char al len Socrates 0 char a2 len null Now copy contents of al to a2 __memcpy char a2 char al len Targeting DSP56F80x DSP56F82x Controllers 187 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples __strcpy Definition Copies the character array pointed to by source to the character array pointed to by dest The source argument must be a constant string The function will not be inlined if source is defined outside of the function call The resulting character array at dest is null terminated as well Prototype char strcpy char dest const char source Example char d 11 _ strcpyl d Metrowerks 0 d array now contains the string Metrowerks 188 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Deposit Extract e extract_h e extract_l e _L deposit h e _L deposit I _ extract_h Definition 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 portio
207. miconductor Inc Development Studio Overview Development Process used for all platform targets but the libraries have been customized and the runtime adapted for use in DSP56800 development Development Process The CodeWarrior 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 Targeting DSP56F80x DSP56F82x Controllers 35 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 a 4 Specify Target Settings 2 Notes TERR l 1 Use any combination stationery Edit Files 3 template files library files ic i or your own source files 2 Compiler linker debugger settings target specification optimizations Build Make Project 3 Edit source and resource files Compile Projest 4 Possible corrections adding a file changing settings or editing a file yes Link Project Debug Project no yes Release End 36 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process Pr
208. more pragma r equireprotos relax pointers than once define a pragma for the compiler such as pragma require prototypes 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 stdkeywords on off str ings keyword H no reuse H 314 enables automatic SOM environment and new allocation checking implies som allow only standard keywords default is off specify string constant options reuse strings equivalent strings are the same object default Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments no pool 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 off 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 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
209. n 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 Definition 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 Targeting DSP56F80x DSP56F82x Controllers 189 For More Information www freescale com Inline Assembly Language and Intrinsic Functions Freescale Semiconductor Inc List of Intrinsic Functions Definitions and Examples Prototype Word16 _ extract_1 Word32 l1src Example long 1 0x87654321 short result result extract 1 1 Expected value of result 0x4321 _L_deposit_h 190 Definition Deposits the 16 bit integer or fractional value into the upper 16 bits of a 32 bit value and zeroes out the lower 16 bits of a 32 bit value Prototype Word32 _L deposit h Wordl6 ssrc Example short sl 0x3FFF long result result L deposit h s1 Expected value of result 0x3 0000 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples _L _deposit_l Definition Deposits the 16 bit intege
210. n www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 Press Enter Setting Up a Remote Connection A remote connection is a type of connection to use for debugging along with any preferences that connection may need To change the preferences for a remote connection or to create a new remote connection 1 On the main menu select Edit gt Preferences The IDE Preferences Window appears 2 Click Remote Connections in the left column The Remote Connections panel shown in Figure 9 4 appears Targeting DSP56F80x DSP56F82x Controllers 221 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Command Converter Server Figure 9 4 Remote Connections Panel IDE Preferences 2 xi N IDE Preference Panels N Remote Connections B General a Build Settings IDE Extras 56800 Local Hardware Connection CCS Remote Connection Plugin Settings 5
211. n www freescale com noted this help 307 Freescale Semiconductor Inc Command Line Tools search keyword group keyword tool keyword all this other skipped Arguments help keyword global for this tool display help usage show usage information no spaces insert blank lines between options in 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 maximum length 63 chars show help for an option whose name or help contains keyword case sensitive for keyword maximum length 63 chars show help for groups whose names contain keyword case sensitive for keyword maximum length 63 chars categorize groups of options by tool default show all options available in this tool show options executed by this tool default show options passed to another tool 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 implies progress search global search
212. nd processors Each DSP56800x family is associated with a subset of supported processors 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 x Select family and then processor for this project DSP56800x Family Processor DSP56F801_60MHz DSP56F801_80MHz DSP5685x DSP56F802 MCS56F81 xx DSP56F803 MC5EF83xx DSP56F805 Simulators DSP56F807 Cancel 354 Targeting DSP56F80x DSP56F82x Controllers 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 Processor DSP56F826 DSP56F827 DSP56800 Family DSPS6F80x DSP5685x MC56F81 xx MC56F83 x Simulators Cancel Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com 355 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 DSP56800x New Project Wizard Target i x Select family and then processor for this project DSP56800x Family Processor DSP56F80x DSP56852 DSP56F82x DSP56853 DSP56854 MC5
213. nd 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 1 highest 7 2 3 de 2 4 gt gt lt lt 5 ie ao A e E 6 amp 7 8 amp amp 9 NOTE The shift operator shifts two bits for each shift operation The divide operator performs division and rounding Comments Add comments 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 Example Comments This is a one line comment text This is a partial line comment Targeting DSP56F80x DSP56F82x Controllers 281 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Deadstrip Prevention The M56800 linker removes unused code and data from the output file This process is called deadstripping To prevent the linker from deadstripping unreferenced code and data use the FORCE ACTIVE KEEP SECTION and REF INCLUDE directives to preserve them in the output file Variables Expressions and Integral Types This section explains variables expressions and integral types Variables and Symbols All symbol names within a Linker Command File LCF start with the underscore character _ followed by letters digits
214. ndex value of 1 in the JTAG chain Generic 4 1 Oxf 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 M56800 Target preference panel A list of flash memory commands is given in the next section The stationery provides an example of how to specify a default initialization file how to write a linker command file for flash memory and how to copy initialized data from ROM to RAM using provided library functions Flash Memory Commands The following is a list of flash memory commands that can be included in your initialization file set_hfmclkd lt value gt This command writes the value which represents the clock divider for the flash memory to the hfmclkd register The value for the set_hfmclkd command depends on the frequency of the clock If you are using a supported EVM this value should not be changed from the value provided in the default initialization file However if you are using an unsupported board and the clock frequency is different from that of the supported EVM a new value must be calculated as described in the user s manual of the particular processor that you are using Targeting DSP56F80x DSP56F82x Controllers 261 For More Information www freescale com Freescale Semiconductor Inc
215. nductor Inc Debugging for DSP56800 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 218 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Command Converter Server Figure 9 3 Metrowerks Command Converter Server Window i Metrowerks Command Converter Server 4 loj xj 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 f
216. ngs and files that determine what your code is as well as control the process of compiling and linking Targeting DSP56F80x DSP56F 82x Controllers 13 For More Information www freescale com Freescale Semiconductor Inc Introduction CodeWarrior IDE The Code Warrior IDE lets you specify multiple build targets For example a project can contain one build target for debugging and another build target optimized for a particular operating system platform target These build targets can share 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 Code Warrior 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 DSP56800 development tools Most features of the Code Warrior 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 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 14 Targeting D
217. nguage is not supported Floating point math functions for example sin cos and sqrt are not supported The sizeof function in C is not the same as the SIZEOF function in the linker In C the sizeof function returns a number of type SIZE_T which the complier declares to be of type unsigned long int The sizeof function in C returns the number of words whereas the SIZEOF function in the linker returns the number of bytes Number Formats This section explains how the CodeWarrior compilers implement integer and floating point types for DSP56800 processors Look at Limits h for more information on integer types and float h for more information on floating point types Both limits hand float h are explained in the MSL C Reference Manual Targeting DSP56F80x DSP56F 82x Controllers 143 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Number Formats DSP56800 Integer Formats Table 7 1 shows the sizes and ranges of the data types for the DSP56800 compiler Table 7 1 Data Type Ranges Type Option Setting Size Range bits bool n a 16 true or false char Use Unsigned Chars is disabled 16 32 768 to 32 767 in the C C Language C Only settings panel Use Unsigned Chars is enabled 16 0 to 65 535 signed char n a 16 32 768 to 32 767 unsigned char n a 16 0 to 65 535 short n a 16 32 768 to 32 767 unsigned short n a 16 0 to 65 535 int n a 16 32 768
218. nings in Syntax problems are a non void checks Targeting DSP56F80x DSP56F82x Controllers 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 83 For More Information www freescale com Target Settings Freescale Semiconductor Inc DSP56800 Specific Target Settings Panels Table 5 5 C C Warnings Panel Elements continued Element Purpose Comments Pointer Integral Conversions Checked Compiler checks for pointer integral conversions Clear Compiler does not perform such checks See ttpragma warn_any_ptr_int_conv and pragma warn_ptr_int_conv checks Unused Checked Compiler checks for declared The pragma un
219. nline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Addition Subtraction e _ add e _ sub e L add e L sub __add Definition Addition of two 16 bit integer or fractional values returning a 16 bit result Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 _ add Word16 src_dst Wordl6 src2 Example short sl 0x4000 0 5 short s2 0x2000 0 25 short result result _ add sl s2 Expected value of result 0x6000 0 75 176 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples _sub Definition Subtraction of two 16 bit integer or fractional values returning a 16 bit result Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word16 __sub Word16 src dst Wordl6 src2 Example short sl 0x4000 0 5 short s2 0xE000 0 25 short result result _ sub sl s2 Expected value of result 0x6000 0 75 _L add Definition 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
220. ns with a MACR instruction The effect of these optimizations reflects in the source code examples in Listing 7 8 and Listing 7 9 Listing 7 8 Sample Multiply and Accumulate Operation void main void _ fixed _al 100 b 100 _ fixed _ sum 0 int i 0 for i 0 i lt 100 i sum ali b i Targeting DSP56F80x DSP56F82x Controllers 159 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Optimizing Code The mixed view without optimizations is as follows Listing 7 9 Assembly Output for Multiply and Accumulate Operation for i 0 i lt 100 i 00001006 A7B20000 moves 0 X 0x0032 00001008 A90E bra START_ 0x101f 0x000817 sum ali bl i 00001009 880F move SP RO 0000100A DE40FF39 lea R0 199 0000100C BC32 moves X 0x0032 N 0000100D F344 move X RO N Y1 0000100E 880F move SP RO 0000100F DE40FF9D lea RO 99 00001011 BC32 moves X 0x0032 N 00001012 F144 move X RO N YO 00001013 B033 moves X 0x0033 X0 00001014 7C79 macr Y1 Y0 X0 00001015 9033 moves X0 X 0x0033 The optimized version with level 3 optimizations Listing 7 10 Listing 7 10 Assembly Output for Optimized Multiply and Accumulate Operation for i 0 i lt 100 i 0000100A A7B20000 moves 0 X 0x0032 0000100C A908 bra START_ 0x5 0x1021 i 0x000815 sum ali bl i 0000100D F316 move X R2 Y1 0000100E F117 move X R3 YO
221. nu bar select Help gt License Authorization the License Authorization dialog box appears g Enter the license authorization code that Metrowerks sent you Targeting DSP56F80x DSP56F82x Controllers 23 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE 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 4 Your Code Warrior software is ready for use a Table 2 3 lists the directories created during full installation b To test your system follow the instructions of the next section to create a project Table 2 3 Installation Directories CodeWarrior IDE for DSP56800 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 DSP 56800x_EABI_Support Default files used by the CodeWariior IDE for the DSP56800 stationery DSP56800x_EABI_Tools Drivers to the CCS and command line tools plus IDE default files for the DSP56800x stationery Freescale_Do
222. ocation 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 Send 304 gt DATA Targeting DSP56F80x DSP56F82x Controllers 289 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing ADDR The ADDR function returns the address of the named section or memory segment Prototype ADDR sectionName segmentName In the example below ADDR is used to assign the address of ROOT to the symbol __ rootbasecode Example MEMORY ROOT RWX ORIGIN 0x8000 LENGTH 0 SECTIONS code ___rootbasecode ADDR ROOT text gt ROOT 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 290 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing Prototype ALIGN alignValue Please note that ALIGN does not update the location counter it only performs arithmetic To update the location counter use an assignment such as the following Example ALIGN 0x10 u
223. oject Files versus Makefiles The CodeWarrior IDE project is analogous to a collection of makefiles because you can have multiple builds in the same project For example you can have one project that maintains both a debug version and a release version of your code You can build either or both of these versions as you wish Different builds within a single project are called build targets The CodeWarrior IDE uses the project window to list the files in a project A project can contain various types of files such as source code files and libraries You can easily add or remove files from a project You can assign files to one or more build targets within the same project These assignments let you easily manage files common to multiple build targets The CodeWarrior IDE automatically handles the dependencies between files and it tracks which files have changed since the last build When you rebuild a project only those files that have changed are recompiled The CodeWarrior IDE also stores compiler and linker settings for each build target You can modify these settings by changing the options in the target settings panels of the CodeWarrior IDE or by using pragma statements in your code Editing Code The CodeWarrior IDE features a text editor It handles text files in MS DOS Windows and UNIX formats To open and edit a source code file or any other editable file in a project use either of the following options e Dou
224. omputer as described below Installing the PCI Command Converter Install the PCI Command Converter hardware Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware 1 Place your PCI Command Converter card on a static proof mat 2 Shut down your computer WARNING Do not touch the components and connectors on the board or inside your computer without first being grounded Otherwise you could damage the hardware with static discharge 3 Locate an empty card slot in your computer 4 Insert the PCI Command Converter card in the empty card slot NOTE One end of the 25 pin cable has a 24 pin female connector A ground cable is retrofitted to a wire of the 25 pin cable at the same end of the cable The ground cable is crimped to a female disconnect terminal 5 Connect the 24 pin female connector at one end of the 25 pin cable to the 24 pin female connector on the PCI Command Converter card Figure 2 5 6 Connect the female disconnect terminal of the ground cable to the socket protruding from the PCT Command Converter card in your computer 7 Connect the 25 pin female connector at the other end of the 25 pin cable to the 25 pin male connector on the OCDemon Wiggler Procedure for Manual Installation of PCI Command Converter Drivers Windows 98 The required files are located in the following directory CodeWa
225. on www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization tasks such as clearing the hardware stack creating an interrupt table and retrieving the stack start and exception handler addresses The default code in the init function also sets the addressing mode in the modifier register M01 to OXFFFF The final task performed by the init function is to call the main function The starting point for a program is set in the Entry Point field in the M56800 Linker Settings panel When creating a project from R5 1 stationery the init code is specific to the DSP56800 board See the startup folder in the new project folder for the init code Listing 14 1 Sample Initialization File DSP56803EVM 56803 init c Metrowerks a Freescale Company sample code include DSP56F803 init h extern rom to ram extern data size extern data RAM addr extern data ROM addr extern _bss size extern bss addr asm void init_M56803_ bfset 32bit_ compares omr move 1 x0 move x0 m01 set the m reg to linear addressing 328 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization move hws la clear the hardware stack move hws la init registers move 0 r1 move r1L x LPR move r1 x COPCTL initialize compiler environment CALLMAIN se
226. ons When a function is called the parameter list is scanned from left to right The parameters are passed in this way 1 The first 32 bit value is placed in A 2 The first two 16 bit values are placed in YO and Y1 respectively 3 The first two 16 bit addresses are placed in R2 and R3 All remaining parameters are pushed onto the stack beginning with the rightmost parameter Multiple word parameters have the least significant word pushed onto the stack first When calling a routine that returns a structure the caller passes an address in RO which specifies where to copy the structure Targeting DSP56F80x DSP56F82x Controllers 145 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Calling Conventions Stack Frames The registers A RO R2 and YO are used to return function results as follows 32 bit values are returned in A 16 bit addresses are returned in R2 All 16 bit non address values are returned in YO Volatile and Non Volatile Registers Non volatile Registers Non volatile registers are registers that can be saved across functions calls These registers are also called saved over a call registers SOCs Volatile Registers Volatile registers are registers that cannot be saved across functions calls These registers are also called non SOC registers NOTESee Table 7 4 for a list of volatile non SOC and non volatile SOC registers Table 7 4 Volatile and Non Volat
227. ons are e Show Headers The Show Headers option determines whether the assembled file lists any ELF header information in the disassembled output Show Symbol and String Tables The Show Symbol and String Tables option determines whether the disassembler lists the symbol and string table for the disassembled module e Verbose Info The Verbose Info option instructs the disassembler to show additional information in the ELF file For the symt ab section some of the descriptive constants are shown with their numeric equivalents The sections line and debug are shown with an unstructured hex dump e Show Relocations The Show Relocations option shows relocation information for the corresponding text rela text or data rela data section e Show Code Modules The Show Code Modules option determines whether the disassembler outputs the ELF code sections for the disassembled module 88 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Tf enabled the Use Extended Mnemonics Show Source Code Show Addresses and Object Code and Show Comments options become available Use Extended Mnemonics The Use Extended Mnemonics option determines whether the disassembler lists the extended mnemonics for each instruction of the disassembled module This option is available only if the Show Code
228. ons are all handled by the default LCF and are as follows e text The compiler places executable code here by default e data The compiler places initialized data here by default e bss The compiler places uninitialized data here by default Targeting DSP56F80x DSP56F82x Controllers 155 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 OMR Settings NOTEThese sections are the sections generated by the compiler in the default case Other user defined sections can be generated through the use of the pragma define section If the project has the Write constant data to rodata section checkbox enabled in the M56800 Processor portion of the Target Settings then the compiler will generate the rodata section for constant data This option is overridden by the pragma use_rodata NOTEThe rodata section is not handled by the default LCF Thus you need to add how you would like the LCF to place this section within the memory map For more details on how to work with LCFs see ELF Linker By default zero initialized data is put into the bss section by the compiler This is done to reduce the load size of the application The load size is reduced because instead of the debugger loading a sequence of zeros into the data section a loadable section the compiler simply moves the zero initialized data to the bss section not a loadable section which is initialized to zero by the startup cod
229. ont of the number Listing 12 14 shows examples of valid decimal integers that you could write into your linker command file Listing 12 14 Sample Decimal Integers _dec_num 9999 _decimalNumber 1234 Hexadecimal base sixteen integers are specified as 0x 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 you could put in your linker command file appear in Listing 12 15 Listing 12 15 Example Hexadecimal Integers _somenumber 0x0F21 _fudgefactorspace 0XF00D _hexonyou Oxcafe File Selection When defining the contents of a SECTION block specify the source files that are contributing to their sections The standard method of doing this is to list the files In a large project the list can grow to become very long For this reason use the asterix keyword The asterix keyword represents the filenames of every file in your project Note that since you have already added the text sections from the files main c file2 c and file3 c the keyword does not include the text sections from those files again 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 code like the example in Listing 12 16 Listing 12 16 Sample Function Selection Using t
230. or Expert Stationery Add to Project Project zi 2 Select DSP56800x EABI Stationery in the Project tab NOTE To create a new project without using stationery select Empty Project in the New window This option lets you create a project from scratch If you are a beginner you should not try to use an Empty Project as it will not have any of the necessary target settings startup files or libraries included that are specific to the DSP56800 that allow you to quickly get up and running This is why we include the DSP56800x_EABI Stationery as it takes care of these tasks and minimizes the startup effort that is required 3 Type a name in the Project name field in this tutorial use sample as the name The Code Warrior IDE adds the mcp extension automatically to your file when the project is saved The mcp extension allows any user to recognize the file as a Metrowerks Code Warrior project file In this tutorial the file name is sample mcp 48 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 4 Set the location for the project If you want to change the default location perform the following steps a In the New window click the Set button The Create New Project dialog box Figure 4 7 appears Figure 4 7 Create New Project Dialog Box Create New
231. or LPT1 config cc parallel 1 6 Press Enter 7 Type the following command to save the configuration config save 8 Press Enter Targeting DSP56F80x DSP56F82x Controllers 219 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 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 HTI 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 220 Targeting DSP56F80x DSP56F82x Controllers For More Informatio
232. ore Information www freescale com Freescale Semiconductor Inc Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com 373 Freescale Semiconductor Inc Targeting DSP56F80x DSP56F82x Controllers 374 For More Information www freescale com
233. ou can specify the variables listed in Table 13 2 Targeting DSP56F80x DSP56F 82x Controllers 305 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Response File Table 13 2 Environment Variables Tool Library Description Compiler MWCM56800Includes Similar to Access Paths panel separate paths with and prefix a path with to specify a recursive path Linker MW56800Libraries Similar to MWC56800Includes List of library names to link with project MW56800LibraryFiles separate with Assembler MWAsm56800Includes similar to MWC56800Includes These are the target specific variables and will only work with the DSP56800 tools The generic variables MWCIncludes MWLibraries MWLibraryFiles and MWaAsmilncludes apply to all target tools on your system such as Windows If you only have the DSP56800 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 H Response file efile o out elf change output file name to out elf g generate debuggin
234. ows some sample code To show the effect of the Show Transitive Closure option you must compile the code Listing 5 1 Sample Code to Show Transitive Closure void foot void int a 100 void pad void int b 101 int main void foot pad return 1 3 After you compile the source the linker generates a link map file Note that this option is not available unless you enable the Generate Link Map option Listing 5 2 Effects of Show Transitive Closure in the Link Map File Link map of Finit_sim_ 1 interrupt_vectors text found in 56800 vector asm 2 sim_intRoutine notype local found in 56800 vector asm 2 Finit sim func global found in 56800 init asm 3 Fmain func global found in M56800 main c 4 Ffoot func global found in M56800 main c 4 Fpad func global found in M56800 main c 3 F_ init sections func global found in Runtime 56800 lib initsections o 4 Fmemset func global found in MSL C 56800 lib mem o 5 F_ fill mem func global found in MSL C 56800 lib mem_funcs o 1 Finit_sim_ func global found in 56800 init asm Disable Deadstripping The Disable Deadstripping option prevents the linker from removing unused code and data 94 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels e Generate ELF Symbol Table The Generate ELF Symbol Table option inst
235. pdate 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 Unlike its counterpart ALIGN ALIGNALL is an actual command It updates the location counter as each object is written to the output Targeting DSP56F80x DSP56F82x Controllers 291 For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing 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 SECTIONS keyword Prototype FORCE ACTIVE symbol symbol INCLUDE The INCLUDE command allows you to include a binary file in the output file Prototype INCLUDE filename 292 Targeting DSP56F80x DSP56F82x Controllers 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
236. pel dry 56800CIDType12 dmo 56800 CIDT ypel2 dry si 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 124 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Windows Peripherals Usage Inspector The Peripherals Usage window Figure 6 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 6 14 Peripherals Usage Window olx View Help 1 0 Intenupts Timers Channels _ Port GPIOD a Pin 0 GPIODO_CS2B Pin 1 GPIOD1_CS3B Pin 2 _ GPIODE_TxD1 Pin 3 GPIOD _RxD1 Port GPIDE Used by more beans Pin 0 GPIDEO_TxDO Used by bean AM1 Asynchro Always _OutputDir Output Output Pin 1 GPIDE1_AxDO Used by bean AM1 Asynchro Always _InputDir Input Input Pin 2 GPIDE2_465 Pin 3 _ GPIDE3_47 Pin 4 GPIDE4_SCLKO Pin 5 GPIDES_MOSIO Pin 6 GPIDEG_MISOO Pin GPIOE _SSOB Port GPIOF Pin 0 GPIOFO_D Pin 1 GPIOF1_D8 Pin 2 GPIOF2_D9 Pin3 GPIOF3 D10 Y The pages of this window reflect the peripheral categories I O interrupts timers and channels The columns of each page list peripheral pins signal names and the allocating beans
237. pendent Back end compilers generate code from the IR for specific platform targets The Code Warrior IDE manages the whole process Figure 3 2 Figure 3 2 CodeWarrior Build System Front end Language Project Manager C C Java Object Pascal Intermediate Representation i Back end CodeGen MIPS PPC YR x86 68K DSP SH Y8xx As a result of this architecture the CodeWarrior IDE uses the same front end compiler to support multiple back end platform targets In some cases the same back end compiler can generate code from a variety of languages Users derive significant benefit from this architecture For example an advance in the C C front end compiler means an immediate advance in all code generation Optimizations in the IR mean that any new code generator is highly optimized Targeting a new processor does not require compiler related changes in the source code so porting is much simpler 38 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview Development Process All compilers are built as plug in modules The compiler and linker components are modular plug ins Metrowerks publishes this API allowing developers to create custom or proprietary tools For more information go to Metrowerks Support at this URL http www metrowerks com MW Support Once the compiler generates object code the plug in linker generates the
238. pert 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 6 1 Project Window Processor Expert Page x xi NewProji mcp sdm extemal memory JB Y A gp Files Link Order Targets Processor Expert gt Configurations gt Operating System E CPUs El Y E x Cpu 56F8346 a Cpu 56F8346 Beans ES User Modules Y ES NewProjl c main 5 Generated Modules External Modules E amp Documentation x E 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 Targeting DSP56F80x DSP56F 82x Controllers 107 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview The Bean Selector Figure 6 2 helps you find appropriate beans by
239. ple select 56800 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 DSP56F80x DSP56F 82x Controllers 225 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger This command resets the board if Always reset on download is checked in the Debugger s M56800 Target panel shown in Figure 5 13 and the download process begins When the download to the board is complete the IDE displays the Program window sim elf in sample shown in Figure 9 7 NOTE Source code is shown only for files that are in the project folder or that have been added to the project in the project manager and for which the IDE has created debug information You must navigate the file system in order to locate sources that are outside the project folder and not in the project manager such as library source files 226 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger Figure 9 7 Program Window Step Out Step Into Step Over Kill Breakpoint Expressions Symbolics Break Run RE x Ooo No Variables All Value Location 0 3221 043221 MR9 MR8
240. ples Stationery ff Processor Expert Stationery HT Add Targets to Project Project z Cancel 2 Select DSP56800x New Project Wizard Figure 4 2 In the Project Name text box type the project name For example the_project 4 In the 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 4 2 appears Targeting DSP56F80x DSP56F82x Controllers 43 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 2 DSP56800x New Project Wizard Target Dialog Box Select family and then processor for this project Processor DSP56800_simulator DSPS56800 simulator Vor IIA I umy j DSPS6F80x DSP56F82x DSP5685x MC5EF81 xx MCS5EF83xx Simulators 6 Select the target board and processor a Select the family such as Simulators from the DSP56800x Family list b Select the processor such as DSP56800_simulator from the Processors list 7 Click Next The DSP56800x New Project Wizard Program Choice dialog box Figure 4 3 appears 44 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Con
241. pply into a wall socket 4 Connect the power supply to the power connector on the DSP568xxEVM board 5 The green LED next to the power connector lights up The board is now connected Targeting DSP56F80x DSP56F82x Controllers 31 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing DSP56800 Hardware Figure 2 5 Attaching PCI Command Converter to DSP568xxEVM Board 14 pin Ribbon Cable Ground Cable Host Computer DSP568xxEVM 25 pin Cable OCDemon JTAG OnCE port Wiggler yw PCI Command Power Supply Converter Card 32 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Development Studio Overview This chapter is for new users of the Code Warrior M IDE This chapter contains the following sections e CodeWarrior IDE e Development Process If you are an experienced CodeWarrior IDE user you will recognize the look and feel of the user interface However it is necessary that you become familiar with the DSP56800 runtime software environment CodeWarrior IDE The CodeWarrior IDE lets you create software applications It controls the project manager the source code editor the class browser the compiler linker and the debugger In the project manager you can organize all the files and settings related to your project so that you can see your project at a glance and easily n
242. project See ELF Linker for general LCF information See each specific target LCF in Stationery for specific LCF information 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 M56800 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 mal loc M56800 does not have an operating system OS but MSL effectively synthesizes some OS services such as heap operations BSS BSS is memory space reserved for uninitialized data The compiler will put all uninitialized data here The stationery init code zeroes this area at startup See the 56824_init c startup code example 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 see 326 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization Creating a Pro
243. pt 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 include files lobal cased like M but write dependency ap to a file and generate object code lobal cased like MD but do not list stem include files lobal scan source files for dependencies and emit Makefile do not generate object ntinue working after errors in earlier files lobal compile only do not link o not precompile any files based on the ilename extension peas treat include lt gt like include always search both user and system path lists specify output filename or directory for object file s or text output or output filename for linker if called global cased preprocess and send output to file do not generate code a ou a O Q th aa T precompile file di generate precompiled header from source write header to file if specified or put header in dir if argument is write header to source specified location if neither is defined header filename is derived from Targeting DSP56F80x DSP56F82x Controllers 311 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments preprocess ppopt keyword no break no line no full path no pragma no comment no space prefix file S no stdinc
244. r 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 Wordl6 ssrc Example short sl Ox7FFF long result result L deposit _1 s1 Expected value of result 0x00007FFF Targeting DSP56F80x DSP56F 82x Controllers 191 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Division div e _ div Is Definition Divides two 16 bit short integers as a fractional operation and returns the result as a 16 bit short integer Generates a DIV instruction Prototype short _ div short short Example short i 0x2000 Assign 0 25 to i short j 0x4000 Assign 0 50 to j _ fixed f d iv iy N Returns 16384 f short2fixed i Returns 0 50 _ div_Is Definition 192 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 0x7FFF occurs naturally Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Note Does not check for division overflow cases Does not check for divide by zero cases
245. rameters for AFTER the highest memory address is used Example MEMORY code RWX ORIGIN 0x8000 LENGTH 0 overlayl RWX ORIGIN AFTER code LENGTH 0 overlay2 RWX ORIGIN AFTER code LENGTH 0 data RW ORIGIN 0x1000 LENGTH 0 ORIGIN is the assigned address LENGTH is any of the following e A value greater than zero If you try to put more code and data into a memory segment greater than your specified length allows the linker stops with an error Autolength by specifying zero 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 Using the AFTER keyword to specify origin addresses prevents this gt fileName is an option to write the segment to a binary file on disk instead of an ELF program header The binary file is put in the same folder as the ELF output file This option has two variants e gt fileName Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing Writes the segment to a new file e gt gt fileName Appends the segment to an existing file OBJECT The OBJECT keyword allows control over the order in w
246. rce or assembly code Targeting DSP56F80x DSP56F 82x Controllers 61 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial The toolbar at the top of the Program window has buttons that allows you access to the execution commands in the Debug menu 6 Set breakpoints a Scroll through the code in the Source pane of the Program window until you come across the main function b 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 4 18 confirming you have set your breakpoint Figure 4 18 Breakpoint in the Program Window oy xj RE xG tiO AA No Variables All Value Location Dx3221 MR9 MR8 init_M56805_ prototypes void swap int a int b void print_array int arr int length Breakpoint int main void Setting int arr SIZE ACA ZA bea by ant isd printf printf Col NOTE To remove the breakpoint click the red dot The red dot disappears 62 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 7 View and edit register values 8 Registers are platform specific Different chip architectures have different regis
247. rdware breakpoints option in the M56800 Target Settings panel However you can use the Watchpoint status window debugging RAM as well Opening the Watchpoint Status Window To select a new watchpoint status 1 Start a debugging session 2 From the menu bar of the Metrowerks CodeWarrior window select DSP56800 gt Watchpoint status The Watchpoint Status window appears Figure 9 19 NOTE The Watchpoint Status menu item is disabled when you use the Simulator or during a system level connect Targeting DSP56F80x DSP56F 82x Controllers 245 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Figure 9 19 Watchpoint Status Window i x m Breakpoint Unit 1 Breakpoint Unit 2 TT Reserve Breakpoint Unit 2 for debugger Bus Executed program fetch y Bus Core Global Data Bus y Value oxo Value oxo Mode Read 7 Mask OxFFFF Occurrence Counter fi rm Sequence Breakpoint 1 occurs COUNTER times Breakpoint 1 or Breakpoint 2 occurs COUNTER times Breakpoint 1 and Breakpoint 2 simultaneously occur COUNTER times Breakpoint 2 occurs once then Breakpoint 1 occurs COUNTER times Breakpoint 2 occurs COUNTER times then Breakpoint 1 occurs once r Status Watchpoint is available Set Watchpoint Clea Close NOTE When you clear a custom watchpoint the settings you last used are now selected inst
248. remains at one and stops at every specified breakpoint Sequence Options To define the criteria for how often the debugger stops on a watchpoint use the Sequence group box Figure 9 22 The value you set in the Occurrence Counter text box determines the value of COUNTER Targeting DSP56F80x DSP56F 82x Controllers 249 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Figure 9 22 Sequence Counter Options in the Watchpoint Status Window m Sequence Breakpoint 1 occurs COUNTER times Breakpoint 1 or Breakpoint 2 occurs COUNTER times Breakpoint 1 and Breakpoint 2 simultaneously occur COUNTER times Breakpoint 2 occurs once then Breakpoint 1 occurs COUNTER times Breakpoint 2 occurs COUNTER times then Breakpoint 1 occurs once Table 9 4 explains the options available in the Sequence group box Table 9 4 Options for the Occurrence Counter Option Comment Breakpoint 1 occurs COUNTER times If Reserve Breakpoint Unit 2 for Debugger is enabled this is the default option and COUNTER is 1 Breakpoint 1 or Breakpoint 2 occurs COUNTER times BPU1 and BPU2 work independently If you are only interested in using BPU2 set BPU1 to a value you know will not be reached during program execution Breakpoint 1 and Breakpoint 2 simultaneously occur COUNTER times BPU1 and BPU2 work together This is useful for monitoring bit status with a d
249. rn 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 Targeting DSP56F80x DSP56F82x Controllers 313 For More Information www freescale com Freescale Semiconductor Inc Command Line Tools Arguments deep level 0 is the same as inline on no bottomup iso templates on off no mapcr msext keyword on HHHHHHHHHHHHHHHHH H types off no multibyte aware for n range 0 8 inline bootom up starting from leaves of the call graph rather than the top level funcion default nable ISO C template parser note this requires a different MSL C library default is off reverse mapping of n and r so that n 13 and r 10 for Macintosh MPW compatability dis allow Microsoft VC extensions enable extensions redefining macros allowing XXX yyy syntax when declaring method yyy of class XXX allowing extra commas ignoring casts to the same type treating function types with equivalent parameter lists but different return as equal allowing pointer to integer conversions and various syntactical differences disable extensions default on non x86 targets enable multi byte character encodings for source text comments and strings once prevent header files from being processed
250. rocessor Expert Tutorial Hinclude GPIO CO h Hinclude GPIO C1 h Hinclude GPIO C2 h Hinclude GPIO C3 h Hinclude GPIO D6 h Hinclude GPIO D7 h include IRQA h include IROB 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 DSP56F80x DSP56F 82x Controllers 139 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 D
251. rod 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 Code Warrior IDE SE Freescale 56800 E Hybrid Controllers References 2 Getting Started System Requirements DSP56800 Hardware Requirements Installing and Registering
252. rom this path CodeWarrior path M56800x Support profiler lib Targeting DSP56F80x DSP56F 82x Controllers 275 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 M56800 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 276 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc 12 ELF Linker The Code WarriorTM Executable and Linking Format ELF Linker makes a program file out of the object files of your project The linker also allows you to manipulate code in different ways You can define variables during linking control the link order to the granularity of a single function change the alignment and even compress code and data segments so that they occupy less space
253. rrior DSP56800x_EABI_Tools drivers ADS_PCI_drivers Win_95_98 1 Install CodeWarrior for DSP56800 Software Development Tools 2 Shut down your computer 3 Install the PCI command converter hardware into an empty PCI slot 4 Turn on your computer 5 The Add New Hardware Wizard window appears Click the Next button Targeting DSP56F80x DSP56F82x Controllers 29 For More Information www freescale com Getting Started Freescale Semiconductor Inc Installing DSP56800 Hardware 6 Check the Search button and then click the Next button 7 Click the Browse button 8 Select the following directory C Program Files Metrowerks CodeWarrior DSP56800x_EABI_Tools drivers ADS_PCI_driv ers Win_95_98 NOTE This is the default installation directory If you changed this directory during the software installation you will need to select your custom directory Then click the Next button Windows 98 finds the correct driver 9 Copy the windrvr sys file to Windows System32 Drivers 10 Copy the windrvr vxd file to Windows System vmm32 11 From the command prompt change to the following directory Code Warrior DSP56800x_EABI_Tools drivers ADS_PCI_drivers Win_95_98 12 Type the following wdreg name Macraigor_PCI file windrvr install Windows NT 4 0 Windows 2000 Windows XP The required files are located in the following directory CodeWarrior DSP_EABI_Tools ADS_PCI_drivers Win_NT 1 EA ad 30 Copy the raptor in
254. rt2fixed 185 copy 187 __memcpy 187 __strepy 188 deposit extract 189 __extract_h 189 __extract_1 189 _L_deposit_h 190 _EL deposit_1 191 division 192 __div 192 __div_Is 192 multiplication MAC 194 _L_mac 198 _L_msu 199 _L_mult 199 __mac_r 194 Targeting DSP56F80x DSP56F82x Controllers __msu_r 195 __mult 196 __mult_r 197 normalization 202 _ norm 202 __norm_s 203 rounding 204 _ round 204 shifting 205 _L_shl 208 _L_shr 209 _E shr r 210 __shl 205 _ shr 206 _ shr r 207 multiplication MAC _L_ mult_ls 200 introduction to Code Warrior 13 introduction to the Code Warrior IDE 13 J JTAG chain debug other chips 260 JTAG initialization file 259 JTAG initialization file with a generic device 260 K keep_section 279 282 293 Kill command 67 L _L_add 177 _L_deposit_h 190 _L deposit_1 191 _L_mac 198 _L_msu 199 _L_mult 199 _E_mult_ls 200 _L_negate 175 _L_shl 208 _L_shr 209 _L_shr_r 210 labels M56800 assembly 167 _ labs 184 libraries MSL for DSP 323 366 For More Information www freescale com Freescale Semiconductor Inc support for DSP 323 using MSL 323 Library option of Project Type pop up menu 76 linear addressing 328 link order 161 linker for DSP 161 link order 161 settings 92 linker command files access permission flags 278 293 addr 290 after 294 align 290 alignall 291 alignment 280 arithmetic operations 281 comments 281 compress 294 deadstripping prevention 282 expressions 283
255. ructs the linker to generate an ELF symbol table as well as a list of relocations in the ELF executable file Suppress Warning Messages The Suppress Warning Messages option controls whether the linker displays warnings If this option is disabled the linker displays warnings in the Message window If this option is disabled the linker does not display warnings e Generate S Record File The Generate S Record File option controls whether the linker generates an S record file based on the application object image The S record files have the extension s In the case of the DSP56800 the linker generates three different S record files Their contents are output file name S S record file containing both P and X memory contents output file name p S S record file containing P memory contents only output file name x S S record file containing X memory contents only The linker places the S record files in the output folder which is a sub folder of the project folder The linker generates the following S3 type S records Sort by Address This option enables the compiler to sort S records generated by the linker using byte address This option is not available unless you enable the Generate S Record File option Generate Byte Addresses This option enables the linker to generate S records in bytes This option is not available unless you enable the Generate S Record File option Max Record Length
256. ry point 334 fstart 327 G Generate ELF Symbol Table checkbox 95 Generate Link Map checkbox 93 Generate Listing File checkbox 86 Generate S Record File checkbox 95 Generate Symbolic Info checkbox 92 generating debug info 56 GLOBAL directive 342 GLOBAL directive assembly function definitions 169 Global Optimizations settings panel 73 global variables linker command file 282 H hardware breakpoints watchpoints 245 heap size 287 I IDE using 41 IDE Code Warrior 14 IDE installing 25 IDE installing and registering 20 implied fractional value 171 include 292 inline assembler for DSP 163 188 inline assembly defining functions 166 function level 164 instructions 165 statement level 165 syntax 164 365 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language general notes 163 installation directories 25 installed beans overview window 124 installing SB 56K Emulator 28 installing and registering the Code Warrior IDE 20 installing the Code Warrior IDE 25 Instruction Scheduling checkbox 90 int size 144 __int2fixed 183 integer formats for DSP56800 144 integral types in LCF 282 intrinsic functions absolute negate 174 _ abs 174 _L_negate 175 __negate 174 addition subtraction 176 __add 176 _L_add 177 _L_sub 178 __sub 177 control 180 __stop 180 conversion 181 __fixed2int 181 __fixed2long 182 __fixed2short 183 __int2fixed 183 _ labs 184 __long2fixed 185 __sho
257. s Parity wake up ri hardware wake up Width 9 bits 9 bits Stopbt 1 w 1 Receiver Disable Transmitti Disable H Baud rate Unassigned timing v Stop in wait no Initializatior BASIC ADVANCED EXPERT 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 6 1 explains the selections of the Processor Expert menu Targeting DSP56F80x DSP56F 82x Controllers 109 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Overview Table 6 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
258. s xRAM data start do r2 end_rom2ram copy for r2 times move x 13 x0 fetch value at address r3 move x0 x r1 stash value at address rl end_rom2ram clear bss always move 0 x0 set x0 to zero move bss size r2 set bss size move bss _addr rl dest address bss data start do r2 end bss clear do for r2 times move x0 x r1 stash zero at address nop end bss clear call main move M56803 argc y0 pass parameters to main move M56803 _argv r2 330 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization move M56803 arge r3 jsr main call the users program jsr fflush debug rts The startup folder includes the following e Stack setup e PLL setup Exception handler and interrupt setup e BSS zeroing e Static initialization e Jump to main NOTE The original general purpose runtime init code FSTART remains in the M56800 support library to provide compatibility for older projects The MSL runtime project is CodeWarrior 56800 Support ms1 MSL_C DSP_56800 Project MSL C 56800 mcp See project group runtime init file FSTART c Targeting DSP56F80x DSP56F 82x Controllers 331 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization 332 Targeting DSP56F80x DSP56F82x Controllers For More
259. s read write and execute where e ORIGIN represents the start address of the memory segment LENGTH represents the maximum size allowed for the memory segment Memory segments with RWX attributes are placed into P memory while RW attributes are placed into X memory Memory segments with R attributes denote X ROM memory and memory segments with RX attributes denote PROM memory You can put a segment immediately after the previous one using the AFTER command If you cannot predict how much space a segment will occupy you can use the command LENGTH 0 unlimited length and let the linker figure out the size of the segment 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 278 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Structure of Linker Command Files NOTE The closure blocks need to be in place before the SECTIONS definition in t
260. s 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 streamlined 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 DSP56800x New Project Wizard Graphical User Interface This section describe the DSP56800x New Project Wizard graphical user interface The subsections in this section are e Invoking the New Project Wizard e New Project Dialog Box e Target Pages e Program Choice Page e Data Memory Model Page e External Internal Memory Page e Finish Page Targeting DSP56F80x DSP56F 82x Controllers 351 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard DSP56800x New Project Wizard Graphical User Interface Invoking the New Project Wizard To invoke the New Project dialog box from the Metrowerks Code Warrior menu bar select File gt New Figure B 1 Figure B 1 Invoking the DSP56800x New Project Wizard 4 olx File Edit View Search Project Debug Processor Expert Window Help Ctrl Shift MN DAT TEES dark EE Find and Open File Ctrl D Close Crh Gtrl 5 Ghrl Shift 5
261. s from the beginning to the end of the function and is properly aligned 152 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 User Stack Allocation Listing 7 2 Example 2 Illegal Modification of SP using Inline Assembly define EnterCritical asm lea SP asm move SR X SP asm bfset 0x0300 SR asm nop asm nop define ExitCritical asm lea SP asm move X SP SR asm nop asm nop pragma check inline sp effects on int func int a 1 b 1 Cc if a EnterCritical c a b else c b ExitCritical 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 M56800_main c line 29 ExitCritical Targeting DSP56F80x DSP56F82x Controllers 153 For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 User Stack Allocation Listing 7 3 Example 3 Modification of SP by a Run time Dependent Amount Hdefine EnterCritical asm move n SP asm move SR X SP asm nop asm nop define ExitCritical asm lea SP asm move X SP SR asm nop
262. s panels that apply to 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 Code Warrior IDE displays the target settings panel that you selected Targeting DSP56F80x DSP56F82x Controllers 71 For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview 72 3 Change the settings in the panel 4 Click OK Exporting and Importing Panel Options to XML Files The Code Warrior 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
263. signal Pull resistor autoselected pull w no pull resistor Open drain no open drain Y Direction Input Output v Input Output Initialization Init directior Output Init value 0 Safe mode yes Optimization fc speed MISISINNISISISINISIO e In the project windows 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 132 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial 7 Enable BitlO SetDir ClrVal and SetVal functions a In the Proces
264. 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 56800 gt Save Restore Registers to display the Save Restore Registers dialog box Figure 9 18 242 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Save Restore Registers Figure 9 18 Save Restore Registers Dialog Box Save Restore Registers x History Parameters Operation Save Registers Restore Registers General Purpose Registers Cancel Filename Browse I 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 Radio Buttons The Save Restore Registers dialog box has two radio buttons e Save Registers Restore Registers The default is Save Re
265. sophisticated processor to display internal peripherals Figure 6 7 Target CPU Window Package and Peripherals Target CPU Cpu 56F8346 EEE eel Pla pn MN Targeting DSP56F80x DSP56F82x Controllers 117 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 6 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 6 8 Target CPU Window Peripherals and Bean Icons Target CPU Cpu DSP56F836 a i bh Sa A OF B Ma AA A RDE 1 PWMAtim Pwatim none 118 Targeting DSP56F80x DSP56F82x 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 6 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 6 9 Target CPU Window Block Diagram ox 7 PHASEB HOME PHAS PORTC PORTD PORTE PORTF A
266. sor 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 ClrVal and SetVal have green checks Figure 6 20 shows this configuration Figure 6 20 GPIO_C3 Enabled Functions 5 Beans 3 lt Aa E IM GetDir RM M SetDir m I Getval E M Putval E M Cial Ei M Setval E A Negval 4 GQ GPIO_C1 Bitlo GPI0_C2 BitiO F onn canis LS 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 project b You may close all windows except the project window Targeting DSP56F80x DSP56F82
267. sors for CodeWarrior Development Studio for Freescale 56804 tin DSP56800 DSP56800E MC56F8367 MC56F8122 MC56F8123 MC56F8145 MC56F8146 MC56F8147 MC56F8155 MC56F8156 MC56F8157 MC56F8165 MC56F8166 MC56F8167 References e Your Code Warrior IDE includes these manuals Code Warrior IDE User s Guide CodeWarrior Development Studio IDE 5 6 Windows Automation Guide Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers DSP56F80x 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 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Introduction References MSL C Reference Metrowerks Standard C libraries DSP56800 to DSP56800E Porting Guide Freescale Semiconductors Inc e To learn more about the DSP56800 processor refer to the following manuals DSP56800 Family Manual Freescale Semiconductors Inc DSP36F801 Hardware User Manual Freescale Semiconductors Inc DSP36F803 Hard
268. source files editing 58 Source Trees settings panel 73 special purpose registers 63 64 65 S record 95 S Record EOL Character list box 96 S Record Max Record Length field 95 stack frame for DSP56800 149 stack pointer register 150 stack size 287 statement level inline assembly 165 stationery saving new target settings 72 __stop 180 storage of code and data for DSP 155 156 369 For More Information www freescale com Freescale Semiconductor Inc Store Full Path Names checkbox 93 __strepy 188 __sub 177 SuiteS6 toolset 341 support web page 39 Suppress Warning Messages checkbox 95 symbols in LCF 282 syntax inline assembly language 164 system level connect 257 system requirements for DSP hardware 19 T target CPU window 116 120 Target Name field 74 target settings overview 70 Target Settings panel Linker 75 Output Directory field 75 Post Linker 75 Pre Linker 75 Target Name 74 Target Settings panels Access Paths 73 Build Extras 73 Custom Keywords 73 Debugger Settings 73 File Mappings 73 Global Optimizations 73 M56800 Linker 92 M56800 Processor 90 91 M56800 Target Settings 98 M56800 Target settings 75 Source Trees 73 Target Settings window 53 71 Troubleshooting Parallel Port Converter on Windows 2000 338 troubleshooting 333 338 communications with target board 337 downloading code 337 entry point errors 334 FSTART 334 ORG and memory addresses 335 plug in error 335 rebuild alert 334 rep instruction
269. ssembler The M56800 Assembler panel Figure 5 7 determines the format used for the assembly source files and the code generated by the DSP56800 assembler Targeting DSP56F80x DSP56F82x Controllers 85 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels Figure 5 7 M56800 Assembler Settings Panel Y M56800 Assembler IV Case Sensitive Identifiers TT Generate Listing File IV Detects pipeline error for delays to N register loads Prefix File The items in this panel are Case Sensitive Identifiers When this option is enabled the assembler distinguishes lowercase characters from uppercase characters for symbols For example the identifier flag is the not the same as Flag when the option is enabled NOTE This option must be enabled when mixing assembler and C code Generate Listing File The Generate Listing File option determines whether or not a listing file is generated when the CodeWarrior IDE assembles the source files in the project The assembler creates a listing file that contains file source along with line numbers relocation 86 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels information and macro expansions when the option is enabled When the option is disabled the assembler does not generate t
270. ssociate 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 240 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 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 O Box The memory types that can appear in the Memory Type Combo box are P Memory Program Memory e X Memory Data Memory Address Text Field Specify the address where you want to write the memory If you want it to be interpreted as hex prefix it with 0x otherwise it is interpreted as decimal Size Text Field Specify the number of words to write to the target If you want it to be interpreted as hex prefix your entry with 0x otherwise it is interpreted as decimal Fill Expression
271. ssor Expert Tutorial d Expand the subentry Port I O e Double click the BitIO bean name six times Figure 6 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 6 16 Bean Selector BitlO Selection iix Bean Categories On Chip Peripherals Quick help gt amp CPU amp CPU extemal devices amp CPU internal peripherals Communication amp Converter Interrupts amp Measurement E Memory gt Peripheral beans amp Port 1 0 s 0 S Bisio S M Byte210 S M Byte310 Filter all CPU Licensed h 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 new bean icons appear in the Processor Expert page c You may close the Bean Inspector window 128 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor
272. stalling and Registering the CodeWarrior IDE e Installing DSP56800 Hardware System Requirements Table 2 1 lists system requirements for installing and using the CodeWarrior IDE for DSP56800 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 DSP56800 See DSP56800 Hardware Requirements Other Power supply DSP56800 Hardware Requirements You can use various DSP56800 hardware configurations with the CodeWarrior IDE Table 2 2 lists these configurations Targeting DSP56F80x DSP56F 82x Controllers 19 For More Information www freescale com Freescale Semiconductor Inc Getting Started Installing and Registering the CodeWarrior IDE NOTE Each protocol in Table 2 2 is selected from the M56800 Target Settings panel Table 2 2 DSP56800 Hardware Requirements Target Connection Boards Supported Hardware Provided With Command Converter Parallel port on board All 56800 targets e 25 pin parallel port interface cable Command Converter e Power supply 9 12 Vdc 500 mA with 2 5 mm receptacle inside positive External Parallel Port All 56800 targets Freescale Parallel Port Command Command
273. t unit 2 BPU2 of the watchpoint status window allows you to monitor values and their masks in either the Core Global Data Bus CGDB or Program Address Bus PAB When you use BPU2 in conjunction with BPU1 and the occurrence counter you can monitor the status of a watchpoint to a resolution as fine as 1 bit at single memory location Targeting DSP56F80x DSP56F 82x Controllers 247 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 OnCE Debugger Features Options for setting BPU2 are in the Breakpoint Unit 2 group box are in Figure 9 21 and listed in Table 9 3 Figure 9 21 Breakpoint Unit 2 Options Breakpoint Unit 2 I Reserve Breakpoint Unit 2 for debugger Bus Core Global Data Bus y Value oxo Mask OKFFFF NOTE If you are using Breakpoint Unit 2 ensure that one of the radio buttons is set to use Breakpoint 2 in the Sequence group box Table 9 3 Options for Breakpoint Unit 2 Setting Value Comment Reserve Enabled Breakpoint unit 2 cannot be user Breakpoint Unit defined and the occurrence counter 2 for Debugger defaults to 1 for BPU1 Disabled Breakpoint unit 2 is user defined and occurrence counter is available for both BPU1 and BPU2 Single stepping stepping over and stepping out of functions cannot be done when hardware breakpoints are enabled Bus Core Global Data Data transfer between the data ALU Bus CGDB and X data memory for one memory
274. tension provided by the CodeWarrior compiler Fractional Arithmetic Many of the intrinsic functions for Freescale DSP56800 use fractional arithmetic with implied fractional values An implied fractional value is a symbol which has been Targeting DSP56F80x DSP56F82x Controllers 171 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Intrinsic Functions for DSP56800 declared as an integer type but is to be calculated as a fractional type Data in a memory location or register can be interpreted as fractional or integer depending on the needs of a user s program All intrinsic functions that generate multiply and divide instructions DIV MPY MAC MPYR and MACR perform fractional arithmetic on implied fractional values The following equation shows the relationship between a 16 bit integer and a fractional value Fractional Value Integer Value 2 Similarly the equation for converting a 32 bit integer to a fractional value is as follows Fractional Value Long Integer Value 231 Table 8 1 shows how both 16 and 32 bit values can be interpreted as either fractional or integer values Table 8 1 Interpretation of 16 and 32 bit Values 172 Type Hex Integer Fixed point Value 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
275. ternal memory es Y E gt P Files Link Order Targets code 169 168 Mm a 169 168 n support 52K Ko of DSP56F805 212 2 wf 24 startup 80 De ex BM DSP56F805_ini 80 D e of EQ interrupt vectors 132 2 em Bl DSP56F805_v 132 2e exi A DSP5EFS05_v n a n a zi Ea linker command files 0 O zi N DSPS6F805_ex n a nia a MM DSPSEFSO5_x n a n a a 323 lib SRO Ke m ff FP56800 lib 2724 2 ni MSL C 56800 Lib 50838 3248 zi 8 View a Source File a Double click the main c file in the project window the source code in the file is displayed in a Code Warrior source code editor window Figure 4 11 NOTE For more details about the Code Warrior editor and its features see the IDE User s Guide 52 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 11 CodeWarrior Editor Window Peles bh gt M gt 3 dl Path C Amy_projects_folder sample main c I pio metroverks sample code include lt stdio h gt include lt stdlib h gt fdefine SIZE 10 7 7 prototypes void swap int a int b void print_array int arr int length int main void int arr SIZE 4 6 7 1 2 3 4 12 4 5 int 1 3 Line 1 Colt lt DA
276. ters a From the menu bar of the Metrowerks Code Warrior window select View gt Registers Expand the General Purpose Registers tree control to view the registers as in Figure 4 19 or double click on General Purpose Registers to view the registers as in Figure 4 20 Figure 4 19 General Purpose Registers for DSP56800 loxi N Register Value ESTE 2 external_memory elf B AB General Purpose Registers A 0x0000000000 AD 0x0000 AL 0x0000 Al 0x00 B 0x0000000000 BO Ox0000 B1 Ox0000 B2 0x00 xo 0x0000 bos Y 0x00000000 YO 0x0000 YI 0x0000 RO O0x0000 R1 0x22 18 R2 0x2 002 R3 0x2 002 N 0x0000 MOL OXFFFF SP 0x321E PC 0x0080 Y IPR 0x0000 Li Targeting DSP56F80x DSP56F82x Controllers 63 For More Information www freescale com Tutorial Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 20 General Purpose Registers Window 64 General Purpose Registers Window external_memory elf 0x0000000000 0x0000 0x0000 0x00 oxoo00000000 oxoo00 0x0000 0x00 0x0000 ox0o0000000 0x0000 0x0000 0x0000 Ox221B ox2002 ox2002 0x0000 OxFFFF Ox321E 0x0080 0x0000 0x0000 0x0114 OMR HWS LE LA PERO PERI MRO MR1 MR2 MR3 MR4 MRS MRG MR MRS MRS MRI10 MR11 MR12 MR13 MR14 MR15 0x0103 0x0000 0x0001 0x0160 0x0000 0x02 00 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0
277. that is saturation on data ALU results enabled Targeting DSP56F80x DSP56F82x Controllers 177 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Prototype Word32 _L add Word32 src_dst Word32 src2 Example long la 0x40000000 0 5 long lb 0x20000000 0 25 long result result L add la 1b Expected value of result 0x60000000 0 75 _L sub 178 Definition Subtraction of two 32 bit integer or fractional values returning 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 sub Word32 src_dst Word32 src2 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long la 0x40000000 0 5 long lb 0xE0000000 0 25 long result result L sub la lb Expected value of result 0x60000000 0 75 Targeting DSP56F80x DSP56F82x Controllers 179 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Control _ Stop __stop Definition
278. the CodeWarrior IDE Installing DSP56800 Hardware Using Parallel Port a tes ho BPA Installing the PCI Command Converter 3 Development Studio Overview CodeWarrior IDE sl Code Warrior Compiler for DSP56800 CodeWarrior Assembler for DSP56800 Code Warrior Linker for DSP56800 CodeWarrior Debugger for DSP56800 Metrowerks Standard Library Development Process ay Project Files versus Makefiles Editing Code Compiling Linking Debugging Viewing Preprocessor Output 4 Tutorial 41 CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 41 Creating a Project Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com 41 Freescale Semiconductor Inc Table of Contents Working with the Debugger References 5 Target Settings Target Settings Overview Target Setting Panels Changing Target Settings Exporting and Importing Panel Options to XML Files Restoring Target Settings g CodeWarrior IDE Target Settings Panels DSP56800 Specific Target Settings Panels Target Settings M56800 Target C C Language C only C C Preprocessor C C Warnings M56800 Assembler ELF Disassembler M56800 Processor M56800 Linker Remote Debugging M56800 Target Debugging Remote Debug Options 6 Processor Expert Interface Processor Expert Overview Processor Expert Code Generation Processor Expert Beans Processor Expert Menu Processor
279. the DSP56F803 DSP56F805 DSP56F807 DSP56F826 and DSP56F827 Target Selection Page DSP56F803 DSP56F805 DSP56F807 DSP56F826 Next Page Next Page Next Page Program External Internal Finish Page Choice Page DSP56F827 Targeting DSP56F80x DSP56F82x Controllers Memory Page 347 For More Information www freescale com Freescale Semiconductor Inc DSP56800x New Project Wizard Overview Table B 4 Page Rules for the DSP56852 DSP56853 DSP56854 DSP56855 DSP56857 and DSP56858 348 Target Selection Page DSP56852 DSP56853 DSP56854 DSP56855 DSP56857 DSP56858 Next Page Program Choice Page Next Page Finish Page Targeting DSP56F80x DSP56F82x 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 Next Page Program Choice Page Targeting DSP56F80x DSP56F82x Controllers Next Page Data Memory Model Page DSP56800x New Project Wizard Next Page if Processor Expert Not Selected External Internal Memory Page For More Information www
280. the basis of your new project You can create customized project stationery as well Project stationery is a useful feature of the CodeWarrior IDE Practice working with a sample project as follows Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 1 Launch the Code Warrior IDE The Metrowerks Code Warrior window appears with a menu bar at the top Figure 4 5 Figure 4 5 Metrowerks CodeWarrior Window Metrowerks CodeWarrior File Edit View Search Project Debug ProcessorExpert Window Help BES EoexReaawn 5 PERL To create a new project from project stationery 1 From the menu bar of the Metrowerks CodeWarrior window select File gt New The New window appears with a list of options in the Project tab Figure 4 6 Targeting DSP56F80x DSP56F82x Controllers 47 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 6 New Window A xl Project File Object dB DSP5E800x EAB Stationery Project name ff DSP56800x Examples Stationery sample dE DSP56800x New Project Wizard a Empty Project Location i Makefile Importer Wizard C my_projects_folder sample Set D Processor Expert Examples Stationery HB Process
281. the section s you want to keep before you use the SECTION keyword Prototype KEEP SECTION sectionType sectionTypel 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 accessFlags are passed into the output ELF file Phdr p_ flags The accessFlags can be e R read e W write e X executable for P memory placement address originis one of the following Memory address Targeting DSP56F80x DSP56F82x Controllers 293 For More Information www freescale com ELF Linker Freescale Semiconductor Inc Linker Command File Keyword Listing 294 Specify a hex address such as 0x8000 AFTER command Use the AFTER name name command to instruct 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 pa
282. ting 1f 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 Word16 sinp2 Example short s1 0xC000 0 5 short s2 0x4000 0 5 long result Acc 0x20000000 0 25 result L mac Acc sl s2 Expected value of result 0 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples _L msu Definition Multiply two 16 bit fractional values and subtract this product from a 32 bit fractional value saturating if necessary Generates 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 msu Word32 laccum Word16 sinpl Wordl6 sinp2 Example short s1 0xC000 0 5 short s2 0xC000 0 5 long result Acc 0 result L msu Acc sl s2 Expected value of result 0 25 _L_mult Definition 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 Targeting DSP56F80x DSP56F82
283. ting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Syntax Hinclude 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 NOTE For this example to work you must be writing to Flash with the CodeWarrior debugger and have your board jumpered to mode 0 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 Targeting DSP56F80x DSP56F 82x Controllers 287 For More Information www freescale com ELF Linker Linker Command File Keyword Listing Freescale Semiconductor Inc Wri
284. ting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Troubleshooting Troubleshooting Tips This dialog box informs you that the software determines if your object code needs to be rebuilt If you have made no changes since the last build the CodeWarrior IDE does not change your object file when you select the Build option Timing values not found in FLASH configuration file Please upgrade your configuration file On chip timing values will be used which may result in programming errors This indicates you have an old flash configuration file that does not include timing information If you continue to use this file it could result in programming errors and a shorter life for the flash memory To upgrade your flash configuration file replace the existing flash configuration file with the flash configuration file from the M56800 Support The flash configuration file is located in the following directory Code Warrior M56800 Support initialization IDE Closes Immediately After Opening There may be a conflict with another version of the CodeWarrior IDE on your system Running the regservers bat file in the Metrowerks Bin directory usually resolves this problem when there are different versions of the Code Warrior IDE installed on the same computer Errors When Assigning Physical Addresses With The Org Directive You cannot use the ORG directive with the CodeWarrior IDE DSP
285. ting Data Directly to Memory You can write directly to memory using the WRITEx command in the linker command file The WRIT EB 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 19 Embedding Data Directly Into the Output example data section WRITEB 0x48 H WRITEB 0x69 1 WRITEB 0x21 Linker Command File Keyword Listing This sections explains the keywords available for use when creating Code Warrior Development Studio for Freescale 56800 applications with the linker command file Valid linker command file functions keywords directives and commands are described 288 location counter ADDR ALIGN ALIGNALL FORCE_ACTIVE INCLUDE INCLUDE KEEP_SECTION MEMORY OBJECT REF_INCLUDE SECTIONS SIZEOF SIZEOFW Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc ELF Linker Linker Command File Keyword Listing e WRITEB e WRITEH e WRITES e WRITEW location counter The period character always maintains the current position of the output location Since the period always refers to a location in a SECTIONS block it can not be used outside a section definition A period may appear anywhere a symbol is allowed Assigning a value to period that is greater than its current value causes the l
286. ting executable code Debug your project as you would any other CodeWarrior project Targeting DSP56F80x DSP56F82x 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 6 1 File Events c kk kk kk k kk k kk kk k kk kk k kk kk k kk kk k kk kk k kk kk k k kk kk k kk k kk k kk k kk k k FERE HEFE HEHE HEFE HE FE HE FE HE FE HEHE HEHE HEHE HEHE HEHE EHE EHE HEHE PE EEE HEE HE 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 IROB 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 x http i www processorexpert com mail info processorexpert com Targeting DSP56F80x DSP56F82x Controllers 135 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial k k AAA
287. ting 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 DSP56F80x DSP56F82x Controllers 253 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Using the DSP56800 Simulator Memory Map Figure 9 26 Simulator Memory Map FFFF FFFF Reserved FFCO Program Memory Space 2000 Reserved 1300 7F Interrupt Vectors 0 0 P X NOTE Figure 9 26 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 254 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Register Details Window Register Details Window From the menu bar of the Metrowerks Code Warrior 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 27 Figure 9 27 Register Details Window mRegister Details F xi Description File Browse Register Name Format Default X 31 30 23 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 1
288. tion Configures how the compiler optimizes code Remote Debugging M56800 Target Debugging Remote Debug Options Linker M56800 Linker Editor Custom Keywords Changes colors for different types of text Debugger Debugger Settings Specifies settings for the CodeWarrior debugger 70 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Target Settings Target Settings Overview Changing Target Settings To change target settings 1 Select Edit gt Target Name Settings Target is the name of the current build target in the CodeWarrior project After you select this menu item the CodeWarrior IDE displays the Target Settings window Figure 5 1 Figure 5 1 Target Settings Window A d IEPS Target Name simulator Access Paths Build Extras Linker M56800 Linker y File Mappings Prelinker None y Source Trees 5 M56800 Target Postlinker None y E Language Settings Dutput Directory C C Language Choose C C Preprocessor Project output C C Warmings ea M56800 Assembler B Code Generation ELF Disassembler M56800 Frocessor Global Optimizations E Linker M56800 Linker TT Save project entries using relative paths Factory Settings Revert Import Panel Export Panel DK Cancel Apply The left side of the Target Settings window contains a list of target setting
289. tionery wizard Targeting DSP56F80x DSP56F 82x Controllers 41 For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial 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 Stationery 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 Stationery Project Wizard In this section of the tutorial you work with the CodeWarrior IDE to create a project with the DSP56800x New Stationery Project Wizard To create a project 1 From the menu bar of the Metrowerks CodeWarrior window select File gt New The New dialog box appears 42 Targeting DSP56F80x DSP56F 82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 1 New Dialog Box New xl Project File Object dO DSP56800x EABI Stationery Project name fe DSP56800x Examples Stationery the_project dl DSP56800x New Project Wizard ff Empty Project Location pe Makefile Importer Wizard jc my_projects the_project Set i Processor Expert Exam
290. tions Working With DSP56800 Assembly Language Adding Assembly Language to C Source Code There are two ways to add assembly language statements in a C source code file You can define a function with the asm qualifier or you can use the inline assembly language The first method uses the asm keyword to specify that all statements in the function are in assembly language as shown in Listing 8 3 and Listing 8 7 Note that if you are using this method you must define local variables within the function Listing 8 3 Defining a Function with asm asm long MyAsmFunction void Local variable definitions Assembly language instructions The second method uses the asm qualifier as a statement to provide inline assembly language instructions as shown in Listing 8 4 Note that if you are using this method you must not define local variables within the inline asm statement Listing 8 4 Inline Assembly with asm long MyInlineAsmFunction void i asm move x r0 x0 General Notes on Inline Assembly Language Keep these points in mind as you write inline assembly language functions All statements must either be a label LocalLabel Or an instruction instruction operands Each statement must end with a new line 166 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Working With DS
291. 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 DSP56800 Floating Point Formats Table 7 2 shows the sizes and ranges of the floating point types for the DSP56800 compiler Table 7 2 DSP56800 Floating Point Types Type Size bits Range 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 144 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc C for DSP56800 Calling Conventions Stack Frames DSP56800 Fixed Point Formats Table 7 3 shows the sizes and ranges of the fixed point types for the DSP56800 compiler Table 7 3 DSP56800 Fixed Point Types Type Declared As Size Range bits fixed _ fixed _ 16 1 0 lt x lt 1 0 short fixed __shortfixed__ 16 1 0 lt x lt 1 0 long fixed __longfixed__ 32 1 0 lt x lt 1 0 NOTEFor compatibility reasons preferably use DSP intrinsics instead of fixed point types in Table 7 3 for fractional arithmetic Calling Conventions Stack Frames The CodeWarrior IDE for Freescale DSP56800 stores data and calls functions in ways that might be different from other target platforms Calling Conventions The registers A R2 R3 YO and Y1 pass parameters to functi
292. 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 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 information Targeting DSP56F80x DSP56F82x Controllers
293. tor Inc Processor Expert Interface Processor Expert Tutorial Figure 6 15 Project Target CPU Windows File Edit View Search Project Debug Processor Expert Window Help Bos RA E E E SCA Ra NERA Ja Cc som Hay or A ICAA TT Files Link Order Targets Processor Expert amp Configurations EG CPUs Z Cpu56F8346 B Documentation x E PESL CPU extemal devices E CPU internal peripherals amp Communication amp Converter Interupts Measurement Memory amp Peripheral beans E Pott l 0 SM 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 DSP56F80x DSP56F82x Controllers 127 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Proce
294. tor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial the objects You can see the compiler s progress in the project window and in the toolbar Editing the Contents of a Project To change the contents of a project 1 Add source files to the project Most stationery projects contain source files that act as placeholders Replace these placeholders with your own files To add files use one of the following options From the menu bar of the Metrowerks CodeWarrior window select Project gt Add Files Drag files from the desktop or Windows Explorer to the project window To remove files a Select the files in the project window that you want to delete b Press the Backspace or Delete key 2 Edit code in the source files Use the IDE s source code editor to modify the content of a source code file To open a file for editing use either of the following options e Double click the file in the project window e Select the file in the project window and press Enter Once the file is open you can use all of the editor s features to work with your code You have now been introduced to the major components of CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers except for the debugger You are now familiar with the project manager source code editor and settings panels Working with the Debugger In this section you will explore the CodeWarrior d
295. trollers Tutorial Figure 4 3 DSP56800x New Project Wizard Program Choice Dialog Box xi Select the example main program for this project Program 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 appears Targeting DSP56F80x DSP56F82x Controllers 45 For More Information www freescale com Tutorial Freescale Semiconductor Inc CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 4 DSP56800x New Project Wizard Finish Dialog Box 46 DSP56800x New Project Wizard Finish x Click Finish to create the project lt Back 10 Click Finish to create the new project NOTE For more details of the DSP56800x New Project Stationery Wizard please see DSP56800x New Project Wizard Creating a New Project with the DSP56800x EABI Stationery In this section of the tutorial you work with the CodeWarrior IDE to create a project with the DSP56800x EABI Stationery You will start using a project stationery A project stationery file is a template that describes a pre built project complete with source code files libraries and all the appropriate compiler and linker settings When you create a project based on stationery the stationery is duplicated and becomes
296. tter F to every function label name Therefore when calling C functions from either Assembly Language or Inline Assembly the F must be prepended You can now call your assembly language function from C as shown in Listing 8 10 Listing 8 10 Sample Code Calling an Assembly Language Function from C void pmemwrite short short Write a value into P memory void main void other code Write the value given in the first parameter to the address of the second parameter in P memory pmemwrite short 0xE9C8 short 0x0010 other code Calling Functions from Assembly Language Assembly programs can call C function or Assembly language functions This section explains the compiler convention for e Calling C Functions from Assembly Language Functions written in C can be called from within assembly language instructions For example if you defined your C program function as void foot void Do something You could then call your C function from assembly language as jsr Ffoot e Calling Assembly Language Functions from Assembly Language 170 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Intrinsic Functions for DSP56800 To call an assembly language function from assembly language use the j sr instruction with the function name as defined in your
297. tup stack move stack addr r0 get stack start address nop move r0 x lt mr15 set frame pointer to main stack top move ro sp set stack pointer too move 0 r1 move r1 x r0 setup the PLL phase locked loop move pllcr init x PLLCR set lock detector on and choose core clock move plldb init x PLLDB set to max freq move Hwait_lock x0 set x0 with timeout value timeout handles simulator case pll_test lock loop until PLL is locked or we reach timeout limit decw x0 decrement our timeout value tstw x0 test for zero beq pll_ timeout if timed out proceed anyway brclr pllsr_init x PLLSR pll_test_lock p11_timeout pll locked move pllcr proceed x PLLCR set lock detector on choose Targeting DSP56F80x DSP56F 82x Controllers 329 For More Information www freescale com Freescale Semiconductor Inc Libraries and Runtime Code Runtime Initialization PLL clock move x PLLSR x0 clear pending clkgen interrupts move x0 x PLLSR setup exception handler and interrupt levels move M56803 int Addr rl address push rl establish exception handler bfset S0100 sr enable all levels of interrupts bfclr 50200 sr allow IPL 0 interrupts xrom to xram option move rom_to_ram ro check for option tstw r0 beq end_rom2ram move _data_size r2 set data size move data ROM addr r3 src address xROM data start move data RAM addr rl dest addres
298. u 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 56800 Default Project xml and is located in the path CodeWarrior bin plugins support directory You can create your own version of this file to use as a default setting when opening a elf file 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 56800_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 256 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Using the Command Window Using the Command Window In addition to using the regular Code Warrior IDE debugger windows you
299. ues 341 Post Linker option 75 Prefix File 87 Prefix File field 87 Pre Linker pop up menu 75 Preprocess command 39 preprocessing 39 See also IDE User Guide Processor Expert beans 107 109 code generation 106 107 menu 109 112 overview 105 112 page 107 tutorial 126 142 Processor Expert interface 105 142 Processor Expert windows 113 125 bean inspector 114 115 bean selector 113 114 CPU types overview 122 installed beans overview 124 memory map 121 122 peripherals usage inspector 125 resource meter 123 target CPU 116 120 Project Files versus Makefiles 37 project stationery 46 50 Project Type pop up menu 76 Project window 51 projects debugging 60 editing contents of 58 stationery 46 50 protocols setting 59 R rebuild alert 334 REF_INCLUDE 282 ref_include 279 282 295 references 17 Freescale Documentation 17 register details window 237 255 register values 229 231 368 For More Information www freescale com Freescale Semiconductor Inc registers display contents 63 64 65 function parameters 145 non volatile 146 special purpose 63 64 65 stack pointer 150 volatile 146 regservers bat 335 remote debug options panel 102 104 remote debugging panel 96 98 rep instruction problems in debugger 334 REP instructions allowing 91 resource meter window 123 Restoring Target Settings 72 ROM to RAM copy 285 287 _ round 204 runtime ROM to RAM copy 286 runtime initialization 327 S Sample Initialization File 32
300. ugh a REP Statement Due to the nature of DSP56800 instruction pipeline do not set a breakpoint on a REP statement in the debugger Doing so may cause the REP instruction to enter an infinite loop and freeze or crash the IDE Can t Locate Program Entry On Start or Fstart c Undefined By default the CodeWarrior stationery defines the entry point of program execution as FSTART_ The entry point is edited in the project target settings by selecting Edit gt M56800 Settings from the menu bar of the Metrowerks CodeWarrior window and then M56800 Linker from the Target Settings panel If the entry point is changed and not updated in the sources linker errors are generated for undefined sources The FSTART c program is defined in the MSL and may also generate errors if the Code Warrior IDE cannot find the MSL path due to access path errors within a DSP56800 project When Opening a Recent Project the CodeWarrior IDE Asks If My Target Needs To Be Rebuilt If you open a recent project file and then select Project gt Debug from the menu bar of the Metrowerks CodeWarrior window the dialog box shown in Figure 15 1 appears Figure 15 1 Rebuild Alert 334 Metrowerks CodeWarrior xi Target M56800 may need to be rebuilt x CodeWarrior cannot determine if target M56800 needs to be rebuilt Before running this target do you want to check to see if t needs to be rebuilt and to build it if it does Dont Build Cancel Targe
301. ult mac r Acc sl s2 Expected value of result 0xE001 __msu_r Definition Multiply two 16 bit fractional values and subtract this product from a 32 bit fractional value Round into a 16 bit result saturating if necessary When an accumulator is the destination zeroes out the LSP portion 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 Wordl sinpl Wordl6 sinp2 Targeting DSP56F80x DSP56F82x Controllers 195 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example short sl short s2 0xC000 0 5 0x4000 0 5 short result long Acc result 0x20000000 _ msu_r Acc sl s2 Expected value of result 0x4000 _ mult 196 Definition 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
302. used overrides this Variables 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 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 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 _ option warn_extracomma command Inconsistent Use of class and struct Keywords checkbox 84 Leave clear Does not apply to C Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Fre
303. uses for different types of text 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 Targeting DSP56F80x DSP56F82x Controllers 73 For More Information www freescale com Freescale Semiconductor Inc Target Settings DSP56800 Specific Target Settings Panels DSP56800 Specific Target Settings Panels This section explains individual settings on DSP56800 specific target settings panels Target Settings The Target Settings panel Figure 5 2 lets you set the name of your build target as well as the linker and post linker plug ins to be used with the build target By selecting a linker you are specifying which family of processors to use The other available panels in the Target Settings window change to reflect your choice Because the linker choice affects the visibility of other related panels you must first set your build target before you can specify other options like compiler and linker settings Figure 5 2 Target Settings Panel 74 N Target Settings Target Name simulator Linker M56800 Linker v Pre linker None d Postlinker None dd r Output Directory Choose Clear Project output IT Save project entries using relative paths Target Name Use the Target Name field to set or change the name of
304. vector c lt gt finclude configdefines h O al fundef CFG_SECTION_ISR_DECLARATION jar SDK_Interruptl COP Reset jsr SDK_illegal ye Illegal In jsr SDK_Interrupt3 P 0x06 3 Software I jar SDK_HWSOverf low P 0x08 3 Hardware S gt Line 43 Colt Jaf 14 Using the DSP56800 Simulator The CodeWarrior Development Studio for Freescale 56800 includes the Freescale DSP56800 Simulator This software lets you run and debug code on a simulated DSP56800 architecture without installing any additional hardware The simulator simulates the DSP56800 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 252 For More Information www freescale com Targeting DSP56F80x DSP56F82x Controllers Freescale Semiconductor Inc Debugging for DSP56800 Using the DSP56800 Simulator NOTE The simulator also enables the 56800 menu for retrieving the machine cycle count and machine instruction count when debugging Cycle Instruction Count From the menu bar of the Metrowerks Code Warrior window select 56800 gt Display Cycle Instruction count The following window appears Figure 9 25 Figure 9 25 Simulator Cycle Instruction Count DSP568 Simulator Cycle Ins ior xj Machine cycles simulated 92 Machine instructions simulated 24 Reset NOTE Cycle coun
305. verter 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 DSP56F80x DSP56F82x Controllers 223 For More Information www freescale com Freescale Semiconductor Inc Debugging for DSP56800 Launching and Operating the Debugger 6 Click the OK button To Change an Existing Remote Connection To change an existing remote connection Double click on the connection name that you want to change or click once on the connection name and click the Change button shown in Figure 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 217
306. w legacy DSP56800 instructions imply data prog 16 no debug_workaround Pad nop workaround debuggin issue 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 322 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc 14 Libraries and Runtime Code You can use a variety of libraries with the Code WarriorTM IDE The libraries include ANSI standard libraries for C runtime libraries and other code This chapter explains how to use these libraries for DSP56800 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 DSP56800 Runtime Initialization MSL for DSP56800 This section explains the Metrowerks Standard Library MSL modified for use with DSP56800 CodeWarrior IDE for DSP56800 includes the source and project files for MSL so that you can modify the library if necessary Using MSL for DSP56800 CodeWarrior IDE for DSP56800 includes a version of the Metrowerks Standard Library MSL The MSL is a C library you can use in your embedded projects All of the sources necessary to build MSL are includ
307. ware User Manual Freescale Semiconductors Inc DSP56F805 Hardware User Manual Freescale Semiconductors Inc DSP36F807 Hardware User Manual Freescale Semiconductors Inc DSP36F826 Hardware User Manual Freescale Semiconductors Inc DSP36F827 Hardware User Manual Freescale Semiconductors Inc For more information on the various command converters supported by the CodeWarrior Development Studio for Freescale 56800 DSP56F80x DSP56F82x refer to the following manuals Suite56 Ethernet Command Converter User s Manual Freescale Semiconductors Inc Suite56 PCI Command Converter User s Manual Freescale Semiconductors Inc Suite56 Parallel Port Command Converter User s Manual Freescale Semiconductors Inc To download electronic copies of these manuals or order printed versions visit http www freescale com Targeting DSP56F80x DSP56F82x Controllers 17 For More Information www freescale com Introduction References Freescale Semiconductor Inc Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Getting Started This chapter explains how to install and run the CodeWarrior IDE on your Windows operating system This chapter also explains how to connect hardware for each of the communications protocols supported by the Code Warrior debugger This chapter contains the following sections e System Requirements e In
308. with C code created both before Listing 7 6 and after Listing 7 7 optimizations are turned on Listing 7 6 Array Example Before Optimizations Mixed View for i 0 i lt 100 i 00001004 A7B20000 moves 0 X 0x0032 00001006 A90B bra main 0x18 0x1018 i 0x000812 ali bli 00001007 880F move SP RO 00001008 DE40FF9D lea RO 99 0000100A BC32 moves X 0x0032 N 0000100B F044 move X RO N XO 0000100C 880F move SP RO 0000100D DE40FF39 lea R0 199 158 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com 0000100F 00001010 Freescale Semiconductor Inc C for DSP56800 Optimizing Code BC32 moves X 0x0032 N DO44 move X0 X RO N The optimization level has been set to 3 Listing 7 7 Note that i is optimized out and the operation is now performed with address registers This optimization is called induction NOTE With induction the variable i is no longer used Listing 7 7 Array Example After Optimizations Mixed View for 1 00001008 00001004 ali 0000100B 0000100C 0000100D 0000100 0 i lt 100 i A7B20000 moves 0 X 0x0032 A905 bra START 0x3 0x101a 0x000810 b il FO16 move X R2 X0 D017 move X0 X R3 DE02 lea R2 DE03 lea R3 Multiply and Accumulate MAC Optimizations Multiply and Accumulate optimizations use address register calculations and perform arithmetic operatio
309. x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial This chapter gives you a quick start at learning how to use the CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers for the DSP36F80x DSP56F82x Controllers CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial This chapter provides a tour of the software development environment of the Code Warrior Development Studio for Freescale 56800 E Hybrid Controllers You will learn how to use the tools to program for DSP36800 boards This tutorial introduces you to many important elements of the Code Warrior IDE that you will use when programming for DSP56800 However the tutorial does not cover or explain all the features of the IDE You will learn how to create compile and link code that runs on DSP56800 systems If you are already familiar with the CodeWarrior software read through the steps in this tutorial anyway You will encounter the DSP56800 compiler and linker for the first time as well as other features specific to DSP56800 application development This tutorial is divided into segments In each segment you will perform steps that introduce you to the critical elements of the CodeWarrior IDE programming environment The segments are e Creating a Project e Working with the Debugger Creating a Project You can create a DSP56800x project by using the e DSP56800x new project sta
310. x Controllers 133 For More Information www freescale com Freescale Semiconductor Inc Processor Expert Interface Processor Expert Tutorial 10 Update file Events c a Dog 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 files text Listing 6 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 Inside IRQA OnInterrupt enter the new line IRQA On 1 Listing 6 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 6 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 134 From the main window menu bar select Project gt Make The IDE compiles and links your project genera
311. x Controllers 199 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Prototype Word32 _L mult Word16 sinpl Word16 sinp2 Example short sl 0x2000 0 25 short s2 0x2000 0 25 long result result L mult sl s2 Expected value of result 0 0625 0x08000000 _L_mult_Is Definition Multiply one 32 bit and one 16 bit fractional value generating a signed 32 bit fractional result Saturates only for the case of 0x80000000 x 0x8000 Assumptions OMR s SA bit was set to 1 at least 3 cycles before this code that is saturation on data ALU results enabled Prototype Word32 _L mult_1ls Word32 linpl Wordl6 sinp2 200 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Example long 11 0x20000000 0 25 short s2 0x2000 0 25 long result result L mult_1s 11 s2 Expected value of result Targeting DSP56F80x DSP56F82x Controllers 0 0625 0x08000000 201 For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions List of Intrinsic Functions Definitions and Examples Normalization e noml e nor
312. x0000 0x0000 0x0000 Ox321B 15 x 4 b Toedit values in the register window double click a register value Change the value as you wish 9 View Data X Memory All variables reside at a specific memory address determined at runtime a To view the memory address range of a variable select Data gt View Memory from the menu bar of the Metrowerks CodeWarrior window If Data gt View Memory is greyed out make sure that you have the Program window as the highlighted window and that you either have the cursor in the Source pane or have a function selected in the Stack pane The Memory window appears Figure 4 21 b Locate the Page list box at the bottom of the View Memory window Select X Memory from the Page list box Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Tutorial CodeWarrior Development Studio for Freescale 56800 E Hybrid Controllers Tutorial Figure 4 21 View X Memory Window alo x Display ox2000 View Raw data y Y Hex 0000104 00002004 00002000 Pida 4c10 00002006 0100 0200 oooo200c 10500 DADO 00002012 3000 3000 00002018 3000 3000 00000201E 3000 3000 00002024 3000 3000 00002024 3000 3000 00002030 3000 3000 00002036 10400 0000 0000203C 6500 2000 00002042 7200 6500 00002048 7400 6F00 0000204E 6100 2000 00002054 5700 6100 Word Size fi 6 y Page x Memory y 4 10 Ent
313. xclusively for 2 to 7 bit input output Filter allfCPU Licensed The Bean Categories page at the left side of this window lists the available 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 6 4 shows This pane describes the selected highlighted bean Use the scroll bars to read descriptions that are long Targeting DSP56F80x DSP56F82x Controllers 113 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
314. y conversions from pointers to integers and vice versa no anyptrintconv any conversions from pointers to integers no undef macro use of undefined macros in if elif conditionals no filecaps incorrect capitalization used in include no sysfilecaps incorrect capitalization used in Hinclude lt gt no tokenpasting token not formed by operator 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 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 318 Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc l file no defaults nofail no stdlib HHHHHHH HHH HH HH Command Line Tools Arguments search path cased add a library by searching access paths for file named lib lt file gt lt ext gt where lt ext gt is a typical library extension added before system libraries see defaults global same as no stdlib default continue importing or disassembling after errors in earlier files global use system library access paths specified
315. y language but their scope is restricted to the current function being compiled Labels in the stand alone assembler may be defined and exported via the GLOBAL directive in either X or P address space therefore these labels are not scope limited e Data variables may not be defined in inline assembly language as the ORG directive is not supported in inline assembly data requires ORG X directive e Colons are required for any label definition in the inline assembler The stand alone assembler does not require a colon on labels as long as the label symbol name begins in the first character position e Mnemonics may begin at any character position on a line in the inline assembler Mnemonics may not begin at the first character position in the stand alone assembler e The stand alone assembler allows semicolon comments The inline assembler does not allow semicolon comments Inline Assembly Language Syntax for DSP56800 This section explains the inline assembly language syntax specific to DSP56800 development with the CodeWarrior IDE Function level Inline Assembly Language To specify that a block of code in your file should be interpreted as assembly language use the asm keyword and standard DSP56800 instruction mnemonics Targeting DSP56F80x DSP56F82x Controllers For More Information www freescale com Freescale Semiconductor Inc Inline Assembly Language and Intrinsic Functions Working With DSP56800 Assembly Lan
Download Pdf Manuals
Related Search
Related Contents
Jabra 6430 Bluetooth Headset User Manual ISLEQ作成資料 P1800 Installation Manual complete user manual for TaraVault User Manual User manual QUICK START GUIDE Comment utiliser votre découpeuse avec plus de Copyright © All rights reserved.
Failed to retrieve file