Home
        CodeWarrior Info on the PPC Target
         Contents
1.                Table 4 4 MetroTRK default baud rates for target boards  Embedded PowerPC Board Solaris 2 6  and Solaris 2 5 1 Baud  Windows Baud Rates  bps   Rates  bps    Cogent CMA102 with CMA 278 Daugh  115200 38400   tercard   Motorola MPC 505 509 EVB 38400 38400   Motorola 555 ETAS 115200 38400   Motorola Excimer 603e 115200 38400   Motorola Yellowknife X4 603 750 115200 38400   Motorola MPC 8xx ADS 115200 38400   Motorola MPC 8xx MBX 115200 38400   Motorola MPC 8xx FADS 115200 38400   Motorola Maximer 7400 115200 38400   Motorola MPC 8260 VADS 115200 38400   Phytec miniMODUL PPC 505 509 19200 19200  If you change the baud rate in the MetroTRK source code  you also  must change the baud rate in the debugger  For more information  on MetroTRK  see    Using MetroTRK    on page 157   Data Bits  The Data Bits pull down menu selects the number of data bits per  character  The default value is 8   Log Serial Data to Log Window  This option currently is unsupported   Parity  Use the Parity pull down menu to select whether you want an odd  parity bit  an even parity bit  or none  The default value is none    PPC 120 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Stop bits    The Stop Bits pull down menu selects the number of stop bits per  character  The default value is 1     Flow Control    Use the Flow Control pull down menu to select whether you want  hardware flow control  software flow control  or none  The defau
2.            Targeting Embedded PowerPC PPC 203    C and C   for Embedded PowerPC  _attribute__   aligned         Struct Definition Examples    This section shows struct definitions that use__ attribute_    aligned           Example 1    The following struct definition aligns all definitions of struct S1  on an 8 byte boundary        struct Sl   short f 3      __attribute__   aligned  8      struct Sl sl                 Example 2    The following struct definition aligns all definitions of struct S2  on a 4 byte boundary        struct S2 4 Short El315    __attribute__   aligned  1      struct S2 s2              NOTE  You must specify a minimum alignment of at least 4  bytes for structs  specifying a lower number for the alignment of a  struct causes alignment exceptions     Typedef Declaration Examples    This section shows typedef declarations that use__ att ribute__    aligned          Example 1  The following typedef declaration aligns all definitions of T1 on an  8 byte boundary   typedef int Tl __attribute__   aligned  8      T1 ti        PPC 204 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  _attribute__   aligned         Example 2    The following typedef declaration aligns all definitions of T2 on an  1 byte boundary     typedef int T2 __attribute__   aligned  1      T2 EZ    Struct Member Examples    This section shows struct member definitions that use  __attribute__   aligned          Example 1    The following struct member definition aligns all defin
3.        Control instruction execution       Run stop step reset         Examine and debug the contents of the data or instruction  cache of the processor   For more information  see    AMC  Data and Instruction Cache Windows    on page 152      e Powerful C C   symbolic debugger with integrated inter   face to all subsystems of the CodeTAP device    e Built in TCP IP Ethernet communications for remote debug   ging       PPC 250 Targeting Embedded PowerPC    Using a CodeTAP Debugging Device  CodeTAP Technical Support    CodeTAP Technical Support    Table 10 1    AMC provides first line technical support for all CodeTAP systems  equipped with CodeWarrior  Contact AMC for technical assistance  with both the CodeTAP device and the CodeWarrior IDE using the  resources shown in Table 10 1     CodeTAP device technical support contact information       Phone 800 ASK 4AMC  800 275 4262   Email support amc com  Web http   www amc com support html       When you contact AMC  provide the following information   e Your name and contact information  e Your company name    e The Applied System Identifier  ASI  number printed on a  label located on the underside of the CodeTAP device    e Your CodeWarrior version number  e A description of the problem or error messages    e The exact sequence of actions leading to the problem       Targeting Embedded PowerPC PPC 251    Using a CodeTAP Debugging Device  CodeTAP Requirements    CodeTAP Requirements    To use the CodeTAP device with CodeWarrior 
4.        The optional iname parameter is a quoted name that specifies the  name of the section where the compiler stores initialized objects   Variables that are initialized at the time they are defined  functions   and character strings are examples of initialized objects  The   name  parameter may be of the form     abs xxxxxxxx    where xxxxxxxx  is an 8 digit hexadecimal number specifying the address of the sec   tion     The optional uname parameter is a quoted name that specifies the  name of the section where the compiler stores uninitialized objects   This parameter is required for sections that have data objects  The  uname parameter may be a unique name or it may be the name of  any previous iname or uname section  If the uname section is also an  iname section then uninitialized data will be stored in the same sec   tion as initialized objects        PPC 184 Targeting Embedded PowerPC    Listing 6 2    C and C   for Embedded PowerPC  Pragmas    The special uname COMM specifies that uninitialized data will be  stored in the common section  The linker will put all common sec   tion data into the     bss    section  When the Use Common Section  option is on in the PowerPC EABI Processor panel  COMM is the de   fault uname for the       data    section  When the Use Common Sec   tion option is off       bss    is the default name of       data    section     The uname parameter may be changed  For example  you may want  most uninitialized data to go into the       bss   
5.      Depends on DRAM setup  See the refer   ence manual for the board     Depends on DRAM setup  See the refer   ence manual for the board     Depends on DRAM setup  See the refer   ence manual for the board     Depends on PCMCIA setup  See the refer   ence manual for the board           Targeting Embedded PowerPC PPC 323    Tested Jumper and Dipswitch Settings  Motorola MPC 8xx FADS    Motorola MPC 8xx FADS    Table E 10 lists the tested dipswitch and jumper settings for the Mo   torola MPC 8xx FADS target board  main board      Table E 10 Motorola MPC 8xx FADS dipswitch and jumper settings       Dipswitch and Jumper Locations Settings  Main Board        jl 1 2 CLOSED  3 OPEN  DS1 Set all 4 to ON   DS1 Set all 4 to OFF        Table E 11 lists the tested settings for the Motorola MPC 8xx FADS  daughtercard     Table E 11 Motorola MPC 8xx FADS jumper settings  daughtercard           Jumper Locations Settings  Daughtercard    J1 Determines a level at which  Power On Reset is generated   Any setting is allowed    J2 1 2 CLOSED  3 OPEN   3 3V setting    J3 Set to 1 2 CLOSED  3 OPEN   factory default            PPC 324 Targeting Embedded PowerPC    Tested Jumper and Dipswitch Settings  Embedded Planet RPX Lite 8xx    Embedded Planet RPX Lite 8xx    Table E 12 lists the tested dipswitch settings for the RPX Lite 8xx tar   get board     Table E 12 RPX Lite 8xx dipswitch settings          Dipswitch Locations Settings  1 Set to on   2 Set to on   3 Set to on   4 Set to on        Table
6.      If you do not want to use any options  simply enter zero  0      See Targeting VxWorks for details on the VxWorks options that can  be used with the CodeWarrior debugger     Parallel Port   Use the Parallel Port menu to select the parallel port to use to com   municate with the BDM emulator  The choices are LPT1  LPT2   LPT3  LPT4     Poll time  ms     The Poll time  ms  field controls the time in milliseconds between  emulator polls        Targeting Embedded PowerPC PPC 107    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Poll time  ms  is also a command in debug initialization files  The  debug initialization file commands overwrite values set in this  panel  For more information  see    polltime    on page 302        Priority    To assign a priority to the initial debug task in VxWorks  enter an  integer from 0 to 255 in the Priority edit field  A priority of 0 is the  highest you can assign  while a priority of 255 is the lowest     NOTE  The name of the initial debug task is specified in the  Entry Point edit field     Protocol    The Protocol pop up menu selects both the type of interface and the  type of debug agent  hardware debug interface or monitor  Specific  options are     e AMC CodeTAP    Selecting AMC CodeTAP configures the debugger to com   municate with the target processor using a CodeTAP device  connected to the BDM port of the target board     e MSI Wiggler    Selecting MSI Wiggler configures the debugger to communi   c
7.     C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    largest alignment found in the input files  The input files are the  read only sections   rodata  found in all files  The  data section  starts at the sum of the starting address of   rodata plus the size of   rodata  The resulting address is aligned on a 0x100 boundary  It  contains all sections of   data in all files  The  data through  bss  sections follows after the   data section  The  EMB PPC sdata0  starts at Oxffff8000 and the  EMB PPC sbss0 follows it     NOTE  extab and extabindex must be located in separate  sections     SHORTEN_NAMES_FOR_TOR_101    The directive SHORTEN_NAMES_FOR_TOR_101 instructs the linker  to shorten long template names for the benefit of the WindRiver    Sytems Target Server  To use this directive  simply add it to the  linker command file on a line by itself     SHORTEN_NAMES_FOR_TOR_101   WindRiver Systems Tornado Version 1 0 1  and earlier  does not  support long template names as generated for the MSL C   library   so the template names must be shortened if you want to use them  with these versions of the WindRiver Sytems Target Server   Miscellaneous features   e Memory Gaps   e Symbols  Memory Gaps       You can create gaps in memory by performing alignment calcula   tions such as     amp   0x20     This kind of calculation can occur between out put_specs  be   tween input_specs  orevenin address_modifiers         re   fers to the current address  You may assign th
8.     For a full discussion of this panel  see    EPPC Processor    on page 79     This section lists pragmas supported for PowerPC development and  explains additional pragmas for Embedded PowerPC development     Table 6 5 lists the pragmas supported for PowerPC development   Refer to the C Compilers Reference for documentation on how to de   termine and modify the state of the compiler using pragmas  and  pragma syntax        Targeting Embedded PowerPC PPC 177    C and C   for Embedded PowerPC                                                                               Pragmas  Table 6 5  Pragmas for PowerPC Development   align align_array_members  ANSL strict ARM_conform  auto_inline bool  check_header_flags cplusplus  cpp_extensions dont_inline  dont_reuse_strings enumsalwaysints  exceptions extended_errorcheck  fp_contract global_optimizer  ignore_oldstyle longlong  longlong_enums mark  once only_std_keywords  optimize_for_size peephole  pop precompile_target  push readonly_strings  require_prototypes RTTI  scheduling static_inlines  syspath_once trigraphs  unsigned_char unused  warning_errors warn_emptydecl  warn_extracomma warn_hidevirtual  warn_illpragma warn_implicitconv  warn_possunwant warn_unusedarg  warn_unusedvar wchar_type   PPC 178 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Pragmas    Table 6 6 lists additional pragmas available only for Embedded  PowerPC  ELF  DWARF  development     Table 6 6 Pragmas for Embedded PowerPC Development       fo
9.     Occasionally  Motorola or IBM issues a new PowerPC variant with a  new PVR value  After encountering such a PVR value  the Power   TAP device fails to complete connection and issues an error mes   sage containing the unknown PVR value     NOTE  The only time you must concern yourself with JTAG con   figuration files is when the PowerTAP device issues an error mes   sage indicating that it encountered an unknown PVR value     To correct the error  you must clone a new JTAG configuration file  from the existing ones and rename it        Targeting Embedded PowerPC  PPC 309    JTAG Configuration Files  Generating JTAG Configuration Files    To clone the file     1  Locate the current set of JTAG files in the following directory         CodeWarrior directory  Bin Plugins Support amctap Support pt60x    2  Use the list in Table C 1 to determine which existing JTAG config   uration file to use as the basis for your new file     Table C 1 Current JTAG configuration files                                                                   JTAG Configuration File Processors Supported   Name   60400  jtag 68603E  Stretch    70201  jtag 68603E PID7v  68603EV  Valiant   71201 jtag 68603E PID7t  68603R  Goldeneye   80201 jtag 68740 750  Arthur    80202 jtag 68740 750  Arthur   68740P  750P  Conan   Doyle   80300 jtag 68740 750  Arthur    80301 jtag 68740 750  Arthur    810101 jtag 8240  8260   910101 jtag 8240  8260   10070201 jtag 68603E PID7v  68603EV  Valiant   2007120 jtag 68603E PID
10.     Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Optimize Partial Link    Select the Optimize Partial Link checkbox to directly download the  output of your partial link  When this option is enabled  the linker is  instructed to do the following     e Allow the project to use a linker command file  This is impor   tant so that all of the diverse sections can be merged into ei   ther  text  data or  bss  If you do not let a linker com   mand file merge them for you  the chances are good that the  debugger will not be able to show you source code properly     e Allow optional deadstripping  This is recommended  The  project must have at least one entry point for the linker to  know to deadstrip     e Collect all of the static constructors and destructors in a simi   lar way to the tool munch     NOTE  Itis very important that you don t use munch yourself  since the linker needs to put the C   exception handling initializa   tion as the first constructor  If you see munch in your makefile  it is  your clue that you need an optimized build     e Change common symbols to  bss symbols  This allows you  to examine the variable in the debugger     e Allow a special type of partial link that has no unresolved  symbols  This is the same as the Diab linker s  r2 command  line argument     NOTE  This feature is not applicable to VxWorks    When this checkbox is cleared  the output file remains as if you  passed the  r argument on the command line    Deads
11.     The items in this panel are     e Source Format       e Generate Listing File       e Prefix File       PPC 76 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Source Format    The Source Format checkboxes define certain syntax options for the  assembly language source files  For more information on the assem   bly language syntax for the Embedded PowerPC assembler  read  the manual Assembler Reference     The following list describes the Source Format checkboxes   Labels Must End With       Select this checkbox to specify that labels must end with a  colon         Directives Begin With          Select this checkbox to specify that directives must begin  with a period         Case Sensitive Identifiers    Select this checkbox to specify that identifiers are case sensi   tive     Allow Space In Operand Field    Select this checkbox to specify that spaces are allowed in op   erand fields     GNU Compatible Syntax    Select this checkbox to indicate that your application uses  GNU compatible assembly syntax     Generate Listing File    A listing file contains file source along with line numbers  relocation  information  and macro expansions     The Generate Listing File checkbox determines whether a listing file  is generated by the assembler when the source files in the project are  assembled     Prefix File    The Prefix File edit field defines a prefix file that is automatically in   cluded in all assembly files i
12.     les 3   None    initregs    Enables a special feature on the PowerTAP device so that the Pow   erTAP remembers the instructions contained in the debug initializa   tion file  Consequently  the plug in does not parse and execute the  debug initialization file every time a hard reset is done on the Pow     erTAP device     Instead the PowerTAP device executes this list of instructions auto   matically when a hard reset occurs  If the debug initialization file is  modified  the plug in modifies the initregs data on the PowerTAP  device once  after which the PowerTAP device uses the new set of  instructions on the next hard reset  Hard resets usually occur when  the process is about to be loaded and launched or if    Hard reset and    Run    is selected in the launch options     initregs  lt ON  OFF gt     polltime    Controls the time in milliseconds between emulator polls     polltime  lt   gt        emulator twice a second  500ms        PPC 302 Targeting Embedded PowerPC    Description    Usage    Example    setMMRBaseAddr    Description    Usage    Example    sleep  10     Debug Initialization Files  Debug Initialization File Commands    NOTE  If you are using a CodeTap or PowerTap device  be  careful when setting polltime to a low value because you can cre   ate a lot of network traffic     setMMRBaseAddr    The debugger needs to know where the base address of the memory  mapped registers is on the Power QUICC II since this register is  memory mapped itself  This command
13.    64 Specifies 64 byte align   ment    128 Specifies 128 byte align   ment         pool  data  on off    Specifies whether to pool like data objects  the de   fault is on         profile on   off    Specifies whether to generate calls at function  entry and exit for use with a profiler         rostr   readonlystrings    Specifies to make string constants read only            schedule onloff    Specifies whether to schedule instructions  the de   fault is off        PPC 332 Targeting Embedded PowerPC    Command Line Tool Options  Embedded PowerPC Disassembler Options       Option    Description        use_lmw_stmw onloff    Specifies whether to use multiple word load  store  instructions for structure copies  the default is on         vector keyword          Specifies AltiVec vectorization options        Parameter Description       on Enables support for vector  types   codegen        off Disables vectorization         no  vrsave Specifies to use VRSAVE  prologue  epilogue code        Embedded PowerPC Disassembler Options    Table F 3 shows the embedded PowerPC disassembler options     Table F 3 Embedded PowerPC disassembler options       Option    Description        fmt    format keyword    Specifies formatting options  this option exists for  compatibility reasons        Parameter Description        no  x Specifies whether to show  extended mnemonics  the  default is to not show the  extended mnemonics         show keyword          Specifies display options        Parameter
14.    Although these files apply to several reference board configura   tions  you can modify the debug initialization file as needed  For ex   ample  if you are using a supported reference board and change  your hardware configuration  specifically your memory configura   tion   you may have to modify the debug initialization file  The file  contains a description of the file format     NOTE  The main purpose of debug initialization files is to down   load a program to the target board  Place other initializations in the  start up code        Targeting Embedded PowerPC PPC 105    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    E    For more information  see    Debug Initialization Files    on page 289     Interface Clock Frequency    The Interface Clock Frequency pop up menu sets the clock fre   quency for the BDM of the MPC8xx and the JTAG of the 60x     Interface Clock Frequency is also a command in debug initializa   tion files  The debug initialization file commands overwrite values  set in this panel  For more information  see    AMCTargetInterface     ClockFreq    on page 301   IP Address    This option allows you to specify the IP address of the board where  your code will be downloaded     Kill User Threads on Exit     Select this checkbox to kill any threads that are spawned by your  application when the debugger disconnects from the board     Log Connection Commands    Select the Log Connection Commands checkbox to enable the Log  Connect
15.    I Activate Browser         F Dump internal browse information after compile       PPC 132 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    4  On the EPPC Target settings panel  Figure 5 4   select Application  from the Project Type menu     Figure 5 4 EPPC Target settings panel with Application selected         EPPC Target    Project Type   Application x      File Name  Embedded_PPC_C  _Testl elf    5  On the EPPC Processor settings panel  Figure 5 5   select the pro   cessor for which you are developing from the Processor menu     Figure 5 5 EPPC Processor panel with processor selected for CodeTAP    EPPC Processor    Struct Alignment   PowerPC      Function Alignment  4 Eyte ka    Processor   821 bd          Targeting Embedded PowerPC PPC 133    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    6  Display the EPPC Target Settings panel  Figure 5 6  and select  several settings as described by the following steps     Figure 5 6 EPPC Target Settings panel with AMC CodeTAP selected     EPFC Target Settings    Target Processor   Bx x    Target 05   BareBoard T   Protocol  AMC CodeT ap    Hoztname get in    Connection Settings    or    Global Connection Settings    panels     W Use Initialization File    Initialization File      CodeTAP_Debug_Init ctt Browse         W Reset On Connect  Log Connection Commands    Force shell download on connect  Verity memory writes    I Serialize instruction execution  Breakpoin
16.    extern int myVar     toragma section  constants   __ qdeclspec  section  constants   const int myConst   0x12345678        Using  pragma section with  pragma push and  pragma pop    You can use this pragma with  pragma pushand  pragma pop  to ease complex or frequent changes to sections settings  See Listing  6 2 for an example     NOTE  The pop pragma does not restore any changes to the ac   cess permissions of sections that exist before or after the corre   sponding push pragma     Linker Issues for Embedded PowerPC    This section discusses the background information on the Embed   ded PowerPC linker and how it works  The topics in this section are     e Linker Generated Symbols       e Deadstripping Unused Code and Data  e Link Order    e Linker Command Files          Targeting Embedded PowerPC PPC 189    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Linker Generated Symbols    You can find a complete list of the linker generated symbols in ei   ther the C include file __ppc_eabi_linker hor the assembly in   clude file__ ppc_eabi_linker i  The CodeWarrior linker auto   matically generates symbols for the start address  the end address   the first byte after the last byte of the section   and the start address  for the section if it will be burned into ROM  With a few exceptions   all CodeWarrior linker generated symbols are immediate 32 bit val     ues   For more information  see    Exceptions    on page 190            If  in your source file  a
17.    incompatible _return_small_structs  toragma incompatible_return_small_structs    onloff reset    This pragma makes CodeWarrior built object files conformant to  GCC     The PowerPC EABI states that software floating point double pa   rameters always begin on an odd register  In other words  if you  have a function    void foo  long a  double b   a is passed in register R3  and b is passed in registers R5 and R6  ef     fectively skipping R4   GCC doesn t skip registers when doubles are  passed  although it does skip them for long longs      incompatible _sfpe_double params   pragma incompatible _sfpe_double_params    on off reset    This pragma makes CodeWarrior built object files conformant to  GCC     The CodeWarrior Linker checks to see if you are including objects in  your project that have incompatible EABI settings  If you do  a  warning is issued     interrupt     pragma interrupt  SRR DAR DSISR enable  on    off   reset                This pragma allows you to create interrupt handlers in C and C     For example        PPC 180 Targeting Embedded PowerPC    C and C   for Embedded PowerPC    Pragmas     pragma interrupt on  void MyHandler  void          my_real_handler             pragma interrupt off    Using the interrupt pragma saves all used volatile general purpose  registers  as well as the CTR  XER LR and condition fields  Then  these registers and condition fields are restored before the RTI  You  can optionally set certain special purpose registers  such as 
18.    stops on any read or write access of the watch   point address    NOTE  Watchpoints  also called access breakpoints  are avail   able only for PowerTAP 7xx or CodeTAP 8xx  You cannot set  watchpoints for PowerTAP6xx or PowerTAP 82xx        Targeting Embedded PowerPC PPC 113    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Remote Debugging Options  The Remote Debugging Options panel  shown in Figure 4 10  al     lows you to choose the type of code or data to download or verify  on initial or successive runs     Figure 4 10 Remote Debugging Options panel    Remote Debugging Options    Program Download Options    Initial Launch Successive Runs  Section Type   Download Very Download Verify    Executable  Constant Data  lnitialized Data   Unitialzed Data    Memon Configuration Options    Use Memory Configuration File       The panel contains two regions     e Program Download Options  e Memory Configuration Options    Program Download Options    There are four Section Types listed in the Program Download Op   tions section of this panel        PPC 114 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    e Executable   the executable code and text sections of the pro   gram     e Constant Data   the constant data sections of the program   e Initialized Data   the initialized data sections of the program     e Uninitialized Data   the uninitialized data sections of the  program that are usually
19.   484 286   B Debug Initialization Files 289  Using Debug Initialization Files         0a a aaa    289  Creating Stand alone Code                  290  Initializing Memory        a a 290  Enabling Debug Support        a a ak Soe aS 291  Creating a Debug Initialization File                291  Disabling the Software Watchdog Timer               293  Using Emulator Operational Settings              293  Proper Use of Debug Initialization Files             294  Debug Initialization File Commands              294  Debug Initialization File Command Syntax          296  CodeTAP Commands                08484 296  PowerTAP Commands               8484 297  Macraigor Wiggler Commands             2   298  Abatron BDI2000 Commands          2 2 2 2   299  AMCMemkReadDelayCycles      2    2    2 299  AMCMemWriteDelayCycles      2    2  2 2 300  AMCMemWriteVerify    ee a OES aS 300  AMCRegWriteVerify       aca He he Ede BS SS  ad 300  AMCTargetInterfaceClockFreq      2    1    ee ee 301  AMCTargetSerializeInstExec                   301       PPC 8 Targeting Embedded PowerPC    AMCTargetShowInstCycles           a a         301       o ie a ec    Bad  aoe  a dae  Bs a Da Hes 302  PONTE    s i i devs Be oat eS ate ete a ee he Y 302  setMMRBaseAddr          2    ee ee es 303  O a Sf She  ng ee da eG Soh Hg 303  Writedei o de Se ae estes Se ae Sd ae E te  oo Ea BP A A 304  writemem b   ura Ge ee  BO a 304  writemem l       rs iras Po oe Hee DS 304  writemem w     e   ww ee a kae e Gaat Geca ii e
20.   Board Initialization Code    on  page 214 for details           Targeting Embedded PowerPC PPC 213    Libraries and Runtime Code for Embedded PowerPC  Board Initialization Code    Board Initialization Code    Metrowerks CodeWarrior comes with several basic assembly lan   guage hardware initialization routines that you may want to use in  your program  When you are debugging  it is not necessary to in   clude this code  since the debugger or debug kernel already per   forms the same board initializations     If your code is running stand alone  without the debugger   you  may want to include the board initialization file  These files are lo   cated at the path below  and use the extension   asm            CodeWarrior directory   PowerPC_EABI_Support Runtime Srcec     These files are included in source form  so you are free to modify  them to work with other boards or hardware configurations     Each of these files includes a function called usr_init     This is  the function you will call to run the hardware initialization code  In  the normal case  this would be put into the ___init_hardware     function in either the ppc_eabi_init cor  ppc_eabi_init cpp file  In fact  the default  __init_hardware   function has a call into usr_init     butit  is commented out  Uncommenting this call will cause your program  to perform the included hardware initializations           PPC 214 Targeting Embedded PowerPC       metrowerks          8    Inline Assembler for  Embedded PowerPC    T
21.   CLORE    Loat     uble _ mffs  void    Loar _ fabsf  float    loat _ fnabsf  float         PowerPC  Instruction    mul    mul    fm    fm    fn    f  n    fm  fm  fn    hw       hwu    add    sub    madd    msub    adds  subs    madds       ita    mf  fa  fn    msubs    fs  bsf  absf       Targeting Embedded PowerPC PPC 239    Inline Assembler for Embedded PowerPC  Intrinsic Functions    Buffer Manipulation    Some intrinsics allow control over areas of memory  so you can  manipulate memory blocks     void  __alloca ulong      __alloca implements alloca    in the compiler     char  __strcpy char    const char        strcpy    detects copies of constant size and calls__ memcpy      This intrinsic requires that a__st rcpy function be implemented  because if the string is not a constant it will call___strcpy to do the    copy     void  __memcpy  void    const void    size_t      _ memcpy    provides access to the block move in the code  generator to do the block move inline     AltiVec Intrinsics Support    You can use all the available AltiVec intrinsics in your code  You  will find a list of these in the relevant Motorola documentation at  this URL on the world wide web     http    www mot  com SPS PowerPC teksupport  teklibrary manuals altivec pem pdf       A table of these intrinsics is shown here as Table 8 3 and Table 8 4  for reference     Table 8 3 AltiVec Generic and Specific Intrinsics       vec_abs vec_abss vec_add vec_addc  vec_adds vec_and vec_andc vec_avg  vec_ce
22.   CodeWarrior uses the XML file to create a  project with the same target settings for any ELF file that you open  to debug     This section contains the following topics     e Customizing the Default XML Project File  e Debugging an ELF File       e ELF File Debugging  Additional Considerations          PPC 162 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Debugging ELF Files    Customizing the Default XML Project File    When you debug an ELF file  CodeWarrior uses the following de   fault XML project file to create a CodeWarrior project for the ELF  file     CodeWarrior_dir plugins support   EPPC_Default_Project  XML          You must import the default XML project file  which creates a new  project  adjust the target settings of the new project  and export the  changed project back to the original default XML project file   CodeWarrior then uses the changed XML file to create projects for  any ELF files that you open to debug     NOTE  If you customize the default XML project file for a particu   lar target board or debugging setup and then decide to customize  it again for a different target board or debugging setup  CodeWar   rior overwrites the existing EPPC_Default_Project  XML file  If  you want to preserve the file that you originally customized for  later use  rename it or save it in another directory        To customize the default XML project file   Import the default XML project file     Select File  gt  Import Project  Navigate to the location o
23.   Software If this option is selected  floating point operations are  emulated in software  The calls generated by using floating point  emulation are defined in the C runtime library  If you are using  floating point emulation  you must include the appropriate C runt   ime file in your project  For information on the C runtime  see       Runtime Libraries for Embedded PowerPC    on page 212     WARNING  Enabling software emulation without including the  appropriate C runtime library will result in linker errors     Hardware If this option is selected  floating point operations are  performed in hardware  This option should not be selected if you  are targeting hardware without floating point support     AltiVec Programming Model    Select the AltiVec Programming Model checkbox to indicate that  your program uses the AltiVec programming model  which defines  several extensions to the PowerPC ABI  including    e Vector data types    e New keywords  vector   bool     vector  pixel _ pixel              e AltiVec alignment issues    For more information  see AltiVec Technology Programming Interface  Manual  available from Motorola  Inc   and    Where to Go from    Here    on page 15   Generate VRSAVE Instructions       After you select the AltiVec Programming Model checkbox   CodeWarrior enables the Generate VRSAVE Instructions check   box     The VRSAVE register indicates to the operating system which vec   tor registers to save and reload when a context switch happens  The     
24.   Targeting Embedded PowerPC PPC 83    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    bits of the VRSAVE register that correspond to the number of each  affected vector register are set to 1     NOTE  The Generate VRSAVE Instructions checkbox applies  only when developing for a real time operating system that sup   ports AltiVec     When a function call happens  the value of the VRSAVE register is  saved as a part of the stack frame called the vrsave word  In addi    tion  the function saves the values of any non volatile vector regis   ters in the stack frame as well  in an area called the vector register   save area  before changing the values in any of those registers     Selecting the Generate VRSAVE Instructions checkbox tells  CodeWarrior to generate instructions to save and restore these vec   tor register related values     For more information  see AltiVec Technology Programming Interface  Manual  available from Motorola  Inc   and    Where to Go from    Here    on page 15   Make Strings Read Only       The Make Strings Read Only option determines where to store  string constants  If this option is off  the compiler stores string con   stants in the data section of the ELF file  If this option is on  the com   piler stores string constants in the read only     rodata    section     The Make Strings Read Only option corresponds to  pragma  readonly_strings  The default setting for this option is off     Pool Data    The Pool Data option 
25.   Working with a Project    Figure 3 7 Editor window  h o M  El d Path   C  Program Files Metrowerks CodeW arrior   S ampleProjectiSourcesmain c 3     CLLEEL TEEPE LAPP ECF ELE  ELERA a      Project Stationery    E  PERRALLE CS IEEE CE LES     include  lt stdio h gt   asm void system_call    nofralloc  sd  blr     void main     printf   Welcome to Codelarriorisrwn        system_call       generate a system call exception to demonstrate the    while  1     44 loop forever       Line 10 af      After you open the file  you can use all the editor features to work  with your code     You also can use a third party editor to create and edit your code  as  long as it saves the file as plain text  If you use a third party editor   there may be times when the IDE is not aware of the fact that a  source file has changed since the most recent build     4  View target settings     A CodeWarrior project can contain one or more build targets  A  build target contains all build specific information  including     e Information required to identify the files that belong to a par   ticular build    e Compiler and linker settings for the build       Targeting Embedded PowerPC PPC 43    Creating a Project for Embedded PowerPC  Working with a Project    e Output information for the build    Each build target has associated target settings  To view and modify  target settings  ensure that your preferred build target is the cur   rently selected build target     The Project window  Figure 3 8  sh
26.   see    MetroTRK  memory map    on page 160         You can change the location of the data and code sections in your  MetroTRK project using one of the following methods     e By modifying settings in the EPPC Linker target settings  panel    e By modifying values in the linker command file  the file in  your project that has the extension   1cf        Targeting Embedded PowerPC PPC 159    Debugging for Embedded PowerPC  Using MetroTRK    NOTE  To use a linker command file  you must select the Use  Linker Command File checkbox on the EPPC Linker target set   tings panel     The stack    In the default implementation  the MetroTRK stack resides in high  memory and grows downward  The default implementation of Me   troTRK requires a maximum of 8KB of stack space     For example  on the Motorola 8xx ADS and Motorola 8xx MBX  boards  the MetroTRK stack resides between the address 0x3F6000  and 0x3F8000   For more information  see    MetroTRK memory  map    on page 160        You can change the location of the stack section by modifying set   tings on the EPPC Linker target settings panel and rebuilding the  MetroTRK project     MetroTRK memory map  Figure 5 23 shows a sample map of RAM memory sections as con     figured when running MetroTRK with a sample target application  on the Motorola 8xx MBX boards        PPC 160 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Using MetroTRK    Figure 5 23 MetroTRK memory map  Motorola 8xx MBX board     ROM Based MetroTRK M
27.   the serial libraries  used to implement console I O depend on the processor running at  a certain speed  The libraries included with CodeWarrior expect this  speed to be either 24 MHz  40 MHz  or 50 MHz  There are several  ways you can ensure that your board is running at a speed compati   ble with the serial I O library     e Run under MetroTRK     MetroTRK for the ADS board attempts to initialize the pro   cessor to run at 24 MHz  MetroTRK for the MBX board at   tempts to initialize it to 40 MHz or 50 MHz  whichever is ap   propriate for the board  For more information on MetroTRK   see    Using MetroTRK    on page 157     e Use an initialization file specific to your platform target     Depending on your target board  use an initialization file   ending in   asm  in the directory              CodeWarrior directory  PowerPC_EABI_ Support  Runtime Src     e If you are not using one of these boards  you must have a  custom initialization routine to set the processor to the right  speed     e Use a custom initialization routine     If you use a custom initialization routine  make sure the pro   cessor speed is set to either 24 MHz  40 MHz  or 50 MHz  de   pending on which board you are using     e Modify the serial library source code        Targeting Embedded PowerPC PPC 211    Libraries and Runtime Code for Embedded PowerPC  Runtime Libraries for Embedded PowerPC    Modify the baud rate divisors to match the operating speed  of your board  For information about building ne
28.   we create __f foo  _e foo  and  _f_foo_rom  In all cases  any         in the name is replaced with a     _     Addresses begin with a    _f     addresses after the last byte in  section begin with a    _e     and ROM addresses end ina    _rom      See the header file __ ppc_eabi_linker h for further details        All user defined sections follow the preceding pattern  However   you can override one or more of the symbols that the linker gener   ates by defining the symbol in the linker command file        PPC 202 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  __attribute__   aligned         NOTE  BSS sections do not have a ROM symbol     _ attribute _   aligned         You canuse__attribute__   aligned      in several situa   tions     e Variable declarations  e Struct  union  or class definitions  e Typedef declarations    e Struct  union  or class members    NOTE  Substitute any power of 2 up to 4096 for the question  mark         This section contains the following topics   e Variable Declaration Examples  e Struct Definition Examples  e Typedef Declaration Examples  e Struct Member Examples       Variable Declaration Examples    This section shows variable declarations that use__ attribute __    aligned          Example 1    The following variable declaration aligns V1 on a 16 byte boundary     int V1 4  __attribute__   aligned  16      Example 2    The following variable declaration aligns V2 on a 2 byte boundary     int V2 4  __attribute__   aligned  2
29.   writemmr SYPCR  writemmr RMR   writemmr MPTPR    Description    Usage    Example    writemmr  lt register number   register name gt   lt value gt     0x01632440  Oxffffffc3  0x0001  0x3200    writereg    Writes data to the specified register on the target  If the PC is modi   fied in the debug initialization file  the debugger plug in will give  you the option to use this address value as the entry point  The valid  register names that you can specify follow     e RO R31  e FPO FP31  e VRO VR31    e The names of all special purpose registers    NOTE  writereg PC  lt value gt  allows you to modify the entry point  of the program to a value other than the entry point of the     elf    file   A dialog prompts you for the entry point to use     writereg  lt registerName gt   lt value gt     writereg MSR 0x00001002    Description    writespr    Writes the value to the SPR with number regNumber  which is the  same as writereg SPRxxxx but allows you to enter the SPR number  in other bases  hex   octal   decimal         PPC 306 Targeting Embedded PowerPC    Debug Initialization Files    Debug Initialization File Commands    Usage    Example    writespr  lt regNumber gt   lt value gt   regNumber   a hex octal decimal SPR number  0 1023     value   a hex octal decimal value to write to SPR    writespr 638 0x02200000    Description    Usage    Example    writeupma 0x08    Description    Usage    writeupma    Maps the user programmable machine  UPM  registers to define  characteristics
30.  247    Troubleshooting for Embedded PowerPC  Targeting BOM Devices FAQ       PPC 248 Targeting Embedded PowerPC       metrowerks          10    Using a CodeTAP  Debugging Device    Using an AMC  Applied Microsystems Corporation  CodeTAP de   bugging device  you can control and debug software running on a  target board with minimal intrusion to the operation of the target  board  The CodeTAP device provides advanced emulation technol   ogy that combines with the CodeWarrior debugger so that you can  work efficiently in the same environment throughout the entire de   velopment cycle     This chapter provides information for using the CodeTAP device  with CodeWarrior for Embedded PowerPC     This chapter contains the following topics   e CodeTAP Highlights  e CodeTAP Technical Support  e CodeTAP Requirements  e Target Settings for CodeTAP  e Setting Up the CodeTAP Emulator  e Updating the CodeTAP Firmware  e Resetting the Processor                Targeting Embedded PowerPC  PPC 249    Using a CodeTAP Debugging Device  CodeTAP Highlights    CodeTAP Highlights    The CodeTAP device provides the following hardware assisted de   bugging features     e Optimal performance       Split second single step execution        Up to 2 MB per minute code download time from the Co   deTAP device to the target board    e Debug code in ROM and RAM  e Run to breakpoints in ROM or RAM  e Crash proof control of the processor       Obtain and modify register contents       Display and modify memory
31.  250  setting up 254  updating firmware 255  PowerTAP  connecting with 136  highlights of 258  interrupts 264 265  operational notes 264 265  setting up 262  updating firmware 263  resetting emulator  CodeTAP 255  PowerTAP 263  setting up emulator  CodeTAP 254  PowerTAP 262  technical support 251  259  using the PowerTAP 6xx 7xx 257 265  asm blocks not supported 217  asm keyword 216  assembler  stand alone described 27  See also inline assembler  __attribute__   aligned       overview 203  204  struct definition examples 204  struct member examples 205  variable declaration examples 203    back end compiler See compiler  baud rates  MetroTRK 158  selecting the baud rate using the Rate  menu 119  BDM Port 271  binary files 33  board initialization code 214  bool 171  bool size 169       Targeting Embedded PowerPC PPC 337    Index    breakpoint  setting 48   Build Extras panel See IDE User Guide   building code 46   Byte Ordering radio button  EPPC Target panel 71    C    C C   Language panel See C Compilers Reference  C C   Warnings panel See C Compilers Reference  cables  serial  using to connect with a target  board  127  calling conventions for PowerPC 174  Change IMMR menu option 150  char size 169  __cntlzw   238  Code Address edit field 97  Code Model menu  EPPC Target panel 72  CodeTAP  connecting to target system 254  connecting with 132  connection type 124  error messages 245  246  highlights of 250  host to emulator communications 254  resetting emulator 255  settin
32.  Description       only   none Examples      show none   show only  code  data       Targeting Embedded PowerPC PPC 333    Command Line Tool Options  Embedded PowerPC Disassembler Options       Option    Description       all    Specifies to show every   thing         no binary    Specifies whether to show  binary information  such as  addresses and opcodes  for  object code  the default is  to show the binary infor   mation         no code     no text    Specifies whether to show    text sections  the default  is to show the  text sec   tions         no data    Specifies whether to show  data  the default is to show  data         no detail    Specifies whether to show  detailed dump informa   tion         no extended    Specifies whether to show  extended mnemonics  the  default is to show ex   tended mnemonics         no exceptions      no xtab les     Specifies whether to show  exception tables  these op   tions also imply the follow   ing item      show data        no  headers    Specifies whether to show  object headers  the default  is to show the object head   ers        PPC 334    Targeting Embedded PowerPC    Command Line Tool Options  Embedded PowerPC Disassembler Options                      Option Description   no  debug   Specifies whether to show   no  dwarf DWARF information    no tables Specifies whether to show  string and symbol tables   the default is to show the  string and symbol tables    no  xtables Specifies whether to show  exception tables       no r
33.  E 13 lists the tested jumper settings for the RPX Lite 8xx target  board     Table E 13 RPX Lite 8xx jumper settings       Jumper Locations Settings       JP1 Set to off  no jumper connected    JP4 1  2   DEBUG connector valid  P6   BDM  port            Targeting Embedded PowerPC PPC 325    Tested Jumper and Dipswitch Settings  Motorola Maximer 7400    Motorola Maximer 7400    For the Motorola Maximer 7400 board  the tested settings are the  factory default jumper settings     Motorola Sandpoint 8240    Table E 14 lists the tested dipswitch and jumper settings for the Mo   torola Sandpoint MPC 8240 target board  main board      Table E 14 Motorola Sandpoint MPC 8240 jumper and dipswitch settings       Dipswitch and Jumper Locations Settings  Main Board     VIO Set for 5V   Each pin on J30  is connected to the corre   sponding pin on J32  all  pins on J31 are uncon   nected      J34 Closed   J33 Open     S3 Up   Points toward the  word Sandpoint at the top  of the board      S4 Up   Points toward the  word Sandpoint at the top  of the board         S5 Down   Points away from  the word Sandpoint at the  top of the board      S6 Down   Points away from  the word Sandpoint at the  top of the board            PPC 326 Targeting Embedded PowerPC    Tested Jumper and Dipswitch Settings  Motorola MPC 8260 VADS    Table E 15 lists the tested settings for the Motorola Sandpoint MPC  8240 daughtercard     Table E 15 Motorola Sandpoint MPC 8240 settings  daughtercard        Dipswitch and
34.  Embedded PowerPC  Target Settings Overview    panel  choose Edit  gt  Target Settings  where Target is the current  build target in the CodeWarrior project  Alternatively  go to the Tar   get view of the Project window and double click the relevant build  target     When you do  the Target Settings window appears  as shown in Fig   ure 4 1     Figure 4 1 Target Settings window  2 Embedded PPC C Settings 24x     Target Settings Panels    Target a  Target Settings Target Name   Access Paths      Build Extras Linker   Embedded PPC Linker y      File Mappings Pre inker   None x    EPPC Project 2  Language Settings Post inker   None x    C C   Language     Output Directory   C C   Warnings    Project   EPPC Assembler  E  Code Generation I Save project entries using relative paths  Global Optimizations  EPPC Processor  EPPC Disassembler  E  Linker  EPPC Linker  El  Editor  Custom Keywords      Factory Settings   Revert Panel      Select the panel you wish to see from the hierarchical list of panels  on the left side of the window  When you do  that panel appears   You can then modify the settings to suit your needs                                                             When you modify the settings on a panel  you can restore the previ   ous values by using the Revert Panel button at the bottom of the  window  To restore the settings to the factory defaults  use the Fac   tory Settings button at the bottom of the panel        PPC 64 Targeting Embedded PowerPC    Target Setting
35.  From the View Connection Settings menu  select View Se   rial Settings    b  Set the serial port options for the serial port that you are us   ing   For more information  see    Primary and Secondary Serial Port  Options    on page 119    c  Goto step 7           Targeting Embedded PowerPC PPC 145    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    6  If you selected TCP IP from the Connection menu  display the  Connection Settings panel  Figure 5 17  and select settings as de   scribed by the following steps     Figure 5 17 Connection Settings panel with View TC IP Settings selected       View Connection Type   view TCPIP Settings ka      Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Host Name    Use Global Connection Settings       a  From the View Connection Settings menu  select View TCP   IP Settings    b  In the Host Name field  type the host name that you as   signed to the Abatron BDI2000 when you configured the de   vice     7  Select any other needed target settings for your project     For more information  see    Settings Panels for Embedded Pow   erPC    on page 66  After selecting any other needed target settings     you can download and execute your code           PPC 146 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    Special Debugger Features for Embedded    PowerPC    This section discusses debugger features that are 
36.  Jumper Locations Settings  Daughtercard           J12 2 3  SW2  1 5  1  3  4  OFF  2 5  ON  SW3  1 5  3  4  OFF  1 2 5  ON  Motorola MPC 8260 VADS    Table E 16 lists the tested dipswitch and jumper settings for the Mo   torola MPC 8260 VADS target board     Table E 16 Motorola MPC 8260 VADS jumper and dipswitch settings       Dipswitch and Jumper Locations Settings       jl 1 2 CLOSED  3 OPEN   5V  setting    P10 Set all to OFF    DS1 Set 1 and 3 to OFF   Set 2 and 4 to ON    DS2 Set all 4 to ON    DS3 Set all 4 to ON           Targeting Embedded PowerPC PPC 327    Tested Jumper and Dipswitch Settings  Phytec miniMODUL PPC 505 509    Phytec miniMODUL PPC 505 509    Table E 17 lists the tested jumper settings for the Phytec miniMO   DUL PPC 505 509 target board     Table E 17 Phytec miniMODUL PPC 505 509 jumper settings          Jumper Locations Settings   JP1 Use the factory default setting   JP2 Use the factory default setting   JP3 Use the factory default setting   JP4 Set all to OFF           PPC 328 Targeting Embedded PowerPC    F    metrowerks Command Line Tool  Options       This appendix describes the command line tool options that are  available for CodeWarrior for Embedded PowerPC   This appendix contains the following topics    e Embedded PowerPC Project Options   e Embedded PowerPC Options   e Embedded PowerPC Disassembler Options             Embedded PowerPC Project Options    Table F 1 shows the embedded PowerPC project command line op   tions     Table F 1 Emb
37.  Pow   erPC board  This window displays the error messages for the board       PPC 268 Targeting Embedded PowerPC    Flash Programmer  What You See    and information regarding the progress and status of BDM connec   tions     Figure A 2 Status and Errors window    Status and Errors     gt  Connecting to target    2     gt  Writing and reading a GPRO to test BDH  functionality prior to initialization       Add resource to STR  ID 203d at index 2000d   Oz07DO1 gt  Resetting Target         Embedded PowerPC Plugin Error   Cannot open BOM config file     gt  Programming Flash          Help    The Help window  shown in Figure A 3  is essentially a context sen   sitive help window  providing information and suggestions on how       Targeting Embedded PowerPC PPC 269    Flash Programmer  What You See    to solve any communication or download problems you might  have     Figure A 3 Help window    Help    Help   a 3000 Ep   Welcome to the Embedded  E    PowerPl Utility Program     This is a utility program  which will allow you to do  many low level things with  your Embedded PowerPC  processor  This program can  debug your initialization  files  view  modify memory  on the target  program the  flash  and much more   Commands are sent to the  target by using the  yntax  described in the Help  window        General instructions on how to use PPCComUtil are displayed at  the top of the window  Click the left and right arrows to browse the  instructions     Preferences    Choose Preferen
38.  PowerPC EABI Stationery                Add to Project   Project       E             ma Cancel            PPC 34 Targeting Embedded PowerPC    Figure 3 2    5     Creating a Project for Embedded PowerPC  Project Stationery    On the Project tab  highlight PowerPC EABI Stationery   Type a name in the Project name field     The name you type appears in the Location field as the default di   rectory location for your project     To change the directory location for your project  type a different  location in the Location field     Alternatively  you can click Set  specify a new directory location in  the Create New Project window  and click Save  which returns you  to the New window   Figure 3 2 shows an example of the Create  New Project window in which the drive location has been changed  from the C  drive to the E  drive   The New window reflects your  newly chosen directory location     Create New Project window    Create New Project       Save in  E  E               File name   newtestl  Save as type   Project Files    mep  y  Cancel      WV Create Folder       On the Project tab of the New window  highlight PowerPC EABI  Stationery again        Targeting Embedded PowerPC PPC 35    Creating a Project for Embedded PowerPC  Project Stationery    6  Click OK   The New Project window appears  Figure 3 3      Figure 3 3 New Project window    3 New Project             Select project stationery        ERE El   HE  BOx_Evwb   E  50x_Phytec  ic             m  555 Etas  H  603 Excime
39.  Registers             etc   Save the file as plain ASCII text with a descriptive name   Open your project in CodeWarrior     Bring up the Target Settings window and select the EPPC Target  Settings panel     7  Enter the path and file name of the debug initialization file in the  Initialization File field of this panel  and click Save        PPC 292 Targeting Embedded PowerPC    AMCTargetl       Debug Initialization Files  Using Debug Initialization Files    Disabling the Software Watchdog Timer    When debugging  you must disable the Software Watchdog Timer   SWT   Otherwise  the SWT times out and the target resets anytime  the target is halted for more than four seconds  Clear the software  watchdog enable bit  SWE  in the system protection control register   SYPCR  to disable the timer     NOTE  You can disable the SWT only for the MPC8xx     Using Emulator Operational Settings    The CodeTAP and PowerTAP devices both provide variables for  configuration of key operations such as     e enabling read after write memory  e enabling register verify  e enabling the interface clock frequency  Each variable is implemented as a command with arguments  For    example  to specify that the speed of the JTAG or BDM interface  clock is 10 MHz  enter the following as a line in the file     InterfaceClockFreq 10000000       For more information  see    Debug Initialization File Commands     on page 294        Targeting Embedded PowerPC PPC 293    Debug Initialization Files  Proper Use 
40.  Settings    or    Global Connection Settings    panels     W Use Initialization File    Initialization File  9  PowerlAP_Debug_Irit ctt Browse          4 Reset On Connect    Il Force shell download on connect  Verify memory writes    l Breakpoint Type   Auto      celos he  Watchpaint Type   Data ka    Mem Read Delay Interface Clock Frequency  fi OMH2 F      Mem    write Delay       a  From the Target Processor menu  select the processor for  which you are developing     b  From the Protocol menu  select AMC PowerTAP     c  If you are using a debug initialization file  select the Use Ini   tialization file checkbox and type the name of the file in the  Initialization File field     d  Select the Reset on Connect checkbox or  if you prefer to  not always reset the target board when you launch the de   bugger  reset the target board        PPC 138 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    e  From the Breakpoint Type menu  select Auto     For more information  see    Breakpoint Type    on page 103    f  From the Watchpoint Type menu  select the type of watch   points to use  Data  Read  Write  or Read Write    For more information  see    Watchpoint Type    on page 113    g  From the Interface Clock Frequency  select the clock fre   quency for the BDM     For more information  see    Interface Clock Frequency    on page  106     7  Display the Connection Settings panel  Figure 5 12  and select set   tings as described by the
41.  System Laboratories  1994  ISBN 0 13 100439 5      e System V Application Binary Interface  PowerPC Processor Sup   plement  published by Sun Microsystems and IBM  1995  and  available on the World Wide Web at the following address     http    www mot  com SPS ADC pps download 8XX   SVR4abippc pdf       NOTE  The pages of the preceding PDF file are in reverse order     e PowerPC Embedded Binary Interface  32 Bit Implementation    published by Motorola  Inc   and available on the World  Wide Web at the following address     http    www mot  com SPS ADC pps download 8XX   ppceabi paf       The PowerPC EABI specifies data structure alignment  calling con   ventions  and other information about how high level languages  can be implemented on a Embedded PowerPC processor  Code gen   erated by CodeWarrior for Embedded PowerPC conforms to the  PowerPC EABI     The PowerPC EABI also specifies the object and symbol file format   It specifies ELF  Executable and Linker Format  as the output file  format and DWARF  Debug With Arbitrary Record Formats  as the  symbol file format  For more information about those file formats   you should read the following documents     e Executable and Linker Format  Version 1 1  published by UNIX  System Laboratories     e DWARE Debugging Information Format  Revision  Version 1 1 0   published by UNIX International  Programming Languages  SIG  October 6  1992  and available on the World Wide Web  at the following address     http    ww esofta com pdfs
42.  The topics in this section are     e Embedded PowerPC Integer Formats       e Embedded PowerPC Floating Point Formats       e AltiVec Vector Data Formats       PPC 168 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Integer Formats    Embedded PowerPC Integer Formats    Table 6 2 shows the size and range of the integer types for the Em   bedded PowerPC compiler              Table 6 2 PowerPC Integer Types  For this type Option setting Sizeis and its range is  bool n a 8 bits true or false  char Use Unsigned Chars 8 bits  128 to 127    is off  see language  preferences panel in  the    C Compilers                                        Guide       Use Unsigned Chars 8 bits O0 to 255  is on  signed char n a 8 bits  128 to 127  unsigned char n a 8 bits 0 to 255  short n a 16 bits  32 768 to 32 767  unsigned n a 16 bits 0 to 65 535  short  int n a 32 bits  2 147 483 648 to  2 147 483 647  unsigned int n a 32 bits 0 to 4 294 967 295  long n a 32 bits  2 147 483 648 to  2 147 483 647  unsigned long n a 32 bits 0 to 4 294 967 295  long long n a 64 bits  9 223 372 036 854 775 808  to 9 223 372 036 854 775 807  unsigned long n a 64 bits Oto    long    18 446 744 073 709 551 615          Targeting Embedded PowerPC PPC 169    C and C   for Embedded PowerPC    Integer Formats    Embedded PowerPC Floating Point Formats    Table 6 3 shows the sizes and ranges of the floating point types for  the embedded PowerPC compiler                             Table 6 3 PowerPC floating
43.  a constant section  into a data section  the default is 8                  model keyword Specifies the code model   Parameter Description  absolute Specifies absolute code and  data addressing  this is the  default option   other Specifies a different code    model than absolute  this  option is equivalent to the  following option      gprel       Embedded PowerPC Options    Table F 2 shows the embedded PowerPC command line options     Table F 2 Embedded PowerPC command line options                      Option Description   align keyword       Specifies structure and array alignment options   Parameter Description  power  pc  Specifies PowerPC align   ment  this option is the de   fault   mac68k Specifies Macintosh 680x0  alignment   mac68k4byte Specifies Mac 680x0 4 byte  alignment        Targeting Embedded PowerPC PPC 331    Command Line Tool Options    Embedded PowerPC Options       Option    Description       Specifies to align members  of arrays     array  members         common on off    Specifies whether to move all uninitialized data  into a common section  the default is off         fp_contract    maf  on off    Specifies whether to generate fused multiply add  instructions  the default is off         func_align keyword    Specifies function alignment                          Parameter Description   4 Specifies four byte align   ment  this is the default    8 Specifies eight byte align   ment    16 Specifies 16 byte align   ment    32 Specifies 32 byte align   ment 
44.  be cleared after reset to prevent a  timeout every four seconds     See the sample files for what to consider     Creating a Debug Initialization File    The following procedure uses MPC8xx as an example because Co   deTAP 8xx requires a debug initialization file that contains register  information for proper operation following reset     NOTE  For more information  see    Debug Initialization File Com   mands    on page 294        To create a debug initialization file that contains a registers section     1  Use your data book to determine what your chip select and pin   assignment registers should be following initialization     2  Edit a copy of the appropriate    init txt    file as plain  ASCII  text  with any text editor or word processor        Targeting Embedded PowerPC PPC 291    Debug Initialization Files  Using Debug Initialization Files    3  Define each register on a separate line to apply the correct values  for your target     Choose the registers and values appropriate for your system  To  add comments  begin a line with the pound sign            CodeTAP MPC8xx Initialization File               Customize for a specific target        Turn off the MPC8xx internal        software watchdog timer       writemmr 0x0004 OxFFFFFF80   SYPCR         Set the Recoverable Interrupt            so that maskable breaks work       writereg msr 0x42         Set up DRAM       writeupma 0x01 Oxffffcc24  writeupma 0x02 Oxffffcc24       writeupma 0x3f Oxffffffff    Set Chip Select
45.  boards     e Cogent CMA102 with CMA 278 Daughtercard  e Motorola Maximer 7400    For more information  see    Flash Programmer    on page 267   Check whether the debug monitor is in flash memory or ROM        To check whether the debug monitor is in flash memory or ROM   a  Connect the serial cable to the target board     b  Use a terminal emulation program to verify that the serial  connection is working     Set the baud rate in the terminal emulation program to the cor   rect baud rate and set the serial port to 8 data bits  one stop bit   and no parity   For more information on MetroTRK baud rates     see Table 4 4 on page 120    c  Reset the target board     For MetroTRK  when you reset the target board  the terminal  emulation program displays a message that provides the version  of the program and several strings that describe MetroTRK     For SDS Monitor  when you reset the target board  the terminal  emulation program repeatedly displays the following charac   ters     Qs    If the terminal emulation program does not display the previ   ously described message or characters or you have trouble com   municating with the debugger  see    No Communications with    Target Board    on page 243           Targeting Embedded PowerPC PPC 129    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    3  If you plan to use console I O  ensure that your project contains  appropriate libraries for console I O     Ensure that your project includes the MSL library and th
46.  debugging device  you  need an Ethernet cable     NOTE  If you are using a CodeTAP or PowerTAP device  see       Using a CodeTAP Debugging Device    on page 249 or    Using the  PowerTAP 6xx 7xx Debugging Device    on page 257        Some of the support code included with CodeWarrior is specific to  the kind of board being targeted  These portions of code are imple   mented for certain reference hardware configurations  If you are not  using a supported reference configuration  this code may not work  correctly on your platform target  For this reason  this product in   cludes all such code in source form so that you can customize the  code to work with your hardware     WARNING  Ifyou are not using a supported reference configu   ration  the support code included with CodeWarrior may not work  correctly on your platform target     The following support code makes board specific assumptions   e MetroTRK    For more information  see    Using MetroTRK    on page 157        e Debug initialization files  For more information  see    Debug Initialization Files    on  page 289     e Console I O under standard C and C   libraries       Targeting Embedded PowerPC PPC 23    Getting Started    Installing CodeWarrior for Embedded PowerPC    For more information  see    Using Console I O for Embed   ded PowerPC    on page 209     e Stand alone application startup code    For more information  see    Board Initialization Code    on    page 214        Contact a hardware vendor for more in
47.  dwarf v1 1 0 pdf       PPC 16 Targeting Embedded PowerPC    Introduction  Where to Go from Here    e DWARF Debugging Information Format  Revision  Version 2 0 0   Industry Review Draft  published by UNIX International   Programming Languages SIG  July 27  1993     For information on Applied Microsytems Corporation   s  CodeTAP and PowerTAP     e Emulator Installation Guide  CodeTAP for the Motorola  MPC8XX  published by AMC  Applied Microsystems Corpo   ration      e Emulator Installation Guide  PowerTAP for PowerPC Processors   published by AMC     For information on AltiVec        To learn more about AltiVec  see     e AltiVec Technology Programming Interface Manual  published  by Motorola  Inc   and available on the World Wide Web at  the following address     http    www mot  com SPS PowerPC teksupport   teklibrary manuals altivecpim pdf       e AltiVec Technology Programming Environments Manual  pub   lished by Motorola  Inc   and available on the World Wide  Web at the following address     http    www mot  com SPS PowerPC teksupport   teklibrary manuals altivec_pem pdf    e PowerPC Advance Information MPC7400 RISC Microproces   sor Technical Summary  published by Motorola  Inc   and  available on the World Wide Web at the following address     http    www mot  com SPS PowerPC teksupport   teklibrary techsum 7400ts pdf       Targeting Embedded PowerPC PPC 17    Introduction  Technical Support    Technical Support    If you are having problems installing or using a Metr
48.  e Specify a Flash Image  e Send the Flash Image          Targeting Embedded PowerPC PPC 273    Flash Programmer  Using the Flash Programmer    Initialize the Programmer    Choose Run Reset from the BDM menu to initialize the flash  PPC   ComUtil will execute the BDM initialization file that is specified in  the Reset Command File preferences  A BDM initialization file is a  batch file of commands to be sent and run on the board once the  files are specified in preference panel  Metrowerks has provided  these files in the directory            CodeWarrior directory lPowerPC_EABI_SupportAConfiglX    To specify a BDM initialization file for downloading  choose Prefer   ences from the Edit menu  and click the Change button under the  heading Reset Command File  When the Open dialog box appears   find the initialization file from your hard drive  and click OK     Specify a Flash Image    To specify a flash image for downloading  choose Preferences from  the Edit menu  and click the Change button under the heading   Flash Programming Command File  When the Open dialog box ap   pears  find the flash image file from your hard drive  and click OK     See    Flash Program Command File    on page 272 for a list of the  sample flash command files  If you are not using one of the Motor   ola development boards  you must write a custom flash command  file        Send the Flash Image    To send the flash image  choose Program Flash from the BDM  menu  When the Open dialog box appears  speci
49.  en   dian nature of the build target     To modify a version of MetroTRK  find an existing MetroTRK  project for your supported target board  You either can make a copy  of the project  and its associated source files  or you can directly edit       Targeting Embedded PowerPC PPC 157    Debugging for Embedded PowerPC  Using MetroTRK    the originals  If you edit the originals  you always can revert back to  the original version on your CodeWarrior CD     MetroTRK Baud Rates    Table 4 4 on page 120 lists the default MetroTRK baud rates for the  boards currently supported by CodeWarrior for Embedded Pow   erPC     For information on modifying the default baud rate  data transmis   sion rate  for MetroTRK  see MetroTRK Reference     MetroTRK Memory Configuration    This section discusses the default memory locations of the Me   troTRK code and data sections and of your target application   This section contains the following topics    e Locations of MetroTRK RAM sections   e MetroTRK memory map          Locations of MetroTRK RAM sections    Several MetroTRK RAM sections exist  You can reconfigure some of  the MetroTRK RAM sections     This section contains the following topics     e Exception vectors  e Data and code sections    e The stack    Exception vectors       For a ROM based MetroTRK  the MetroTRK initialization process  copies the exception vectors from ROM to RAM     NOTE  For the MPC 555 ETAS board  the exception vectors re   main in ROM        PPC 158 Targeting Emb
50.  following steps     Figure 5 12 Connection Settings panel with View TC IP Settings selected       View Connection Type   view TCEPIP Settings        Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Host Name    l Use Global Connection Settings       a  From the View Connection Settings menu  select View TCP   IP settings     b  In the Host Name field  type the host name that you as   signed to the PowerTAP device during emulator setup     For more information  see Emulator Installation Guide  which is  available from AMC  This document describes how to establish  Ethernet communications  assign host names and IP addresses   and update the network databases        Targeting Embedded PowerPC PPC 139    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    8  Select any other needed target settings for your project     For more information  see    Settings Panels for Embedded Pow   erPC    on page 66  After selecting any other needed target settings     you can download and execute your code        Connecting with Wiggler  Hummingbird  or  Raven BDM    To connect your host machine and target board     1  Connect the BDM interface box  Wiggler  Hummingbird  or  Raven BDM  to the parallel port on your host machine     Ensure that the parallel cable is a true parallel cable with all the pins  running straight through     2  Plug in the BDM interface box so that it has power   3  Plug the BDM cable into the BDM p
51.  generates with any standard flash pro   grammer to burn your program into ROM  or you can use  the third target  Flash to ROM version  to burn your program  into ROM     Burn ROM    This target burns your program image to ROM  This target  includes a small amount of code that programs the flash  The  linker creates a RAM buffer that includes the image to flash  followed by the flash code  Download this ELF file with the  debugger and run     If CodeWarrior successfully flashed the image  the program  stops on the label copy_successful  If flashing the image  was not successful  the program stops on the label  copy_failed     NOTE  Using the Flash to ROM target to flash your programs to  ROM is substantially faster than using the flash programmer        Targeting Embedded PowerPC PPC 37    Creating a Project for Embedded PowerPC  Working with a Project    Working with a Project    This section provides step by step instructions for developing typi   cal Embedded PowerPC projects     NOTE  For more information on creating  debugging  and work   ing with projects  see IDE User Guide  This manual discusses al   ternate ways of performing various operations  describes the  Codewarrior user interface  and discusses many other topics such  as touching files  file synchronization  and details of the build pro   cess     CodeWarrior displays build errors and warnings in the Errors  amp   Warnings window  For information on specific error messages   see Error Reference  which is avail
52.  initialized by the runtime code in   cluded with CodeWarrior     NOTE  You do not need to download uninitialized data if you are  using Metrowerks runtime code     There are four checkboxes to the right of each of these section types   e Initial Launch  Download  e Initial Launch  Verify  e Successive Runs  Download    e Successive Runs  Verify    By selecting the appropriate combination of checkboxes  you choose  whether to download and or verify sections on initial and or suc   cessive runs  This panel allows you to verify that any or all sections  of program are making it to the target processor successfully  or that  they have not been modified by runaway code or the program stack   For example  once you download a text section you might never  need to download it again  but you may want to verify that it still  exists     Memory Configuration Options    In the Memory Configuration Options section  there is a checkbox  labeled Use Memory Configuration File  The Use Memory Config   uration File option defines the legally accessible areas of memory  for your specific board  Select this checkbox if you want to use a    memory configuration file  and click Browse to find and select the  file        Targeting Embedded PowerPC PPC 115    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    If you are using a memory configuration file and you try to read  from an illegal address  the debugger fills the memory buffer with a  reserved character  defined i
53.  into the output_spec        Targeting Embedded PowerPC PPC 199    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC     text  TEXT        A    x   with a section name means that the specified section in all  files will go into the output_spec     In all cases  the input_spec is subject to input_type  For exam   ple      EOC       means that only sections of type TEXT in file foo c will be added     In all cases  if there is more that one input_spec that fits an input  file  the more specific input_spec gets the file     If an archive name is used instead of source file name  all referenced  members of that archive are searched  You can further specify a  member with foo a  foobar   c   The linker doesn t support grep   If listing just the source file name is ambiguous  enter the full path     Listing 6 8 Example 3  SECTIONS      init        text BIND 0x00010000                    rodata         extab       extabindex           data BIND A           sdata        Sbss   1    sdata2        sbss2         Ss 2 4                    DDR  rodata    SIZEOF  rodata   ALIGN 0x100              PPC EMB sdata0 BIND Oxfff  f8000         PPC EMB sbss0                  Example 3 shows how you might specify a SECTIONS directive  without a MEMORY directive  The  text section starts at  0x00010000 and contains all sections named   text in all input  files    rodata starts just after the  text section  Itis aligned on the       PPC 200 Targeting Embedded PowerPC    La      0x20 
54.  line to the target proces   sor  To choose Hard Reset  select Debug  gt  Hard Reset     After a Hard Reset  the debug initialization file is processed  again  If the debug initialization file contains register initial   ization commands  the processor registers and controllers  can be set up for your target system     Under certain conditions  you may find these reset commands use   ful  but you must understand how to progress from the reset state to  the point where you can resume application execution  For more in     formation on reset operations  see the user manual for your target  processor        Targeting Embedded PowerPC PPC 263    Using the PowerTAP 6xx 7xx Debugging Device  Operational Notes    Operational Notes    This section contains notes on operational characteristics and re   quirements when using PowerTAP with CodeWarrior to debug  your target system     Recoverable Interrupts    The MPC8xx  MPC60x  and MPC7xx families have a bit in the ma   chine state register  MSR  called the recoverable interrupt bit   MSRRI   The MSRRI indicates whether the interrupt is restartable   If this bit is not set  the target CPU may not respond to breakpoints   To the processor  a normal  maskable break looks just like any other  interrupt exception     For example  to set a breakpoint at the beginning of an interrupt ser   vice routine  you must ensure that the recoverable interrupts are en   abled and that the machine status save restore registers  SSRO   SSR1  are correctl
55.  max number of times the loop is toe executed  If the third argument  is not entered  the loop will execute infinitely            do   untilEqual IREGx memAddr  maxNumTimes            do   untilEqual IREGx IREGy  maxNumTimes                 Print Commands  IREG    Displays the contents of the internal registers of PPCComUtil     Internal registers can be used as storage for values that can be read  from the target  There are 32 registers  IREGO IREG31   These reg   isters can be used with the commands and  or  xor  not  abortEqual   and untilEqual  They are intended to provide programming type                      Targeting Embedded PowerPC PPC 285    Flash Programmer  Command File Syntax    Usage    Examples    IREG  IREG 22       Description    Usage    Example    sleep 5000    TREG 1 9    control for programming the flash by enabling you to write small  flash programming programs  The first argument  start Reg  is  optional and indicates the register from which to start displaying   The second argument  st opReg  is optional and indicates what the  last register to display is  The command is used for interactive and  config file debugging purposes     IREG  lt regNumber gt   IREG  lt startReg gt   lt stopReg gt     load IREGx  lt immdValue gt           Displays IREGO to IREG31     Displays IREG22 only     Displays IREGO1 and IREG9                         Miscellaneous Commands  Sleep    This BDM command will cause PPCComUtil to suspend the execu   tion of the current threa
56.  menu option 151  watchpoint types  data 151  read 151  read write 151  write 151  watchpoints  setting 49  what s in this manual 12  where to learn more 15  Wiggler  debugging device  104  connecting with 140  connection type 124  Windows system requirements 21  wordwarrior metrowerks com 18  working with a project 38 61  writedcr 304  writemem b 304  writemem l 304  writemem w 305  writemmr 305  writereg 306  writespr 306  writeupma 307  writeupmb 307       PPC 346 Targeting Embedded PowerPC    CodeWarrior    Targeting Embedded PowerPC    Credits    writing lead     other writers     engineering     frontline warriors     John Roseborough    Caresse Bennett  Stephanie Tucker  Jim  Trudeau    Mark Anderson  Greg Clayton  Steve  Moore  Khurram Qureshi  Eric Roe  Day   mon Rogers  Robert St  John  Ferry Sutan   to  Joel Sumner  ChingLing Wang   Charles Watson  Lawrence You  Warren  Paul    Mark Anderson  Ferry Sutanto  L Frank  Turovich  Todd McDaniel  Steve Moore   Nick Havens  Gary Hogan  Joc O Connor   Warren Paul  Vasili Prikhodko  Roy Zuni   ga  Eddie Trevino  ChingLing Wang  and  many more          MISS     Guide to CodeWarrior Documentation    CodeWarrior documentation is modular  like the underlying tools  There are manuals  for the core tools  languages  libraries  and targets  The exact documentation provided  with any CodeWarrior product is tailored to the tools included with the product  Your  product will not have every manual listed here  However  you will probab
57.  more information     To have the desired effect  this option must be enabled during the  definition of the data  as well as during the declaration of the data   Common section data is converted to use the  bss section at link   time  The linker supports common section data in libraries even if  the switch is disabled at the project level     WARNING  You must initialize all common variables in each  source file that uses those variables  otherwise you will get unex   pected results     TIP  We recommend that you develop with this setting off  When  you have your program debugged  look at the data for especially  large variables that are used in only one file  Change those vari   able names so that they are the same  and make sure that you ini   tialize them before you use them  You can then turn the switch on        Targeting Embedded PowerPC PPC 85    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Use LMW 8 STMW    LMW  Load Multiple Word  and STMW  Store Multiple Word  are  PowerPC instructions that load and store a group of registers to  memory all in a single instruction  If the Use LMW  amp  STMW option  is selected  the compiler sometimes uses these instructions to store  and restore volatile registers in the prologue and epilogue of a func   tion     Code that uses the LMW and STMW instructions is usually faster  and always smaller than code that does not     NOTE  When building little endian code  the compiler never  uses LMW and STMW i
58.  must be in all debug initial   ization files for the Power QUICC II processors  This command in   forms the debugger plug in of the base address  which allows you  to send any writemmr commands from the debug initialization file   as well as read the memory mapped registers for the register views     NOTE  The setMMRBaseAddr command works only with target  boards that use the 8260 processor     setMMRBaseAddr  lt value gt     value   the base address for the memory mapped registers    0x0f  00000    sleep    Causes the processor to wait the specified number of milliseconds  before continuing to the next command     sleep  lt value gt       sleep for 10 milliseconds       Targeting Embedded PowerPC PPC 303    Debug Initialization Files  Debug Initialization File Commands    Description    Usage    Example    writedcr    Allows writing to the 403 DCR registers using the applicable DCRN  number     NOTE  The writedcr command applies only to target boards with  the 403 processor     writedcr  lt dcr_register_number gt   lt value gt     writedcr 128 OxFF180242  BRO    writemem b  Description Writes data to a memory location using a byte as the size of the  write   Usage  writemem b  lt address gt   lt value gt   address   the hex  octal  or decimal address in memory to modify  value   the hex  octal  or decimal value to write at the address  Example  writemem b Ox0001FFO0O OxFF   Write 1 byte to memory  writemem    Description Writes data to a memory location using a long as the 
59.  oa a 305  WAtemMDI se aa e bade Me Rk a a Be ee ee a 305  A A 306  WINESD a ais Be weeks cho are A Se Ate e A He kd Se A 306  WHCUDING s e DAL Ate oe me Sik ee ac Ge me ARA 307  writeupmb     20 le de to de Oe Be Pea D 3 307   C JTAG Configuration Files 309  Generating JTAG Configuration Files          2    0    309  D Memory Configuration Files 313  Command Syntax   PRA a 313  Memory Configuration File Commands            314  reservedchar   La la a eee A ae eee A A 314  A a a ds as Os da  amp  A 314  reserved  2 mba A a AR ee 315   E Tested Jumper and Dipswitch Settings 317  Cogent CMA102 with CMA 278 Daughtercard           318  IBM 403  EV Be 3 8 a Set a Ae ee    are aes ge ee A 319  Motorola MPC 505 509 EVB           2 2 4 4 2 4 319  Motorola 555X ETAS   acana rs Bonet E a o a aa 320  Motorola Excimer 603e                 es 321  Motorola Yellowknife X4 603 750     a a a a a aaa    321  Motorola MPC 8xx ADS   aaa a a 322  Motorola MPC 8xx MBX   aaa aa a 323  Motorola MPC 8xx FADS  aaa a 324  Embedded Planet RPX Lite 8xx            2 2   325       Targeting Embedded PowerPC PPC 9    Motorola Maximer 7400        2 2 2 2 2 2  0 0 2 0484 326    Motorola Sandpoint 8240     a   2    2             326   Motorola MPC 8260 VADS      2    a a ee          327   Phytec miniMODUL PPC 505 509    2    328   F Command Line Tool Options 329  Embedded PowerPC Project Options                 329   Embedded PowerPC Options       a a a a a a            331   Embedded PowerPC Disassembler Opt
60.  of the memory array     writeupma  lt offset gt   lt ram_word gt      lt offset gt  0 3F  as defined in the UPM transaction type table in the  Memory Controller section of the Motorola manual     lt ram_word gt  UPM RAM word for that offset    Oxffffcc24    writeupmb    Maps the user programmable machine  UPM  registers to define  Characteristics of the memory array     writeupmb  lt offset gt   lt ram_word gt      lt offset gt  0 3F  as defined in the UPM transaction type table in the  Memory Controller section of the Motorola manual     lt ram_word gt  UPM RAM word for that offset       Targeting Embedded PowerPC PPC 307    Debug Initialization Files  Debug Initialization File Commands    Example    writeupmb 0x08 Oxffffcc24       PPC 308 Targeting Embedded PowerPC    C    rs  JTAG Configuration  Files       A JTAG configuration file contains a set of commands that config   ure the PowerTAP device and the JT AG interface of the target board  so that target control is established and debugging can take place     This appendix discusses how to generate JTAG configuration files     Generating JTAG Configuration Files    The support software provided with a PowerTAP device includes  JTAG configuration files for many of the MPC6xx and MPC7xx vari   ants on the market  When you launch Debug from the CodeWarrior  IDE  the PowerTAP device reads the PVR register of the target pro   cessor  determines the processor type  and automatically loads the  correct JTAG configuration files 
61.  one linker command file is supported per target in a project   The linker command file must end in the   1cf extension     The topics in this section include     e Setting up CodeWarrior IDE to accept LCF files       e Linker Command File Directives          PPC 192 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Setting up CodeWarrior IDE to accept LCF files    If you have an existing project  it won t recognize the  1cf format   and won t let you add it to the project  You need to create a file map     ping   To add the  1cf file mapping to your project   1  Select Edit  gt  Target Settings   Where Target is the name of the current build target   2  Select the File Mappings panel     3  In the File Type edit field  enter TEXT  and in the Exten   sion edit field  enter  1cf      4  Click the Compiler pop up menu and select None  Click the  Add button to save your settings     Now  when you add a  1cf file to your project  the compiler recog   nizes the file as a linker command file     Linker Command File Directives   The CodeWarrior PPC EABI linker supports the directives listed be   low    EXCLUDEFILES   FORCEACTIVE   FORCEFILES   GROUP   INCLUDEDWARE   MEMORY   SECTIONS   SHORTEN NAMES FOR TOR 101             NOTE  You can only use one SECTIONS  MEMORY   FORCEACTIVE  and FORCEFILES directive per linker command  file                    Targeting Embedded PowerPC PPC 193    C and C   for Embedded PowerPC  Linker Issues fo
62.  other words  you can write code that is both in  function level assembly language and statement level assembly  language     TIP  To enter a few lines of assembly language code within a  single function  you can use the support for intrinsics included in  the compiler  Intrinsics are an alternative to using asm statements  within functions  For more information  see    Intrinsic Functions    on    page 234        Function level assembly code for PowerPC uses the following  syntax     asm  function definition      For example     asm long MyFunc void     OK  an assembly function          assembly instructions  blr    must end with blr instruction    However  the following statement level code is also permitted     long MyFunc  void           Targeting Embedded PowerPC PPC 217    Inline Assembler for Embedded PowerPC    Working With Assembly  asm            function assembly statement blocks are now  supported         NOTE  Assembly language functions are never optimized  re   gardless of compiler settings     Statement level assembler syntax has the following form     asm   one or more instructions      You can use an asm statement wherever a code statement is  allowed     NOTE Functions that contain an asm block are only partially optimized  as  CodeWarrior optimizes the function  but the optimizer skips any asm  blocks of code     The built in assembler uses all the standard PowerPC assembler  instructions  It accepts some additional directives described in     Assembler Di
63.  point types  Type Size Range  float 32 bits 1 17549e 38 to 3 40282e 38  short double 64 bits 2 22507e 308to1 79769e 308  double 64 bits 20222078300 to 1 79769e 308  long double 64 bits 2 22507e 308 to 1 79769e 308  AltiVec Vector Data Formats  There are 11 new vector data types for use in writing AltiVec   specific code  shown in Table 6 4  All the types are a constant size   128 bits or 16 bytes  This is due to the AltiVec programming model   which is optimized for quantities of this size   Table 6 4 AltiVec Vector Data Types    Vector Data Type Size   bytes   vector unsigned char   16  vector signed char 16  vector bool char 16  vector unsigned 16  short  int   vector signed short 16   int   vector bool short 16   int        Contents    16 unsigned  char    16 signed char    16 unsigned  char    8 unsigned  short    8 signed short    8 unsigned  short          Possible  Values    0 to 255     128 to 127    0   false  1    true    0 to 65535     32768 to  32767    0   false  1    true       PPC 170 Targeting Embedded PowerPC    C and C   for Embedded PowerPC    Data Addressing  Vector Data Type Size Contents Possible   bytes  Values  vector unsigned long   16 4 unsigned int   0 to 232  1   int   vector signed long 16 4 signed int  231 to 231 1   int   vector bool long  int    16 4 unsigned int   0   false  1    true  vector float 16 4 float any IEEE 754  value  vector pixel 16 8 unsigned 1 5 5 5 pixel  short             In the table  the  int  portion of the Vector Data Typ
64.  requires that you use the ori    instruction     This is the simplified form to accessing globals     void foo void        register long  addr     gTheLong     asm    use addr for r7            Targeting Embedded PowerPC    PPC 229    Inline Assembler for Embedded PowerPC  Assembler Directives    Assembler    Listing 8 3    void save_fpr    Directives  This section describes some special assembler directives that the    Embedded PowerPC built in assembler accepts  They are     e entry  fralloc    frfree    machine    nofralloc    opword    entry    entry   extern   static   name    Embedded PowerPC assembler directive that defines an entry point  into the current function  Use the extern qualifier to declare a glo   bal entry point and use the static qualifier to declare a local entry  point  If you leave out the qualifier  extern is assumed     Using the entry directive    15  void         void save_fpr       16  void                                    asm void save_fpr_14  void      stfd fp14  144  SP   entry save_fpr_15  stfd fp15  130  SP   entry save_fpr_16  stfd fpl6  128  SP              PPC 230 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC    Assembler Directives    fralloc   fralloc   number    Embedded PowerPC assembler directive that creates a stack frame  for a function and reserves registers for your local register variables     You need to create a stack frame for a function if the function per   forms the following actions     e Calls oth
65.  se   rial port on the MPC8xx ADS or MBX boards  as well as the  MPC5xx EVB board  The standard C library I O is supported  in   cluding stdio  stderr  and stdin  All functions that do not re   quire disk I O are supported in this version of MSL  The memory  functions malloc    and free    are also supported  For important  information about how to use serial I O in your programs  see    Us   ing Console I O for Embedded PowerPC    on page 209        Using alternate C C   libraries    You may be able to use another standard C library with CodeWar   rior for Embedded PowerPC  You should check the files stdarg h  in both libraries  The CodeWarrior Embedded PowerPC C C    compiler will only generate correct variable argument functions       PPC 208 Targeting Embedded PowerPC    Libraries and Runtime Code for Embedded PowerPC  MSL for Embedded PowerPC    with the header file supplied with the MSL  You may find that other  implementations are also compatible  You may also need to modify  the runtime to support a different standard C library  In any event   you must include __va_arg c     Other C   libraries will not be compatible   Using MSL with an embedded operating system  OS     If you are working with any kind of embedded OS  you may need to  customize MSL to work properly with the OS  There is a document  that addresses these issues     Using Console I O for Embedded    PowerPC    on page 209     Using Console I O for Embedded PowerPC    There are a few special consideration
66.  section discusses the hardware you need to develop applica   tions for Embedded PowerPC and how to connect it to your com   puter     You can use CodeWarrior for Embedded PowerPC with several  types of development boards  The development board usually has a  serial  BDM  JTAG  or COP port     Depending on the target board and the other hardware available to  you  you can debug using one of the following methods     e A debug monitor  such as MetroTRK or SDS Monitor   through a serial connection    e A debugging device that connects to the target board using  BDM  a CodeTAP device  a Wiggler  a Hummingbird  a  Raven BDM  or an Abatron BDI2000     e A debugging device that connects to the target board using  JTAG  a PowerTAP device     e A debugging device that connects to the target board using  COP  a Raven COP     NOTE  For more information  see    Supported Debugging Meth   ods    on page 123        This section contains the following topics     e Configuring Your Embedded PowerPC Board       e Connecting with a Debug Monitor  e Connecting with CodeTAP    e Connecting with PowerTAP  e Connecting with Wiggler  Hummingbird  or Raven BDM    e Connecting with Raven COP  e Connecting with Abatron BDI2000                PPC 126 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    NOTE  For information about debugging with the AMC  Applied  Microsystems Corporation  CodeTAP device  see    Using a Code   TAP Debugging Device    on page 2
67.  section while specific  variables be stored in the COMM section  Listing 6 2 shows an exam    ple of specifying that specific uninitialized variables be stored in the  COMM section     Storing uninitialized data in the COMM section       the Use Common Section option is off   pragma push    save the current state   pragma section   data   COMM     int foo   int bar         pragma pop    restore the previous state    You may not use any of the object types  data modes  or code modes  as the names of sections  Also  you may not use pre defined section  names in the PowerPC EABI for your own section names     The optional data_mode datamode parameter tells the compiler  what kind of addressing mode to use for referring to data objects for  a section     The permissible addressing modes for datamode are     e near_abs   objects must be within the range  65 536 bytes to  65 536 bytes  16 bits on each side     e far_abs   objects must be within the first 32 bits of RAM    e sda_rel   objects must be within a 32K range of the linker   defined small data base address    The sda_rel addressing mode may only be used with the      sdata        sbss        sdata2           sbss2          EMB PPC sdata0     and     EMB PPC sbss0    sections        Targeting Embedded PowerPC PPC 185    C and C   for Embedded PowerPC  Pragmas    The default addressing mode for large data sections is far_abs   The default addressing mode for the predefined small data sections  is sda_rel     Specify one of 
68.  settings panel     J EPPC Processor OOOO   Struct Alignment   PowerPC 7   Functor Alignment 4 Byte     Processor  2240           Floating Faint    None  Software    f Hardware    Make Stings ReadOnly         Pool Data         Use Common Section  Use Lhd  amp  STM a   Use FMADD  amp  FSUE    E E       Instruction Scheduling    Peephole Optimization    E E      Profiler Information          Altivec Programming Model    Generate   VASAVE Instructions       The items in this panel are              Struct Alignment Function Alignment   Processor Floating point options   AltiVec Programming Model Generate VRSAVE Instructions  Make Strings Read Only Pool Data   Use Common Section Use LMW  amp  STMW   Use FMADD  amp  FMSUB Instruction Scheduling  Peephole Optimization Profiler Information             PPC 80 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Struct Alignment    The Struct Alignment pull down menu is not used for generating  embedded PowerPC code  You should keep the setting at PowerPC     WARNING  Ifyou choose another setting for Struct Alignment   your code may not work correctly     Function Alignment    If your board has hardware capable of fetching multiple instruc   tions at a time  you may achieve slightly better performance by  aligning functions to the width of the fetch  With the Function  Alignment pop up menu  you can select alignments from 4  the de   fault  to 128 bytes     This option corresponds 
69.  the core instructions for  the 603  604  740  and 750 processors  In addition  CodeWarrior sup   ports all optional instructions     If you use all  CodeWarrior supports all core and optional instruc   tions for all Embedded PowerPC processors     If you do not use the machine directive  the compiler uses the set   ting you selected for the Processor pop up menu on the EPPC Pro     cessor panel   For example     machine altivec    This enables the assembler AltiVec instructions  The following  statement has the same effect      pragma altivec_codegen on       PPC 232 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Assembler Directives    If you use 603  you also can use the following instructions     acbf dcbi  dcbz eciwx    frsqrte frsqrte     mfsrin mftb  mttbl mttbu  tlbli tlbsync    dcbst dcbt  ecowXx fres  fsel fsel   mftbu mtsr  stfiwx tlbie    dcbtst    fres     mfsr    mtsrin    tlbld    If you use 740 or 750  you can use the following instructions        debt dcbi  dcbz eciwx  frsqrte frsqrte   mfsrin mftb    mttbl mttbu    dcbst dcbt  ecowXx fres  fsel fsel   mftbu mtsr  stfiwx tlbie    dcbtst  tres   mfsr  mtsrin    tlbsync       If you use 821  823  or 860  you can also use the following instruc     tions    dcbf dcbi  dcbtst dcbz  misr mfsrin  mtsr mtsrin  tlbia tlbie    dcbst  eciwx  mftb   mttbl    tlbsync    dcbt  ecowx  mftbu    mttbu    NOTE  If you are using the 850 processor  use the number 860  with the machine directive  Both proces
70.  the items Optimize Partial Link  Deadstrip Unused Symbols   and Require Resolved Symbols appear in the panel     File Name    The File Name edit field specifies the name of the debuggable exe   cutable or library you create  By convention  application names  should end with the extension     e1f     and library names should  end with the extension     a     When the output name of an applica   tion ends in     e1f    or      ELF     the extension is stripped before the      mot    and     MAP    extensions are added  if you have selected the  appropriate switches for generating S Records and Map files in the  EPPC Linker panel      Byte Ordering    The Byte Ordering radio button controls whether the code and data  generated is stored in little endian or big endian format  In big en   dian format  the most significant byte comes first  B3  B2  B1  BO   In  little endian format  the bytes are organized with the least signifi   cant byte first  BO  B1  B2  B3   See documentation for the PowerPC  processor for details on setting the byte order mode        Targeting Embedded PowerPC PPC 71    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Disable CW Extensions    The Disable CW Extensions checkbox disables CodeWarrior fea   tures that may be incompatible if you are exporting code libraries  from CodeWarrior to other compilers  linkers     CodeWarrior currently supports one extension  storing alignment  information in the st_other field of each symbo
71.  this shortcut  lwz r4 0  b     ERROR  frfree  blr  Using registers  For a register operand  you must use one of the register names of  the appropriate kind for the instruction  The register names are  case sensitive  You also can use a symbolic name for an argument or  local variable that was assigned to a register   The general registers are RTOC  SP  r0 to r31  and gpr0 to gpr31   The floating point registers are fp0 to fp31 and   0 to   31  The  condition registers are cr0 to cr7   Using labels  For a label operand  you can use the name of a label  For long  branches  such as b and b1 instructions  you can also use function  names  For bla and 1a instructions  use absolute addresses   For other branches  you must use the name of a label  For example    3    OK  Branch to local label  foo    OK  Branch to external function foo   3    OK  Call local label          Targeting Embedded PowerPC PPC 225    Inline Assembler for Embedded PowerPC  Working With Assembly    bl foo    OK  Call external function foo  bne foo    ERROR  Short branch outside function          NOTE  Local labels declared in other functions are not allowed     Using variable names as memory locations    Whenever an instruction requires a memory location  such as a load  instruction  a store instruction  or 1a   you can use a local or global  variable name  You can modify local variable names with struct  member references  class member references  array subscripts  or  constant displacements  For example  a
72.  use a  heap     NOTE  If there is not enough free space available in your pro   gram  malloc returns zero     TIP  If you do not call malloc or new  consider setting Heap  Size  k  to 0 to maximize the memory available for code  data  and  the stack     Stack Address    The Stack Address edit field specifies the location in memory where  the program stack resides     If you wish to specify a specific stack address  enable the checkbox  and type an address in the edit field  You must specify the address       PPC 94 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    in hexadecimal notation  The address you specify is the top of the  stack and grows down the number of kilobytes you specify in the  Stack Size  k  edit field in the EPPC Target panel  The address will  be aligned up to the nearest 8 byte boundary  if necessary  The pos   sible addresses depend on your target hardware platform and how  the memory is mapped  The stack must reside in RAM     NOTE  Alternatively  you can specify the stack address by spec   ifying a value for the symbol _stack_addr in a linker command  file  For more information  see    Linker Command Files    on page  192     If you disable the checkbox  the linker uses the address  0x003DFFFO  This default address is suitable for the 8xx evaluation  boards  but may not be suitable for boards with less RAM  For other  boards  please see the stationery projects for examples with suitable  addres
73.  window    Run Debug  Stop           Kill   Step Over   Step Into  Step Out    mm EPPC_C_detug_elf  Pex tad             o Variables  All El             gram Files Metrowerks CodewarriorS ampleProject   S ource  main c    void main    ep      x   10  a    printf   Welcome to CodeWarrior   rsn       Source    4       NOTE  CodeWarrior enables the Stop button  located between  Run Debug and Kill  only after the program begins running  De   pending on the size and complexity of the program  you may not       Targeting Embedded PowerPC PPC 55    Creating a Project for Embedded PowerPC  Working with a Project    see the Stop button become available  In that case  you must use  the Kill button to stop executing the program     11  Stop program execution   a  Remove the breakpoint that you previously set   Click the red marker next to main    to remove the breakpoint   b  Seta breakpoint on __init_data       Double click __start in the Stack pane of the Stack Crawl  window  CodeWarrior displays the source code for the  _ start routine in an Editor window  Figure 3 20      Figure 3 20 __start c file  m_ start e  Iof x   h 0  M  El d Path   C  Program Files Metrowerks CodeWarrior PowerPC_EABI_Support Runtim   4__start c  lt  gt       mtlr r3 a    blrl a   felse  bl main   endif          exit program         if defined USE_FAR_ADDRESSING_TO_TEXZT_SECTION        lis r3 exit  ha     gt  addi r3 r3 exit l    mtlr r3  7 blrl   telse  b exit  fendif q     Z RHEE HK HH HK HH HHH HHH HHH HHH H
74.  window groups all possible options into a series  of panels  The list of panels appears on the left side of the dialog       Targeting Embedded PowerPC PPC 45    Creating a Project for Embedded PowerPC  Working with a Project    box  When you select a panel  the options in that panel appear on  the right side of the dialog box     Different panels affect   e Settings related to all build targets    e Settings that are specific to a particular build target  includ   ing settings that affect code generation and linker output     e Settings related to a particular programming language    For more information  see    Settings Panels for Embedded Pow   erPC    on page 66   5  Build the project        Choose Project  gt  Enable Debugger to inform the compiler and  linker to generate debug information appropriate for all files in your  build target  If you compile without generating debug information   you must recompile before you can debug     Choose Project  gt  Make to compile and link the code for the current  build target   6  Run and debug your code     After you enable debugging and make the project  choose Project  gt   Debug to run with the debugger        PPC 46 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    A Stack Crawl window  Figure 3 10  appears     Figure 3 10 Stack Crawl Window    m EPPC_C_debug elf Al E  PEx               o Variables  All  oo Ana vanes          nofralloc    sc    blr  void main     gt  printf  Wel
75.  writing   Usage AMCRegWriteVerify  lt off gt   AMCRegWriteVerify  lt on gt     Example    AMCRegWriteVerify 0  Turn verify off  AMCRegWriteVerify 1  Turn verify on          PPC 300 Targeting Embedded PowerPC    Description    Usage    Example    Debug Initialization Files  Debug Initialization File Commands    AMCTargetinterfaceClockFreq    Clock frequency for the BDM of the MPC8xx and the JTAG of the  60x     AMCTargetInterfaceClockFreq  lt  gt     AMCTargetInterfaceClockFreq 3670000          Description    Usage    Example    AMCTargetSerial    AMCTargetSerializelnstExec  Forces the MPC8xx to serialize its instruction execution     AMCTargetSerializelnstExec  lt off gt      AMCTargetSerializelnstExec  lt on gt     izeInstExec 0  Turn off          AMCTargetSerial       izeInstExec 1  Turn on       Description  Usage    Example    WARNING  You cannot have AMCTargetSerializeInstExec set to     0    and AMCTargetShowInstCycles set to    All    at the same time     AMCTargetShowinstCycles    Configures the MPC8xx show cycles     AMCTargetShowInstCycles      AMCTargetShowInstCycles 0   All  AMCTargetShowInstCycles 1   Change in Flow             Targeting Embedded PowerPC PPC 301    Debug Initialization Files  Debug Initialization File Commands    AMCTargetShowl          AMCTargetShowl    Description    Usage    Example    initregs ON  initregs OFF       Description  Usage    Example    polltime 500  poll    ns  ns    tCycl  tCycl    es 2   All    indirect change in flow         
76.  you must     1  Complete the emulator installation described in Emulator In   stallation Guide  available from AMC     Ml    2  Install CodeWarrior as described in    Installing CodeWarrior  for Embedded PowerPC    on page 24     The hardware requirements for debugging with a CodeTAP device  follow     e An evaluation board  see    Target board requirements    on  page 22     e Two power supplies  one for your target board and the one  supplied with the CodeTAP    e A CodeTAP device    Target Settings for CodeTAP    CodeWarrior for Embedded PowerPC provides project stationery  that you can use to create projects  The project stationery settings  are already set to reasonable default values  For more information     see    Project Stationery    on page 33     You also can open and view a sample project in the following direc   tory     Windows  CodeWarrior  directory   CodeWarrior_Examples CDemon CDemon mcp    Solaris  CodeWarrior directory  CodeWarrior_Examples CDemon   CDemon mcp    Table 10 2 lists the most common build target settings for develop   ing and debugging with a CodeTAP device  For more information   see    Settings Panels for Embedded PowerPC    on page 66 and    Con     necting with CodeTAP    on page 132           PPC 252 Targeting Embedded PowerPC    Using a CodeTAP Debugging Device    Target Settings for CodeTAP                         Table 10 2 Target settings for CodeTAP   Panel Name Setting Value   Build Extras  see IDE Activate Browser checkbox Select
77. 0          AMCMemWriteDelayCycles    on page 300    Settings  0  1 0xfe00          AMCMemWriteVerify    on page 300    Settings  0 1             Targeting Embedded PowerPC PPC 297    Debug Initialization Files  Debug Initialization File Commands                                                             Commands AMC PowerTAP Settings     AMCRegWriteVerify    on page 300 Settings  0 1     AMCTargetInterfaceClockFreq    on page 301 Settings   10000000   5000000   1000000   100000   10000     initregs    on page 302 None     polltime    on page 302 Settings  1 20     setMMRBaseAddr    on page 303 None     sleep    on page 303 None     writemem b    on page 304 None     writemem 1    on page 304 None     writemem w    on page 305 None     writemmr    on page 305 None     writereg    on page 306 None     writespr    on page 306 None          Macraigor Wiggler Commands    The following list shows the debug initialization file commands  supported for the Macraigor Wiggler  Hummingbird  and Raven  devices when used with 5xx and 8xx processors and the page num   ber where you can read the description of the command     e    polltime    on page 302  e    setMMRBaseAddr    on page 303    e    sleep    on page 303          e    writedcr    on page 304    e    writemem b    on page 304          PPC 298 Targeting Embedded PowerPC    Debug Initialization Files  Debug Initialization File Commands    e    writemem l    on page 304  e    writemem w    on page 305    e    writemmr    on page 3
78. 0  1   0x8000           SECTIONS    GROUP        text        rodata       rodata    extab    extabindex        gt  text  GROUP       data         bss 5 de    sdata BIND 0x3500          SbBss    i      sdata2        sbss2   f      gt  data  GROUP       PPC EMB sdataO        PPC EMB sbssO          gt  paged                      PPC 196 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    INCLUDEDWARF                The INCLUDEDDWARF directive allows you to source level debug  code in the kernel while debugging your application  It is of the  form     INCLUDEDDWARF   executablename extension                  In the following example     INCLUDEDDWARF   kernel elf                  kernel elf is added to your project  The linker adds only the   debug and   line sections of kernel  elf to your application   This allows you to source level debug code in the kernel while de   bugging your application     You are limited to one executable file when using this directive  If  you need to process more than one executable  add this directive to  another file     MEMORY  A MEMORY directive is of the form     MEMORY      lt memory_spec gt           where memory_spec is     lt symbolic name gt    origin   num  length   num    origin may be abbreviated as org or o  length may be abbrevi   ated as len or 1  If you don t specify length  the memory_spec is  allowed to be as big as necessary  In all cases  the linker will warn  you if sections overla
79. 0 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    The Project window appears  Figure 3 6      Figure 3 6 Project window    a SampleProject mcp          Serial  UART       Runtime   i po  Linker Command File E pod    4 E  E         10 files       The Project window is the central location from which you con   trol development  In the Project window  you can perform many  operations  including adding or removing source files and li    braries  compiling code  and generating debugging information     2  Modify the project contents   To add files   e Choose Project  gt  Add Files        Targeting Embedded PowerPC PPC 41    Creating a Project for Embedded PowerPC  Working with a Project    e Choose Project  gt  Add Window to add an active editor win   dow   Use this command when you create a new file and de   cide to add it to the active project      e Drag files from the desktop or folder into the project     To remove files  select the file or files in the Project window and  press the Delete key     NOTE  Do not delete files from this project  If you do so  the  project may not build and execute correctly     3  Modify source files     Use the editor to modify the content of a source code file  To open a  file for editing  double click the file name in the Project window  or  select the file and press Enter  The Editor window appears  Figure  3 7         PPC 42 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC
80. 00000 System Reset i 0x00004000 Software Emulation     O 20000000 Check Stop Ox00002000 Instruction TLB Miss  010000000 Machine Check Ox00007 000 Instruction TLE Error  Ox  D2000000 External OxOO000800 Data TLE Miss  0 07 000000 Alignment 000000400 Data TLE Error   v 0x00800000 Prograrn  0x  00000008 Load  Store Break point  Ox00400000 Floating Point Unavailable 0x  00000004  Instruction Breakpoint  Ox00200000 Decrementer OxOO000002 External Break point  Ox00040000 System Call Ox00000001 Development Fort     Ox  D0020000 Trace          Punzelected these may affect the debugger s ability to control target       a4  lt 1             Targeting Embedded PowerPC PPC 117    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Connection Settings    The Connection Settings panel  shown in Figure 4 12  allows you to  set the primary and secondary serial port options     Figure 4 12 Connection Settings panel  Windows   Connection Settings  View Connection T ype   View Serial Settings        Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Primary Serial Port Options    Port  COM     Parity   Mone ka    Rate  115200    Stop Bits  1     Data Bits   2 ka   Flow Control  Hardware  ATS CT5       Log Serial Data to Log window    Use Global Connection Settings    Secondary Serial Port Options    Port  COM1 ka   Parity   None Ad    Rate  38400 ka   Stop Bits  1 Ad    Data Bits  2     Flow Control None      Log S
81. 05  e    writereg    on page 306          e    writespr    on page 306    Abatron BDI2000 Commands    The following list shows the debug initialization file commands  supported for the Abatron BDI2000  the page number where you  can read the description of the command  and any applicable set   tings information for each command     e    writemem b    on page 304    e    writemem l    on page 304  e    writemem w    on page 305    e    writemmr    on page 305  e    writereg    on page 306          e    writespr    on page 306       e    writeupma    on page 307    e    writeupmb    on page 307    AMCMemReadDelayCycles       Description Defines the number of additional processor cycles to allow for mem   ory reads     Usage AMCMemReadDelayCycles  lt   gt     Example       AMCMemReadDelayCycles 350       Targeting Embedded PowerPC PPC 299    Debug Initialization Files  Debug Initialization File Commands    AMCMemWriteDelayCycles    Description Defines the number of additional processor cycles necessary for  memory writes     Usage AMCMemWriteDelayCycles  lt   gt     Example    AMCMemWriteDelayCycles 350       AMCMemWriteVerify  Description Enables or disables memory read after write verification   Usage AMCMemWriteVerify  lt off gt   AMCMemWriteVerify  lt on gt     Example    AMCMemWriteVerify O  turn off memory verification  AMCMemWriteVerify 1  turn on memory verification                AMCRegWriteVerify  Description Causes the emulator to perform a register verification after
82. 2    3     S  S  S    tore    Flash Programmer  Command File Syntax    GO 0x10000  GO 0x10000  GO 0x10000       NOTE  The least significant byte of the register will be stored in  the specified address   storelREG    The second storelREG command has the following     Store the value of the specified internal register x to the memory lo   cation that is pointed by IREGy     storelIREG  b   w   1   lt IREGx gt   lt IREGy gt     This command doesn t need to be inside startProgramLoop and  endProgramLoop block     This command will also work if it is entered in the command line     For the examples below  IREGO contains 0x11223344 and IREG1  contains 0x00010000           REG b IREGO IREG        tore       tore             REG w IREGO IREG   REG  1 REGO IREG                                 1  This command will store 0x44 to address 0x00010000      2  This command will store 0x33 to address 0x00010000 and store  0x44 to address 0x00010001      3  This command will store 0x11 to address 0x00010000  0x22 to ad   dress 0x00010001  0x33 to address 0x00010002  and 0x44 to address  0x00010003        Targeting Embedded PowerPC PPC 279    Flash Programmer  Command File Syntax    Description    Usage    Examples     1  OOOOFFFC     2  00010000       3  00010004         Description    Usage    NOTE  The least significant byte of the register will be stored in  the specified addr   loadIREG    There are two kinds of loadIREG  Load Internal Register  com   mands  The first kind has the followi
83. 42 Targeting Embedded PowerPC    Motorola MPC 8xx FADS target board jumper  settings 324  Motorola MPC 8xx MBX target board dipswitch  settings 323  Motorola MPC 8xx MBX target board jumper  settings 323  Motorola MPC 8260 VADS target board dipswitch  settings 327  Motorola MPC 8260 VADS target board jumper  settings 327  Motorola MPC 505 509 EVB target board  dipswitch settings 319  Motorola MPC 505 509 EVB target board jumper  settings 319  Motorola Yellowknife X4 603 750 target board  jumper settings 321  MSL   using 208 209   and runtime libraries 208   described 29   for PowerPC Embedded 207 212   using alternate C C   libraries 208   using console I O 208  209 212   using with RTOS 209   See also MSL C Reference  MSL C   Reference  multiple symbols and linker 192    N    nofralloc directive 234   number formats  floating point 170  for PowerPC 168 171  integers 169    O    Only Show Operands and Mnemonics 89  operands in inline assembler 224  Optimize Partial Link checkbox  EPPC Target  panel 74   optimizing   for PowerPC 175 176   inline assembly disables 218   register coloring 175   settings panels used to optimize code 65  opword directive 234          Index    Output Directory option  Target Settings panel 69    P    Parallel Port 107  Parity menu 120  Phytec miniMODUL PPC 505 509 target board  jumper settings 328  picking a target 67  pixel 171  polltime 302  Port menu 119  Post Linker option  Target Settings panel 69  PowerPC Embedded debugging See debugging  Pow
84. 49    For information about debugging with the AMC PowerTAP device     see    Using the PowerTAP 6xx 7xx Debugging Device    on page  257        Configuring Your Embedded PowerPC Board    Tested jumper and dipswitch settings are available for a number of  supported target boards  Before using a target board with  CodeWarrior  set the appropriate jumper or dipswitch settings for  the target board  For more information  see    Tested Jumper and  Dipswitch Settings    on page 317        Connecting with a Debug Monitor    This section presents high level steps for connecting with a debug  monitor using a serial port     The type of serial cable connection that you can use depends on  your target board  Table 5 3 lists the type of serial cable connection  required for various embedded PowerPC target boards     Table 5 3 Serial cable connection type for target boards                   Embedded PowerPC Board Serial Cable Connection Type   Cogent CMA102 with CMA 278 Daughtercard Use the equipment and cable sup   plied with the board    Motorola MPC 505 509 EVB Straight serial   Motorola 555 ETAS Null modem   Motorola Excimer 603e Null modem   Motorola Yellowknife X4 603 750 Null modem   Motorola MPC 8xx ADS Straight serial          Targeting Embedded PowerPC PPC 127    Debugging for Embedded PowerPC  Setting Up for Remote Debugging       Embedded PowerPC Board    Serial Cable Connection Type       Motorola MPC 8xx MBX  Motorola MPC 8xx FADS  Embedded Planet RPX Lite 8xx       Motorol
85. 7400    Motorola Sandpoint 8240       Motorola MPC 8260 VADS    Phytec miniMODUL PPC 505 509    UARTA_COGENT_CMA102 a  UARTB_COGENT_CMA102 a       Not available    UARTA_MOT_5XX_EVB a  UARTB_MOT_5XX_EVB a    UART1_MOT_555_ETAS a    UARTA_MAX EXCIMER a  UARTB_MAX EXCIMER a       UARTA_YK_SP a  UARTB_YK_SP a    UART1_MOT_8XX_ADS a  UART2_MOT_8XX_ADS a       UART1_MOT_8XX_MBX_40   UART2_MOT_8XX_MBX_40 a    w          w    UART1_MOT_8XX_MBX_50   UART2_MOT_8XX_MBX_50 a             UART1_MOT_8XX_ADS a  UART2_MOT_8XX_ADS a   uses the MPC ADS 24Mhz  libraries                       UART1_RPX_LITE_8xx a       UARTA_MAX EXCIMER a  UARTB_MAX EXCIMER a       UARTA_YK_SP a  UARTB_YK_SP a    UART1_MOT_8260_VADS a  UART2_MOT_8260_VADS a                   UART_PHYTEC_5XX a          PPC 210 Targeting Embedded PowerPC    Libraries and Runtime Code for Embedded PowerPC  MSL for Embedded PowerPC    If your MBX board is not running at the Processor Speed specified  in Table 7 1  you need to modify one of these libraries to work with  your hardware  When making changes  it is important to add a  baud rate divisor table tailored to your processor speed  CodeWar   rior projects  the files ending in  mcp  are used to modify and build  new versions of the library  The projects are located at this path            CodeWarrior directory   PowerPC_EABI_Tools MetroTRK Transport   ppc  Board directory     Configuring the board for console I O  MPC 8xx only     If you are using either the 821 or 860 processor
86. 7t  68603R  Goldeneye   40071201 jtag 68603E PID7t  68603R  Goldeneye           Frequently  you can use heuristics to determine the correct base file   For example  if the PVR reported at startup is 0x60070201  you  should look for another file that attaches a three digit prefix to  70201  IBM versioning uses a prefix to the original Motorola number   here 70201   whereas Motorola increments the final digit  Select the  file that supports a processor that is architecturally closest to the one  on your target        PPC 310 Targeting Embedded PowerPC    JTAG Configuration Files    Generating JTAG Configuration Files    http   www mot   PVRSettings txt    Copy the base file to its new name    The PowerTAP device expects the filename to be in the following  format    pvr_string jtag   For example  a PVR of 0x60070201 becomes 60070201 jtag  Attempt to launch debug again     If you selected the correct base file and applied the correct name  the  PowerTAP device should connect successfully  If not  try using an   other related JTAG file as a base     AMC  Applied Microsystems Corporation  Customer Support can  assist you  if you are unable to generate a JTAG file that works  For  more information  see    CodeTAP Technical Support    on page 251    or    PowerTAP Technical Support    on page 259        For a list of current PVR numbers for all versions of Motorola 6xx  and 7xx processors  see the following URL     com SPS PowerPC teksupport faqsolutions allelse        Targeting Emb
87. AM     If you disable the checkbox  the linker calculates the small data ad   dress to begin immediately following the  data section     Small Data2    The Small Data2 edit field specifies the location in memory where  the small data2 section resides  For more information about the  small data section  see    Small Data2    on page 73        If you wish to specify a specific small data2 address  enable the  checkbox and type an address in the edit field  You must specify the  address in hexadecimal notation  The possible addresses depend on  your target hardware platform and how the memory is mapped  All  types of data must reside in RAM     If you disable the checkbox  the linker calculates the small data2 ad   dress to begin immediately following the   sbss section     NOTE  Ifthe linker discovers that any of the sections  heap  or  stack overlap  it issues a warning  You should fix the address  problem and re link your program     Generate ROM Image    The Generate ROM Image checkbox allows you to create a ROM  image at link time by specifying the RAM Buffer Address and ROM  Image Address        NOTE  A ROM image is defined as a file suitable for flashing to  ROM        PPC 98 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    RAM Buffer Address    The RAM Buffer Address edit field is used to prepare your pro   gram to be flashed into ROM  It specifies the address in RAM that  will be used as a buffer for the flash i
88. C   for Embedded PowerPC  Pragmas    Occasionally you might create a section without making it the cur   rent section for an object type  You might do so to force an object  into a section with the __dec1spec keyword  In this case  the com   piler automatically updates the access permission for that section to  allow the object to be stored in the section  then issue a warning  To  avoid such a warning  make sure to give the section the proper ac   cess permissions before storing object code or data into it  As with  associating an object type to a section  passing a specific permission  adds to the permissions that a section already has     NOTE  Associating an object type with a section sets the appro   priate access permissions for you     Predefined sections and default sections    The predefined sections set with an object type become the default  section for that type  After assigning a non standard section to an  object type  you may revert to the default section with one of the    forms in    Forms for  pragma section    on page 188   The compiler predefines the sections in Listing 6 3                          Listing 6 3 Predefined sections  pragma section code_type   text  data_mode far_abs code_mode pc_rel  pragma section data_type   data    bss  data_mode far_abs code_mode pc_rel  pragma section const_type   rodata    rodata  data_mode far_abs code_mode pc_rel  pragma section sdata_type   sdata    sbss  data_mode sda_rel code_mode pc_rel  pragma section sconst_typ
89. CodeWarrior      Targeting Embedded  PowerPC       t minute changes to CodeW  me of the information in this manual may b  lease read the Release Not  CodeW D for the most r t informat  Revised  991129 CIB    III    Metrowerks Code Warrior copyright   1993 1999 by Metrowerks Inc  and its licensors   All rights reserved     Documentation stored on the compact disk s  may be printed by licensee for personal  use  Except for the foregoing  no part of this documentation may be reproduced or trans   mitted in any form by any means  electronic or mechanical  including photocopying   recording  or any information storage and retrieval system  without permission in  writing from Metrowerks Inc     Metrowerks  the Metrowerks logo  CodeWarrior  and Software at Work are registered  trademarks of Metrowerks Inc  PowerPlant and PowerPlant Constructor are trademarks  of Metrowerks Inc     All other trademarks and registered trademarks are the property of their respective  owners     ALL SOFTWARE AND DOCUMENTATION ON THE COMPACT DISK S  ARE  SUBJECT TO THE LICENSE AGREEMENT IN THE CD BOOKLET     How to Contact Metrowerks     U S A  and international Metrowerks Corporation  9801 Metric Blvd   Suite 100  Austin  TX 78758  U S A     Canada Metrowerks Inc   1500 du College  Suite 300  Ville St Laurent  OC  Canada H4L 5G6    Ordering Voice   800  377 5416  Fax   512  873 4901    World Wide Web http    www metrowerks com    Registration information register metrowerks com       Technical support c
90. Creating a Project     Aes  Ye ais ea  Be HR    be ar Heats BP ES 34  Project Stationery Targets   2    2  2  ee en 37  Working with a Project 05003  8k oo a ee Be Se RS 38  Targeting Embedded PowerPC PPC 3    4 Target Settings for Embedded PowerPC   Target Settings Overview   Settings Panels to Optimize Code   Settings Panels for Embedded PowerPC  Target Settings    Pa ae A 4  BETESATSS  sio we east Ae ve Actes Hc ae Ae et We AE  e A  EPPC Assembler       a a  Ge heap ee a Aaa  Global Optimizations    2    a a a 2  ee   EPPO Processor ii i ghee So de oe Rs ede ac dc Geet Y  EPPC Disassemblers     ao e aca he a BG ws a A  PPP CIA AMA BG he ne ae oe  EPPC Target Settings       oe  dle cho riada BE te a  Remote Debugging Options               0    EPPC Exceptions      a 46  Oy We Get de eh  Se Hee  Connection Settings       5 cht sd ode he hes Feats OH Dia eo ke    5 Debugging for Embedded PowerPC  Supported Debugging Methods  Setting Up for Remote Debugging  Configuring Your Embedded PowerPC Board          Connecting with a Debug Monitor              Connecting with CodeTAP             02   Connecting with PowerTAP        2    2    0   Connecting with Wiggler  Hummingbird  or Raven BDM      Connecting with Raven COP      2    2  2 2  Connecting with Abatron BDI2000          2    2     Special Debugger Features for Embedded PowerPC  Displaying Registers 4 26   aS  Seis eee oo wes  BPPC MENU af 36  Ds 4 bo A A Gaui oe SEAS  AMC Data and Instruction Cache Windows           Regist
91. E User Guide    D    Data Address edit field 97  Data Addressing 171  data addressing  for PowerPC Embedded 171 173  Data Bits menu 120  data cache window 152  data transmission rates  for MetroTRK  158       PPC 338 Targeting Embedded PowerPC    Deadstrip Unused Symbols checkbox  EPPC Tar   get panel 74  deadstripping unused code 191  debug initialization files  command syntax 296  commands 294  Abatron DBI2000 299  AMCMemReadDelayCycles 299  AMCMemWriteDelayCycles 300  AMCMemWriteVerify 300  AMCRegWriteVerify 300  AMCTargetInterfaceClockFreq 301  AMCTargetSerializeInstExec 301  AMCTargetShowInstCycles 301  CodeTAP 296  initregs 302  Macraigor Wiggler 298  polltime 302  PowerTAP 297  setMMRBaseAddr 303  sleep 303  writedcr 304  writemem b 304  writemem l 304  writemem w 305  writemmr 305  writereg 306  writespr 306  writeupma 307  writeupmb 307  creating stand alone code 290  debugging 289  initialization 290  memory initialization 290  proper use 294  use of 294  debug monitor  connecting with 127  debugger  described 28  EPPC Menu  Breakpoint Type menu option 152  Change IMMR menu option 150  Hard Reset menu option 151  overview 150  Set Stack Depth menu option 150  Soft Reset menu option 150  Watchpoint Type menu option 151       Index    special purpose registers 147  See also Debugger User Guide  Debugger Settings panel See IDE User Guide  debugging 32  Debug command 46  debug initialization files 289  debugging monitors  MetroTRK 123  SDS Monitor 123  ELF files  additi
92. EGy  not IREGa IREGs                                  Wait and Abort Commands  abortEqual    Abort the current config file if an internal register is equal to the  specified value  The first argument  IREGx  is an internal register   The second argument can be an internal register  IREGy   or the  memory address  memAddr  of a 32 bit value           abortNotEqual    Abort the current config file if an internal register is not equal to the  specified value  The first argument  IREGx  is an internal register   The second argument can be an internal register  IREGy   or the  memory address  memAddr  of a 32 bit value              PPC 284 Targeting Embedded PowerPC    Flash Programmer  Command File Syntax    abortEqual IREGx  memAddr     abort if IREGx   the content of  memAddr        IREGx  memAddr           abortNotEqual      abort if IREGx    the content of  memAddr              abortEqual IREGx IREGy            abort if IREGx            REGy       abortNotEqual             REGx IREGy            abortif IREGx    IREGy    Description    Usage    Description       untilEqual    Waits until two values are the same before continuing with program  execution  If thereis a corresponding DO statement  execution will  shift to the statement following the DO statement  The first argument   IREGx  is an internal register  The second argument can be an inter   nal register  IREGy   or the memory address  memAddr  of a 32 bit  value  The third argument  maxNumTimes  is optional and is the 
93. FFFFF DRFF7FFFFF DRPFFFFFFF  O FFFBFEFF DRFFFFFBFC O FDFFFFFF O FFFOFFD   O  FDFFFFFF OxFFFFFFFF DRFFFFFFFF DRFFFFFFFF  D  FEFFFEBFD DRFFFFFDFF DRFFFFFFFF DRFFFFFFFF  D  FOFFFFFF DXFFFFFBEF D  FFFFFFFF DRPF7FFFFF  DxDFF7BBF DRPFFF7FFE DRFFFFFFFF DRPFFFFFFF  DRPFFDEFFFF OxFFFFFFFF O FFFFFFFF OnFFFFFFFF  O  FCFFFFFF OzFDFFFBFF OnFFFFFFFF OnFFFFFFFF          Targeting Embedded PowerPC PPC 149    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    EPPC Menu    When you use the debugger with CodeWarrior for Embedded Pow   erPC  the debugger has a menu that is unique to this product  To see  the menu  select Debug  gt  EPPC     The EPPC menu contains the following menu options     e Set Stack Depth    e Change IMMR  e Soft Reset    e Hard Reset  e Watchpoint Type       e Breakpoint Type       Set Stack Depth    Select the Set Stack Depth menu option to set the depth of the stack  to read and display  Showing all levels of calls when you are exam   ining function calls several levels deep can sometimes make step   ping through code more time consuming  Therefore  you can use  this menu option to reduce the depth of calls that CodeWarrior dis     plays    Change IMMR   Select the Change IMMR menu option to set the IMMR address  when debugging for the 8260 processor     NOTE  The Change IMMR menu option is available only after  you select 8260 as the target processor     Soft Reset    Select the Soft Reset menu option to send a soft reset signal to the  t
94. HH HH HHH HHH HH HHH HHH HHH HHH HHH HHH HHH HK HH HK HHKHRKHN        _ COpy_rom_section         Line  1937 a             PPC 56 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    Choose __init_data from the Routine pop up menu  Figure 3 21   to display ___init_data       Figure 3 21 Choosing the _ init_data function                    6 __starte    __start  __copy_tom_section  __init_bss_section  __init_registers     init_data      exit program  AS     if defined USE_FAR ADDRESSING_TO_TEXT_SECTION       lis r3  exit ha      gt  addi r3 r3 exitQl    mtlr r3   gt  blrl  felse  exit  fendif E     ES    E    _ copy_rom_section         Copy the ROM section to RAM if dst and src are different and size    Line  220 Maf         A       Targeting Embedded PowerPC PPC 57    Creating a Project for Embedded PowerPC  Working with a Project    Set a breakpoint at the line containing__init_data  Figure  3 22      Figure 3 22 Editor window after setting breakpoint on __init_data      m__starte Iof x   h o nm d  Path   C  Program Files Metrowerks Code  arrior PowerPC_EABI_Support Runtim   4__start c  lt  gt     LHRH HHH HHH KKH HHH JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE ME JE FE E E E E EE a    4 al      _ init data E        Initialize all  RAM  data sections  copying ROM sections as necessary          dst destination RAM address     size number of bytes to 
95. Initialization File checkbox 112  error messages  CodeTAP and PowerTAP 245  246    F    __fabs   236   File Mappings panel See IDE User Guide  File Name menu  EPPC Target panel 71  flash programmer       PPC 340 Targeting Embedded PowerPC    command file syntax 275 287  using 273 275  flashing a program to ROM using project statio   nery targets 37  float size 170  floating point formats for PowerPC 170  Floating Point support 82  floating point formats 170  Flow Control menu 121  __fnabs   236  FPSCR 237  fralloc assembly statement 223  fralloc directive 231  frfree assembly statement 223  frfree directive 231  function level assembly 217    G    Generate DWARF File check box 92  Generate Link Map check box 92  Generate Listing File checkbox  EPPC Assembler  settings panel 77  Generate ROM Image checkbox 98  Generate S Record File checkbox 95  Generate VRSAVE Instructions checkbox 83  generating code  for specific processors 177  Global Optimizations panel 78    H    hard reset  CodeTAP 255  PowerTAP 263  Hard Reset menu option 151  hardware  connecting 126  Heap Address 93  Heap Size  k  field  EPPC Target panel 73  Host Name field 121  Hummingbird  debugging device  104  connecting with 140  connection type 124    Index    IBM 403 EVB target board jumper settings 319  IDE described 26  Use Initialization File checkbox 112  Initialization File field 105  initregs 302  inline assembler  asm blocks not supported 217  comments 221  directives 230 234  for PowerPC 215 241  func
96. OPEN  2 3 CLOSED  J61 1 2 CLOSED   J34 1 2 OPEN   J32 1 2 CLOSED   J35 1 2 CLOSED   J36 1 2 OPEN   J38 1 2 OPEN   J40 1 2 OPEN       Targeting Embedded PowerPC PPC 321    Tested Jumper and Dipswitch Settings             Motorola MPC 8xx ADS   Jumper Locations Settings   157 1 2 CLOSED   J59 1 2 OPEN   J58 1 2 CLOSED   J60 1 2 CLOSED   J45  J46  J47  J55  J56 Use the factory defaults   Motorola MPC 8xx ADS    Table E 8 lists the tested dipswitch and jumper settings for the Mo   torola MPC 8xx ADS target board     Table E 8 Motorola MPC 8xx ADS dipswitch and jumper settings          Dipswitch and Jumper Locations Settings  DS1  DS2 Set all to OFF   J1  POR  Set to KA    J2  VDDL  Set to 3 3V    J3  KAWPR  Set to 3 3V           PPC 322 Targeting Embedded PowerPC    Tested Jumper and Dipswitch Settings    Motorola MPC 8xx MBX    Motorola MPC 8xx MBX    Table E 9 lists the tested jumper settings for the Motorola MPC 8xx    MBxX target board     Table E 9 Motorola MPC 8xx MBX dipswitch and jumper settings       Jumper Locations    Settings       Jumper 1    Jumper 2  Jumper 3  Jumper 4  Jumper 5    Jumper 6    Jumper 7  Jumper 8    Jumper 9    Jumper 10    Jumper 11    Depends on battery setup  See the refer   ence manual for your target board     3 4 CLOSED  Normal Mode setting    1 2 CLOSED  Boot ROM Write Protect   2 3 CLOSED  Uses Flash for Boot    2 3 CLOSED  Select DEBUG Port Signal  Pins    Depends on setup  See the reference man   ual for the board    Any setting is allowed
97. P Settings selected         Connection Settings    View Connection Type   view TCPVIP Settings        Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Host Name      Use Global Connection Settings    a     b        From the View Connection Settings menu  select View TCP   IP settings     In the Host Name field  type the host name that you as   signed to the CodeTAP device during emulator setup     For more information  see Emulator Installation Guide  which is  available from AMC  This document describes how to establish  Ethernet communications  assign host names and IP addresses   and update the network databases        Targeting Embedded PowerPC PPC 135    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    Figure 5 8    Build Extras    Select any other needed target settings for your project     For more information  see    Settings Panels for Embedded Pow   erPC    on page 66  After selecting any other needed target settings   you can download and execute your code        Connecting with PowerTAP    You can use a PowerTAP device to connect your target board to  your network so that you can debug programs on the target board  across the network   For more information  see    Using the Power   TAP 6xx 7xx Debugging Device    on page 257         To connect your PowerTAP device to your network and target  board     Assemble the PowerTAP components and configure the system  for network communication     F
98. SRRO  and SRR1 DAR  DSISR  as well as re enable interrupts while in the  handler                    pack     pragma pack  n     Where n is one of the following integer values  1  2  4  8  or  16     This pragma creates data that is not aligned according to the EABI   The EABI alignment provides the best alignment for performance     Not all processors support misaligned accesses which could cause a  crash or incorrect results  Even on processors which don t crash   your performance will suffer since the processor has code to handle  the misalignments for you  You may have better performance if you  treat the packed structure as a byte stream and pack and unpack  them yourself a byte at a time     If your structure has bitfields and the PowerPC alignment does not  give you as small a structure as you would like  double check that    you are specifying the smallest integer size for your bitfields     For example     typedef struct foo      unsigned a   unsigned b     Teo   r       Te   r       Targeting Embedded PowerPC PPC 181    C and C   for Embedded PowerPC  Pragmas    unsigned c  1     foo     would be smaller if rewritten as    typedef struct foo         unsigned char a  1    unsigned char b  1    unsigned char c  1   b    FOO        unsigned without a integer type means unsigned int    NOTE  Pragma pack is implemented somewhat differently by  most compiler vendors  especially with bitfields  If you need porta   blity  you are probably better off using shifts and masks in
99. TAP Debugging Device    on page 249    e    Using the PowerTAP 6xx 7xx Debugging Device    on page    297    e Emulator Installation Guide  supplied with the CodeTAP or  PowerTAP device        Reset On Connect    Select the Reset On Connect checkbox to cause CodeWarrior to  issue a reset to the target board before executing the debug initial   ization file     Serialize instruction execution    The MPC8XX core has multiple execution units  which allows in   structions to be executed concurrently  When you select the Serial        Targeting Embedded PowerPC PPC 109    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    ize instruction execution checkbox  this option sets the MPC8XX  ICTRL register bit 29  which forces the MPC8XX to serialize its in   struction execution     Serialize instruction execution is also a command in debug initial   ization files  The debug initialization file commands overwrite val   ues set in this panel  For more information  see    AMCTargetSerial   izelnstExec    on page 301 for additional information on this  command        For information about the serialization of the MPC8XX core  see  MPC860 User s Manual  available from Motorola      NOTE  You cannot enable this option and Show Inst Cycles set  to All at the same time  According to the MPC860 User s Manual   this is an incorrect combination for the ICTRL bits  29 31      Show Inst Cycles    The Show Inst Cycles option allows you to control the instruction  fetch sho
100. User Guide for more general information on the debugger     This chapter contains the following topics     e Supported Debugging Methods  e Setting Up for Remote Debugging    e Special Debugger Features for Embedded PowerPC  e Register Details Window    e Using MetroTRK  e Debugging ELF Files             Supported Debugging Methods    With CodeWarrior for Embedded PowerPC  you can use a variety  of methods to debug your applications     e Debug monitors  MetroTRK and SDS Monitor  that run on  the target board and communicate with the debugger using a  serial cable connection     e Various hardware debugging devices that facilitate commu   nication between the debugger and your target board     e Target server  useful when debugging programs for Vx   Works   For more information  see Targeting VxWorks for  PowerPC        Targeting Embedded PowerPC PPC    123    Debugging for Embedded PowerPC  Supported Debugging Methods    Table 5 1 lists the supported debugging devices     Table 5 1 Supported debugging devices                            Manufacturer Debugging Device Connection Type  Applied Microsystems Corporation  CodeTAP BDM  PowerTAP JTAG  Macraigor Systems  Inc  Wiggler BDM  Hummingbird BDM  Raven BDM BDM   555 and 8xx processors   Raven COP JTAG COP   6xx and 82xx processors   Abatron AG Abatron BDI2000 BDM       Table 5 2 lists the currently supported target boards and the sup   ported debugging methods for each board     Table 5 2 Supported debugging methods for targe
101. a Maximer 7400   Motorola Sandpoint 8240  Motorola MPC 8260 VADS   Phytec miniMODUL PPC 505 509       Null modem  Straight serial    Use the equipment and cable sup   plied with the board     Null modem  Null modem  Straight serial  Straight serial       NOTE  CodeWarrior supports the SDS Monitor and MetroTRK  debug monitors  For more information  see    Using MetroTRK    on  page 157        To connect to your target board using a debug monitor   Ensure that your target board has a debug monitor     If your debug monitor has not been previously installed on the tar   get board  burn the debug monitor to ROM or use another method   such as the flash programmer  to place MetroTRK or another debug  monitor in flash memory     Depending on the board you are using  you can use a MetroTRK  project provided by this product to place MetroTRK in flash mem   ory  The following boards have self flashable MetroTRK project tar   gets     e Motorola MPC 505 509 EVB   e Motorola 555 ETAS   e Motorola Excimer 603e   e Motorola Yellowknife X4 603 750  e Motorola MPC 8xx ADS   e Motorola MPC 8xx MBX                Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    e Motorola MPC 8xx FADS   e Motorola MPC 8260 VADS   e Phytec miniMODUL PPC 505 509  The following boards do not have self flashable MetroTRK project  targets  consequently  you must use the flash programmer or an     other method to place MetroTRK in flash memory or ROM when  using these
102. able online     This example discusses how to        1  Create a project       Modify the project contents          Modify source files       View target settings     Build the project     Run and debug your code   Set a breakpoint           Set a watchpoint        ONDA       Show registers   10 Run  stop  and step through code   11 Stop program execution   To work with the example project   1  Create a project   To create a project from project stationery     a  Launch CodeWarrior        PPC 38 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    b  Choose File  gt  New   The New window appears  Figure 3 4      Figure 3 4 New window       fe Empty Project  ay Makefile Importer Wizard                c  On the Project tab  highlight PowerPC EABI Stationery   d  Type a name in the Project name field     The Location field contains the default directory location for  your project        Targeting Embedded PowerPC PPC 39    Creating a Project for Embedded PowerPC  Working with a Project    e  Click OK to accept the default directory location for your  project     The New Project window appears  Figure 3 5      Figure 3 5 New Project window  2 Hew Project    Select project stationery     2400_Masimer  740 Cogent  8240 Sandpoint  8260 VADS   Bex FADS          H   H          H     Cancel      f  Select the project stationery        Select the project stationery for the target board and language  that you are using and click OK        PPC 4
103. addition   you can generate an S record output file for your application     For more information about the linker  see    EPPC Linker    on page  90           Targeting Embedded PowerPC PPC 27    Getting Started  Development Tools for Embedded PowerPC    CodeWarrior Debugger for Embedded  PowerPC    The CodeWarrior debugger controls the execution of your program  and allows you to see what is happening internally as your program  runs  You use the debugger to find problems in your program     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  and in   spect the contents of registers     For general information about the debugger  including all of its  common features and its visual interface  you should read the IDE  User Guide     The CodeWarrior debugger for Embedded PowerPC debugs soft   ware as it is running on the target board  It communicates with the  target board through a monitor program  such as MetroTRK  or  through a hardware protocol  such as BDM or JTAG  Hardware pro   tocols require additional hardware to communicate with the target  board  such as a Macraigor Systems Inc  Wiggler or an AMC Code   TAP or PowerTAP device     NOTE  For more information on supported debugging methods  and the target boards with which you can use them  see    Sup     ported Debugging Me
104. ain c after declaring a global variable    E main c  ojx  h o    Mm El d  Path    C  Program FilestMetrowerksiCodewWarriorS ampleProject   S ource main c      CAE SCA LI FAL ELE EP ELE EE ESE ST     f Project Stationery     ARRE E EEE EEE ER ELSE    Ebo    include  lt stdio h gt     int x     asm void system_call      nofralloc  sc  blr     void main    0  Global x   10   Variable  printf  Welcome to CodeWarrior   r n       system_call       generate a system call exception to demonstrate the       Line  20 Tal    c  Save main c by choosing File  gt  Save   d  Rebuild your project     Choose Project  gt  Debug to rebuild your project and run it again        Targeting Embedded PowerPC PPC 49    Creating a Project for Embedded PowerPC  Working with a Project    The Stack Crawl window  Figure 3 13  lists the global variable  that you added     Figure 3 13 Stack Crawl window listing new global variable              m EPPC_C_debug elf Al ES  Ext    Global Variable  and Its Yalue       Source  C  Program Files MetrowerksCodewW arrioriS am  blr    void main        x   10  g    printf   Welcome to Codelarrior iirn            PPC 50 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    e  Choose Window  gt  Watchpoints Window   The Watchpoints window appears  Figure 3 14      Figure 3 14 Empty Watchpoints window    e Watchpoints A  ES    Location Lenath Description Condition       f  Choose Window  gt  Global Variables Window   The Global Var
105. al information about certain types of information in the ELF file   For the   symtab section some of the descriptive constants are  shown with their numeric equivalents    line   debug  extab and  extabindex sections are also shown with an unstructured hex    dump     EPPC Linker    The EPPC Linker panel  shown in Figure 4 8  is where you control  settings related to linking your object code into final form  be it exe   cutable  library  or other type of code        PPC 90    Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 8 EPPC Linker panel  EPPC Linker  Link  Options Segment Addresses   Y Generate DWARF Info   Use Linker Command File  M Use Full Path Names  W Code Address     Generate Link Map T Data Address  000000000  I List Unused Objects      Suppress Warning Messages    F Small Data  000000000    F Small Data2  000000000       Heap Address  000000000    ROM    W Stack Address  MCSF ee     Generate ROM Image    6  records RAM Buffer Address   Oxfe00000  W Generate 5 Record File FROM Image Address     Max Length  Entry Point       These items in this panel are                    Generate DWARE Info Use Full Path Names  Generate Link Map List Unused Objects  Suppress Warning Messages Heap Address   Stack Address Generate S Record File  Max Length EOL Character   Use Linker Command File Code Address   Data Address Small Data   Small Data2 Generate ROM Image       Targeting Embedded PowerPC PPC 91    Targ
106. al variables are where the parameters will be stored that the  registers will point to     As an example  if you pass 4 long integers to your assembly  function  this would consume 16 bytes of the parameter area     Specifying Operands in Embedded PowerPC  Assembly    This section describes how to specify the operands for assembly lan   guage instructions  This section contain the following topics     e Using register variables and memory variables  e Using registers  e Using labels    e Using variable names as memory locations          e Using immediate operands       Using register variables and memory variables    When you use variable names as operands  the syntax you should  use depends on whether the variable is declared with or without the  register keyword  For example  some instructions like addi require  register operands  Any place that a register operand is normally  used  you can use a register variable  The inline assembler does       PPC 224    Targeting Embedded PowerPC    Listing 8 2    Inline Assembler for Embedded PowerPC  Working With Assembly    allow you to make a shortcut by using locals and arguments not de   clared register in certain instructions     Using register variables and memory variables    asm void foo register int  a          b  b  bl    int b   fralloc  lwz r4 a    lwz r4 0 a              ERROR  you must fully express the     operand of register variables     OK                lwz r4 b    OK  the inline assembler will allow you     to take
107. ally not 32 bit immediates but are vari   ables with storage  You access themjust like C variables  The startup  code now automatically handles initializing all bss type sections  and moves all necessary sections from ROM to RAM  even for user  defined sections     Deadstripping Unused Code and Data    The Embedded PowerPC linker deadstrips unused code and data  only from files compiled by the CodeWarrior C C   compiler  As   sembler relocatable files and C C   object files built by other com   pilers are never deadstripped  Deadstripping is particularly useful  for C   programs  Libraries  archives  built with the CodeWarrior  C C   compiler only contribute the used objects to the linked pro   gram  If a library has assembly or other C C   compiler built files   only those files that have at least one referenced object contribute to  the linked program  Completely unreferenced object files are al   ways ignored     When the Pool Data option is enabled on the EPPC Processor panel   the pooled data is not stripped  However  all small data and code is  still subject to deadstripping        There are  however  situations where there are symbols that you  don t want dead stripped even though they are never used  See       Linker Command Files    on page 192 for information on how to do  this        Targeting Embedded PowerPC PPC 191    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Link Order    Link order is generally specified in the Link Order view of th
108. ar platform target  such as this manual     The documentation is organized so that various chapters in this  manual are extensions of particular generic manuals  as shown in  Table 1 1  For a complete discussion of a particular subject  you may  need to look in both the generic manual and the corresponding  chapter in this Targeting manual     CodeWarrior documentation architecture       This chapter    Extends     Target Settings for Embedded PowerPC IDE User Guide          Debugging for Embedded PowerPC IDE User Guide       C and C   for Embedded PowerPC C Compilers Reference  Libraries and Runtime Code for Embed  MSL C Reference  ded PowerPC MSL C   Reference    Inline Assembler for Embedded Pow  Assembler Guide  erPC          For example  to completely understand the C C   compiler  you  need to know the information in the C Compilers Reference  which  covers the C C   front end compiler  and the information in the C  and C   for Embedded PowerPC chapter in this manual  which  covers the back end compiler that generates target specific code     Table 1 2 lists every chapter in this manual  and describes the infor   mation contained in each     Contents of chapters          Chapter Description  Introduction This chapter   Getting Started Installation and setup instructions       and an overview of CodeWarrior        Targeting Embedded PowerPC PPC 13    Introduction  About This Book       Chapter    Description       Creating a Project for Em   bedded PowerPC       Target S
109. are for specifying the address of an output  section        PPC 198 Targeting Embedded PowerPC    etext    O    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC       The psuedo functions ADDR     SIZEOF     NEXT     BIND     and  ALIGN    are supported                       TIP  Other compiler vendors also support ways that you can  specify the ROM Load address with the address_modifiers   With CodeWarrior  this information is specified in the EPPC Linker  settings panel  You may also simply specify an address with BIND                 ADDR    takes previously defined output_spec or memory_spec  enclosed in    and returns its address        SIZEOF    takes previously defined output_spec or  memory_spec enclosed in    and returns its size        ALIGN    takes a number and aligns the output_spec to that  alignment        NEXT    is similar to ALIGN  It returns the next unallocated memory  address           BIND    can take a numerical address or a combination of the above  psuedo functions     input_spec can be empty or a file name  a file name with a section  name  the wildcard   with a section name singly or in combination     When input_spec is empty  as in    all  text sections in all files in the project that aren t more specifi   cally mentioned in another input_spec are added to that  output_spec     A file name by itself means that all sections will go into the  output_spec     A file name with a section name means that the specified section  will go
110. arget processor        PPC 150 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    NOTE  The Soft Reset menu option is not available when using  MetroTRK or SDS Monitor     Hard Reset    Select the Hard Reset menu option to send a hard reset signal to the  target processor     NOTE  The Hard Reset menu option is not available when using  MetroTRK or SDS Monitor     Watchpoint Type    Select the Watchpoint Type menu option to indicate the type of  watchpoint to set from among the following menu options     e Data    A watchpoint occurs when your program writes to memory  at the watch address and the value of the data at that address  changes     e Read    A watchpoint occurs when your program reads from mem   ory at the watch address     Write    A watchpoint occurs when your program writes to memory  at the watch address     Read Write    A watchpoint occurs when your program accesses memory  at the watch address     NOTE  The Watchpoint Type menu option is available only  when using an AMC CodeTAP or PowerTAP device or an Abatron  BDI 2000 device        Targeting Embedded PowerPC PPC 151    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    Breakpoint Type    Select the Breakpoint Type menu option to indicate the type of  breakpoint to set from among the following menu options     e Software    CodeWarrior writes the breakpoint to target memory  which  is then removed when the breakpoi
111. arget system        Targeting Embedded PowerPC PPC 255    Using a CodeTAP Debugging Device  Resetting the Processor    Under certain conditions  you may find these reset commands use   ful  but you must understand how to progress from the reset state to  the point where you can resume application execution  For more in   formation on reset operations  see the user manual for your target  processor        PPC 256 Targeting Embedded PowerPC       metrowerks    11    Using the PowerTAP  6xx 7xx Debugging  Device    Using the AMC  Applied Microsystems Corporation  PowerTAP  debugging device  you can control and debug software running on  your MPC6xx and 7xx embedded system  The PowerTAP device  provides advanced emulation technology that combines with the  CodeWarrior debugger so that you can work efficiently in the same  environment throughout the entire development cycle     This chapter provides information for using the AMC PowerTAP  6xx 7xx with CodeWarrior     This chapter contains the following topics     e PowerTAP Highlights  e PowerTAP Technical Support    e PowerTAP Requirements          e Target Settings for PowerTAP    e Setting Up the PowerTAP Emulator  e Updating the PowerTAP Firmware    e Resetting the Processor  e Operational Notes             Targeting Embedded PowerPC PPC 257    Using the PowerTAP 6xx 7xx Debugging Device  PowerTAP Highlights    PowerTAP Highlights    PowerTAP provides the following hardware assisted debugging  features     e Optimal performanc
112. argeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    EPPC Target Settings  The EPPC Target Settings panel  shown in Figure 4 9  selects the    debug agent and controls how the debugger uses it to interact with  the target board  This section discusses each item in this panel     Figure 4 9 EPPC Target Settings panel  AMC CodeTAP setting options     EPPC Target Settings    Target Processor  821   860 r    Target O5  BareBoard      Hostname set in Connection Settings    or    Global Connection Settings    panels     I Use Initialization File      Reset On Connect   T Log Connection Commands  Tr    Farce hiel a on connect BW onene   W Serialize instruction execution    Poll time  ms  Breakpoint Type  f  uto      Wratchpoint Type   Data ba    Interface Clock Frequency   3 67 MHz    Show Inst Cycles  Jal ka         There are several configurations for this panel  each associated with  one of the debug agents selected in the Protocol field     e An AMC  Applied Microsystems Corporation  CodeTAP or  PowerTAP debugging device    e A Macraigor Systems Inc  Wiggler  e SDS Monitor  e Abatron BDI       Targeting Embedded PowerPC PPC 101    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Table 4 2    e MetroTRK    Depending on which option you choose from the Protocol menu   various items shown in Table 4 2 on page 102 appear in the panel        Because of the variable appearance of this panel  Table 4 2 l
113. ate with the target processor using a Macraigor System Inc   Wiggler connected to the BDM port of the target board     NOTE  The MSI Wiggler option is not available for Solaris   hosted development     e AMC PowerTAP    Selecting AMC PowerTAP configures the debugger to com   municate with the target processor using a PowerTAP device  connected to the JTAG interface of the target board        PPC 108 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    e MetroTRK    Selecting MetroTRK configures the debugger to communi   cate with MetroTRK  For more information  see    Connecting  with a Debug Monitor    on page 127 and    Using MetroTRK       on page 157    e SDS Monitor  Selecting SDS Monitor configures the debugger to communi   cate with the SDS Monitor debug monitor  For more informa   tion  see    Connecting with a Debug Monitor    on page 127     e Target Server       Selecting Target Server configures the debugger to commu   nicate with the target processor using the VxWorks operating  system  If you want to do task level debugging  choose this  protocol     e Abatron BDI    Selecting Abatron BDI configures the debugger to communi   cate with the target processor using an Abatron BDI2000 de   bugging device     For information on properly connecting the target board to the  debug agent using the selected protocol  see the following items     e    Setting Up for Remote Debugging    on page 126       e    Using a Code
114. aths        Targeting Embedded PowerPC PPC 69    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    EPPC Target    The EPPC Target panel  shown in Figure 4 3  is where you specify  the name and configuration of your final output file     Figure 4 3 EPPC Target settings panel  Application setting   A EFFE Target    Project Type   Application      File Mame  E mbedded_PPC_C  _8240 elf    Byte Ordering    Big Endian Little Endian Disable Cw Extensions    Code Model  Absolute Addressing     Small Data  Small Data   Heap Size  k   Stack Size  k        The items in this panel are        Project Type File Name   Byte Ordering Disable CW Extensions  Code Model Small Data   Small Data2 Heap Size  k    Stack Size  k  Optimize Partial Link       Deadstrip Unused Symbols Require Resolved Symbols       PPC 70 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Project Type    The Project Type pull  down menu determines the kind of project  you are creating  The options available are     e Application  e Library    e Partial Link   allows you to generate a relocatable output file  that a dynamic linker or loader can use as input    The option you choose in this pop up menu also controls the visibil   ity of other items in this panel  If you choose Library or Partial  Link  the Heap Size  k  and Stack Size  k  items disappear from this  panel because they are not relevant  Also  if you choose Partial    Link 
115. ations settings panel and the EPPC  Processor panel     Settings Panels for Embedded PowerPC    This section discusses the purpose and effect of each setting in the  panels specific to Embedded PowerPC development  These panels  are     Target Settings    EPPC Target  EPPC Assembler    Global Optimizations   EPPC Processor   EPPC Disassembler   EPPC Linker   EPPC Target Settings  Remote Debugging Options  EPPC Exceptions    Comnection Settings                   Settings panels of more general interest are discussed in other  CodeWarrior manuals  Table 4 1 lists several panels and where you  can find information about them     Table 4 1 Where to find information on other settings panels          Panel Manual   Access Paths IDE User Guide  Build Extras IDE User Guide  Custom Keywords IDE User Guide  Debugger Settings IDE User Guide       PPC 66 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC             Panel Manual   File Mappings IDE User Guide   C C   Language C Compilers Reference   C C   Warnings C Compilers Reference  Target Settings    The Target Settings window contains a Target Settings panel  The  window and the panel are not the same  The window displays all  panels  one at a time  The Target Settings panel is one of those pan   els     The Target Settings panel  shown in Figure 4 2  is perhaps the most  important panel in CodeWarrior  This is the panel where you pick  your target  When you select a linker in t
116. bb 79 604d93bd 76495951 30303083  91424060 O38e6093 30d8397f cff3ef50 D5e1507b eDr  e311 Vecbfus  5b309b0c d fceb    abf1d080 322014c0 a  8b13957 351118df ce43b73b fc3 0Dbc3 De4eDeb4 V33c5eal dleb4acd  cO amp ccOao 513cAbbe 23d4b0a8 394 fdeOb d4075d4a 7f89858b bef30009 bbDesf17  4c  Bc2al    5a3a38080 5777f3e8 pereedaDf3 Yafl1bf31 Ofdcd400 Gbbdc387 aebO4Obc ebede453 da3544b8 x         L Disabled  L1 Unlocke f  Sorted by  Line ua    E  He    D  o  D  o  1  1  1  1  2  2  2  2  3  3  3  3  4  4  4    mn e 0 UYn E O Y mn E O Y mn E O yn O  DODODODOoOoOooooooooo  oonoroononroonnroonnrnonnnOr       Both AMC cache displays show the following items   e Cache line number   Address tag   Cache way   Valid bit   LRU  least recently used  designator    Figure 5 20 shows the buttons in the L1 Instruction Cache window        Targeting Embedded PowerPC PPC 153    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    Figure 5 20 Buttons in the L1 Instruction Cache window    Enable Disassemble Text Search    Valid Lines  Invalidate Sort by Way Update  Lock Context    Help             fi L1 Instruction Cache  8260     cpg pg ppp es    Slt Allway           vie  X   eT ali a tal al seat  eo    78978000 efd109d8 f6170931 59f7a578   cabebac    f6dbEDDO f f500ee3 ecdedait fca f32c aa4340fb t  334e 7000 DO d914la5f be395ed8 f7132b61 ecfe 533 j    caf23nAn n agaran   u2nA2n 42 AGUsATTA 333732101        ooo  suen   oo  300k    a    The cache display can be filtered by cach
117. bedded Pow   erPC    on page 66  After selecting any other needed target settings   you can download and execute your code        Connecting with Abatron BDI2000    To connect your host machine and target board     Connect the Abatron BDI2000 device with the serial port on your  host machine using a serial cable  or connect the Abatron BDI2000  device to your network using an Ethernet cable     Plug in the Abatron BDI2000 device so that it has power   Plug the BDM cable into the BDM port on the board     Ensure that the BDM connector is inserted correctly  Align the red  stripe with pin 1 of the BDM port        Targeting Embedded PowerPC PPC 143    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    4  Display the EPPC Target Settings panel  Figure 5 15  and select  several settings as described by the following steps     Figure 5 15 EPPC Target Settings panel with Abatron BDI selected  A EPFC Target Settings    Target Processor   Ex bd      Target 05  BareBoard T Protocol  4batron BOI    Set serial preferences in    Connection Settings  panel   _f  Use Initialization File    Initialization File     Abatron_Debug_Init cft Browse            Reset On Connect Connection   Serial x      Breakpoint Type  f  u to x    Watchpoint Type   Data ka         a  From the Target Processor menu  select the processor for  which you are developing     b  From the Protocol menu  select Abatron BDI     c  If you are using a debug initialization file  select the Use Ini   tializati
118. bit Microprocessors  Publishing information about this  book can be found in    Where to Go from Here    on page 15           PPC 148 Targeting Embedded PowerPC    Debugging for Embedded PowerPC    Special Debugger Features for Embedded PowerPC    If you are developing for AltiVec  you also can display the vector  registers by selecting Window  gt  Registers Window  gt  VR  Figure  5 18 shows the VR window        VAsave OsDO000000    Figure 5 18 VR window  DRFFF7EBFF OxFFFFFFFF OxFFFFFFFF OnFFFFFFFF  O FDFFFFF6 DXFFBFAFFF DRFFFFFFFF DRFPFFFFFFF  D  FSFFFFFF DXFPFFFFFEF DRFFFFFFFF DRFFFFFBFF  O FFFFFBDF OxFFFFFFFF O FFFFFEFF OnFFFFFFFF  O FFFBFBFF O2BFFFFFFF O   E FFFFFFF OnFFFFFFFF  DRPFFFFFFF OxBFFFSFFF DRFFFFFFFF DRPFFFFFFF  DRPFFFFFFF OxFFFFF FFE O FFFFFFDF OxFFFFFFFF  O   FFFFFFFY DXFFBFFFFF DRFFFFBFFF DRFPFFFFFFF  O FDFFFFB  O  BFFFEFFD DRFFFFFFFF DZFFF7DEFFE  D  FDFFFBFF DXFFDFFEFF D  FFFFFFFF DRPFFFFFFF  O FCEEFFFF OzFFFFFFFF O FFFFFFFF DRPFFFFFFF  D  FPFFEFBFF OxFFFFFFFA O FFFFFF SF OxFFFFFBFF  O FFFAFEFF O   BFFFFFFF O DEFFFFFF DRFPFFFFFFF  O DDFFFBFE DXFFBFFFFF DRFFFFFFFF DEFPFFFFFFF  DxEFBFFFFF OxBIFFFFFF DRFFFFFFFF DRFFEFFFFF  O  FFFEFFDF O  BFBFBFFF D  FFFFFFFF DRPFFFF7FF  OF SF FFFFF OxFFDOFFFFF DRFFFFFFFF DRPFFFFFFF  D  FBBFFOF  Ox  FFFFFFF DRFFFZFFFF DRPFFFFFFF  DRFFFFFFFD DXFFFBFFFF DRFFFFFFFF DZFPFFFFFFF  O  DFFFFFFF OxFFFFODFF DRFFFFFFFF DRFPFFFFFFF  O FDFFFFFD OxFFFFFFFF O FFFEFF FF OnFFFFFFFF  O EFFEFDFF O2FDFFFFFF DRFFFFFFFF DRFFFBDIFFF  DAPFFFFFFF OxBEA
119. ble for boards with less RAM For other  boards  please see the stationery projects for examples with suitable  addresses     NOTE  To enter a hexadecimal address  use the format  0x12345678   where the address is the 8 digits following the  character    x         Data Address    The Data Address edit field specifies the location in memory where  the global data of the program resides     If you wish to specify a specific data address  enable the checkbox  and type an address in the edit field  You must specify the address  in hexadecimal notation  The possible addresses depend on your  target hardware platform and how the memory is mapped  Data  must reside in RAM     If you disable the checkbox  the linker calculates the data address to  begin immediately following the read only code and data   text    rodata  extab and extabindex      Small Data    The Small Data edit field specifies the location in memory where  the small data section resides  For more information about the small  data section  see    Small Data    on page 72           Targeting Embedded PowerPC PPC 97    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    If you wish to specify a specific small data address  enable the  checkbox and type an address in the edit field  You must specify the  address in hexadecimal notation  using a format of 0x12345678    The possible addresses depend on your target hardware platform  and how the memory is mapped  All types of data must reside in  R
120. bly    Special Embedded PowerPC Instructions    To set the branch prediction  y  bit for those branch instructions that  can use it  use   or      For example     1 bnet  2    Predicts branch taken   2 bne  f1    Predicts branch not taken    Most integer instructions have four different forms   e normal     e record  which sets register cr0 to whether the result is less   than  equal to  or greater than zero  This form ends in a peri   od               e overflow  which sets the SO and OV bits in the XER if the re     MN a    sult overflows  This form ends in the letter    o        e overflow and record  which sets both registers  This form  ends in    o        add r3 r4 r5    Normal add   add  r3 r4 r5    Add with record  sets cr0   addo 1r3 r4 r5    Add with overflow sets XER   addo  r3 r4 r5    Add with overflow and record  sets cr0 and XER       Some instructions only have a record form  with a period   Make  sure to include the period always     andi  13 r4 7        is not optional here  andis  r3 r4 7    Or here  stwex  r3 r4 r5    Or here    Support for AltiVec Instructions    The full set of AltiVec assembly instructions is now supported in  your inline assembly code  For more information  see AltiVec  Technology Programming Interface Manual  available from Motorola   Inc   and    Where to Go from Here    on page 15        PPC 220 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Working With Assembly    NOTE  You would have to specify the machine a
121. breakpoint resources most effectively  Software breakpoints apply only to code lo   cated in RAM  Hardware breakpoints use the on chip breakpoints of the processor  You can set hardware  breakpoints in RAM or ROM       For more information  see Emulator Installation Guide  which is available from AMC  This document de     scribes how to establish Ethernet communications  assign host names and IP addresses  and update the network    databases     NOTE  Watchpoints are available only when using CodeTAP  8xx systems     Setting Up the CodeTAP Emulator    To set up the CodeTAP emulator     Establish communications between the host machine where the  debugger is running and the CodeTAP device     For more information  see Emulator Installation Guide  available from  AMC    Connect to the target board     To learn how to establish a connection with the target  see    Con   necting to a Target    in Emulator Installation Guide  available from  AMC      NOTE  You can check for any AMC application notes at     http   www amc com    You optionally can use a debug initialization file to perform initial  configuration of the target processor  target system  and CodeTAP    4    device  For more information  see    Debug Initialization Files    on  page 289        PPC 254    Targeting Embedded PowerPC    Using a CodeTAP Debugging Device  Updating the CodeTAP Firmware    Updating the CodeTAP Firmware    The CodeTAP device stores its core software in flash memory on the  target board  This c
122. bug initialization files  refer to  text files in the following directory            CodeWarrior directory   CodeWarrior PowerPC_EABI_Support Config    This section contains the following topics     Debug Initialization File Command Syntax  CodeTAP Commands   PowerTAP Commands   Macraigor Wiggler Commands   Abatron BDI2000 Commands  AMCMemkeadDelayCycles  AMCMenWriteDelayCycles  AMCMemWriteVerify    AMCRegWriteVerify  AMCTargetInterfaceClockFreq  AMCTargetSerializelnstExec  AMCTargetShowInstCycles  initregs   polltime   setMMRBaseAddr    writedcr                      writemem b  writemem l  writemem w  writemmr  writereg  writespr  writeupma  writeupmb       Targeting Embedded PowerPC PPC 295    Debug Initialization Files  Debug Initialization File Commands    Debug Initialization File Command Syntax  The following list shows the rules for the syntax of debug initializa   tion file commands   e Any white spaces and tabs are ignored   e Character case is ignored in all commands   e You can enter a number in hex  octal  or decimal       Hex   preceded by Ox  0x00002222 OxA OxCAfeBeaD       Oct  preceded by 0  0123 0456       Dec   starts with 1 9  12 126 823643        sy    e Comments start with a         or          and continue to the end of  the line     CodeTAP Commands    Table B 1 lists the debug initialization file commands supported for  the CodeTAP device  the page number where you can read the de    scription of the command  and any applicable settings information   f
123. cate any particular function   mark any location within a file  or go to a specific line of code     Compiling    To compile a source code file  it must be among the files that are  part of the current build target  If it is  you simply select it in the  project window and choose Compile from the Project menu     To compile all the files in the current build target that have been  modified since they were last compiled  choose Bring Up To Date in  the Project menu     In UNIX and other command line environments  object code com   piled from a source code file is stored in a binary file  a     o    or     obj     file   The CodeWarrior IDE stores and manages object files transpar   ently     Linking    Linking object code into a final binary file is easy  use the Make  command in the Project menu  The Make command brings the ac   tive project up to date  then links the resulting object code into a  final output file     You control the linker through the IDE  There is no need to specify a  list of object files  The project manager tracks all the object files auto   matically  You can use the project manager to specify link order as  well        Targeting Embedded PowerPC PPC 31    Getting Started    The Development Process with CodeWarrior    Use the EPPC Target settings panel to set the name of the final out   put file     Debugging    To tell the compiler and linker to generate debugging information  for all items in your project  make sure Enable Debugger is selected  in th
124. ces from the Edit menu to see the PPCComUtil  preferences panel  Figure A 4         PPC 270 Targeting Embedded PowerPC    Flash Programmer  What You See    Figure A 4 PPCComuUtil Preferences panel    PPCComUtl Preferences    Connection Settings    Protocol    OnCEaohi    Parallel Port   LPT1      BOM Settings       BOM Port   Parallel    fA  Log Output    Reset Command File     Flash Program Command File     This is where you specify the BDM settings for the connection be   tween your computer and the board   The options in this panel include   e BDM Port  e Log Output  e Log Output  e Flash Program Command File  BDM Port  The BDM Port pop up menu selects the port that your computer    uses to communicate with the BDM emulator  The connection  choice is        Targeting Embedded PowerPC PPC 271    Flash Programmer  What You See    e Parallel  Log Output  When Log Output is enabled  all output is written to a log file   Reset Command File    The Reset Command File field allows you to select your debug ini   tialization file  The debug initialization file allows you to set up the  memory configuration and system registers for your target board   The Change button allows you to browse your hard drive to specify  a settings file     When you select Run Reset Command File from the BDM menu   this file is executed     NOTE  Itis useful to use PPCComuUtil to debug your debug ini   tialization file before using it with the debugger     WARNING  To make sure your program runs as you i
125. come to Codelarrioriirn    I      syste      generate a system call exception to demons    Pe    TIP  You also can debug a project by clicking the Run Debug  button  the arrow icon  in the Project window     For more information  see    Debugging for Embedded PowerPC    on  page 123           Targeting Embedded PowerPC PPC 47    Creating a Project for Embedded PowerPC  Working with a Project    7  Seta breakpoint     In the Stack Crawl window  scroll the code to the main    function  and click the gray dash in the Breakpoint column  next to the first  line of code in the main    function  A red marker appears  Figure  3 11      Figure 3 11 Stack Crawl window after setting a breakpoint    um EPPC_C_debug elf Al ES    rPaxtand    o Variables  All  po dana vanishes       nofralloc  sc  blr        Breakpoint   void main     Marker e          printf   Welcome to Codellarrior inrwn     system_call       generate a system call exception to demons    while  1            loop forever    TIP  You also can set a breakpoint by clicking in the Breakpoint  column of the Editor window next to a valid line of code     You successfully set a breakpoint  Keep the Stack Crawl window  open to set a watchpoint        PPC 48 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    8  Seta watchpoint   a  Kill the program by choosing Debug  gt  Kill     b  In main c  declare a global variable and assign a value to the  variable  Figure 3 12      Figure 3 12 m
126. cribes the Metrowerks Standard Libraries  MSL   that have been modified for use with Embedded PowerPC   CodeWarrior for Embedded PowerPC includes the source and  project files for MSL so that you can modify the libraries if neces   sary        Targeting Embedded PowerPC PPC 207    Libraries and Runtime Code for Embedded PowerPC  MSL for Embedded PowerPC    The topics in this section are     e Using MSL for Embedded PowerPC  e Using Console I O for Embedded PowerPC    e Allocating Memory and Heaps for Embedded PowerPC          Using MSL for Embedded PowerPC    CodeWarrior for Embedded PowerPC includes a version of the  Metrowerks Standard Libraries  MSL   MSL is a complete C and  C   library you can use in your embedded projects  All of the  sources necessary to build MSL are included in CodeWarrior for  Embedded PowerPC  along with the project files for different con   figurations of MSL  If you already have a version of CodeWarrior  installed on your computer  the CodeWarrior installer will include  the new files needed for building versions of MSL for Embedded  PowerPC     To use MSL  you must use a version of the runtime libraries dis   cussed in    Runtime Libraries for Embedded PowerPC    on page 212   You should not have to modify any of the source files included with  MSL  If you have to make changes based on your memory configu   ration  you should make the changes to the runtime libraries        Console I O    MSL for Embedded PowerPC supports console I O through the
127. cts generate binary files in the ELF  format  You can create three different kinds of projects  application  projects  library projects  and partial linking projects     The only difference between the application projects and library  projects is that an application project has associated stack and heap  sizes  a library does not  A partial linking project allows you to gen   erate an output file that the linker can use as input     Project Stationery    CodeWarrior provides project stationery for Embedded PowerPC  projects  Project stationery are templates that describe pre built       Targeting Embedded PowerPC PPC 33    Creating a Project for Embedded PowerPC    Project Stationery    Figure 3 1    projects  complete with source code files  libraries  and appropriate  compiler and linker settings     Project stationery helps you get started very quickly  When you cre   ate a project based on stationery  the stationery is duplicated and be   comes the basis of your new project     This section contains the following topics     e Creating a Project  e Project Stationery Targets    Creating a Project    To create a project from project stationery   Choose File  gt  New     The New window appears  Figure 3 1      New window    Project   File   Object              B Empty Project Project name    Java Applet Wizard  newtestl    dB Java Application Wizard   1  Java Bean Wizard Location      PowerParts Application Wizard  CA newtest  Set       dey PowerParts Component Wizard   fi 
128. d Symbols      2    2 a 190  Deadstripping Unused Code and Data            191  TIPICO ts 192  Linker Command Files                 0484 192   _ attribute   aligned            ata id Sailer    203  Variable Declaration Examples               2   203  Struct Definition Examples        a a a a 04  204  Typedef Declaration Examples                  204  Struct Member Examples          a a a a a 205       Targeting Embedded PowerPC PPC 5    7 Libraries and Runtime Code for Embedded PowerPC 207    MSL for Embedded PowerPC     oa a a a a a    207  Using MSL for Embedded PowerPC             208  Using Console I O for Embedded PowerPC           209  Allocating Memory and Heaps for Embedded PowerPC      212   Runtime Libraries for Embedded PowerPC           212   Board Initialization Code                    214   8 Inline Assembler for Embedded PowerPC 215   Working With Assembly      ra A ee 216  Assembler Syntax for Embedded PowerPC           216  Special Embedded PowerPC Instructions           220  Support for AltiVec Instructions         2    0    220  Creating Labels for Embedded PowerPC Assembly          221  Using Comments in Embedded PowerPC Assembly        221  Using the Preprocessor in Embedded PowerPC Assembly     222  Using Local Variables and Arguments                222    Creating a Stack Frame in Embedded PowerPC Assembly     223  Specifying Operands in Embedded PowerPC Assembly     224    Assembler Directives       2    1 we eee e      o  230  EUA a api    Se  BU  GR 
129. d for a specified interval  which is in milli   seconds     sleep  lt interval gt     This command doesn t have to be inside startProgramLoop and  endProgramLoop block     This command will cause PPCComUtil to suspend the execution for  5000 milliseconds        PPC 286 Targeting Embedded PowerPC    Flash Programmer  Command File Syntax    NOTE  The Sleep command is very useful when waiting is nec   essary for a device to finish a particular operation  For example   flash chip AM29F040 takes about 10 seconds to finish erasing        Targeting Embedded PowerPC PPC 287    Flash Programmer  Command File Syntax       PPC 288 Targeting Embedded PowerPC    B       metrowerks o Debug Initialization  Files    A debug initialization file contains a set of commands that initialize  the target board to write the program to memory when it is  launched by the debugger  This chapter explains how you can use  debug initialization files with the     e Applied Microsystems Corporation  AMC  PowerTAP de   bugging device  e AMC CodeTAP debugging device    e Macraigor Systems Inc  Wiggler  Hummingbird  or Raven  debugging devices    e Abatron BDI2000    This appendix contains the following topics     e Using Debug Initialization Files  e Proper Use of Debug Initialization Files  e Debug Initialization File Commands    Using Debug Initialization Files    A debug initialization file is a command file processed during  Debug launch and each time Hard Reset is selected in the Debug  menu  A debug ini
130. ddresses are declared as follows    unsigned char _f_text       you can treat __f_text just like a C variable even though it is a 32   bit immediate value        unsigned int textsize   _e text _f text     The linker generated symbols in versions prior to CodeWarrior for  Embedded PowerPC Release 3 have different names  If you have  source that depends on the older names that you can t change  you  will need to link with something similar to the default  1cf file   That linker command file has aliases to all of the older symbol  names     If you do have to have linker symbols that are not addresses  you  can access them from C  see Listing 6 5     Listing 6 5 How to access linker symbols that are not addresses  unsigned int size    unsigned int   amp _text_size   Exceptions Beginning with CodeWarrior for Embedded PowerPC Release 3  the    linker generates three new symbols   e _ sinit    rom_copy_info          PPC 190 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    bss_init_info       _ Sinit no longer exists as a function in __start candis  wholly constructed by the linker     rom_copy_infoisan array of a structure that contains all of the  necessary information about all initialized sections to copy them  from rom to ram        bss_init_info isa similar array that contains all of the infor   mation necessary to initialize all of the bss type sections  Please see      init data in start c        These three symbols are actu
131. de A Mads Newt Ray ae A A 230  DAME BS A  ae ae AA BS ee a 231  A BG A Bs ee a Be Bh cot a Se LG gs 231  machines  Le ts eo SB 232  Nofralloc  a nar a ta Ge a vs A a ai a i 234  OPWOrd a 00d Ros e Ee dl ADA 234   Intrinsic Functions      macaco a de e a 234  Low Level Processor Synchronization             235  Floating Point Functions        2    0          236  Byte Reversing Functions        2               236  Setting the Floating Point Environment            237  Manipulating the Contents of a Variable or Register          237  Data Cache Manipulation                       238  Math Functions a a Se ar 239  Buffer Manipulation     3 2 a a a AA 240       PPC 6 Targeting Embedded PowerPC    AltiVec Intrinsics Support                    240    9 Troubleshooting for Embedded PowerPC 243  No Communications with Target Board               243   Downloading Code Fails or Crash When Code Runs          244   Debugger Window Does Not Appear                245   Common Error Warnings for CodeTAP and PowerTAP        245   Targeting BDM Devices FAQ      2    2    2 we  246   10 Using a CodeTAP Debugging Device 249  Godel Ar Highlights    ao ta Edd    87 3  a Sore A 250   CodeTAP Technical Support         2    a we 251   Code TAP Requirements 4 1 42 4 AA a 252   Target Settings for CodeTAP             002  252   Setting Up the CodeTAP Emulator            2   254   Updating the CodeTAP Firmware               255   Debugging Using CodeTAP  a  ira dl ld eae se 255   Resetting the Process
132. ded Pow   erPC    on page 66  After selecting any other needed target settings     you can download and execute your code        Connecting with Raven COP    To connect your host machine and target board    Connect the Raven COP to the parallel port on your host machine   Plug in the Raven COP so that it has power    Plug the COP cable into the COP port on the board     Display the EPPC Target Settings panel  Figure 5 14  and select  several settings as described by the following steps     Se    Figure 5 14 EPPC Target Settings panel for Raven COP  EPPC Target Settings    Target Processor  8240 x    Target os  B areBoard ka    Protocol MSI Wiggler    W Use Initialization File    Initialization File   Raven_D ebug_Initcfd Browse         lett J T Log Connection Commands    Device Raven 2     wigglers log       file          PPC 142 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    a  From the Target Processor menu  select the processor for  which you are developing     a  From the Protocol menu  select MSI Wiggler     b  If you are using a debug initialization file  select the Use Ini   tialization file checkbox and type the name of the file in the  Initialization File field     c  From the Parallel Port menu  select the parallel port to  which you connected your parallel cable     d  From the Device menu  select Raven   Select any other needed target settings for your project     For more information  see    Settings Panels for Em
133. devices and Motorola 505   509 or 555 processors only     This edit field allows you to specify a starting address of a scratch  space  used to read in the FPU registers  The space is 8 bytes long  and must be located in valid RAM     The scratch space is used to read  save  and later restore the FPU  registers  This means that the FPU Buffer Address can be in the mid   dle of your code or data if you need it to be        PPC 104 Targeting Embedded PowerPC    Windows    Solaris    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Initialization File    Use the Initialization File field to specify your debug initialization  file  which configures your target board for BDM or JTAG when the  debugger establishes communications with the target hardware   You can use the Browse button to browse your hard drive to locate  the initialization file  The file you select allows you to set memory  and registers for your target  You also can edit text in this field by  clicking in the field and typing     NOTE  Selecting a debug initialization file is mandatory for all  BDM targets     The following directory contains several debug initialization files               CodeWarrior Directory   PowerPC_EABI_Support   Initialization_Files                     CodeWarrior Directory  PowerPC_EABI_Support   Initialization_Files           NOTE  The Config FAQ txt file  which answers common  questions about initialization files  also resides in the preceding di   rectory  
134. e       Split second single step execution        Up to 2 MB per minute code download time from Power   TAP to target    e Control and debug software running on a target board  with  minimal intrusion to the operation of the target board    Crash proof control of the processor for all speed grades and  variants supported by the Common Onchip Processor  COP   of the PowerPC         Obtain and modify register contents       Display and modify memory        Control instruction execution        Run stop step reset         Examine and debug the contents of the data or instruction  cache of the processor   For more information  see    AMC  Data and Instruction Cache Windows    on page 152         Rapid deployment of COP drivers for new processors or  mask revisions    Powerful C C   symbolic debugger with integrated inter   face to all subsystems of PowerTAP    Quiescent Acknowledge  QACK  tied low for simple target  connection for 603E and EC603E processors  eliminates tying  QACK low on target    Telnet access to the serial port of the target board  interact  with serial target port over the network    Trigger in trigger out for synchronization with external de   vices       PPC 258 Targeting Embedded PowerPC    Using the PowerTAP 6xx 7xx Debugging Device  PowerTAP Technical Support    PowerTAP Technical Support    Table 11 1    AMC provides first line technical support for all PowerTAP sys   tems equipped with CodeWarrior  Contact AMC for technical assis   tance with both the Po
135. e   sdata2    sbss2  data_mode sda_rel code_mode pc_rel  pragma section   EMB PPC sdata0    EMB PPC sbss0  data_mode sda_rel code_mode pc_rel  pragma section RX   init    init  data_mode far_abs code_mode pc_rel    NOTE  The  EMB PPC sdata0 and  EMB PPC sbss0 Sec   tions are predefined as an alternative to the sdata_type object  type  The  init section is also predefined  but it is not a default  section  The  init section is used for startup code           Targeting Embedded PowerPC PPC 187    C and C   for Embedded PowerPC    Pragmas    Forms for  pragma section    This pragma has these principal forms      pragma section   namel     This form simply creates a section called  namel if it does not al   ready exist  With this form  the compiler does not store objects in  the section without an appropriate  subsequent  pragma section  statement or an item defined with the __decl1spec keyword  If  only one section name is specified  it is considered the name of the  initialized object section  iname  If the section is already declared   you may also optionally specify the uninitialized object section  un   ame  If you know that the section must have read and write permis   sion  use  pragma section RW  namel instead  especially if you  use the __declspec keyword      pragma section objecttype   name2     With the addition of one or more object types  the compiler stores  objects of the types specified in the section  name2  If  name2 does not  exist  the compiler creates it wit
136. e   to a specific unal   located address or just do alignment as the example shows  The gap       Targeting Embedded PowerPC PPC 201    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    etext    etext              is filled by default with 0  in the case of an alignment  but not with  ALIGN            You can specify an alternate fill with    lt short_value gt  asin         0x20       0x20     text      OxAB  gt  text    short_value is 2 bytes long  Note that the fill pattern comes be   fore the memory_spec  You can add a fill to a GROUP or to an indi   vidual output_spec section  Fills can t be added between BSS type  sections  All calculations must end ina             Symbols    You can create symbols that you can use in your program by assign   ing a symbol to some value in your linker command file     _foo_start         text  _foo_end        gt  text    In the example above  the linker generates the symbols  _foo_start and _foo_end as 32 bit values that you can access in  your source files  _foo_start is the address of the first byte of the    text section and __foo_end is the first byte after the last byte of  the  text section     You can use any of the psuedo functions in the  address_modifiers in a calculation     The CodeWarrior linker automatically generates symbols for the  start address  the end address  the first byte after the last byte of the  section   and the start address for the section if it will be burned into  ROM  For a section   foo
137. e  Project window  For general information on setting link order  see  the IDE User Guide     Regardless of the link order specified in the Link Order view of the  Project window  the Embedded PowerPC linker always processes  C C    assembler source files  and object files   o  before it pro   cesses archive files   a   which are treated as libraries  Therefore  if a  source file defines a symbol  the linker uses that definition in prefer   ence to a definition in a library     One exception exists  The linker uses a global symbol defined in a li    brary in preference to a source file definition of a weak symbol  You   can create a weak symbol with  pragma overload  See  ppc_eabi_init c or__ppc_eabi_init cpp for examples           The Embedded PowerPC linker ignores executable files that are in  the project  You may find it convenient to keep the executable there  so that you can disassemble it  If a build is successful  the file will  show up in the project as out of date  there will be a check mark in  the touch column on the left side of the project window  because it  is a new file  If a build is unsuccessful  the IDE will not be able to  find the executable file and will stop the build with an appropriate  message     Linker Command Files    Linker command files are an alternative way of specifying segment  addresses  The other method of specifying segment addresses is by  entering values manually in the Segment Addresses area of the  EPPC Linker settings panel     Only
138. e  sections to assist in copying them        Targeting Embedded PowerPC PPC 99    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC     CodeWarrior       See the file              Directory  PowerPC_EABI_Support Runtime Inc     ppc_eabi_linker h       for an explanation of linker generated symbols created for ROM ad   dresses     NOTE  Not all flash programs require that a buffer address be  specified  For example  MPC8BUG requires a buffer but the  CodeWarrior Flash Programmer does not  If you don t need a  buffer  it is very important that you set the buffer address to be  identical to the ROM Image Address     ROM Image Address    The ROM Image Address edit field allows you to specify the ad   dress where you want your program to load in ROM     NOTE  In previous versions of CodeWarrior for Embedded Pow   erPC  Release 2 and earlier   you were required to enter the  image address in the Code Address edit field  Now  the Code Ad   dress and ROM Image Address fields can be different  therefore   you can copy the text section to RAM     Entry Point    The Entry Point edit field specifies the function that the linker uses  first when the program launches  This is the starting point of the  program     The default __start function is bootstrap or glue code that sets up  the PowerPC EABI environment before your code executes  This  function is in the ___start c file  The final task performed by   __ start is to call your main    function        PPC 100 T
139. e C Programming Language  Second Edi   tion  Prentice Hall  by Kernighan and Ritchie  These references  show you where to look for more information on the topics in the  corresponding sections        Targeting Embedded PowerPC PPC 167    C and C   for Embedded PowerPC  Integer Formats    Table 6 1 lists other useful compiler and linker documentation     Table 6 1 Other compiler and linker documentation       For this topic    Refer to       How CodeWarrior implements  the C C   language    Using C C   Language and  C C   Warnings settings pan   els    Controlling the size of C    code    Using compiler pragmas    Initiating a build  controlling  which files are compiled  han   dling error reports    Information about a particular  error    Embedded PowerPC assembler    C Compilers Reference    C Compilers Reference     Setting  C C   Compiler Options     chapter    C Compilers Reference     C   and  Embedded Systems    chapter    C Compilers Reference     Pragmas  and Symbols    chapter    IDE User Guide     Compiling  and Linking    chapter    Error Reference  which is avail   able online    Assembler Guide       Integer Formats    This section describes how the CodeWarrior C C   compilers im   plement integer and floating point types for Embedded PowerPC  processors  You also can read limits  h for more information on  integer types  and float  h for more information on floating point  types  The altivec h file provides more information on AltiVec    vector data formats    
140. e ELF  CodeWarrior does not au   tomatically remove the deleted files from the corresponding project   For the project to include only the current files  you must manually  delete the files that no longer apply to the ELF from the project     Recreating an ELF created project    To recreate a project that you previously created from an ELF file   1  Close the project if it is open   2  Delete the project file     The project file has the file extension  mcp and resides in the same  directory as the ELF file     3  Drag the ELF file to the IDE     CodeWarrior opens a new project based on the ELF file        PPC 166 Targeting Embedded PowerPC    metrowerks             6  C and C   for  Embedded PowerPC    This chapter describes the Metrowerks back end compiler and  linker for Embedded PowerPC     The back end of the compiler refers to the module that actually gen   erates code for the target processor  Front end refers to the module  that parses and interprets the source code     The sections in this chapter are     e Integer Formats  e Data Addressing       e Calling Conventions       e Register Variables    e Register Coloring Optimization  e Generating Code for Specific Processors    e Pragmas  e Linker Issues for Embedded PowerPC    e _ attribute   aligned                  For more information about code generation issues in other  CodeWarrior manuals  see Table 6 1     This chapter contains references to K amp R 8A  This refers to Appendix  A     Reference Manual     of Th
141. e Project menu     If you want to only generate debug information on a file by file ba   sis  click in the debug column for that file  The Debug column is lo   cated in the project window  to the right of the Data column     When you are ready to debug your project  choose Debug from the  Project menu     For more information on debugging  refer to the IDE User Guide  For  information specific to Embedded PowerPC debugging  see    De   bugging for Embedded PowerPC    on page 123        Viewing Preprocessor Output    To view preprocessor output  select the file in the project window  and choose Preprocess from the Project menu  A new window ap   pears 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 ex   pansion or other subtleties of the preprocessor        PPC 32 Targeting Embedded PowerPC    3       za  Creating a Project  for Embedded  PowerPC    This chapter gives an overview of the steps required to create  com   pile  and link code that runs on Embedded PowerPC embedded sys   tems     This chapter includes the following topics     e Types of Projects   the different kinds of projects you can  build with CodeWarrior    e Project Stationery   how to quickly create a project from tem   plates and use provided project stationery targets to flash  your program to ROM       e Working with a Project   how to run and debug a project       Types of Projects    All Embedded PowerPC proje
142. e UART  driver library  If needed  add the libraries and rebuild the project  In  addition  you must have a free serial port  besides the serial port  that connects the target board with the host machine  and be run   ning a terminal emulation program     4  On the EPPC Target Settings panel  Figure 5 1   select SDS Moni   tor or MetroTRK from the Protocol menu     Figure 5 1 EPPC Target Setting panel with MetroTRK selected       EPPC Target Settings    Target Processor  555 x     Target Os   BareBoard    Protocol        Set serial preferences in    Connection Settings    or    Global Connection Settings    panel        F Log Connection Commands       For more information  see    Protocol    on page 108        PPC 130 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    5  On the Connection Settings panel  Figure 5 2   select View Serial  Settings from the View Connection Type menu     Figure 5 2 Connection Settings panel with View TPC IP Settings selected    Connection Settings  View Connection Type   view Serial Settings ka       Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Primary  Serial Port Options    Port   CO ae hd   Parit   N one ka    Riate  115200    Stop Bits   lt    Data Bits   e bd Flow Control  JH ardware  ATS CTS          Log Serial Data to Log Window Use Global Connection Settings    Secondary Serial Port Options    Port  CO Mi  x   Parity   N one x    Fia
143. e checkbox determines whether the disas   sembler lists the symbol table for the module that was disassem   bled     Show Code Modules    The Show Code Modules checkbox determines whether the disas   sembler outputs the ELF code sections for the module that was dis   assembled     Use Extended Mnemonics    The Use Extended Mnemonics checkbox determines whether the  disassembler lists the extended mnemonics for each instruction for  the module that was disassembled     Only Show Operands and Mnemonics    The Only Show Operands and Mnemonics checkbox determines  whether the disassembler lists the offset for any functions in the  module that was disassembled     Show Data Modules    The Show Data Modules checkbox determines whether the disas   sembler outputs any ELF data sections  such as  rodata and   bss  for the module that was disassembled     Disassemble Exception Tables    The Disassemble Exception Tables checkbox determines whether  the disassembler outputs any C   exception tables for the module  that was disassembled     Show DWARF Info    Show DWARF Info informs the disassembler to include DWARF  symbol information in the disassembled output        Targeting Embedded PowerPC PPC 89    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Relocate DWARF Info    The Relocate DWARF Info checkbox relocates object and function  addresses in the DWARF information     Verbose Info    The Verbose Info checkbox tells the disassembler to show addi   tion
144. e factory default settings        Table E 2 lists the tested dipswitch setting for the Cogent CMA278  daughtercard     Cogent CMA278 daughtercard dipswitch settings          Dipswitch Location Setting  SW2 Set 6 and 8 to OFF  All others are  ON     For more information  see the following documents     e CMA102 Motherboard User s Manual by Cogent Computer  Systems  Inc     e CMA278 PPC60x 740 User s Manual by Cogent Computer  Systems  Inc        PPC 318 Targeting Embedded PowerPC    Tested Jumper and Dipswitch Settings    IBM 403 EVB    Table E 3 lists the tested jumper settings for the IBM 403 EVB target    board     IBM 403 EVB    Table E 3 IBM 403 jumper settings          Jumper Locations Settings   J3 1 2 CLOSED   J4 1 2 CLOSED   J5 1 2 CLOSED   J6 1 2 CLOSED   J7 1 2 CLOSED   J8 9 Use the factory defaults   J10 1 2 OPEN   J11 1 2 OPEN       Motorola MPC 505 509 EVB    Table E 4 lists the tested dipswitch and jumper settings for the Mo   torola MPC 505 509 EVB target board     Table E 4 Motorola MPC 505 509 EVB dipswitch and jumper settings       Dipswitch and Jumper Locations    Settings       DS1    DS2  reset configuration word     DS3  DS4  DS5    All set to ON    Set 1 and 2 to ON  All others are OFF   Set 5 and 7 to ON  All others are OFF   Set 3  6 and 8 to ON  All others are OFF   Set 2  4  5  6 to ON  All others are OFF        Targeting Embedded PowerPC PPC 319    Tested Jumper and Dipswitch Settings  Motorola 555 ETAS       Dipswitch and Jumper Locations    Setti
145. e is optional     There are two additional keywords besides pixel and vector   __ pixel and __vector  These keywords can be used in C or C    code     bool is not a reserved word in C unless it is used as an AltiVec  vector data type     For more information  see AltiVec Technology Programming Interface  Manual  available from Motorola  and    Where to Go from Here    on    page 15     Data Addressing    int foo   int foobar   void bar      You can increase the speed of your application by selecting different  EPPC Processor and EPPC Target settings that affect what the com   piler does with data fetches        In absolute addressing the compiler normally generates two instruc   tions to fetch the address of a variable  For example        Targeting Embedded PowerPC PPC 171    C and C   for Embedded PowerPC                         Data Addressing     foo   1   foobar   2       becomes something like    li opl   lis r4 fooftha  lt    load the high 16 bits into r4   addi r4 r4 foo l  lt    add the low 16 bits to r4   stw r3 0 r4   lt    4 instructions to assign 1 to foo   li r572   lis r6 foobar ha  lt    load the high 16 bits into r6   addi r6 r6 foobar l  lt    add the low 16 bits to r6   stw r5 0 1r6   lt    4 instructions to assign 1 to foobar  However  each variable access takes two instructions and a total of  four bytes to make a simple assignment  If we set the small data  threshold in the EPPC Target panel to be at least the size of an int   we can fetch the variables w
146. e way or by valid bit  In the  Instruction Cache window  you also can disassemble  show assem   bly language instructions for  the valid cache lines     NOTE  You must enable the cache to be able to collect valid  cache lines     The cache windows have their own help system  To learn how to  use the windows  view the context sensitive help associated with  the GUI  graphical user interface  elements  and call up the stan   dard help system     To invoke help for the cache window  click the Help menu in the  menu bar of the cache window  Alternatively  you can click the  What s This icon and then click again on the GUI item for which  you need help        PPC 154    Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Register Details Window    Register Details Window    Select Window  gt  Register Details Window to view the Register De   tails window  Figure 5 21      Figure 5 21 Initial Register Details window    w Register Details     OF ES  Description Fie Brose       Register Name  Format    Default    31  20  23  28  27  26  25  24 23  224 21  20  13  18  17  16  15  14 13 12 11  sf 8  71 61 51 4  321110   ee     Type the name of a register or a full path to a description file in the     Description File   field     Revert   Head   E   Heset vane  Text View   Auto z              You can use the Register Details window to view different PowerPC  registers  After CodeWarrior displays the Register Details window   type the name of the register description file in t
147. ed    User Guide    EPPC Target    Project Type    on page 71 Application    EPPC Processor    Processor    on page 81 Your processor    EPPC Target Settings     Target Processor    on page 111 Your processor      Protocol    on page 108 AMC CodeTAP      Breakpoint Type    on page 103 Auto       Watchpoint Type    on page 113 Data  Read  Write  or   Read Write               112       Use Initialization File    on page    Select when using a  debug initialization  file        4        Initialization File    on page 105    When using a debug  initialization file  type  the file name in this  field           Interface Clock Frequency    on  page 106    Select the clock fre   quency for the BDM        4        Show Inst Cycles    on page 110    None  Indirect  Flow   or All        Connection Settings    4     118       View Connection Type    on page    View TCP IP Settings        4        Host Name    on page 121    The host name you as   signed to the Code   TAP device during em     ulator setup           1  You can define values for some settings on the EPPC Target Settings panel on the panel or in debug initializa   tion files  If you use debug initialization file commands to define the values  the commands overwrite any val   ues previously set on the panel  For more information  see    Debug Initialization Files    on page 289           Targeting Embedded PowerPC PPC 253    Using a CodeTAP Debugging Device  Setting Up the CodeTAP Emulator    N       The Auto option manages 
148. edded PowerPC    Debugging for Embedded PowerPC  Using MetroTRK    The location of the exception vectors in RAM is a set characteristic  of the processor  For PowerPC  the exception vector must start at  0x000100  which is in low memory  and spans 7936 bytes to end at  0x002000     NOTE  Do not change the location of the exception vectors be   cause the processor expects the exception vectors to reside at the  set location     Data and code sections    The standard configuration for MetroTRK uses approximately 29KB  of code space as well as 8KB of data space     In the default implementation of MetroTRK used with most sup   ported target boards  which is ROM based  no MetroTRK code sec   tion exists in RAM because the code executes directly from ROM   However  for some PowerPC target boards  some MetroTRK code  does reside in RAM  usually for one of the following reasons     e Executing from ROM is slow enough to limit the MetroTRK  data transmission rate  baud rate      e For the 603e and 7xx processors  the main exception handler  must reside in cacheable memory if the instruction cache is  enabled  On some boards the ROM is not cacheable  conse   quently  the main exception handler must reside in RAM if  the instruction cache is enabled     RAM does contain a MetroTRK data section  For example  on the  Motorola 8xx ADS and Motorola 8xx MBX boards  the MetroTRK  data section starts  by default  at the address 0x3F8000 and ends at  the address 0x3FA000   For more information
149. edded PowerPC    Flash Programmer  Command File Syntax    untilVerifyData    Description Waits for the data written in writeData to verify        Usage untilVerifyData    Listing 0 1 Loop Commands Example    startProgramLoop OxFFE000000x FFFFFFFF4          writemem l OxFFE15554 OxAAAAAAAA  writemem l OXFFEOAAA8S 0x55555555  do something in the loop   writemem l 0xFFE15554 OxAOQAQAOAO  writeData  Write numBytesPerLoop bytes of data to the flash             untilVerifyData  Wait until data verifies    endProgramLoop    Current Address    Description This BDM command will store the current address of the program  loop into the specified internal register 0 31     Usage  currAddr  lt IREG gt     Example       currAddr IREGO    NOTE  This command must be inside the program loop        Targeting Embedded PowerPC PPC 283    Flash Programmer  Command File Syntax    Description    Usage    Usage    Action Commands    and  or  xor  not       Bitwise logical AND  OR XOR  and NOT functions that can be used on  internal registers and memory locations  The first argument  IREGd  is the destination internal register  The second argument  IREGs1  is the first source internal register  The third argument  can be an internal register  IREGs2   or the memory address  me   mAddr  of a 32 bit value        COS             and IREGa IREGs  memAddr   or REGa IREGs  memAddr  xor IREGa IREGs  memAddr   not IREGa  memAddr                    and IREGa IREGx IREGy  or REGa IREGX IREGy  xor IREGa IREGs IR
150. edded PowerPC PPC 311    JTAG Configuration Files  Generating JTAG Configuration Files       PPC 312 Targeting Embedded PowerPC    D       metrowerks o Mem O ry  Configuration Files    A memory configuration file contains commands that define the le   gally accessible areas of memory for your specific board     This appendix covers the following topics     e Command Syntax    e Memory Configuration File Commands       Command Syntax    Listed below are the rules for syntax of commands in a config file   e All syntax is case insensitive   e Any white spaces and tabs are ignored   e Comments can be standard C or C   style comments   e A number may be entered in hex  octal  or decimal       Hex   preceded by Ox  0x00002222 OxA OxCAfeBeaD       Oct   preceded by 0  0123 0456       Dec   starts with 1 9  12 126 823643        Targeting Embedded PowerPC PPC 313    Memory Configuration Files  Memory Configuration File Commands    Memory Configuration File Commands    This section lists the command name  its usage  a brief explanation    of the command  examples of how the command may appear in  configuration files  and any important notes about the command     A sample configuration file can be found in this directory            CodeWarrior directory lCodeWarriorlPowerPC_EABI_SupportA  Config Memory mem_config txt    Description    Usage    Example    reservedchar    Allows you to specify a reserved character for the memory configu   ration file  This character is seen when you try t
151. edded PowerPC project command line options    Option Description        big Generates code and links for a big endian target   this option is the default         little Generates code and links for a little endian target        Targeting Embedded PowerPC  PPC 329    Command Line Tool Options    Embedded PowerPC Project Options       Option    Description           proc essor     keyword    Specifies the processor for scheduling and inline  assembler                    Parameter Description  401   403   505 This is the processor num   S09 tt S39    ber   601   602   603  603e   604    604e   740   750  801   821    823   850   860  7400   8240    8260  generic This is the default option         fp keyword    Specifies floating point code generation options        Parameter Description       Indicates not to use float   ing point     none   off       soft  ware  Indicates software floating   point emulation  this op     tion is the default        Hardware floating point  codegen     hard ware        fmadd Same as the following    items      fp hard     fp_contract        sdata threshold     short    Sets the maximum size in bytes for mutable data  objects before being spilled from a small data sec   tion into a data section  the default is 8        PPC 330    Targeting Embedded PowerPC    Command Line Tool Options  Embedded PowerPC Options       Option Description        sdata2  threshold  short Sets the maximum size in bytes for constant data  objects before being spilled from
152. elocate For DWARF information  specifies whether to relo   cate addends in  rela text and  rela debug    xtables on off Specifies whether to show exception tables  the de   fault is off  This option exists for compatibility rea   sons           Targeting Embedded PowerPC PPC 335    Command Line Tool Options  Embedded PowerPC Disassembler Options       PPC 336 Targeting Embedded PowerPC    Index    Symbols    __abs   236   __attribute__   aligned       overview 203  204  struct definition examples 204  struct member examples 205  variable declaration examples 203   __cntlzw   238   __eieio   235   __fabs   236   __fnabs   236   __isync   235   __labs   236   __Thbrx   236   _lwbrx   236       pixel 171   rlwimi    237   rlwinm   237   r1lwnm    237   __setflm   237   __sthbrx   236   _ stwbrx   236   __ sync   235   _ vector 171    A    Abatron BDI2000  debugging device   connecting with 143  connection type 124  __abs   236  Access Paths panel See IDE User Guide  alternate C C   libraries 208  AltiVec  AltiVec Programming Model checkbox 83  vector types 170  AltiVec Programming Model checkbox 83  AMC  Applied Microsystems Corporation  249   251  252  253  254  255  257  259  260  261  262  263  AMCMemReadDelayCycles 299  AMCMemWriteDelayCycles 300  AMCMemWriteVerify 300  A  A       MCRegWriteVerify 300  MCTargetInterfaceClockFreq 301       AMCTargetSerializeInstExec 301  AMCTargetShowInstCycles 301  Applied Microsystems Corporation  CodeTAP  connecting with 132  highlights of
153. emory Map    UN OX3FADOO  MetroTRK Data  SKB 4   Ox3F8000    MelroTRK stack  8KB    Ox400000  4MB     Ox3F6000    Application  Stack               Application  Heap  0x040000       Application code  and data   Sample 190KB        0x010000    0x002000  Exception    vectors  SKB       0x000100       Targeting Embedded PowerPC PPC 161    Debugging for Embedded PowerPC  Debugging ELF Files    Using MetroTRK for Debugging    To use MetroTRK for debugging  you must load it on your target    board in system ROM   See    RAM Buffer Address    on page 99 for  details about setting the location of the code to be flashed into    ROM      MetroTRK can communicate over serial port A or serial port B  de   pending on how the software was built  Ensure that you connect  your serial cable to the correct port for the version of MetroTRK that  you are using     After you load MetroTRK on the target board  you can use the de   bugger to upload and debug your application if the debugger is set  to use MetroTRK     NOTE  Before using MetroTRK with hardware other than the  supported reference boards  see Metro TRK Reference     Debugging ELF Files    You can use the CodeWarrior debugger to debug an ELF file that  you previously created and compiled in a different environment  than CodeWarrior  Before you open the ELF file for debugging  you  must examine some IDE preferences and change them if needed  In  addition  you must customize the default XML project file with ap   propriate target settings
154. ence for the Microsoft Foundation Classes for Win32   Microsoft   s Reference for the Win32 API   Introductory guide to the Metrowerks application framework for Mac OS  Advanced topics in PowerPlant programming for Mac OS    How to use CodeWarrior to program for the Java Virtual Machine  How to use CodeWarrior to program for Mac OS   How to use CodeWarrior to program for MIPS embedded processors  How to use CodeWarrior to program for NEC V800 Series processors  How to use CodeWarrior to program for Net Yaroze game console  How to use CodeWarrior to program for the Nucleus RTOS   How to use CodeWarrior to program for PalmPilot   How to use CodeWarrior to program for the PlayStation game console  How to use CodeWarrior to program for PPC embedded processors  How to use CodeWarrior to program for the VxWorks RTOS   How to use CodeWarrior to program for Windows   How to use CodeWarrior to program for Windows CE    
155. er  for the S record file  This field is only available if the Generates S   Record File item is checked  The end of line characters are    e  lt cr gt   lt lf gt  for DOS   e  lt lf gt  for Unix    e  lt cr gt  for Mac  Use Linker Command File    The Use Linker Command File checkbox allows you to choose be   tween specifying segment addresses in a linker command file  or di   rectly in the settings panel using the segment address edit fields     When the checkbox is enabled  the fields for Code Address  Data  Address  Small Data  and Small Data2 are dimmed  even if values  are specified there  The linker expects a linker command file and if it  doesn t find one  an error occurs           NOTE  If you have a linker command file in your project and the  Use Linker Command File checkbox is deselected  the linker ig   nores the file        PPC 96 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Code Address    The Code Address edit field specifies the location in memory where  the executable code resides     If you wish to specify a specific code address  enable the checkbox  and type an address in the edit field  You must specify the address  in hexadecimal notation  The possible addresses depend on your  target hardware platform and how the memory is mapped     If you disable the checkbox  the default code address will be  0x00010000  This default address is suitable for the 8xx evaluation  boards  but may not be suita
156. er Details Window  Using MetroTRK  MetroTRK Overview       2    2                MetroTRK Baud Rates     2    2    2  en  MetroTRK Memory Configuration    2                 PPC 4 Targeting Embedded PowerPC    Using MetroTRK for Debugging               162       Debugging ELF Files      a a A BSS 162  Customizing the Default XML Project File          163  Debugging an ELF File       amp  ao pi  amp  a eS 164  ELF File Debugging  Additional Considerations            165   6 Cand C   for Embedded PowerPC 167   Integer Formats   gcc  de Se A A 168  Embedded PowerPC Integer Formats            169  Embedded PowerPC Floating Point Formats          170  AltiVec Vector Data Formats             4   170   Data Addressing      lo cr ect a We dy he Beg Bh eee 171   Calling Conventions       sis y a Se ah ee Sr ak 174   Register Variables 222210 a OS Rm DE SEES 174   Register Coloring Optimization         2    2    0    175   Generating Code for Specific Processors             177   PRAGIVAS  25 40 a BE ee A os oo A Ee a 177  FOLCESACHVE sag a ae We te  ee es a 179  function_align     4  be    Sas GIS cata ka aa 179  incompatible_return_small_structs             180  incompatible_sfpe_double_params             180  TERUEL Yoni nas Sees E A Secon    ari nat A 180  packa iaai d Be Ais mele A e Be Bl ag Som    BLA Joy Se eet 181  pooled_data     ote e e RA oe ec Se ee 182  SECO ih es 2 4d ok  Se eh Se ea ek Ve a ee a ek 183   Linker Issues for Embedded PowerPC             189  Linker Generate
157. er functions  or  e Uses more than 224 bytes of local variables  e Declares local registers    You can avoid using fralloc when using non volatile registers as  long as you save the registers        For more information  see    Creating a Stack Frame in Embedded  PowerPC Assembly    on page 223        The fralloc directive has an optional argument number which lets  you specify the size in bytes of the parameter area of the stack  frame  By default  the compiler creates a 32 byte parameter area  If  your assembly language routine calls any function that takes more  than 32 bytes of parameters  you must specify a larger amount     frfree    frfree    Embedded PowerPC assembler directive that frees the stack frame  and restores the registers that fralloc reserved  For more infor   mation  see    Creating a Stack Frame in Embedded PowerPC Assem   bly    on page 223           NOTE  The frfree directive does not generate a b1r instruc   tion  You must include one explicitly        Targeting Embedded PowerPC PPC 231    Inline Assembler for Embedded PowerPC    Assembler Directives    machine    machine number    Embedded PowerPC assembler directive that specifies which CPU  the assembly code is for  The number must be one of the following     401    555    604    821    7400    PPC604e    PPC403GCX    403 505  601 602  740 750  823 850   8240 8260  PPC403GA PPC403GB  all generic    509    603    801    860    PPC603e    PPC403GC    altivec    If you use generic  CodeWarrior supports
158. erPC Embedded settings panels See settings  panels  PowerTAP  connecting to target system 262  connecting with 136  connection type 124  error messages 245  246  highlights of 258  host to emulator communications 262  interrupts 264 265  operational notes 264 265  resetting emulator 263  setting up 262  technical support 259  updating firmware 263  pragma  for PowerPC 177  overload 192  Prefix File field  EPPC Assembler settings panel 77  Pre Linker option  Target Settings panel 69  preprocessing 32  See also IDE User Guide  preprocessor  using in inline assembler 222  Processor  compiler settings 81  Profiler Information checkbox 87  project  creating 34 36  modifying 41  stationery 33  types of 33  working with a 38 61       Targeting Embedded PowerPC PPC 343    Index    project stationery 65   project stationery targets  types 37  Project Type menu  EPPC Target panel 71  project window 41   Protocol 108   PVR register 309    R    RAM  data sections when using MetroTRK 159  exception vectors when using MetroTRK 158  map when using MetroTRK 160  stack when using MetroTRK 160  RAM Buffer Address edit field 99  Rate menu 119  Raven BDM  debugging device   connecting with 140  connection type 124  Raven COP  debugging device   connecting with 142  connection type 124  Raven  debugging device  104  register coloring optimization 175  Register Details window 155  register variables for PowerPC 174  registers  displaying 147  floating point 147  general 147  Register Details windo
159. erial Data to Log window D Use Global Connection Settings       View Connection Type    You can use the View Connection Type menu to specify your set   tings for connecting to your board   e When you select View Serial Settings  the Primary and Sec   ondary Serial Port Options are shown   You can use a serial connection for all debugging protocols     e When you select View TCP IP Settings  the TCP IP Options  are shown           PPC 118 Targeting Embedded PowerPC    Windows    Solaris    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    You can use TCP IP only for the CodeTAP and PowerTAP  emulators     Primary and Secondary Serial Port Options    The settings for the Primary Serial Port include   e Port  e Rate   Data Bits   Log Serial Data to Log Window   Stop bits   Flow Control   Use Global Connection Settings   Port       The Port pull  down menu selects the serial port on your computer  that the debugger uses to communicate with the target hardware     The options are COM1  COM2  COM3  and COM4   The options are  dev term a and  dev term b   Rate    The Rate pull down menu selects the serial baud rate for communi   cating with the target hardware     Table 4 4 lists the default baud rate that MetroTRK uses to commu   nicate with each target board  These baud rates are the fastest that  work with the hardware        Targeting Embedded PowerPC PPC 119    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC                
160. et Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC       RAM Buffer Address ROM Image Address  Entry Point       Generate DWARF Info    The Generate DWARF Info checkbox controls whether the linker  generates debugging information  When this setting is on  the linker  generates debugging information  The debugger information is in   cluded within the linked ELF file  This setting does not generate a  separate file  When this setting is off the linker does not generate de   bugging information     When you choose the Enable Debugger item in the CodeWarrior  Project menu  CodeWarrior turns this item on for you     Use Full Path Names    The Use Full Path Names checkbox controls how the linker in   cludes path information for source files  When this setting is on  the  linker includes path names within the linked ELF file  see the note  below   When this setting is off  the linker uses only the file names     NOTE  To avoid problems with path names  turn off Use Full  Path Names when building and debugging on different machines  or platforms     The Use Full Path Names checkbox is available only when you se   lect Generate DWARF Info   Generate Link Map    Enable the Generate Link Map checkbox to tell the linker to gener   ate a link map     The linker adds the extension  MAP to the file name specified in the  EPPC Target settings panel  see the edit field called File Name   The  file is saved in the same folder as the CodeWarrior project file        PPC 92 Ta
161. et has changed   The emulator must remove the breakpoints to avoid corrupting  memory        Access breakpoints are not supported for this processor       Watchpoints  also called access breakpoints  are available only for  PowerTAP 7xx or CodeTAP 8xx  You cannot set watchpoints for  PowerTAP 6xx or PowerTAP 82xx     Targeting BDM Devices FAQ    This section lists some common problems you may encounter when  targeting a BDM device using CodeWarrior     e Debugger window doesn t appear after launching process  using a BDM target    e Watchpoints are not working using a BDM target  e Hardware breakpoints are not working using a BDM target    Debugger window doesn t appear after launching process  using a BDM target          If the debugger window does not appear after you launch a process  using a BDM target  enable all exceptions in the EPPC Exceptions  settings panel  This catches exceptions that occur before your pro   gram reaches the first breakpoint        PPC 246 Targeting Embedded PowerPC    Troubleshooting for Embedded PowerPC  Targeting BDM Devices FAQ    Watchpoints are not working using a BDM target    If watchpoints are not working when using a BDM target  enable  the Data Breakpoint exceptions in the EPPC Exceptions panel        Hardware breakpoints are not working using a BDM target    If hardware breakpoints are not working when using a BDM target   enable the Instruction Breakpoint exceptions in the EPPC Excep   tions panel        Targeting Embedded PowerPC PPC
162. ettings 118 121  Custom Keywords See IDE User Guide  Debugger Settings See IDE User Guide  EPPC Assembler 75 78  EPPC Disassembler 87 90  EPPC Exceptions 116 117  EPPC Linker 90 100  EPPC Processor 79 87  EPPC Target 70 75  EPPC Target Settings 101 113  File Mappings See IDE User Guide  for PowerPC Embedded 66 121  Remote Debugging Options 114 116  selecting 64  Target Settings panel 67 69  See also target settings  Settings window 45  short double size 170  short size 169  Show Code Modules 89  Show Data Modules 89  Show Dwarf Info 89  Show Headers 88  Show Symbol Table 89  signed char size 169  sleep 303  Small Data Address edit field 97  98  Small Data field  EPPC Target panel 72  Small Data2 field  EPPC Target panel 73  soft reset  CodeTAP 255  PowerTAP 263  Soft Reset menu option 150  source file  modifying 42  Source Format checkboxes  EPPC Assembler set   tings panel 77  special purpose registers 147  S record 95  EOL Character 96  Max Length 95  stack  MetroTRK 160  Stack Address edit field 94    Index    Stack Crawl window  Stop button 56  stack frame in inline assembler 223  Stack Size edit field 73  Stack Size  k  field  EPPC Target panel 73  stand alone assembler 27  See also Assembler Guide  stationery 33  stationery targets  types 37  __sthbrx   236  SIMW 86  Stop  Stack Crawl window 56  Stop Bits menu 121  Stop button  debugging with 56  _ stwbrx   236  Suppress Warning Messages check box 93  symbols  linker generated 190  multiple linker 192  __sync   235  sys
163. ettings for Embed        ded PowerPC    Debugging for Embedded  PowerPC    C and C   for Embedded  PowerPC    Libraries and Runtime  Code for Embedded Pow   erPC    Inline Assembler for Em   bedded PowerPC       Troubleshooting for Em   bedded PowerPC    Using a CodeTAP Debug   ging Device          Using the PowerTAP 6xx   7xx Debugging Device    Flash Programmer       Debug Initialization Files     TAG Configuration Files    The kinds of projects you can build  and how to build them     How to control the compiler  linker   and debugger for this platform tar   get     Includes details on debugger setup  for embedded systems     Details of the back end compiler for  Embedded PowerPC development     Libraries provided with CodeWar   rior for this platform target     Describes support for inline assem   bly language programming built  into the CodeWarrior compilers     Troubleshooting information spe   cific to this platform target     Information relevant to using a Co   deTAP debugging device with  CodeWarrior     Information relevant to using a  PowerTAP debugging device with  CodeWarrior     How to use the Embedded Pow   erPC utility to burn flash images to  your embedded PowerPC board     Discusses debug initialization files  and the commands that you can use  in the files  including command syn   tax     Discusses JTAG files and how to  clone them        PPC 14 Targeting Embedded PowerPC    Introduction             Where to Go from Here  Chapter Description  Memory Config
164. example      define remainder  x y z        divw Z X  y     mullw Zr Zrys N  subf Z yZ X    asm void newPointlessMath  void       remainder  r3 r4 r5    blr       Using Local Variables and Arguments    To refer to a memory location  you can use the name of a local vari   able or argument     NOTE  You can refer to local variables by name even if a func   tion does not contain the fralloc directive  For more information   see    Creating a Stack Frame in Embedded PowerPC Assembly       on page 223        The rule for assigning arguments to registers or memory depends  on whether the function has a stack frame  If function has a stack  frame  the inline assembler assigns     e scalar arguments declared register to r14 r31       e floating point arguments declared register to fp14 fp31  e other arguments to memory locations    e scalar locals declared register to r14 r31       PPC 222 Targeting Embedded PowerPC    asm void foo    Inline Assembler for Embedded PowerPC  Working With Assembly    e floating point locals declared register to fp14 fp31    e other locals to memory locations    If function has no stack frame  the inline assembler assigns     e arguments that are declared register and passed in regis   ters to the appropriate register    e other arguments to memory locations    e all locals to memory locations    NOTE  Some opcodes expect registers  and others expect ob   jects  For example  if you use no fralloc with parameters  you may  run into difficulties     For mo
165. f  EPPC_Default_Project   XML  which is found in the following  directory  and click OK        CodeWarrior_dir plugins support    EPPC_Default_Project  XML       CodeWarrior displays a new project based on  EPPC_Default_Project  XML                 Change the target settings of the new project     Select Edit  gt  Target Settings to display the Target Settings window   where you can change any needed target settings of the new project  as needed for your target board and any debugging devices you are       Targeting Embedded PowerPC PPC 163    Debugging for Embedded PowerPC  Debugging ELF Files    using  For more information  see    Target Settings for Embedded  PowerPC    on page 63    3  Export the new project with its changed target settings   Export the new project back to the original default XML project file     EPPC_Default_Project   XML  by selecting File  gt  Export Project  and saving the new XML file over the old one        NOTE  When you export the XML file  navigate to the following  directory  where CodeWarrior will save the new XML file over the  old one        CodeWarrior_dir plugins suppport       The new EPPC_Default_Project   XML file reflects any target set   tings changes that you made  Any projects that CodeWarrior creates  when you open an ELF file to debug use those target settings     Debugging an ELF File    If you have not already done so  you must prepare before debug   ging an ELF file for the first time  For more information  see    De     buggin
166. formation about using a  PowerPC processor in your embedded circuit design     Installing CodeWarrior for Embedded PowerPC    Your first step toward developing software for your platform target  is to install the CodeWarrior tools   If you have already installed the  software  you can skip ahead to CodeWarrior Compiler Architec   ture   The tools include a variety of components such as the IDE  de   bugger  plug in compilers and linkers  standard libraries  runtime  libraries and headers  and all necessary documentation        The CodeWarrior Installer automatically copies all necessary com   ponents to the correct locations  It is strongly recommended that you  use the CodeWarrior Installer to ensure that you have all the re   quired files  If you have questions regarding installer options  read  the installer on screen instructions     To start the Installer     Double click the drive on the desktop that holds the Code Warrior  CD     When you do  a dialog box appears with a button titled Launch  Code Warrior Setup     Press the Launch Code Warrior Setup button     If for some reason you do not see this dialog  double click the  setup exe file located at the root level of the CD        PPC 24 Targeting Embedded PowerPC    Getting Started  CodeWarrior Compiler Architecture    CodeWarrior Compiler Architecture    A proprietary multi language  multi target compiler architecture is  at the heart of CodeWarrior  Front end language compilers generate  a memory resident  unambiguo
167. fy the S Record file  to be sent  After you click OK  a flash image is made  and your flash  is programmed     NOTE  You must enable the checkbox Generate S Record File  and Generate ROM Image in the EPPC Linker settings panel to  generate a ROM able S record file  You must also have the cor        PPC 274 Targeting Embedded PowerPC    Flash Programmer  Command File Syntax    rect addresses for your ROM memory entered in the RAM Buffer  Address and ROM Image Address edit fields           Command File Syntax    Description    Usage    This section describes the command set of the flash programmer   This language is for writing initialization files and can be used in  conjunction with the Console window to help you debug     The types of commands available include     e Write Register Commands  e Read  Write and Save Memory Commands       e Loop Commands       e Action Commands  e Waitand Abort Commands       e Print Commands    e Miscellaneous Commands    Write Register Commands    The write register commands include   e writereg  e writespr    writereg  Writes a value to the specified register     writereg  lt registerName gt   lt value gt      lt registerName gt  can be one of following   e MSR   Machine State Register  e CR   Condition Register    e PC   Program Counter       Targeting Embedded PowerPC PPC 275    Flash Programmer  Command File Syntax    e Rxx   General Registers  where xx is a decimal from 0 31    e SPRxxxx   Special Purpose Registers  where xxxx is a  deci
168. g an ELF File    on page 164     To debug an ELF file   1  Drag the ELF file  with symbolics  to the IDE     CodeWarrior creates a new project using the previously customized  default XML project file   For more information  see    Customizing  the Default XML Project File    on page 163   CodeWarrior bases the  name of the new project on the name of the ELF file  For example  an  ELF file named Foo ELF results in a project named Foo mcp        The symbolics in the ELF file specify the files in the project and their  paths  Therefore  the ELF file must include the full path to the files     NOTE  The DWARF information in the ELF file does not contain  full path names for assembly   s  files  therefore CodeWarrior can   not find them when creating the project  indicated by a log win        PPC 164 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Debugging ELF Files    dow   However  when you debug the project  CodeWarrior finds  and uses the assembly files if the files reside in a directory that is  an access path in the project  If not  you can add the directory to  the project  after which CodeWarrior finds the directory whenever  you open the project   You can add access paths for any other  missing files to the project as well       Optional  Check whether the target settings in the new project  are satisfactory     For more information  see    Target Settings for Embedded Pow   erPC    on page 63        Enable the debugger   Select Project  gt  Enable Debugge
169. g up 254  technical support 251  updating firmware 255  CodeWarrior  compare to command line 29  compiler architecture 25  compiler described 26  components 25 29  debugger described 28  development process 29 32  documentation architecture 13  IDE described 26  installing 24  linker described 27  stand alone assembler described 27  tools listed 25  Cogent CMA102 target board jumper settings 318  Cogent CMA 278 daughtercard dipswitch  settings 318  command file syntax  flash programmer 275 287    command syntax  debug initialization files 296  memory configuration files 313  command line and CodeWarrior compared 29  command line tool options  embedded PowerPC specific disassembler  options 333  embedded PowerPC specific options 331  embedded PowerPC specific project  options 329  commands  debug initialization files syntax 296  memory configuration files syntax 313  comments in inline assembler 221  communications with target board 243  246  compiler  architecture 25  back end for PowerPC 167 205  described 26  other documentation 168  support for inline assembly 215  See also C Compilers Reference  compiling 31  configuration files  generating JTAG 309  configuration files  memory  command syntax  of 313  configuring the board for console I O 211  connecting hardware 126  Connection menu  choosing a serial or TCP IP  connection 103  console I O 208  209 212  configuring the board 211  UART libraries 209  Conventions 174  creating a project 34 36  Custom Keywords panel See ID
170. ging    on page 126    Verify that all of your settings in the debugger preference  panel are correct     If none of those suggestions corrects the problem  try to establish  communications with the board by using another program  You can  use a terminal emulation program to connect with the serial port  or  you can use the MPC8BUG debugger  supplied by Motorola with  the MPC8xx ADS board  to connect with the BDM port        If you believe your connections are correct  see    Connecting with a  Debug Monitor    on page 127  This section explains what you  should see when you reset MetroTRK        Downloading Code Fails or Crash When Code    Runs    If you are unable to download code to the target hardware or you  cannot run your program  check the following     e Verify that the communications to the target hardware are  working correctly  as described in    No Communications  with Target Board    on page 243     e If you are concerned that your application is not working  correctly  you should use one of the samples provided with       PPC 244    Targeting Embedded PowerPC    Troubleshooting for Embedded PowerPC  Debugger Window Does Not Appear    CodeWarrior for Embedded PowerPC to verify that your  connection to the board is properly established     Debugger Window Does Not Appear    If the debugger window does not appear after you launch a process   try the following     e Enable the verification of all program sections in the Remote  Debugging Options settings panel  Thi
171. gsters Hoang point Regist ers  ae ae r   fp2  _ dt  first word     d1  secondword  r6 fp4  reci r7 fps  rec  r fp6 d3 secondword     d1  first word  r5 fp3       rec d  first word  rg rec d  first word  fp   rec d secondword  ri0  rec d second word  fps  fp9   fp10    d3  first word  fp11  d3 secondword  fp12  fp13       Register Variables    The PowerPC back end compiler automatically allocates local vari   ables and parameters to registers based on to how frequently they  are used and how many registers are available  If you are optimiz   ing for speed  the compiler gives preference to variables used in  loops     The Embedded PowerPC back end compiler also gives preference  to variables declared to be register  but does not automatically  assign them to registers  For example  the compiler is more likely to       PPC 174 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Register Coloring Optimization    place a variable from an inner loop in a register than a variable de   clared register  See also  K amp R  844 1  8A8 1    For information on which registers the compiler can use for register  variables  see the following documents     e System V Application Binary Interface  Third Edition  published  by UNIX System Laboratories  1994  ISBN 0 13 100439 5     e System V Application Binary Interface  PowerPC Processor Sup   plement  published by Sun Microsystems and IBM  1995    e PowerPC Embedded Binary Interface  32 Bit Implementation  This  document can be obta
172. h the appropriate access permis   sions  If only one section name is specified  it is considered the name  of the initialized object section  iname  If the section is already de   clared  you may also optionally specify the uninitialized object sec   tion  uname     pragma section objecttype    When there is no iname parameter  the compiler resets the section  for the object types specified to the default section  For information  on predefined sections  see    Predefined sections and default sec   tions    on page 187  Resetting the section for an object type does not  reset its addressing modes  You must reset them     When declaring or setting sections  you also can add an uninitial   ized section to a section that did not have one originally by specify   ing a uname parameter  The corresponding uninitialized section of  an initialized section may be the same        PPC 188 Targeting Embedded PowerPC    Listing 6 4    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Forcing individual objects into specific sections    You may store a specific object of an object type into a section other  than the current section for that type without changing the current  section  Use the __declspec keyword with the name of the target  section and put it next to the extern declaration or static definition of  the item you want to store in the section  Listing 6 4 shows exam   ples     Using _ declspec to force objects into specific sections    declspec  section   data
173. he Description File  field to display the applicable register and its values   Alternatively   you can use the Browse button to find the register description file      Figure 5 22 shows the Register Details Window displaying the MSR  register        Targeting Embedded PowerPC PPC 155    Debugging for Embedded PowerPC  Register Details Window    Figure 5 22 Register Details window showing the MSR register    pw Register Disassembly for MSR MA  x     Description File   C  C  Program Files Metrowerks CodeW arrior Bin Plugins Support Registers E ppe Files Metrowerks CodeW arrior Bin Plugins    Support Reaisters Eppc  Browse       Register Name  MSA Format   Default z     ofrfafafafotol riel 3  1019  12  13  141 15  16 17  181 19  201 211221 23  2af 26  27 281 29  30  31       ogooooo0oooooooofojojojojojol1fofofofofofofojojo_of1f o   Nip  25       000     JH xception vector table starts at the physical addres        Exception prefix  The setting of this bit specifies the location of the  exception vector table        Revert   Read   Write   Reset Value   Text View   Auto z  y  ZA    You can change the format in which CodeWarrior displays the reg   ister using the Format menu  In addition  when you click on differ   ent bit fields of the displayed register  CodeWarrior displays an ap   propriate description  depending on which bit or group of bits you  choose  You also can change the text information that CodeWarrior  displays by using the Text View menu     NOTE  For more informat
174. he Target Settings panel   you specify the target operating system and or processor  The other  panels listed in the Target Settings window change to reflect your  choice     Because the linker choice affects the visibility of other related pan   els  you must set your target first before you can specify other tar   get specific options like compiler and linker settings        Targeting Embedded PowerPC PPC 67    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 2 Target Settings panel    Target Settings       Target Name   Embedded PPC C    Linker  Embedded PPC Linker bd    Pre linker  Hone     Postlinker  None  gt      Output Directory      Project  Choose           Save project entries using relative paths    NOTE  The Target Settings panel is not the same as the EPPC  Target panel  You specify the build target in the Target Settings  panel  You set other target specific options in the EPPC Target  panel     The items in this panel are     Target Name Linker  Pre Linker Post Linker    Output Directory Save Project Entries Using Relative Paths       Target Name    Use the Target Name text field to set or change the name of a build  target  When you use the Targets view in the Project window  you  will see the name that you have set        PPC 68 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    The name you set here is not the name of your final output file  It is  the name you as
175. his chapter describes support for inline assembly language built  into the CodeWarrior compilers     This chapter does not discuss the stand alone assembler available  for Embedded PowerPC  For information on the stand alone assem   bler  see the Assembler Guide     This chapter does not document all the instructions available in Em   bedded PowerPC assembly language  For information on Embed   ded PowerPC assembly language instructions  see PowerPC Micro   processor Family  The Programming Environment for 32 Bit  Microprocessors  published by Motorola     You can find this and other useful published information on the  World Wide Web at the following address     http   motorola com SPS PowerPC teksupport  teklibrary index html       This chapter contains the following topics     e Working With Assembly  e Assembler Directives       e Intrinsic Functions          Targeting Embedded PowerPC PPC 215    Inline Assembler for Embedded PowerPC  Working With Assembly    Working With Assembly    This section describes how to use the built in support for assembly  language programming included in the CodeWarrior compiler  in   cluding assembler syntax   This section contains the following topics    e Assembler Syntax for Embedded PowerPC   e Special Embedded PowerPC Instructions    e Creating Labels for Embedded PowerPC Assembly  e Using Comments in Embedded PowerPC Assembly  e Using the Preprocessor in Embedded PowerPC Assembly    e Using Local Variables and Arguments             e C
176. iables window appears  Figure 3 15      Figure 3 15 Global Variables window    e Global Variables for  EPPC_C_debug elf           Targeting Embedded PowerPC PPC 51    Creating a Project for Embedded PowerPC  Working with a Project    g  Select main c from the File pane in the Global Variables win   dow     A list of variables appears in the Variables pane of the Global  Variables window  Figure 3 15      h  Select the global variable that you declared in main c from  the list in the Variables pane     i  Choose Debug  gt  Set Watchpoint     Information about this variable appears in the Watchpoints win   dow  Figure 3 16      Figure 3 16 Variable information displayed in Watchpoints window    e Watchpoints Al E    Location Lenath Description Condition  Ox00006DA8 4 x   Al       You successfully set a watchpoint  Watchpoints trigger accord   ing to any condition you specify  in the Condition field of the  Watchpoints window  and the type you selected during debug   ger configuration        PPC 52 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    j  Choose Project  gt  Run     A message appears indicating that CodeWarrior hit the watch   point that you set  Figure 3 17      Figure 3 17 Watchpoint message window    ES Watchpaoint at variable  x   address 000006010        k  Click OK to close the message window   9  Show registers     Choose Window  gt  Registers Window  The resulting cascading  menu displays a variable list of regis
177. il vec_cmpb vec_cmpeq vec_cmpge       PPC 240 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Intrinsic Functions    vec_cmpgt vec_cmple vec_cmplt vec_ctf  vec_sums vec_trunc vec_unpackh   vec_unpackl  vec_xor    Table 8 4 AltiVec Predicates    vec_all_eq  vec_all_le  vec_all_nga  vec_all_numeric    vec_any_le    vec_any_nge    vec_any_numerics       vec_all_ge    vec_all_lt  vec_all_ngt  vec_any_eq    vec_any_lt    vec_any_ngt    vec_any_out          vec_all_gt  vec_all_ nan  vec_all_nle  vec_any_ge    vec_any_na  n    vec_any_nle       vec_all_in  vec_all_ne  vec_all_nlt  vec_any_gt    vec_any_ne    vec_any_nlt       Targeting Embedded PowerPC PPC 241    Inline Assembler for Embedded PowerPC  Intrinsic Functions       PPC 242 Targeting Embedded PowerPC    9    awe  Troubleshooting for  Embedded PowerPC    This chapter discusses common problems encountered when using  Embedded PowerPC  and possible solutions  It also includes an   swers to frequently asked questions about BDM devices        The sections are     e No Communications with Target Board  e Downloading Code Fails or Crash When Code Runs    e Debugger Window Does Not Appear  e Common Error Warnings for CodeTAP and PowerTAP  e Targeting BDM Devices FAO    If you read this chapter and are still having technical problems   please contact technical support  See    Technical Support    on page  18 for information on the various methods of receiving technical  support              No Communications w
178. ime Libraries for Embedded PowerPC    In addition  you must include one of the following source files   which contains hooks from the runtime that you can customize if  necessary  One kind of customizing is special board initialization     See    Board Initialization Code    on page 214 for details on this  See    the actual source file for other kinds of customizations possible        e _ ppc_eabi_init c  for C projects   e _ ppc_eabi_init cpp  for C   projects        CodeWarrior for Embedded PowerPC includes the source and  project files for the runtime libraries so that you can modify them if  necessary  All the files are within the directory           CodeWarrior   PowerPC_EABI_Support Runtime Src     The runtime library project files are located at           CodeWarrior   PowerPC_EABI_Support Runtime Project        The project names are Runt ime PPCEABI mcp and  Run_EC   PPCEABI mcp  Each project file has unique targets for  each of the configurations of the runtime library           For more information on how to customize the runtime library for  use with your project  you should carefully read the comments in  the source files  as well as any release notes for the runtime library     NOTE  The C and C   runtime libraries do not initialize hard   ware  They assume that you will be loading and running the pro   grams with the Metrowerks debugger  When your program is  ready to run as a stand alone application  you must add the nec   essary hardware initialization  See  
179. ined at        ftp   ftp linuxppc org linuxppc docs EABI_Version_1 0 ps       Register Coloring Optimization    Listing 6 1    short i   int j     for  1 0  i lt   for  3 0  j lt     int k   i   j        The PowerPC back end compiler can perform a register optimiza   tion called register coloring  In this optimization  the compiler lets  two or more variables share a register  it assigns different variables  or parameters to the same register if you do not use the variables at  the same time  In Listing 6 1  the compiler could place i and j in the  same register     Register coloring example       100  i      MyFunc  i      1000  j    4 OurFunc  j                 However  if a line like the one below appears anywhere in the func   tion  the compiler recognizes that you are using i and j at the same  time and places them in different registers        Targeting Embedded PowerPC PPC 175    C and C   for Embedded PowerPC  Register Coloring Optimization    By default  the PowerPC compiler performs register coloring     If the value of Optimization Level on the Global Optimizations  panel is 1 or more  the compiler assigns all variables that fit into reg   isters to virtual registers  The compiler then maps the virtual regis   ters into physical registers using register coloring  As previously  stated  this method allows two virtual registers that have disjoint  lifetimes to both exist in the same physical register     NOTE  For more information  see    Global Optimizations    on  
180. insic Functions    Setting the Floating Point Environment    This function lets you change the Floating Point Status and Control  Register  FPSCR   It sets the FPSCR to its argument and returns the  original value of the FPSCR     These functions are not available if the None option is set in the  EPPC Processor preference panel  See    EPPC Processor    on page 79  for details     float _ setflm float      This example shows how to set and restore the FPSCR     double old_fpscr   oldfpscr   __setflm 0 0      Clear all flag exception mode bits  and save the original settings             Peform some floating point operations       __setflm old_fpscr      Restore the FPSCR       Manipulating the Contents of a Variable or  Register    These functions rotate the contents of a variable to the left     int _ rlwinm int  int  int  int       Rotate Left Word Immediate  then AND with Mask                   int _ rlwnm int  int  int  int       Rotate Left Word  then AND with Mask                int _ rlwimi int  int  int  int  int       Rotate Left Word Immediate then Mask Insert             The first argument to ___rlwimi is usually overwritten  However  if  the first parameter is a local variable allocated to a register  it is both  an input and output parameter  For this reason  this intrinsic should       Targeting Embedded PowerPC PPC 237    Inline Assembler for Embedded PowerPC  Intrinsic Functions    always be written to put the result in the same variable as the first  paramete
181. inue executing the program   by running or stepping through it  or you can kill it        Targeting Embedded PowerPC PPC 61    Creating a Project for Embedded PowerPC  Working with a Project       PPC 62 Targeting Embedded PowerPC    4       mms  Target Settings for  Embedded PowerPC    This chapter discusses the settings panels that affect code genera   tion for Embedded PowerPC development  By modifying the set   tings on a panel you control the behavior of the compiler  linker   and debugger     Specific details about how the compiler and linker work for Embed   ded PowerPC development  such as compiler pragmas  linker sym   bols and so forth  is found in    C and C   for Embedded PowerPC       on page 167   The sections in this chapter are     e Target Settings Overview  e Settings Panels to Optimize Code    e Settings Panels for Embedded PowerPC          Target Settings Overview    Each build target in a CodeWarrior project has its own settings   These settings control a variety of features such as compiler options   linker output  error and warning messages  and remote debugging  options  You modify these settings through the Target Settings win   dow     NOTE  For more information  see  DE User Guide     In brief  you control the compiler  linker  and debugger behavior for  a particular build target by modifying settings in the appropriate  settings panels in the Target Settings window  To open any settings       Targeting Embedded PowerPC PPC 63    Target Settings for
182. ion  see  DE User Guide        PPC 156 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Using MetroTRK    Using MetroTRK    This section briefly describes MetroTRK and provides information  related to using MetroTRK with this product     This section contains the following topics   e MetroTRK Overview  e MetroTRK Baud Rates  e MetroTRK Memory Configuration          e Using MetroTRK for Debugging       E    For more information  refer to MetroTRK Reference     Connecting  with a Debug Monitor    on page 127  and the release notes for Me   troTRK included on the Code Warrior CD     MetroTRK Overview    MetroTRK is a software debug monitor for use with the debugger   MetroTRK resides on the target board with the program you are de   bugging to provide debug services to the host debugger  MetroTRK  connects with the host computer through a serial port     You use MetroTRK to download and debug applications built with  CodeWarrior for Embedded PowerPC     CodeWarrior installs the source code for MetroTRK  as well as ROM  images and project files for several pre configured builds of Me   troTRK  If you are using a board other than the supported boards   you may need to customize the MetroTRK source code for your  board configuration  For more information  see MetroTRK Reference     You can use MetroTRK on both little  and big endian machines be   cause MetroTRK is endian neutral  The CodeWarrior debugger is  also endian neutral and works with MetroTRK regardless of the
183. ion Commands window  The Log Connection Commands  window displays communications between the debugger and Me   troTRK  You can save the contents of the Log Connection Com   mands window to a file     NOTE  Itis useful to enable Log Connection Commands when  porting MetroTRK   Mem Read Delay    The Mem Read Delay field defines the number of additional pro   cessor cycles to allow for memory reads     Mem Read Delay is also a command in debug initialization files   The debug initialization file commands overwrite values set in this       PPC 106 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    panel  For more information  see    AMCMemkReadDelayCycles    on  page 299     Mem Write Delay    The Mem Write Delay field defines the number of additional pro   cessor cycles necessary for memory writes     Mem Write Delay is also a command in debug initialization files   The debug initialization file commands overwrite values set in this  panel  For more information  see    AMCMemWriteDelayCycles    on    page 300   Options    The debugger spawns one task per application  The VxWorks OS al   lows you to specify various task options that affect the manner in  which the task is spawned  These options take effect before debug   ging begins     For example  to set the task options VX_FP_TASK and  VX_NO_STACK_FILL  enter the hex values and separate them with  the decimal value 264  a logical OR in decimal format      0x8 264 0x100  
184. ion Reads a certain number of bytes from memory     Usage readmem  lt address gt   lt NumberOfBytes gt        Targeting Embedded PowerPC PPC 277    Flash Programmer  Command File Syntax     lt address gt  is the hex  octal  or decimal address you want to read  from                                                                                                                Examples Shows memory with the following display   Command Memory display  readmem 0x10000 16 00010000  61626364 65666768 abcdefgh  00000008  30313233 34353637 01234567   readmem 0x10000 00010000 EEE os AA   readmem 0x10001 00010001 Cd bs Dra psie   readmem 0x100001 4 0001000    62636465        bcde   readmem 0x10002 4 00010002     63646566       cdef   readmem 0x10002 10 00010002     636465666768   cdefgh   00000008 BO BB 2 33 as did la 0123  storelREG  There are two kinds of storeI REG  Store Internal Register  com   mands  The first kind has the following   Description Store the value of the specified internal register to the specified  memory location   Usage storeIREG  b  w  1   lt REG gt   lt Memory Addr gt   This command doesn t need to be inside startProgramLoop and  endProgramLoop block   This command will also work if it is entered in the command line   Examples These commands will store the value of IREGO to memory addr at  0x10000   PPC 278 Targeting Embedded PowerPC    nn Dn                            torelREG b IRE  toreIREG w IRE  torelREG   RE       Description    Usage    Example     1    
185. ions           333   Index 337       PPC 10 Targeting Embedded PowerPC       metrowerks    Introduction    This manual shows you how to install and use CodeWarrior to de   velop software for Embedded PowerPC systems     This chapter provides an introduction to the manual and CodeWar   rior for Embedded PowerPC  it contains the following sections    e Read the Release Notes    e Solaris  Host Specific Information   e About This Book   e Where to Go from Here    e Metrowerks Year 2000 Compliance          Read the Release Notes     Before you use CodeWarrior or a particular tool  you should read  the release notes  They contain important last minute information  about new features  and technical issues or incompatibilities that  may not be included in the documentation     The release notes directory is always included as part of a standard  CodeWarrior installation  You can also find them on the CodeWar   rior for Embedded PowerPC CD  in the Release Notes folder           Targeting Embedded PowerPC PPC 11    Introduction    Solaris  Host Specific Information    Solaris  Host Specific Information    The Solaris hosted tools are functionally equivalent to the Windows  hosted tools  with the following minor differences     No Wiggler or Hummingbird support   because the opera   tion of the Macraigor Systems    Wiggler depends on the paral   lel port on PC compatibles     Connection Settings panel changes   The Port option in the  Connection Settings panel uses Unix communication p
186. is used if your program calls  malloc or new     If you wish to specify a specific heap address  enable the checkbox  and type an address in the edit field  You must specify the address  in hexadecimal notation  The address you specify is the bottom of  the heap  The address will be aligned up to the nearest 8 byte  boundary  if necessary  The top of the heap will be Heap Size  k   kilobytes above the Heap Address  Heap Size  k  is found in the       Targeting Embedded PowerPC PPC 93    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    _stack_end    _heap_end  _heap_addr      EPPC Target panel   The possible addresses depend on your target  hardware platform and how the memory is mapped  The heap must  reside in RAM     If you disable the checkbox  the top of the heap will equal the bot   tom of the stack  In other words     _stack_addr    Stack Size  k    1024      _stack_end     _heap_end  Heap Size  k    1024         The MSL allocation routines do not require that you have a heap  below the stack  You can set the Heap Address to any place in RAM  that does not overlap with other sections  The MSL also allows you  to have multiple memory pools  which can increase the total size of  the heap  Please see the    Allocating Memory and Heaps for Embed   ded PowerPC    on page 212 for how you initialize multiple memory  pools        You can disable Heap Address if your code does not make use of a  heap  If you are using MSL  your program may implicitly
187. ists the  options in alphabetic order  The option descriptions in this section    are also in alphabetic order     EPPC Target Settings panel options    Arguments    Connection    Entry Point    FPU Buffer Address       Interface Clock Frequency  Kill User Threads on Exit   Mem Read Delay          Options  Poll time  ms   Protocol    Serialize instruction execution    Breakpoint Type       Device    Force shell download on con   nect       Initialization File    IP Address       Log Connection Commands  Mem Write Delay    Parallel Port       Priority    Reset On Connect       Show Inst Cycles       Speed  Target OS    Target Server Name       Use Initialization File    Watchpoint Type          Stack Size  Target Processor    Unload Module on Exit           Verify memory writes       PPC 102 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Arguments    This field is used to enter up to ten argument values for the  taskSpawn    function     Below are a few helpful hints for using this option     e It is not necessary to enter any or all arguments  If no values  are entered  the debugger assumes a value of zero for each  argument     e Each argument is an integer value  and must be separated by  a space to be recognized by the debugger   Breakpoint Type    Choose how to set a breakpoint using the options on the Breakpoint  Type pop up menu     e Software     breakpoint written to target memory  which is  then removed whe
188. it to set up the memory correctly  when you run your program     Initializing Memory    The most common use of debug initialization files is to configure  the essential set of memory control registers so that memory opera   tions  including downloads  are possible  This is useful if your tar   get system or evaluation board does not yet have initialization code  in target ROM  However  this method can also be used to override  existing initialization following reset        PPC 290 Targeting Embedded PowerPC    Debug Initialization Files  Using Debug Initialization Files    When you create this section of the file  you typically mirror the val   ues that the processor chip select  pin assignment  or other memory  control registers would have after you run your initialization code   The set of registers that must be configured varies by processor  See  your data book and the sample files in            CodeWarrior directory   CodeWarrior PowerPC_EABI_Support Config    Sample files are specific to processor  debug agents  such as the Co   deTAP device  PowerTAP device  or Wiggler  and  in some cases   evaluation board  Use them as templates for your own version     Enabling Debug Support    Some PowerPC processors must be configured to allow the Code   TAP or PowerTAP devices to take control of certain processor func   tions  For example  if the recoverable interrupt bit is not set in the  MSR  certain breakpoints may not work  Likewise  the MPC8xx  watchdog timer enable bit must
189. ith Target Board    If you are unable to establish communications with the target hard   ware  check the following     e Verify that the cable  serial or parallel  is connected to your  computer     e If you are using MetroTRK  If MetroTRK is loaded onto your  MPC8xx ADS board  the LED labeled    RS232 Port 1    should  be lit up  If it is not  MetroTRK is not functioning properly  If  you have rebuilt MetroTRK to use Port 2  the    RS232 Port 2     LED should be lit instead  There is no equivalent indicator on  the MBX board or MPC5xx EVB board        Targeting Embedded PowerPC PPC 243    Troubleshooting for Embedded PowerPC  Downloading Code Fails or Crash When Code Runs    e If you are using the serial port to communicate with the  board  you should make sure that the serial cable you are  using is the right type  If you are using an MPC8xx ADS or  MPC5xx EVB board  you need to use a straight through cable   pins 2 and 3 straight through   If you are using an MPC8xx  MBX board  you should be using a null modem cable  pins 2  and 3 reversed   In general  if the RS232 connector on your  target board is male  you will use a null modem cable  if it is  female  you will use a straight through cable     Verify that the cable  either serial or BDM  is correctly con   nected to the target hardware     If you are using the BDM emulator  verify that the cable from  the computer is correctly connected to the BDM emulator     For more information  see    Setting Up for Remote Debug   
190. ith one instruction    li ES ll   stw r3 foo  lt    2 instructions to assign 1 to foo   li r4 2   stw r4 foobar  lt    2 instructions to assign 2 to foobar    Because small data sections are limited in size you might not be able  to put all of your application data into the small data and small  data2 sections  We recommend that you make the threshold as high  as possible until the linker reports that you have exceeded the size  of the section     If you do exceed the available small data space  consider using  pooled data  The disadvantage of this method is that the linker can   not deadstrip unused pooled data     Before you enable the Pool Data option on the EPPC Processor  panel  you need to     1  Select Generate Link Map and List Unused Objects on the  EPPC Linker panel              PPC 172 Targeting Embedded PowerPC    lis  addi       stw    stw    C and C   for Embedded PowerPC  Data Addressing    2  Examine the map for data objects that are reported unused   3  Delete or comment out those definitions in your source   4  Enable Pool Data     To see the results of pooled data  the following example has a zero  small data threshold     r3    bss 0ftha  lt    this is foolha   r3 r3    bss 0   1l  lt    this is fool   r3 now points to the  top of the data section    r0 1   r0 0 13      02   r0 4 13   lt    foobar is at offset 4 in the data section    When pooled data is implemented  the first used variable of either  the  data   bss or  rodata section gets a two instructi
191. iting code 31  See also IDE User Guide   editor  integrated 42  third party 43   __eieio   235   ELF 16   ELF files  debugging  additional considerations 165  customizing default XML project file 163  deleting files 166  deleting old access paths 166  overview 162  procedure 164  recreating an ELF created project 166  removing files 166   entry assembly statement 230   entry directive 230    Entry Point edit field 100  EOL Character pull down menu 96  EPPC Assembler settings panel 75 78  Generate Listing File checkbox 77  Prefix File field 77  Source Format checkboxes 77  EPPC Disassembler settings panel 87 90  EPPC Linker settings panel 90 100  EPPC Menu  embedded PowerPC specific   Breakpoint Type menu option 152  Change IMMR menu option 150  Hard Reset menu option 151  overview 150  Set Stack Depth menu option 150  Soft Reset menu option 150  Watchpoint Type menu option 151  EPPC Processor settings panel 79 87  AltiVec Programming Model checkbox 83  Generate VRSAVE Instructions checkbox 83  Profiler Information checkbox 87  EPPC Target panel 70 75  Byte Ordering radio button 71  Code Model menu 72  Deadstrip Unused Symbols checkbox 74  Disable CW Extensions checkbox 72  File Name menu 71  Heap Size  k  field 73  Optimize Partial Link checkbox 74  Project Type menu 71  Require Resolved Symbols checkbox 75  Small Data field 72  Small Data2 field 73  Stack Size  k  field 73  EPPC Target Settings panel 101 113  Initialization File field 105  Reset on Connect checkbox 109  Use 
192. itions of  struct S3 on an 8 byte boundary  where a is at offset 0 and b is at  offset 8     struct S3     char a    int b __attribute__   aligned  8          struct S3 s3     Example 2    The following struct member definition aligns all definitions of  struct S4 on a 4 byte boundary  where a is at offset 0 and b is at  offset 4     struct S4     char a    int b __attribute__   aligned  2      y   struct S4 s4        NOTE  Specifying __attribute__   aligned  2    does  not affect the alignment of S4 because 2 is less than the natural  alignment of int        Targeting Embedded PowerPC PPC 205    C and C   for Embedded PowerPC  _attribute__   aligned            PPC 206 Targeting Embedded PowerPC       metrowerks    Libraries and  Runtime Code for  Embedded PowerPC    CodeWarrior provides a variety of libraries for use with the  CodeWarrior development environment  They include ANSI   standard libraries for C and C    as well as runtime libraries and  other code  This chapter discusses how to use these libraries for Em   bedded PowerPC development     With respect to the Metrowerks Standard Libraries  MSL  for C and  C    this chapter is an extension of the MSL C Reference and the  MSL C   Reference  Consult those manuals for general details on the  standard libraries and their functions     The sections in this chapter are   e MSL for Embedded PowerPC  e Runtime Libraries for Embedded PowerPC          e Board Initialization Code    MSL for Embedded PowerPC    This section des
193. l     If Disable CW Extensions is checked   e The st_other field is always set to 0     Some non Code Warrior linkers require that this field have  the value 0     e The CodeWarrior linker cannot deadstrip files     To deadstrip  the linker requires that alignment information  be stored in each st_other field     NOTE  The Disable CW Extensions option in the Project set   tings panel is for developers creating C libraries for use with third   party linkers  Not all third party linkers require this option  you may  need to try both settings  This applies to C libraries only  Assembly  files do not need the option  and C   libraries are not portable to  other linkers  Disable CW Extensions is not usually used when  building a CW linked application since it may result in a larger ap   plication     Code Model    The Code Model pull down menu determines the addressing mode  for the generated executable  The only code model currently sup   ported is absolute addressing  Position independent code is not sup   ported at the time of this writing     Small Data    The Small Data edit field controls the threshold size  in bytes  for  an item considered by the linker to be small data  The linker stores       PPC 72 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    small data items in the Small Data address space  This space has  faster access than the regular data address space     Read   write data items whose byte size is less 
194. l in your  source code  it does not actually make a function call  The compiler  substitutes the assembly instruction that matches your function call   As a result  no function call occurs in the final object code  The final  code is the assembly language instructions that correspond to the  intrinsic functions        PPC 234 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Intrinsic Functions    TIP  You can use intrinsic functions or the asm keyword to add a  few lines of assembly code within a function  If you want to write  an entire function in assembly  you can use the inline assembler   See    Working With Assembly    on page 216        For information on Embedded PowerPC assembly language in   structions  see PowerPC Microprocessor Family  The Programming En   vironment for 32 Bit Microprocessors  published by Motorola     See also     Working With Assembly    on page 216        The topics in this section are     Low Level Processor Synchronization  Floating Point Functions       Byte Reversing Functions       Setting the Floating Point Environment    Manipulating the Contents of a Variable or Register    Data Cache Manipulation  Math Functions       Buffer Manipulation       AltiVec Intrinsics Support       Low Level Processor Synchronization    These functions perform low level processor synchronization              void __eieio void     Enforce In Order Execution of I O       void __ sync  void        Synchronize          void __isync void     I
195. ler for Embedded PowerPC is an ANSI  compliant C C   compiler  This compiler is based on the same  compiler architecture that is used in all of the CodeWarrior C C    compilers  When used with the CodeWarrior linker for Embedded       PPC 26 Targeting Embedded PowerPC    Getting Started  Development Tools for Embedded PowerPC    PowerPC  you can generate Embedded PowerPC applications that  conform to the PowerPC EABI     For more information about the Code Warrior C C   language im   plementation  you should read the C Compilers Reference  For infor   mation on the Embedded PowerPC back end compiler  see    Set    tings Panels for Embedded PowerPC    on page 66  and    C and C      for Embedded PowerPC    on page 167        CodeWarrior Assembler for Embedded  PowerPC    The CodeWarrior assembler for Embedded PowerPC is a stand   alone assembler that has an easy to use syntax  This is the same syn   tax used by assemblers for other platform targets supported by  CodeWarrior  such as MeCore and DSP     For more information about the CodeWarrior assembler  see the As   sembler Guide     In addition  the C C   compiler supports inline assembly for Em   bedded PowerPC development  See    Inline Assembler for Embed     ded PowerPC    on page 215     CodeWarrior Linker for Embedded PowerPC    The CodeWarrior linker for Embedded PowerPC is an ELF linker   This linker allows you to create code using absolute addressing  It  also allows you to create multiple user defined sections  In 
196. ll of the following are valid  local variable references     asm void foo  void        long myVar    long myArrayl1    Rect myRectArray 3         lwz r3 myVar  SP     load myVar into r3   la r3 myVar SP     load address of myVar into r3  lwz r3 myRect top   lwz r3 myArray 2   SP                    lwz r3 myRectArray 2  top  loz r3 myRectArray 2  toptl  SP   blr    You also can use a register variable that is a pointer to a struct or  class to access a member of the struct  For example     void foo  void      register Rect  p   asm    lwz r3 p  gt top           PPC 226 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Working With Assembly    You can use the  hiword and  loword directives to access parts of  a variable defined long long     long long gTheLongLong   5     asm void Foo void    asm void Foo void        fralloc    lwz r5  gTheLonglong hiword    the upper word of gTheLongLong  lwz r6  gTheLongLong loword    the lower word of gTheLongLong             frfree  blr    Using immediate operands    For an immediate operand  you can use an integer or enum con   stant  sizeof expression  and any constant expression using any of  the C dyadic and monadic arithmetic operators  These expressions  follow the same precedence and associativity rules as normal C ex   pressions  The inline assembler carries out all arithmetic with 32 bit  signed integers     An immediate operand can also be a reference to a member of a  struct or class type  You can use any struc
197. loaded    to your board  If you want to free up memory on your board  you    can enable this checkbox to delete the module from memory on exit   If you prefer to leave the module on the board when you re finished    debugging  disable this checkbox     Use Initialization File    Select the Use Initialization File checkbox to indicate that your  project uses a debug initialization file  For more information  see     Initialization File    on page 105           PPC 112 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Verify memory writes    The Verify memory writes checkbox enables or disables memory  read after write verification     Verify memory writes is also a command in debug initialization  files  The debug initialization file commands overwrite values set in  this panel  For more information  see    AMCMemWriteVerify    on    page 300        Watchpoint Type    Use the Watchpoint Type pop up menu on the EPPC Target Set   tings panel to set watchpoints and conditional watchpoints     The type you select determines why the debugger stops  There are  four options to choose from     e Data     stops only when the data at the watchpoint address  changes  Internal processing of the Data watchpoint may af   fect target performance if the expression is accessed fre   quently     e Read     stops on any read access of the watchpoint address  e Write     stops on any write access of the watchpoint address    e Read Write  
198. lt  value is none     NOTE  All versions of MetroTRK included in this package have  no flow control enabled  The only exception to this rule is the Me   troTRK built for the Cogent boards  which have hardware flow con   trol enabled by default     TCP IP Options    The settings available when you select View TCP IP Settings from  the View Connection Type menu follow     e Host Name    e Use Global Connection Settings  Host Name    Enter the host name of your CodeTAP or PowerTAP device in this  field     CodeTAP and PowerTAP use high speed  networked Ethernet com   munications  For instructions on assigning a host name  an IP ad   dress  and configuring Ethernet communications  see the Emulator  Installation Guide supplied with the CodeTAP or PowerTAP     Use Global Connection Settings    When enabled  this option overrides all settings for the primary se   rial port with settings in the Global Connection Settings panel  to  see this panel  select Edit  gt  Preferences  gt  Debugger  gt  Global Con   nection Settings      For more information  see IDE User Guide        Targeting Embedded PowerPC PPC 121    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC       PPC 122 Targeting Embedded PowerPC       metrowerks    9    Debugging for  Embedded PowerPC    This chapter discusses how to use the CodeWarrior tools for debug   ging Embedded PowerPC code  It covers those aspects of debug   ging that are specific to the Embedded PowerPC platform  See the  IDE 
199. ltivec direc   tive or its equivalent  refer to    machine    on page 232 for more in   formation        You can also use intrinsics in your code  refer to    Intrinsic  Functions    on page 234 for more information on this topic        Creating Labels for Embedded PowerPC  Assembly    A label can be any identifier that you have not already declared as a  local variable  The name may start with    so these are legal names   foo  G foo  and  1  Only labels that do not start with     need to end  in a colon  For example     asm void foo void          xl  add ES 64 175    OK  has colon    x2  add r6 r7 r8    OK  has both Q and colon  x3 add E9 ELO   41     ERROR  Needs colon    x4 add EL  Pilon la    OK  starts with           add r3  r4  75  add 3 14  155  add L3y 64 75       NOTE  The first statement in an assembly function cannot be a  label that starts with an at sign character         Using Comments in Embedded PowerPC  Assembly    You cannot begin comments with a pound sign     because the pre   processor uses the pound sign  However  you can use C and C    comments  For example       ERROR     OK     OK          Targeting Embedded PowerPC PPC 221    Inline Assembler for Embedded PowerPC  Working With Assembly    Using the Preprocessor in Embedded  PowerPC Assembly    You can use all preprocessor features  such as comments and mac   ros  in the assembler  However  you must end each assembly state   ment with a semicolon      because the preprocessor ignores new  lines  For 
200. ly have addi   tional manuals  not listed here  for utilities or other software specific to your product     Core Documentation   IDE User Guide   Debugger User Guide  CodeWarrior Core Tutorials  Language Compiler Documentation  C Compilers Reference  Pascal Compilers Reference  Error Reference   Pascal Language Reference  Assembler Guide  Command Line Tools Reference  Plugin API Manual   Library Documentation  MSL C Reference   MSL C   Reference   Pascal Library Reference  MFC Reference   Win32 SDK Reference   The PowerPlant Book  PowerPlant Advanced Topics  Targeting Manuals  Targeting Java VM   Targeting Mac OS   Targeting MIPS   Targeting NEC V800 Series  Targeting Net Yaroze  Targeting Nucleus   Targeting Palm OS   Targeting PlayStation OS  Targeting PowerPC Embedded Systems  Targeting VxWorks   Targeting Win32   Targeting Windows CE    How to use the CodeWarrior IDE  How to use the CodeWarrior debugger  Step by step introduction to IDE components    Information on the C C   front end compiler   Information on the Pascal front end compiler   Comprehensive list of compiler linker error messages  with many fixes  The Metrowerks implementation of ANS Pascal   Stand alone assembler syntax   Command line options for Mac OS and Be compilers   The CodeWarrior plugin compiler linker API    Function reference for the Metrowerks ANSI standard C library  Function reference for the Metrowerks ANSI standard C   library  Function reference for the Metrowerks ANS Pascal library   Refer
201. mage programmer     Enter an address value in this field to load all code and data into  consecutive addresses in ROM  Your application is responsible for  copying data  exception vectors  and possibly even code into their  executing addresses     The CodeWarrior flash programmer does not use a separate RAM  buffer for flashing  If you are using the CodeWarrior flash program   mer  you need to ensure that the RAM Buffer Address equals the  ROM Image Address        NOTE  Using the Flash to ROM target to flash your programs to  ROM is substantially faster than using the flash programmer  For    more information  see    Project Stationery Targets    on page 37     If you are not using the Code Warrior flash programmer  some ROM  flash programs  such as MPC8BUG for 821  expect to find your pro   gram in a RAM buffer in memory  This buffer address is different  from where you want your program to execute  You enter the exe   cuting addresses for the different sections in the edit fields Code  Address  Data Address  Small Data  and Small Data2        For example  MPC8BUG expects a RAM Buffer Address of  0x02800000  MPC8BUG makes a copy of your program starting at  address 0xFFE00000  If OxFFE00000 is where you want your     text section then you would put OxFFE00000 as the Code Ad   dress  If you specify a different Code Address  you need to copy the  code to that address from 0xFFE00000  You will find linker gener   ated symbols for all ROM addresses and executing addresses for th
202. mal from 0 1023     lt value gt  is a hex  octal  or decimal value       Examples  writereg MSR 0x00001002  writereg CR 0x00000000  writereg SPR638 0x02200000    writespr    Description Writes the value to the SPR  Special Purpose Registers  using the  number regNumber     Same as writereg SPRxxxx  but allows you to enter the SPR  number in other bases  such as hex  octal  or decimal     Usage  writespr  lt regNumber gt   lt value gt    lt regNumber gt  is a hex  octal  or decimal SPR number  0 1023    lt value gt  is a hex  octal  or decimal value    Examples    writespr 638 0x02200000  writespr 0x800 0x00000000       PPC 276 Targeting Embedded PowerPC    Flash Programmer  Command File Syntax    Read  Write and Save Memory Commands    The read  write and save memory commands include     e writemem    e readmem  e storeIREG  e loadIREG       e Load Internal Register Immediate    writemem       Command    Description       wri  wri    wri    temem b    temem w       temem  1    write a byte to memory  write a word to memory  2 bytes     write a long to memory  4 bytes     Description Allows you to write a byte  word  or long to memory     Usage writemem   b w 1      lt address gt   lt value gt      lt address gt  is the hex  octal  or decimal destination address     lt value gt  is the hex  octal  or decimal value to write at the destina   tion address    Examples    writemem 1 0x00010000 0x00112233       writemem w 0x00010001 Oxl2ac  writemem b 2345 255    readmem    Descript
203. mbedded PowerPC    GROUP  lt address_modifiers gt     Listing 6 6    SECTIONS    GROUP BIN    text       rodata                   GROUP BIN   data      bss               Sdata BI        sbss   sdata2   sbss2       GROUP BIN   PPC EMB    PPC EMB              FORCEFILES  main o        The FORCEFILES directive does not recognize the file extension   c  If you use the extension   o the linker will look for your source  file     If you only have a few symbols that you do not want deadstripped   use FORCEACTIVE     GROUP       The GROUP directive lets you organize the linker command file  It is  of the form         lt section_spec gt           Please see the topic SECTIONS for the description of the compo   nents     Example 1    D 0x00010000                  rodata    extab    extabindex       D 0x2000              ND  0x3500                           D Oxffff8000         sdata0  sbss0        O       Targeting Embedded PowerPC PPC 195    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Example 1 shows that each group starts at a specified address  If no  address_modifiers were present  it would start following the previ   ous section or group  All sections in a group follow contiguously  unless there is an address_modifier for that output_spec  You nor   mally wouldn t have an address_modifier for an output_spec  within a group  though     Listing 6 7 Example 2    MEMORY    text   origin   0x00010000  data   org   0x00002000 len   0x3000  page0   o   Oxffff800
204. mbols 192  other documentation 168  linker generated symbols 190  Linker option  Target Settings panel 69  linking 31  See also IDE User Guide  List Unused Objects check box 93  LMW 86  local variables in inline assembler 222  L1 Data Cache window 152  long double size 170  long long  type 227  long longsize 169  long size 169  _lwbrx   236       machine assembly statement 232  machine directive 232  makefiles 30  Max Length edit field 95  memory  code section when using MetroTRK 159  data sections when using MetroTRK 159  exception vectors when using MetroTRK 158  map when using MetroTRK 160  stack when using Metro TRK 160  MetroTRK  connecting with 128  debugger settings 109  described 28  MetroTRK Reference 157  using MetroTRK 157  See also MetroTRK Reference  baud rates 158  data transmission rates 158  debug monitor 157  memory configuration 158  overview 157  RAM section locations 158  MetroTRK Reference 157  Metrowerks Standard Libraries See MSL  Metrowerks Target Resident Kernel See MetroTRK  modifying  project 41  source file 42  target settings 43  63 65  Motorola Excimer 603e target board jumper  settings 321  Motorola 555 ETAS target board dipswitch  settings 320  Motorola Maximer 7400 target board jumper  settings 326  Motorola MPC 8xx ADS target board dipswitch  settings 322  Motorola MPC 8xx ADS target board jumper  settings 322  Motorola MPC 8xx FADS daughtercard jumper  settings 324  Motorola MPC 8xx FADS target board dipswitch  settings 324             PPC 3
205. mple  you can have  one project that has both a debug version and a release version of  your code  You can build one or the other  or both as you wish  In  CodeWarrior  these different builds within a single project are  called    build targets        The IDE uses the project manager window to list all the files in the  project  Among the kinds of files in a project are source code files  and libraries     You can add or remove files easily  You can assign files to one or  more different build targets within the project  so files common to  multiple targets can be managed simply     The IDE manages all the interdependencies between files automati   cally and tracks which files have been changed since the last build   When you rebuild  only those files that have changed are recom   piled     The IDE also stores the settings for compiler and linker options for  each build target  You can modify these settings using the IDE  or  with  pragma statements in your code        PPC 30 Targeting Embedded PowerPC    Getting Started  The Development Process with CodeWarrior    Editing Code    The CodeWarrior IDE has an integral text editor designed for pro   grammers  It handles text files in MS DOS Windows  UNIX  and  Mac OS formats     To edit a source code file  or any other editable file that is in a  project  double click the file name in the project window to open the  file     The editor window has excellent navigational features that allow  you to switch between related files  lo
206. mple of an L1 Instruction Cache window     Figure 5 19 AMC L1 Instruction Cache Display    fi L1 Instruction Cache  8260  lolx   Eile View Controls Help    BR  an way      Jaj viej  ej  nel way   adaress  v i    uoran  voreaa  orde  voraa  wora      woras    orde   woraz       78978000 efd109da f6170931 59173578  cdbebdc feld  eOia f4c39b31  dabbecS eSbefdad  fbdbbooo ff5D0e23 ecdedadt fed4f3ec aa4340fb b9d96008 91e057b5 abf fl c3 fde fd099  334e7000 d9l4la5f be395eda f7132b81 ecfe 533 f3l1ffcb  7189472 cubbed a bbe49d37  befe 000 aSOecd5  430de0f3 dS4ad td 777731lel afe 179d  fatilabd ebede395 fudefffe  b17fA020 47fe595a 43ca79f0 76571406 4S54eaba  Ddede4b9 ldc  y4cba 2272d7e0  fOcc le  afcO4oeo 967134159 b4ec4 ice b399a79b cege5ad3 8bb773390 pab  cfdd eSb4e74e 3bedc bd  f3beco2o bbeae be 15c7244f 4eb0f09a c921332b ecObdl b 354 fc ds b Dabb4e 50719241  baeeco2o 99241496 bdOc fSb 30bd5b3c a55tab32 f fcode2 341b9d8b ec  r abd acd39b71  59ab2040 414e7b16 O4ceaft3 e4ao4fcs clcOcbb3 d73c4d346 647028dc O40 bede 55193ef4  a5309040 Pa4bact3 bc49b de f105feac 3beebd c acci29d9 5b445c3b bbee3co9   bfb925b  bbaadO4O 3c3451ff 779481c0 9030a51f b3dS5ece3 cld54aDf beb4333a boa f4esd befactdb  daDa39040 5bca5947 b1Da3ebe c3e73d3f a30e9a14 407aa 0f eeDOfb74 3be31430 Brbe3bba  Sbdye0b0 97bbb4ab 75ace  da 1b8dd  db lec383f3 be83d7e3 Sbeo0a co 14bd53a2 E00145ab  bbd5cOb0 af647ccb bfedeb53 ee ofa47  89077c7b b4 3aeac ebufb3ab cedef7b7 dflbOafa  97140060 45f87487 eb1f2474 4deta3d3b b  ladbfe alc
207. n   see    Project Stationery    on page 33    You also can open and view a sample project in the following direc   tory     Windows  CodeWarrior  directory   CodeWarrior_Examples CDemon CDemon mcp       Solaris  CodeWarrior directory  CodeWarrior_Examples CDemon   CDemon mcp    Table 11 2 lists the most common build target settings for develop   ing and debugging with a PowerTAP device  For more information   see    Settings Panels for Embedded PowerPC    on page 66 and    Con     necting with PowerTAP    on page 136           PPC 260 Targeting Embedded PowerPC    Using the PowerTAP 6xx 7xx Debugging Device  Target Settings for PowerT AP                            Table 11 2 Target settings for PowerTAP   Panel Name Setting Value   Build Extras  see IDE User Activate Browser checkbox Selected    Guide    EPPC Target    Project Type    on page 71 Application    EPPC Processor    Processor    on page 81 Your processor    EPPC Target Settings     Target Processor    on page Your processor   111     Protocol    on page 108 AMC PowerTAP      Breakpoint Type    on page Auto2   103     Watchpoint Type    on page Data  Read  Write  or  113 Read Write           Use Initialization File    on    page 112    Select when using a  debug initialization  file           Initialization File    on page       105    When using a debug  initialization file  type  the file name in this  field           Interface Clock Frequency       Select the clock fre        on page 106 quency for the JTAG   C
208. n  Level to 0  which causes the compiler to use register coloring only  for compiler generated  temporary  variables  For more informa   tion  see    Register Coloring Optimization    on page 175     e Level 1 performs dead code elimination and global register  allocation     e Level 2 performs the optimizations found in Level 1 plus  common subexpression elimination and copy propagation   Level 2 is best for most code     e Level 3 performs the optimizations found in Level 2  plus  moving invariant expressions out of loops  also called Code  Motion   strength reduction of induction variables  copy  propagation  and loop transformation  Level 3 is best for  code with many loops     e Level 4 performs the optimizations in Level 3  including per   forming some of them a second time for even greater code ef   ficiency  Level 4 can provide the best optimization for your  code  but it will take more time to compile than with the  other settings     This option corresponds to  pragma global_optimizer and   pragma optimization level           NOTE  Use compiler optimizations only after debugging your  software  Using a debugger on an optimized program may affect  the source code view that the debugger shows     EPPC Processor    The EPPC Processor settings panel  shown in Figure 4 6  controls  processor dependent code generation settings        Targeting Embedded PowerPC PPC 79    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 6 EPPC Processor
209. n the breakpoint triggers  The breakpoint  can be set only in writable memory     e Hardware     breakpoint registers on the target processor are  used     e Auto     debugger decides which is the best method to set the  breakpoint     The default setting is Auto    NOTE  PowerTAP permits only one type of breakpoint to be ac   tive at a time  You can choose either one hardware breakpoint or   up to 1024 software breakpoints    Connection   Select Serial or TCP IP from the Connection menu to indicate the    type of connection to use     NOTE  The Connection menu applies only to the Abatron BDI  protocol        Targeting Embedded PowerPC PPC 103    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Device    This menu allows you to select a Macraigor Systems hardware   based debugging device  The choices include     e Raven  BDM or COP  depending on which device you are us   ing   e Hummingbird    e Wiggler    NOTE  The Device option is not available within the Solaris  hosted tools because the Wiggler protocol  which uses a parallel  PC  is not available for Solaris     Entry Point    Enter the entry point name in this edit field  The entry point is the  function used as the entry point when the initial task is spawned     Force shell download on connect    Select the Force shell download on connect checkbox to force the  shell program to download again to the CodeTAP or PowerTAP de   vice     FPU Buffer Address    NOTE  This option is for Macraigor 
210. n the memory configuration file      If you try to write to an illegal address  the write command is ig   nored and fails        For more information  see    Memory Configuration Files    on page  313     EPPC Exceptions    The EPPC Exceptions settings panel  shown in Figure 4 11  lists all  the exceptions that the debugger is able to catch  If you want the de   bugger to catch all the exceptions  you should select the checkboxes  of all the options in this panel  However  if you prefer to handle  some of the exceptions  leave the checkboxes of those exceptions un   selected     NOTE  The EPPC Exceptions panel is available only for pro   cessors that use BDM as the debugging protocol  with the excep   tion of the IBM 403 evaluation board     Four exceptions affect the ability of the debugger to control the tar   get processor  To ensure the debugger performs properly  always  select the following exceptions     e 0x00800000 Program     for software breakpoints on some  boards    e 0x00020000 Trace     for single stepping    e 0x00004000 Software Emulation     for software breakpoints  on some boards    e 0x00000001 Development Port     for halting target processor        PPC 116 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 11 EPPC Exceptions panel    N EPPC Exceptions    Exception handling currently only supported for EPFC BOM Targets     Exception Handling  check the exceptions to always catch     Ox4 00
211. n the project  This field allows you to in        Targeting Embedded PowerPC PPC 77    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 5    clude common definitions without including the file in every source  file     Global Optimizations  The Global Optimizations settings panel is shown in Figure 4 5     This panel instructs the compiler to rearrange its object code to pro   duce smaller and faster executing object code  Some optimizations  remove redundant operations in a program  Other optimizations  analyze how an item is used in a program and attempt to reduce the  effect of that item on the performance of the program     Global Optimizations settings panel       Global Optimizations    Optimize For         Faster Execution Speed Smaller Code Size         Optimization Level    ae      Global Register Allocation Only For Temporary Values       All optimizations rearrange object code without affecting the logical  sequence of execution  In other words  an unoptimized program  and its optimized counterpart produce the same results     The levels range from 0 to 4  and the higher the number  the more  the code is optimized        PPC 78 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    e Level 0 performs global register allocation  register coloring   only for temporary values  No additional optimizations are  performed     NOTE  To avoid ambiguity when debugging  set Optimizatio
212. n the small data threshold option in the  PowerPC EABI Project settings panel    const_type   constant data of a size greater than the size  specified in the small const data threshold option in the Pow   erPC EABI Project settings panel    sconst_type   constant data of a size less than or equal to  the size specified in the small const data threshold option in  the PowerPC EABI Project settings panel    all_types   all code and data    Specify one or more of these object types without quotes and sepa   rated by spaces        Targeting Embedded PowerPC PPC 183    C and C   for Embedded PowerPC  Pragmas    CodeWarrior C C   generates some of its own data  such as excep   tion and static initializer objects  which are not affected by  pragma  section     NOTE  CodeWarrior C C   uses the initial setting of the Make  Strings ReadOnly option in the PowerPC EABI Processor settings  panel to classify character strings  If Make Strings ReadOnly is on   character strings are stored in the same section as data of type  const_type  lf Make Strings ReadOnly is off  strings are stored  in the same section as data for data_type     The optional permission parameter specifies access permission  It  may be one or more of these values     e R   read only permission  e W   write permission  e X   execute permission  For information on access permission  see    Section access permis     sions    on page 186  Specify one or more of these permissions in any  order  without quotes  and no spaces 
213. ng     Load the content of the specified memory to the specified internal  register     loadIREG  b  w   1   lt IREGx gt   lt address gt     The following is an example of memory layout     OOOOFFFF  0x11223344  00010003  OxAABBCCDD  00010007  0x44556677                 1  loadIREG b IREGO 0x10000             TREGO contains 0x000000AA           2  loadIREG w IREGO 0x10000             TREGO contains 0x0000AABB              3  loadIREG  1 IREGO 0x10000          IREGO contains OxAABBCCDD             loadIREG       The second kind of 1oadIREG command has the following     Load the content of the specified memory that is pointed to by  IREGy to the specified internal register              loadIREG   b w 1   lt IREGx gt   lt IREGy gt        PPC 280 Targeting Embedded PowerPC    Examples     1    2    3     Flash Programmer  Command File Syntax    This command doesn t need to be inside startProgramLoop and  endProgramLoop block     This command will also work if it is entered in the command line     The following is an example of memory layout     OOOOFFFC     OOOOFFFF  0x11223344    00010000   00010003  OxAABBCCDD                00010004   00010007  0x44556677    Description    write    Usage    Example          REG           1  loadIREG b IREGO IREG1  IREGO will contain 0x000000A A   2  loadIREG w IREGO IREG1  IREGO will contain 0x0000A ABB   3  loadIREG   IREGO IREG1  IREGO will contain 0xAABBCCDD   IREG1   0x00010000     Load Internal Register Immediate    This BDM command will 
214. ngs       DS6  position 1  BDM or HC11     DS6  positions 2 4  DCE or DTE     J3  J4  J6  JZ    Set to BDM when BDM or MetroTRK is  used as the connection protocol     Set to DCE    1 2 CLOSED  factory default   1 2 CLOSED  factory default   1 2 CLOSED  factory default   1 2 CLOSED  factory default        Motorola 555 ETAS    Table E 5 lists the tested dipswitch settings for the Motorola 555                ETAS target board   Table E 5 Motorola 555 ETAS dipswitch settings   Dipswitch Locations Settings   Reset Configuration Word Set 2 and 20 to OFF  All others    32bit  are ON    SW 100 Set 6  7 to ON  All others are  OFF    SW101 Switch to A    SW102 Switch to A to use BDM  Mac   raigor Wiggler  or MetroTRK    SW200 Set 1 and 3 to OFF  2 and 4 to  ON    MODCK 1 Set to OFF    MODCK 2 Set to ON    MODCK 3 Set to OFF    PPC 320 Targeting Embedded PowerPC    Tested Jumper and Dipswitch Settings  Motorola Excimer 603e    Motorola Excimer 603e    Table E 6 lists the tested jumper settings for the Motorola Excimer  603e EVB target board     Table E 6 Motorola 555 ETAS jumper settings          Jumper Locations Settings   J3 1 2 CLOSED  3 OPEN  J4 1 OPEN  2 3 CLOSED  J5 1 OPEN  2 3 CLOSED       Motorola Yellowknife X4 603 750    Table E 7 lists the tested jumper settings for the Motorola Yel   lowknife X4 603 750 target board     Table E 7 Motorola Yellowknife X4 603 750 jumper settings          Jumper Locations Settings   J39 1 OPEN  2 3 CLOSED  J63 Use the factory defaults   J64 1 
215. nking    e Basic information on debugging    NOTE  To debug for this hardware platform  see both the IDE  User Guide and this manual  This manual contains debugging in   formation that is specific to this hardware platform     The difference between CodeWarrior and traditional command line  environments is how the software  in this case the IDE  helps you  manage your work more effectively  If you are unfamiliar with an  integrated environment in general  or with CodeWarrior in particu   lar  you may find the topics in this section helpful  Each topic dis   cusses how one component of the CodeWarrior tools relates to a tra   ditional command line environment        Targeting Embedded PowerPC PPC 29    Getting Started  The Development Process with CodeWarrior    Read these topics to find out how using the CodeWarrior IDE dif   fers from command line programming     Makefiles   the IDE uses a project to control source file de   pendencies and the settings for compilers and linkers    Editing Code   an overview of source code editing in the IDE    Compiling   how the IDE performs compile operations    Linking   how the IDE performs linking operations    Debugging   how to debug a program from the IDE    Viewing Preprocessor Output   A tip on debugging prepro   cessor directives       Makefiles    The CodeWarrior IDE project is analogous to a makefile  Because  you can have multiple build targets in the same project  the project  is analogous to a collection of makefiles  For exa
216. not found in the  IDE User Guide  These are features that are unique to this platform  target and enhance the debugger especially for Embedded PowerPC  development     The special features include   e Displaying Registers  e EPPC Menu  e AMC Data and Instruction Cache Windows       Displaying Registers    To display registers  select Window  gt  Registers Window  Registers  Window is a cascading menu that shows the register types available  for your target processor and board     Your target processor and board determine which registers are  available to display  Some of the most common available registers  follow     e General purpose registers  GPR on the Register Window  menu     e Special purpose registers  SPR on the Register Window  menu     e Floating point registers  FPU on the Register Window menu        Targeting Embedded PowerPC PPC 147    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    NOTE  CodeWarrior provides choices to display only the regis   ters that apply to your target processor and board     The SPR window displays various groupings of special purpose  registers supported by the PowerPC architecture  Just as in the GPR  window  you can edit these values directly by typing into the value  field     NOTE  You cannot edit the register values that have read only  access     For specific information about the use of each special purpose regis   ter  see the PowerPC Microprocessor Family  The Programming Environ   ment for 32 
217. ns  which are small local opti   mizations that eliminate some compare instructions and improve  branch sequences     This option corresponds to  pragma peephole  By default  this  option is off     Profiler Information    Select the Profiler Information checkbox to tell CodeWarrior to  generate special object code during runtime to collect information  for a code profiler     This option corresponds to  pragma profile     EPPC Disassembler    The EPPC Disassembler settings panel  shown in Figure 4 7  is  where you control the information displayed when you choose  Project  gt  Disassemble in the IDE     See the    Compiling and Linking    chapter of the IDE User Guide for  general information about the Disassemble command        Targeting Embedded PowerPC PPC 87    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 7 EPPC Disassembler settings panel    ag    Iv  M  M       The items in this panel are                       Show Headers Show Symbol Table   Show Code Modules Use Extended Mnemonics  Only Show Operands and Show Data Modules  Mnemonics   Disassemble Exception Tables Show DWARF Info  Relocate DWARF Info Verbose Info    Show Headers    The Show Headers checkbox determines whether or not the assem   bled file lists any ELF header information in the disassembled out   put        PPC 88 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Show Symbol Table    The Show Symbol Tabl
218. nstruction Synchronize       For more information on these functions  see the instructions eie   io  sync  and isync in PowerPC Microprocessor Family  The Pro   gramming Environments by Motorola        Targeting Embedded PowerPC PPC 235    Inline Assembler for Embedded PowerPC  Intrinsic Functions    Floating Point Functions    These functions generate inline instructions that take the absolute  value of a number     These functions are not available if the None option is set in the  EPPC Processor preference panel  See    EPPC Processor    on page 79  for details           int _ abs int      Absolute value of an integer                float _ fabs float      Absolute value of a float          float __fnabs float      Negative absolute value of a float          long __labs long      Absolute value of a long int       Byte Reversing Functions    These functions generate inline instructions that can dramatically  speed up certain code sequences  especially byte reversal opera        tions   int _ lhbrx void    int      Load halfword byt reverse index  ef  int _ lwbrx void    int      Load word byt reverse index          void __sthbrx unsigned short  void    int               Store halfword byt reverse index     void _ stwbrx  unsigned int  void    int       Store word byt reverse indexed       However  these intrinsics are now created as having side effects and  will never be optimized away        PPC 236 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Intr
219. nstructions  even if you select this option   These instructions can cause problems in little endian implemen   tations     Consult the PowerPC    Microprocessor Family  The Programming En   vironments by Motorola and IBM for more specific details about  LMW and STMW efficiency issues     Use FMADD 8 FMSUB    When this option is checked  floating point operations are per   formed in hardware  In addition  the FMADD and FMSUB instruc   tions are generated to speed up operation     Selecting this option corresponds to setting  pragma    fp_contract in source code     NOTE  This option can only be used on boards that have hard   ware based floating point support   Instruction Scheduling    If the Instruction Scheduling checkbox is enabled  scheduling of in   structions is optimized for the specific processor you are targeting       PPC 86 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC     determined by which processor is selected in the Processor pop up  menu      NOTE  Enabling the Instruction Scheduling checkbox can  make source level debugging more difficult  because the source  code may not correspond exactly to the underlying instructions  being run   It is sometimes helpful to turn this option off when de   bugging  and then turn it on once you have finished the bulk of  your debugging     Peephole Optimization    The Peephole Optimization checkbox controls whether the com   piler performs    peephole    optimizatio
220. nt triggers  The break   point can be set only in writable memory     e Hardware    Selecting the Hardware menu option sets a processor depen   dent breakpoint  Hardware breakpoints use registers     e Auto    Selecting the Auto menu option causes CodeWarrior to try to  set a software breakpoint and  if that fails  to try to set a hard   ware breakpoint     AMC Data and Instruction Cache Windows    PowerPC processors have two separate N way set associative  caches  One cache is for instructions  the other cache is for data  The  instruction and data caches are located on the processor and are  called primary or level 1  L1  caches     The size and design of the caches vary by processor  as shown by  the following list   e The 603e has 16K  four way set associative caches   e The 860 has 4K  two way set associative caches   e The 740 750 has 32K  8 way set associative caches   The AMC Tools menu in the CodeWarrior menu bar provides ac   cess to two powerful debugging enhancements  the L1 Data Cache  window and the L1 Instruction Cache window   To open either window   Click Debug  gt  AMC Tools   2  Select either L1 Data Cache or L1 Instruction Cache        PPC 152 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Special Debugger Features for Embedded PowerPC    Use the resulting window to examine and debug the contents of the  data or instruction cache of the processor  You can use the controls  to enable  lock  or invalidate the cache     Figure 5 19 shows an exa
221. ntended   use the debug initialization file only to set up the processor for  reading and writing memory  If you use the debug initialization file  to set up the UART  TCP IP  or any other on board peripheral  un   derstand that the debug initialization file setup happens only once   when the debug initialization file is sent the first time      To make sure your processor is configured correctly each time   use the initialization code of your program to set up the board  rather than the debug initialization file     Flash Program Command File    To select your flash program command file  click Change and select  the file from your hard drive        PPC 272 Targeting Embedded PowerPC    Flash Programmer  Using the Flash Programmer    This product provides flash program command files for the default  flash memory from AMD with part number AM29F040 found in the  8xx and 5xx evaluation boards from Motorola  The command files     e Flash505 txt         FlashADS_8xx txt         FlashMBX 8xx txt    are located here            CodeWarrior directory   PowerPC_EABI_Support Flash     NOTE  CodeWarrior for Embedded PowerPC does not provide  flash program command files for the many varieties of flash mem   ory available  See the documentation that came with your flash  memory for information on how to write flash programming algo   rithms     Using the Flash Programmer    When sending a flash image to the board  there are three things you  need to do     e Initialize the Programmer      
222. o read from an ille   gal address  When an illegal read occurs  the debugger fills the  memory buffer with this reserved character     reservedchar  lt char gt      lt char gt  can be any character  one byte      reservedchar OxBA    Description    Usage    range    Allows you to specify a memory range for reading and or writing   and its attributes        range  lt loAddr gt   lt hiAddr gt   lt sizeCode gt   lt access gt   e  lt loAddr gt    start of memory range to be defined    e  lt hiAddr gt    ending address in the memory range to be de   fined    e  lt sizeCode gt    specifies the size  in bytes  to be used for  memory accesses by the debug monitor or emulator        PPC 314 Targeting Embedded PowerPC    Memory Configuration Files  Memory Configuration File Commands    e  lt access gt    can be one of the following  Read  Write  or  ReadWrite  This parameter allows you to make certain  areas of your memory map read only  write only  or read    write only to the debugger           Example  range OxFF000000 OxFFOOOOFF 4 Read  range OxFF000100 OxFFOOOIFF 2 Write  range 0xFF000200 OxFFFFFFFF 1 ReadWrite    reserved    Description Allows you to specify a reserved range of memory     Any time the debugger tries to read from this location  the memory  buffer is filled with the reservedchar  Any time the debugger tries to  write to any of the locations in this range  no write will take place     Usage reserved  lt loAddr gt   lt hiAddr gt        e  lt loAddr gt    start of mem
223. of 32 MB of RAM     Solaris    e A Sparc based machine with the following system software  and hardware         Solaris 2 5 1 or later      Motif 1 2 or later  CDE recommended        Targeting Embedded PowerPC PPC 21    Getting Started  System Requirements        X11 R5 display server  e A minimum of 64 MB of RAM   e 80 MB free hard disk space     e A CD ROM drive to install Code Warrior software  documen   tation  and examples     Target board requirements    A target board from one of the following manufacturers is recom   mended     Cogent Computer Systems  Inc         Cogent CMA102 with CMA 278 Daughtercard  IBM  e IBM 403 EVB  Motorola       Motorola MPC 505 509 EVB  Motorola 555 ETAS  Motorola Excimer 603e  Motorola Yellowknife X4 603 750  Motorola MPC 8xx ADS  Motorola MPC 8xx MBX  Motorola MPC 8xx FADS  Motorola Maximer 7400  Motorola Sandpoint 8240  Motorola MPC 8260 VADS  Embedded Planet   e Embedded Planet RPX Lite 8xx  Phytec    e Phytec miniMODUL PPC 505 509                            PPC 22 Targeting Embedded PowerPC    Getting Started    System Requirements    Additional Requirements    e If you are debugging with MetroTRK  you need a serial cable  to connect your host system with the embedded target   For  more information  see    MetroTRK    on page 28         e If you are debugging using the Macraigor Wiggler  a parallel  cable should be included with your package     e If you are debugging using an AMC  Applied Microsystems  Corporation  CodeTAP or PowerTAP
224. of Debug Initialization Files    Proper Use of Debug Initialization Files    Use a debug initialization file to initialize memory setup only  If you  choose to use the file for additional initialization  such as initializing  on board peripherals or setup ports  these actions will not occur  during normal execution  such as running the program after it is  burned to ROM  The peripherals will not get initialized because the  program will not use the debug initialization file to run  Conse   quently  the program may fail to execute properly     Instead  add initializations other than memory setup to the  init_hardware function in the Metrowerks Embedded PowerPC  startup code     Debug Initialization File Commands    This section discusses debug initialization file commands  includ   ing    e Debug initialization file command syntax   e The commands that apply to each debugging device    e Descriptions and examples of individual commands    NOTE  You can define the values for some debug initialization  file commands in the EPPC Target Settings panel  The values  defined in debug initialization files overwrite those set in the panel     Each section that discusses an individual command lists   e The command name  e A brief description of the command  e Command usage  syntax   e Command examples    e Any important notes about the command       PPC 294 Targeting Embedded PowerPC    Debug Initialization Files  Debug Initialization File Commands    For more information on specific de
225. on fetch of  the first variable in that section  Subsequent fetches in that function  use the register containing the already loaded section address with  a calculated offset     TIP  You can access small data in assembly files with the two in   struction fetch used with large data  because any data on your  board can be accessed as if it were large data  The opposite is not  true  large data can never be accessed with small data relocations   the linker will issue an error if you try to do so   Extern declara   tions of empty arrays  e g   extern int foo      are always  treated as if they were large data  If you know that the size of the  array fits into a small data section  specify the size in the brackets     If you are interested in more details about small data sections   please refer to System V Application Binary Interface  PowerPC Proces   sor Supplement andPowerPC Embedded Application Binary Interface   which are referenced in the section    Where to Go from Here    on    page 15        Targeting Embedded PowerPC PPC 173    C and C   for Embedded PowerPC  Calling Conventions    Calling Conventions    See the following materials for a description of the PowerPC EABI  calling conventions     e System V Application Binary Interface  Third Edition  published  by UNIX System Laboratories  1994  ISBN 0 13 100439 5      e System V Application Binary Interface  PowerPC Processor Sup   plement  published by Sun Microsystems and IBM  1995    Parameter Hack General Purpose Re
226. on file checkbox and type the name of the file in the  Initialization File field     d  Select the Reset on Connect checkbox or  if you prefer to  not always reset the target board when you launch the de   bugger  reset the target board     e  If you used a serial cable to connect the Abatron BDI2000 to  your host machine  select Serial from the Connection menu        PPC 144 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    If you used an Ethernet cable to connect the Abatron  BDI2000 to your network  select TCP IP from the Connection  menu     5  If you selected Serial from the Connection menu  display the Con   nection Settings panel  Figure 5 16  and select settings as de   scribed by the following steps  Otherwise  go to step 6     Figure 5 16 Connection Settings panel with View Serial Settings selected    8 Connection Settings    View Connection Type   view Serial Settings ka       Configure connection settings here  Choose the connection type in the Debugger  Target Settings panel     Primary  Serial Port Options    Port  CO Wi  ka   Parit   N one ka     Riate  115200    Stop Bits      Data Bits   e     Flow Control   H ardware  ATS CTS          Log Serial Data to Log Window   Use Global Connection Settings    Secondary Serial Port Options    Port   COM x    Parity   None x    R ate  38400 x   Stop Bits  1 x    Data Bits   E x   Flow Control Hone ka    Log Serial Data to Log Window   Use Global Connection Settings       a 
227. onal considerations 165  customizing default XML project file 163  deleting files 166  deleting old access paths 166  overview 162  procedure 164  recreating an ELF created project 166  removing files 166  for PowerPC Embedded 123 162  setting up remote 126 143  special features 147 156  Stop and Kill buttons 56  supported methods  Abatron BDI 123  CodeTAP 123  Hummingbird 123  MetroTRK 123  PowerTAP 123  Raven BDM 123  Raven COP 123  SDS Monitor 123  Wiggler 123  target settings 101 121  See also Debugger User Guide  debugging with MetroTRK 162  details  Register Details window 155  development tools 25 29  Device menu  Hummingbird 104  Raven 104  Wiggler 104  dipswitch settings  Cogent CMA 278 daughtercard 318  Embedded Planet RPX Lite 8xx target  board 325  Motorola 555 ETAS target board 320       Targeting Embedded PowerPC PPC 339    Index    Motorola MPC 8xx ADS target board 322  Motorola MPC 8xx FADS target board 324  Motorola MPC 8xx MBX target board 323  Motorola MPC 8260 VADS target board 327  Motorola MPC 505 509 EVB target board 319  Motorola Sandpoint 8240 target board 326  directives  assembler  entry 230  fralloc 231  frfree 231  machine 232  nofralloc 234  opword 234  Disable CW Extensions checkbox  EPPC Target  panel 72  Disassemble Exception Tables 89  disassembly  Register Details window 155  documentation  contacting Metrowerks 18  description 12  feedback 18  documentation architecture 13  double size 170  downloading code problems 244  DWARF 16    E    ed
228. onnection Settings    View Connection Type    on View TCP IP Settings    page 118                 Host Name    on page 121    The host name you as   signed to the Power   TAP device during em     ulator setup          1  You can define values for some settings on the EPPC Target Settings panel on the panel or in debug initializa   tion files  If you use debug initialization file commands to define the values  the commands overwrite any val   ues previously set on the panel  For more information  see    Debug Initialization Files    on page 289           Targeting Embedded PowerPC PPC 261    Using the PowerTAP 6xx 7xx Debugging Device  Setting Up the PowerT AP Emulator    N    The Auto option manages breakpoint resources most effectively  Software breakpoints apply only to code lo   cated in RAM  Hardware breakpoints use the on chip breakpoints of the processor  You can set hardware  breakpoints in RAM or ROM       For more information  see Emulator Installation Guide  which is available from AMC  This document de     scribes how to establish Ethernet communications  assign host names and IP addresses  and update the network    databases     NOTE  Another setting that is available on the EPPC Target Set   tings panel is Watchpoint Type   For more information  see       Watchpoint Type    on page 113   Watchpoints are available only  when using PowerTAP 7xx systems     Setting Up the PowerTAP Emulator    To set up the PowerTAP emulator     Establish communications between the h
229. or      2    a a a ee              255   11 Using the PowerTAP 6xx 7xx Debugging Device 257  PowerTAP Highlights       20 mms Gow bok a 258   PowerTAP Technical Support      a a a a a a 259   PowerTAP Requirements       de cal a at ar e 260   Target Settings for PowerTAP       a a ase a   0    260   Setting Up the PowerTAP Emulator                 262   Updating the PowerTAP Firmware          a a a aa a 263   Resetting the Processor      2    a 2  a a              263   Operational Notes     o a a eget Se Ga ee 264   Recoverable Interrupts      2  a a a a a 264    Interrupts and the Machine Status Save  Restore Registers   265    A Flash Programmer 267  What You See    ao Rok a a 267   Consoles  Zeta s rc de gt Bec be ORS 268   Status and Errors       a aoa he a a a a 268   Helps Ga o BP mad AA aa A in BY mala 269       Targeting Embedded PowerPC PPC 7       Preferences soa aas AF xe BP  RRR Bh Ge WER SA BOGE 270  Using the Flash Programmer         2    a a eee 273  Initialize the Programmer        2    2  7 we  274  Specify a Flash Image  do sal Bat he ME EO oe Be See 274  Send the Flash Image     aoa goa 426  4 A   274  Command File Syntax      22 cdt Gs aa ad et GH Oe ae we cy 275  Write Register Commands               20   275  Read  Write and Save Memory Commands          277  Loop Commands    Hd eM  a 282  Action Commands   iio aa a e a e 284  Wait and Abort Commands                 284  Print Commands      a o ee Bed Se He Mo PB 285  Miscellaneous Commands             
230. or each command     Table B 1 Debug initialization file commands for CodeTAP                      Commands AMC CodeTAP 8xx Settings     AMCMemWriteVerify    on page 300 Settings  0 1     AMCRegWriteVerify    on page 300 Settings  0 1     AMCTargetInterfaceClockFreq    on page 301 Settings   7340000   3670000   1830000   100000   10000   1000     AMCTargetSerializeInstExec    on page 301 Settings  0 1       PPC 296 Targeting Embedded PowerPC    Debug Initialization Files  Debug Initialization File Commands             Commands AMC CodeTAP 8xx Settings     AMCTargetShowInstCycles    on page 301 Settings   0 All     1 Change of Flow   2 Indirect Change of Flow   3 None             polltime    on page 302    Settings  1 20                                              sleep    on page 303 None     writemem b    on page 304 None     writemem 1    on page 304 None     writemem w    on page 305 None     writemmr    on page 305 None     writeupma    on page 307 None     writeupmb    on page 307 None     writereg    on page 306 None     writespr    on page 306 None          PowerTAP Commands    Table B 2 lists the debug initialization file commands supported for  the PowerTAP device  the page number where you can read the de   scription of the command  and any applicable settings information    for each command     Table B 2    Debug initialization file commands for PowerTAP       Commands    AMC PowerTAP Settings          AMCMemReadDelayCycles    on page 299       Settings  0  1 0xfe0
231. or more information  see Emulator Installation Guide  available from  AMC      Plug the JTAG cable into the JTAG port on the board     On the Build Extras settings panel  Figure 5 8   select the Activate  Browser checkbox     Build Extras settings panel    F Use modification date caching    MW Activate Browser      F Dump internal browse information after compile          PPC 136 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    4  On the EPPC Target settings panel  Figure 5 9   select Application  from the Project Type menu     Figure 5 9 EPPC Target settings panel with Application selected    EPPC Target       Project Type   Application x      File Name  Embedded_PPC_C  _Testl ell      5  On the EPPC Processor settings panel  Figure 5 10   select the pro   cessor for which you are developing from the Processor menu     Figure 5 10 EPPC Processor panel with processor selected for PowerTAP       EPPC Processor    Struct Alignment   PowerPC      Function Alignment  4 Byte x    Processor  8240 bd         Targeting Embedded PowerPC PPC 137    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    6  Display the EPPC Target Settings panel  Figure 5 11  and select  several settings as described by the following steps     Figure 5 11 EPPC Target Settings panel with AMC PowerTAP selected  N EPFC Target Settings    Target Processor  8240 ki    Target 0s  BareBoard       Protocol JAME PowerT ap    Hoztname set in    Connection
232. ore software may change when AMC updates  the debugger software or adds new features to the CodeTAP device   The release letter shipped with the AMC products states whether  you must update the core software     For core software update procedures  see the    CodeTAP Core Soft   ware    appendix in Emulator Installation Guide  available from AMC      Debugging Using CodeTAP    When you launch a debug session while using CodeTAP  reset is as   serted to the target system  resetting the processor  If you chose to  use a debug initialization file  the CodeTAP is initialized  and any  parameters in the initialization file are passed to the target and the  emulator  The project is loaded into target memory  and runs to  main  if the Stop at temp breakpoint on application launch check   box is selected in the Debugger Settings panel and main was speci   fied as the default breakpoint      Resetting the Processor    When using a CodeTAP device  you can reset the target processor  using the following methods     e Soft Reset    A Soft Reset asserts the SRESET  line to the target processor   To choose Soft Reset  select Debug  gt  Reset     Hard Reset    A Hard Reset asserts the HRESET  line to the target proces   sor  To choose Hard Reset  select Debug  gt  Hard Reset     After a Hard Reset  the debug initialization file is processed  again  If the debug initialization file contains register initial   ization commands  the processor registers and controllers  can be set up for your t
233. organizes some of the data in the large data  sections of  data   bss  and  rodata so that the program can  access it more quickly  This option only affects data that is actually  defined in the current source file  it does not affect external declara   tions or any small data  The linker is normally aggressive in strip   ping unused data and functions from your C and C   files in your       PPC 84 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    project  However  the linker cannot strip any large data that has  been pooled     If your program uses tentative data  you will get a warning that you  need to force the tentative data into the common section  For more    information  see    Use Common Section    on page 85     Use Common Section    The Use Common Section checkbox determines whether the com   piler places global uninitialized data in the common section  This  section is similar to a FORTRAN Common Block  If the linker finds  two or more variables with the same name and at least one of them  is in a common section  those variables share the same storage ad   dress  When the switch is off  two variables with the same name  generate a link error  The compiler never places small data  pooled  data  or variables declared static in the common section     The section pragma provides fine control over which symbols the  compiler includes in the common section  For more information  see     section    on page 183 for
234. ort  conventions        Different baud rates apply for MetroTRK when running So   laris 5 1  See    MetroTRK Baud Rates    on page 158 for a table    of baud rates    The flash utility  PPCComUtil  has not been ported to Solaris   therefore flashing that does not use project stationeries that  include a Burn ROM target must be done on a Windows  computer     When using Solaris  MetroTRK projects that use PowerTAP   from Applied Microsystems Corporation  Inc   can self   flash  However  MetroTRK projects that use Wiggler do not  self flash for Solaris  Because PPCComUtil is not available for  Solaris  you must use a Windows computer to flash Me   troTRK projects that use Wiggler     All file path names are shown in DOS format  Solaris path  names are identical to the DOS path  except a forward slash  should replace the back slash     About This Book    CodeWarrior is a multi host  multi language  multi target develop   ment environment  Most features of CodeWarrior apply no matter   what platform target you are programming for  However  each tar   get has its own unique features  This manual describes those unique  features to programming for Embedded PowerPC     General features of CodeWarrior are described in other manuals   For a complete understanding of CodeWarrior  you must refer to       PPC 12 Targeting Embedded PowerPC    Table 1 1    Table 1 2    Introduction  About This Book    both the generic documentation and the documentation that is spe   cific to your particul
235. ort on the board     Ensure that the BDM connector is inserted correctly  Align the red  stripe with pin 1 of the BDM port        PPC 140 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    4  Display the EPPC Target Settings panel  Figure 5 13  and select  several settings as described by the following steps     Figure 5 13 EPPC Target Settings panel with MSI Wiggler selected       EPPC Target Settings  Target Processor   Sxx ki    Target DS   BareBoard  gt    Protocol   MSI Wiggler    W Use Initialization File        Initialization File      Hurom_Debug_Init ctt Browse         T Log Connection Commands  Parallel Port  LPT1    i    Log will be placed in    Device  Hummmingbird     seas lar  Me       a  From the Target Processor menu  select the processor for  which you are developing     b  From the Protocol menu  select MSI Wiggler     c  If you are using a debug initialization file  select the Use Ini   tialization file checkbox and type the name of the file in the  Initialization File field     d  From the Parallel Port menu  select the parallel port to  which you connected your parallel cable     e  From the Device menu  select the debugging device that  you are using  Raven  Hummingbird  or Wiggler         Targeting Embedded PowerPC PPC 141    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    5  Select any other needed target settings for your project     For more information  see    Settings Panels for Embed
236. ory range to be defined    e  lt hiAddr gt    ending address in memory range to be defined    Example  reserved 0xFF000024 OxFF00002F       Targeting Embedded PowerPC PPC 315    Memory Configuration Files  Memory Configuration File Commands       PPC 316 Targeting Embedded PowerPC       metrowerks    E    Tested Jumper and  Dipswitch Settings    This appendix provides tested jumper and dipswitch settings for a  number of supported target boards  Before using a target board  with this product  set any appropriate jumper or dipswitch settings  for your supported target board     This appendix contains the following topics   e Cogent CMA102 with CMA 278 Daughtercard   IBM 403 EVB   Motorola MPC 505 509 EVB   Motorola 555 ETAS   Motorola Excimer 603e   Motorola Yellowknife X4 603 750   Motorola MPC 8xx ADS   Motorola MPC 8xx MBX   Motorola MPC 8xx FADS   e Embedded Planet RPX Lite 8xx   Motorola Maximer 7400   Motorola Sandpoint 8240   Motorola MPC 8260 VADS   Phytec miniMODUL PPC 505 509                                  Targeting Embedded PowerPC PPC 317    Tested Jumper and Dipswitch Settings  Cogent CMA102 with CMA 278 Daughtercard    Cogent CMA102 with CMA 278 Daughtercard    Table E 1    Table E 2    Table E 2 lists the tested jumper settings for the Cogent CMA102  target board when used with a CMA 278 daughtercard     NOTE  The CMA 278 daughtercard uses a 603 740 processor     Cogent CMA102 jumper settings          Jumper Locations Settings  P6 All pins are OPEN   W2 Use th
237. ost machine where the  debugger is running and the PowerTAP device     For more information  see Emulator Installation Guide  available from  AMC      Connect to the target board     To learn how to establish connection with the target  see    Connect   ing to a Target    Emulator Installation Guide  available from AMC      NOTE  If you are using an evaluation board  see    Debugging for  Embedded PowerPC    on page 123  You can check for any AMC  application notes at        http   www amc com       PPC 262 Targeting Embedded PowerPC    Using the PowerTAP 6xx 7xx Debugging Device  Updating the PowerT AP Firmware    Updating the PowerTAP Firmware    The PowerTAP device stores its core software in flash memory on  the target board  This core software may change when AMC up   dates the debugger software or adds new features to the PowerTAP  device  The release letter shipped with the AMC products states  whether you must update the core software     For core software update procedures  see the    PowerTAP Core Soft   ware    appendix in Emulator Installation Guide  available from AMC      Resetting the Processor    When using a PowerTAP device  you can reset the target processor  using the following methods     e Soft Reset    WARNING  At the time of this writing  Soft Reset does not work  for some PowerTAP targets     A Soft Reset asserts the SRESET  line to the target processor   To choose Soft Reset  select Debug  gt  Reset     e Hard Reset    A Hard Reset asserts the HRESET 
238. ou have been using all along  You will  how   ever  need to become familiar with the Embedded PowerPC run   time software environment     CodeWarrior IDE    The CodeWarrior IDE is the application that allows you to write  your executable  It controls the project manager  the source code ed   itor  the class browser  the compilers and linkers  and the debugger     The CodeWarrior project manager may be new to those more famil   iar with command line development tools  All files related to your  project are organized in the project manager  This allows you to see  your project at a glance  and eases the organization of and naviga   tion between your source code files     For more information about how the CodeWarrior IDE compares to  a command line environment  see    The Development Process with  CodeWarrior    on page 29  That short section discusses how various  parts of the IDE implement the classic features of a command line  development system based on makefiles     The CodeWarrior IDE has an extensible architecture that uses plug   in compilers and linkers to target various operating systems and mi   croprocessors  The CodeWarrior CD includes a C C   compiler for  the Embedded PowerPC family of processors  Other CodeWarrior  packages include C  C    Pascal  and Java compilers for Mac OS   Win32  and other platforms     For more information about the CodeWarrior IDE  you should read  the IDE User Guide     CodeWarrior Compiler for Embedded PowerPC    The CodeWarrior compi
239. owerks directs you to the relevant statements of Microsoft Cor   poration  Sun Microsystems  Inc   Apple Computer  Inc   and other  host or target operating systems relating to the Year 2000 Compli   ance of their operating systems  Except as expressly described  above  the Products  in themselves  do not process date data and  therefore do not implicate Year 2000 Compliance issues     For additional information  visit   http    ww metrowerks com about y2k html       Targeting Embedded PowerPC PPC 19    Introduction  Metrowerks Year 2000 Compliance       PPC 20 Targeting Embedded PowerPC       mms  Getting Started    This chapter gives you the information you need to install  CodeWarrior  For new CodeWarrior users  this chapter provides a  brief overview of the CodeWarrior development environment     This chapter includes the following topics        e System Requirements   e Installing CodeWarrior for Embedded PowerPC  e CodeWarrior Compiler Architecture   e Development Tools for Embedded PowerPC   e The Development Process with CodeWarrior       System Requirements    Currently  the host platforms available for programming Embedded  PowerPC systems with CodeWarrior are Windows 32 bit operating  systems and Solaris     Windows Requirements    e A personal computer with a Pentium or higher processor   with a CD ROM drive to install CodeWarrior software  docu   mentation  and examples     e Microsoft Windows 95  Windows 98  or Windows NT 4 0 op   erating system     e A minimum 
240. owerks prod   uct  contact Metrowerks Technical Support     There are several ways you can contact Technical Support  Table 1 3  lists your technical support options     Table 1 3 Technical Support options       E mail cw_emb_support metrowerks com   Telephone  512  873 4700   Newsgroup comp  sys mac programmer  codewarrior   World Wide Web http    www metrowerks com support  embedded  Compuserve Go  Metrowerks       To assist Technical Support in answering your question  please use        CodeWarrior Directory  Release_Notes email_Tech_Question_Form txt    when submitting a support question     Contacting the Documentation team    At Metrowerks  our goal is to deliver the highest quality software  and documentation  To achieve this goal  we need your feedback   Please send any errors  omissions  suggestions  or general com   ments about CodeWarrior documentation to     wordwarrior metrowerks com       PPC 18 Targeting Embedded PowerPC    Introduction  Metrowerks Year 2000 Compliance    Metrowerks Year 2000 Compliance    The Products provided by Metrowerks under the License agree   ment process dates only to the extent that the Products use date data  provided by the host or target operating system for date representa   tions used in internal processes  such as file modifications  Any Year  2000 Compliance issues resulting from the operation of the Products  are therefore necessarily subject to the Year 2000 Compliance of the  relevant host or target operating system     Metr
241. ows the current build target     eee 3 8 The dls aid window and current build target          Current  Build 4 W Sex FADS Debug Version   E my Aer FF  Target  O co El  e mE Serial  UART  0 0  El    E Runtime 0  D       El  EU Linker Command File 0  0   El    10 files       TIP  To change the current build target for the currently selected  Project window  choose Project  gt  Set Default Target  gt  Target   where Target is the name of the target that you are specifying as  the current build target        PPC 44 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    When the Project window shows the correct current build target   choose Edit  gt  Target Settings  where Target is the name of the cur   rent build target  The Target Settings window appears  Figure 3 9      Figure 3 9 The Target Settings window       8xx FADS Debug Version Settings    Target Settings 8xx FADS Debug Version    Access Paths    Build Extras  Runtime Settings ore  File Mappings  Source Trees  None o  EPPC Target  E  Language Settings  i C C   Language  C C   Warnings  EPPC Assembler  E  Code Generation  i Global Optimizations  EPPC Processor  EPPC Disassembler  E  Linker  i EPPC Linker                   TIP  To quickly open the settings for a build target  go to the Tar   gets view in the Project window and double click the relevant build  target  Using this method  you can open the settings for two or  more build targets simultaneously     The Target Settings
242. p  The length is useful if you want to avoid  overlapping an RTOS or exception vectors that might not be a part  of your image     You specify that a output_spec or a GROUP goes into a  memory spec with the     gt     symbol        Targeting Embedded PowerPC PPC 197    C and C   for Embedded PowerPC  Linker Issues for Embedded PowerPC    Example 2 showed the MEMORY directive added to Example 1  The  results of both examples are identical     SECTIONS    A SECTIONS directive has the following form        SECTIONS    lt section_spec gt               lt output_spec gt     where section_spec is      lt input_type gt    lt address_modifiers gt        lt input_spec gt           Table 6 7    output_spec is the section name for the output section                 input_type is one of TEXT  DATA  BSS  CONST and MIXED  CODE  is also supported as a synonym of TEXT  One input_type is per   mitted and must be enclosed in      If an input_type is present   only input sections of that type are added to the section  MIXED  means that the section contains code and data  RWX   The  input_type restricts the access permission that are acceptable for  the output section  but they also restrict whether initialized content  or uninitialized content can go into the output section              Types of input for input_type             Name Access Permissions Status  TEXT RX Initialized  DATA RW Initialized  BSS RW Uninitialized  CONST R Initialized  MIXED RWX Initialized             address_modifiers 
243. page 78     When debugging a project  the variables sharing a register may ap   pear ambiguous  In Listing 6 1 on page 175  i and j would always  have the same value  When i changes  j changes in the same way   When j changes  i changes in the same way     To avoid confusion while debugging  set Optimization Level to 0 on  the Global Optimizations panel  This setting causes the compiler to  allocate user defined variables only to physical registers or place  them on the stack  The compiler still uses register coloring to allo   cate compiler generated variables     Alternatively  you can declare the variables you want to watch as  volatile     NOTE  The Optimization Level option on the Global Optimiza   tions panel corresponds to the global_optimizer pragma  For  more information  see C Compilers Reference           PPC 176 Targeting Embedded PowerPC    C and C   for Embedded PowerPC  Generating Code for Specific Processors    Generating Code for Specific Processors    Pragmas    This section describes how to use the CodeWarrior compiler to gen   erate code for specific processors within the PowerPC family     You can specify a processor in the Processor pop up list of the EPPC  Processor panel  This allows you to generate code targeted for that  processor  Code targeted for one processor may not run efficiently  on other PowerPC processors   although it will run correctly  To ef   ficiently run your code on multiple PowerPC processors  select Ge   neric from the pop up list 
244. r        cos      7  Select the stationery for your target processor and programming  language and click OK     CodeWarrior creates a project using the stationery you selected     Most stationery projects contain source files that are placeholders  only  You must replace them with your own files  See    Modify the  project contents     on page 41        You also can create customized project stationery by saving a project  into the Stationery folder  For more information  see IDE User    Guide        PPC 36 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Project Stationery    Project Stationery Targets    The CodeWarrior stationeries provide multiple targets with differ   ent purposes  Using the project stationery  you can add your own  code to an existing stationery project  quickly set up the code so that  it is appropriate to place in ROM  and burn the code into ROM     The available targets follow   e Debug Version    This target is set by default when you create the project  This  target includes only the user code and the standard and runt   ime libraries  This target does not perform any hardware ini   tialization or set up any exception vectors  You can continue  using only this target until you need ISRs or to ROM your  code     e ROM Version    This target makes your code ROMable  This target builds an  image for ROM that includes all exception vectors  a sample  ISR  and the hardware initialization  You can use the S   record that this target
245. r   Begin debugging     Select Project  gt  Debug  Your project begins running with the de   bugger     NOTE  For more information on debugging  see IDE User Guide     After debugging  the ELF file you imported is unlocked  If you  choose to build your project in CodeWarrior  rather than using an   other compiler   you can select Project  gt  Make to build the project   and CodeWarrior saves the new ELF file over the original one     ELF File Debugging  Additional Considerations    This section  which discusses information that is useful when de   bugging ELF files  contains the following topics     e Deleting old access paths from an ELF created project          e Removing files from an ELF created project    e Recreating an ELF created project          Targeting Embedded PowerPC PPC 165    Debugging for Embedded PowerPC  Debugging ELF Files    Deleting old access paths from an ELF created project    After you create a project to allow debugging an ELF file  you can  delete old access paths that no longer apply to the ELF file using the  following methods     e Manually remove the access paths from the project in the Ac   cess Paths target settings panel     e Delete the existing project for the ELF file and recreate it by  dragging the ELF file to the IDE     Removing files from an ELF created project    After you create a project to allow debugging an ELF file  you may  later delete one or more files from the ELF  However  if you open  the project again after rebuilding th
246. r Embedded PowerPC    EXCLUDEFILES             The EXCLUDEFILES directive is for partial link projects only  It  makes your partial link file smaller  It is of the form           EXCLUDEFILES   executablename extension         In the following example     EXCLUDEFILES   kernel elf               kernel elf is added to your project  The linker does not add any  section from kernel  elf to your project  However  it does delete  any weak symbol from your partial link that also exists in ker     nel elf  Weak symbols can come from templates or out of line in   line functions                    EXCLUDEFILES can be used independently of INCLUDEDWARF   Unlike INCLUDEDWARF  EXCLUDEFILES can take any number of  executable files     FORCEACTIVE                            The directives FORCEACTIVE and FORCEFILES give you more con   trol over symbols that you don t want dead stripped  FORCEAC     TIVE is of the form          FORCEACTIVE   symboll symbol2                   Use FORCEACTIVE with a list of symbols that you do not want to be  dead stripped     FORCEFILES       Use FORCEFILES to list source files  archives or archive members  that you don t want dead stripped  All objects in each of the files are  included in the executable  It is of the form        FORCEFILES   source o object o archive a member o           NOTE  If you want to use FORCEFILES with the source file  main c  type          PPC 194 Targeting Embedded PowerPC    C and C   for Embedded PowerPC    Linker Issues for E
247. r as shown here     ra   __rlwimi  ra  rs  sh  mb  me     You can count the leading zeros in a register with the following  intrinsic     int __cntlzw int      Count leading zeros in a integer       TIP  You can use inline assembly for a complete assembly lan   guage function  as well as individual assembly language state   ments  See    Working With Assembly    on page 216        Data Cache Manipulation    The intrinsics shown in Table 8 1 map directly to PowerPC  assembly instructions     Table 8 1 Data Cache Intrinsics    Intrinsic Prototype PowerPC  Instruction  void _ dcbf  void    int   acbf  void _ debt  vale    mie  p dcbt  void __dcbst  void    int   dcbst  volel Cleo si  vale    aime    dcbtst  void _ dcbz  void    int   dcbz          PPC 238 Targeting Embedded PowerPC    Table 8 2    Inline Assembler for Embedded PowerPC    Math Functions    Intrinsic Functions    The intrinsics shown in Table 8 2 map directly to PowerPC  assembly instructions     Math Intrinsics    Intrinsic Prototype    in  al    do  do    do  do    do  do    do    Q  O    O    mh MEN o MEN th h O rh                                                       t _ mulhw int  int     ne muaa  uime  vae      uble _ fmadd  double  double   uble     uble _ fmsub double  double   uble     uble _ fnmadd  double  double   uble     uble _ fnmsub  double  double   uble      loat _ fmadds  float  float  float    loat _ fmsubs  float  float  float    loat _ fnmadds  float  float    Loat     Loar     amseulos  LOSE
248. rPC target processors that are available and  the debugging protocols supported for each     Debugging protocols for PowerPC target processors       Processor Type Debugging Protocol       Generic no FPU  Any protocol    Generic with FPU  Any protocol    505 509 MSI Wiggler   MetroTRK  Abatron BDI   555 MSI Wiggler   Serial MetroTRK  Aba   tron BDI   603 AMC PowerTAP  MetroTRK  Raven  COP       Targeting Embedded PowerPC PPC 111    Target Settings for Embedded PowerPC    Settings Panels for Embedded PowerPC       Processor Type    Debugging Protocol       740 750  821 860    7400  8240    8260    403    AMC PowerTAP  MetroTRK    AMC CodeTAP  MSI Wiggler   Me   troTRK  Abatron BDI    AMC PowerTAP  MetroTRK    AMC PowerTAP  MSI Wiggler     AMC PowerTAP  MetroTRK  Raven  COP       MSI Wiggler        1  Code Warrior includes generic processors as an option so that you can use a non   standard processor with the Code Warrior tools  To debug a target board with a ge   neric processor  you must customize MetroTRK to work with the board  For more  information  see MetroTRK Reference     2  The MSI Wiggler option is available for Windows hosted development only     Target Server Name    Target Server Name is the name of the registered target server you    want to connect to     Unload Module on Exit     Enable Unload Module on Exit  to unload the application module    from the target once your application exits the debugger     Each time your debug your application  the module is down
249. rce active function align          incompatible return small structs incompatible sfpe double params          interrupt pack  pooled data section       force active    tporagma force_active on off reset    This pragma inhibits the linker from dead stripping any variables  or functions defined while the option is in effect  It should be used  for interrupt routines and any other data structures which are not  directly referenced from the entry point of the program  but which  must be linked into the executable program for correct operation     NOTE   pragma force_active can t be used with uninitial   ized variables because of language restrictions with tentative ob   jects  Also  if auto inlining and deferred inlining are on the com   piler shuffles functions around and will  at the time of this writing   lose the force_active information     function_align     pragma function_align 4   8   16   32   64    128    If your board has hardware capable of fetching multiple instruc   tions at a time  you may achieve better performance by aligning  functions to the width of the fetch     With the pragma function_align  you can select alignments  from 4  the default  to 128 bytes        Targeting Embedded PowerPC PPC 179    C and C   for Embedded PowerPC  Pragmas    This pragma corresponds to Function Alignment pop up menu in  the EPPC Processor settings panel  See    Function Alignment    on  page 81 for information on how to specify function alignment    through the settings panel  
250. re information on Embedded PowerPC register conventions  and argument passing conventions  see    C and C   for Embedded    PowerPC    on page 167        Creating a Stack Frame in Embedded PowerPC  Assembly    You need to create a stack frame for a function when the function  performs the following actions    e calls other functions   e uses more than 224 bytes of local variables   e declares local register variables  The easiest way to create a stack frame is to use the fralloc direc   tive at the beginning of your function and the frfree directive just  before the blr statement  The directive fralloc automatically al     locates  while   free automatically de allocates  memory for local  variables  and saves and restores the register contents        Your code here       Targeting Embedded PowerPC PPC 223    Inline Assembler for Embedded PowerPC  Working With Assembly    frfree    blr    The fralloc directive has an optional argument number which lets  you specify the size in bytes of the parameter area of the stack  frame  The stack frame is an area for storing parameters used by the  assembly code  By default  the compiler creates a 32 byte parameter  area for you to pass variables into your assembly language  functions  If your assembly language routine calls any function that  takes more than 32 bytes of parameters  you must specify a larger  amount  In PowerPC  function arguments are passed using  registers  In the case of integer values  registers r3 r10 are used   Loc
251. reating a Stack Frame in Embedded PowerPC Assembly       e Specifying Operands in Embedded PowerPC Assembly       Assembler Syntax for Embedded PowerPC    To specify that a block of code in your file should be interpreted as  assembly language  use the asm keyword     NOTE  To ensure that the C C   compiler recognizes the asm  keyword  you must turn off the ANSI Keywords Only option in the  C C   Language panel  This panel and its options are fully de   scribed in the C Compilers Reference     The assembly instructions are the standard Embedded PowerPC in   struction mnemonics  For information on Embedded PowerPC as   sembly language instructions  see PowerPC Microprocessor Family   The Programming Environment for 32 Bit Microprocessors  published  by Motorola  serial number MPCFPE32B AD      For instructions specific to the 5xx series of processors  see MPC500  Family RCPU Reference Manual  published by Motorola  serial num   ber RCPURM AD         PPC 216 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Working With Assembly    For instructions specific to the 8xx series of processors  see MPC821  Data Book  published by Motorola  serial number MPC821UM AD      There are two ways to use assembly language with the  CodeWarrior compilers     First  you can write code to specify that an entire function is in  assembly language  This is called function level assembly language   Alternatively  assembly statement blocks within a function are also  supported  In
252. rectives    on page 230  If you use the machine  directive  you can also use instructions that are available only in  certain versions of the PowerPC  For more information  see     machine    on page 232           Keep these tips in mind as you write assembly functions     e All statements must follow this syntax      LocalLabel    instruction   directive   operands     Each instruction must end with a newline or a semicolon          e Hex constants must be in C style  not Pascal style  For example     li r3  OxABCDEF    OK  li r3  SABCDEF     ERROR                PPC 218 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Working With Assembly    e Assembler directives  instructions  and registers are case   sensitive and must be in lowercase  For example  the following  two statements are different     add r2 r3 r4    OK  ADD R2 R3 R4    ERROR          e Every assembly function must end in an blr statement  The  compiler does not add one for you  For example     asm void f  void      add r2 r3 r4       SEMANTIC ERROR  No blr statement          asm void g void      add r2 r3 r4  pir    OK    Listing 8 1 shows an example of an assembly function     Listing 8 1 Creating an assembly function    asm void mystrcpy  char  tostr  char  fromstr       addi  tostr tostr  1   addi fromstr fromstr  1   41 lbzu r5 1 fromstr    cmpwi r5 0   stbu r5 1 tostr    bne  1   blr       Targeting Embedded PowerPC PPC 219    Inline Assembler for Embedded PowerPC  Working With Assem
253. rgeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    The link map shows which file provided the definition for every ob   ject and function in the output file  It also displays the address given  to each object and function  a memory map of where each section  will reside in memory and the value of each linker generated sym   bol  Although the linker aggressively strips unused code and data  when the relocatable file is compiled with the CodeWarrior com   piler  it never deadstrips assembler relocatables or relocatables built  with other compilers  If a relocatable was not built with the  CodeWarrior C C   compiler  the link map lists all the unused but  unstripped symbols  You can use that information to remove the  symbols from the source and rebuild the relocatable in order to  make your final process image smaller     List Unused Objects    Enable the List Unused Objects checkbox to tell the linker to in   clude unused objects in the link map     Typically this item is off  However  you may want to turn it on in  certain cases  For example  you may discover that an object you ex   pect to be used is not in use     Suppress Warning Messages    Enable the Suppress Warning Messages checkbox to tell the linker  to display warnings in the CodeWarrior message window     In typical usage  this setting is on   Heap Address    The Heap Address edit field specifies the location in memory where  the program heap resides  The heap 
254. s allows you to verify  that your program writes to memory correctly        e Verify that the linker is generating code in valid memory  space for your target     e Verify that your Stack Pointer is in valid RAM and that it will  not overwrite your program     Common Error Warnings for CodeTAP and  PowerTAP    Following are some errors you might encounter when using Code   TAP or PowerTAP  and possible solutions     e    Could not connect to hostname       e    The memory at address Oxnnnnnnnn has changed during  emulation  Breakpoints            e    Access breakpoints are not supported for this processor          Could not connect to hostname          This message indicates that a communications problem exists or  that the emulator that you are attempting to connect to is currently  in use     To correct the problem     1  Check the Ethernet communications     To learn how to check the Ethernet communications  see Emulator  Installation Guide  available from AMC  Applied Microsystems Cor   poration         Targeting Embedded PowerPC PPC 245    Troubleshooting for Embedded PowerPC  Targeting BOM Devices FAQ    2  If you still receive this message  reset the emulator     To learn how to reset the emulator  see Emulator Installation Guide   available from AMC     3  After resetting the emulator  check the Ethernet communications  again        The memory at address Oxnnnnnnnn has changed during  emulation  Breakpoints            Indicates that memory in which breakpoints have s
255. s for Embedded PowerPC  Settings Panels to Optimize Code    TIP  Use project stationery when you create a new project  The  stationery has all settings in all panels set to reasonable or default  values  You can create your own stationery file with your preferred  settings  Modify a new project to suit your needs  then save the  new project in the stationery folder  For more information  see IDE  User Guide and    Project Stationery    on page 33        Settings Panels to Optimize Code    You can choose code optimizations in the following settings panels   the Global Optimizations settings panel and the EPPC Processor set   tings panel     The Global Optimizations panel performs a number of optimiza   tions that apply to all CodeWarrior products  depending on which  optimization level you choose  from 0 to 4    For more information   see    Global Optimizations    on page 78      The EPPC Processor settings panel also contains several settings  that you can select to perform Embedded PowerPC specific optimi   zations     e Make Strings Read Only  e Pool Data   e Use Common Section   e Use LMW     STMW   e Use FMADD  amp  FMSUB    e Instruction Scheduling  e Peephole Optimization          NOTE  For more information  see    EPPC Processor    on page  79           Targeting Embedded PowerPC PPC 65    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Select the best combination of optimization settings for your appli   cation in both the Global Optimiz
256. s when using console I O with  the MSL C or C   libraries  In order for the console I O to function   a special serial I O library must be built into the project  In addition   the hardware must be initialized properly to work with this library   These issues are discussed in the following two topics     e Including UART libraries  e Configuring the board for console I O  MPC 8xx only              Including UART libraries    In order for the C or C   libraries to handle console I O  a special  serial driver library must be included in your project  The particular  library you use will depend on the board you are using and the se   rial port that you want to communicate through  Table 7 1 indicates  the file you must include based on your setup  You can find all files  listed in this table in the Bin folder of the following directories            CodeWarrior directory   PowerPC_EABI_Tools MetroTRK Transport   ppc  Board directory  Bin        Targeting Embedded PowerPC PPC 209    Libraries and Runtime Code for Embedded PowerPC    MSL for Embedded PowerPC    Table 7 1 Serial l O libraries       Board    Filename       Cogent CMA102 with CMA 278  Daughtercard    IBM 403 EVB  Motorola MPC 505 509 EVB       Motorola 555 ETAS    Motorola Excimer 603e       Motorola Yellowknife X4 603 750       Motorola MPC 8xx ADS  24 MHz        Motorola MPC 8xx MBX  40MHz        Motorola MPC 8xx MBX  50MHz           Motorola MPC 8xx FADS  24MHz        Embedded Planet RPX Lite 8xx  Motorola Maximer 
257. ses        NOTE  Since the stack grows downward  it is common to place  the stack as high as possible  If you have a board that has Me   troTRK installed  this monitor puts its data in high memory  The  default  factory  stack address reflects the memory requirements  of MetroTRK and places the stack address at OxOO3DFFFO  Me   troTRK also uses memory from 0x00000100 to 0x00002000 for  exception vectors     Generate S Record File    The Generate S Record File checkbox determines whether the  linker generates an S Record file based on the application object im   age  This file will have the same name as the executable file  but  witha  mot extension  The linker generates S3 type S Records     Max Length    The Max Length edit field specifies the maximum length of the S   record generated by the linker  This field is only available if the       Targeting Embedded PowerPC PPC 95    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Generates S Record File item is checked  The maximum value al   lowed for an S Record length is 256 bytes     NOTE  Most programs that load applications onto embedded  systems have a maximum length allowed for the S Records  The  CodeWarrior debugger can handle S Records of 256 bytes long  If  you are using something other than the CodeWarrior debugger to  load your embedded application  you need to find out what the  maximum allowed length is     EOL Character    The EOL Character pop up menu defines the end of line charact
258. sign to the build target for your personal use  The  name of the final output file is set in the EPPC Target panel     Linker    Choose a linker from the items listed in the Linker pop up menu   For Embedded PowerPC  use Embedded PPC Linker     Pre Linker    Some build targets have pre linkers that perform work on object  code before it is linked  There is no pre linker for Embedded Pow   erPC development     Post Linker    Some build targets have post linkers that perform additional work   such as object code format conversion  on the final executable   There is no post linker for Embedded PowerPC development     Output Directory    This is the directory where your final linked output file will be  placed  The default location is the directory that contains your  project file  Click the Choose button to specify another directory     Save Project Entries Using Relative Paths    To add two or more files with the same name to a project  select this  option  When this option is off  each project entry must have a  unique name     When this option is selected  the IDE includes information about the  path used to access the file as well as the file name when it stores in   formation about the file  When searching for a file  the IDE com   bines Access Path settings with the path settings it includes for each  project entry     When this option is off  the IDE only records information about the  file name of each project entry  When searching for a file  the IDE  only uses Access P
259. size of the  write   Usage  writemem l  lt address gt   lt value gt     address   the hex  octal  or decimal address in memory to modify       PPC 304 Targeting Embedded PowerPC    Example    Debug Initialization Files  Debug Initialization File Commands    value   the hex  octal  or decimal value to write at the address    writemem 1 0x00010000 0x00000000   Writes 4 bytes to memory    writemem w   Description Writes data to a memory location using a word as the size of the  write    Usage  writemem w  lt address gt   lt value gt   address   the hex  octal  or decimal address in memory to modify  value   the hex  octal  or decimal value to write at the address  Example  writemem w Ox0001FFFO 0x1234   Write 2 bytes to memory   writemmr   Description Writes a value to the specified MMR  Memory Mapped Register      The setIMMR command must precede any writemmr commands in  the debug initialization file  If the register size is smaller than the  data given in the data argument  the lowest significant bytes of the  data will be used     All the Memory Mapped registers are supported by name as found  in the Power QUICC II manual  If any registers are found to not be  supported  writemem commands can be used to accomplish the reg   ister modification     NOTE  The writemmr command applies only to target boards  with 8xx or 8260 processors        Targeting Embedded PowerPC PPC 305    Debug Initialization Files  Debug Initialization File Commands    Usage    Example    writemmr 0x0000
260. sors use the same in     struction set        Targeting Embedded PowerPC PPC 233    Inline Assembler for Embedded PowerPC    Intrinsic Functions     CodeWarrior       nofralloc    You can use the nofralloc directive so that an inline assembly  function does not build a stack frame  When you use nofralloc  if  you have locals  parameters or make function calls  you are respon   sible for creating and deleting your own stack frame  Please see the  file___start c  in the folder listed below  for an example of the  use of nofralloc           Directory  PowerPC_EABI_Support Runtime Src     opword    The opword directive is supported by the inline assembler  For ex   ample  the line    opword 0x7C0802A6    is equivalent to    mflr   r 0     No error checking is done on the value of the opword  the in   struction is simply copied into the executable     Intrinsic Functions    This section discusses support for intrinsic functions in the  CodeWarrior compilers  Support for intrinsic functions is not part of  the ANSI C or C   standards  They are an extension provided by  the CodeWarrior compilers     Intrinsic functions are a mechanism you can use to get assembly lan   guage into your source code     There is an intrinsic function for several common processor opcodes   instructions   Rather than using inline assembly syntax and speci   fying the opcode in an asm block  you call the intrinsic function that  matches the opcode     When the compiler encounters the intrinsic function cal
261. stead of  bitfields     pooled _ data     pragma pooled_data on   off   reset    This pragma changes the state of pooled data     NOTE  Pooled data is only saves code when more than two vari   ables from the same section are used in a specific function  If  pooled data is selected  the linker only pools the data if it saves  code  This feature has the added benefit of typically reducing the  data size and allowing deadstripping of unpooled sections        PPC 182 Targeting Embedded PowerPC    C and C   for Embedded PowerPC    Pragmas    section     pragma section   objecttype   permission    iname    uname   data_mode datamode   code_mode codemode     This sophisticated and powerful pragma lets you arrange compiled  object code into predefined sections and sections you define  This  topic is organized into these parts     Parameters    Section access permissions       Predefined sections and default sections       Forms for  pragma section    Forcing individual objects into specific sections    Using  pragma section with  pragma push and  pragma  pop       Parameters    The optional objecttype parameter specifies where types of object  data are stored  It may be one or more of the following values     code_type   executable object code    data_type   non constant data of a size greater than the  size specified in the small data threshold option in the Pow   erPC EABI Project settings panel    sdata_type   non constant data of a size less than or equal  to the size specified i
262. t Type  luto        Pal Ue rael Watchpoint Type   Data      Interface Clock Frequency  13 67 MHz      Show Inst Cycles  A ka         a  From the Target Processor menu  select the processor for  which you are developing     b  From the Protocol menu  select AMC CodeTAP     c  If you are using a debug initialization file  select the Use Ini   tialization file checkbox and type the name of the file in the  Initialization File field     d  Select the Reset on Connect checkbox or  if you prefer to  not always reset the target board when you launch the de   bugger  reset the target board        PPC 134 Targeting Embedded PowerPC    Debugging for Embedded PowerPC  Setting Up for Remote Debugging      From the Breakpoint Type menu  select Auto     For more information  see    Breakpoint Type    on page 103   From the Watchpoint Type menu  select the type of watch   points to use  Data  Read  Write  or Read Write      Ml    For more information  see    Watchpoint Type    on page 113       From the Interface Clock Frequency menu  select the clock    frequency for the BDM     For more information  see    Interface Clock Frequency    on page  106     From the Show Inst Cycles menu  select which show cycles  are performed  All  Flow  Indirect  or All      For more information  see    Show Inst Cycles    on page 110        7  Display the Connection Settings panel  Figure 5 7  and select set   tings as described by the following steps     Figure 5 7 Connection Settings panel with View TCP I
263. t boards          Embedded PowerPC Board Supported Debugging Methods   Cogent CMA102 with CMA 278 Daughtercard  PowerTAP  MetroTRK   IBM 403 EVB MSI Wiggler   Motorola MPC 505 509 EVB MSI Wiggler  MetroTRK  Abatron  BDI   Motorola 555 ETAS Raven BDM  Hummingbird  MSI  Wiggler  MetroTRK  Abatron BDI   Motorola Excimer 603e Raven COP  PowerTAP  MetroTRK   Motorola Yellowknife X4 603 750 Raven COP  PowerTAP  MetroTRK          PPC 124 Targeting Embedded PowerPC    Debugging for Embedded PowerPC    Supported Debugging Methods       Embedded PowerPC Board    Supported Debugging Methods       Motorola MPC 8xx ADS       Motorola MPC 8xx MBX    Motorola MPC 8xx FADS    Embedded Planet RPX Lite 8xx       Motorola Maximer 7400       Motorola Sandpoint 8240  Motorola MPC 8260 VADS    Phytec miniMODUL PPC 505 509       Raven BDM  CodeTAP  Humming   bird  MSI Wiggler  Target Server   MetroTRK  Abatron BDI    Raven BDM  CodeTAP  Humming   bird  MSI Wiggler  Target Server   MetroTRK  Abatron BDI    Raven BDM  CodeTAP  Humming   bird  MSI Wiggler  Target Server   MetroTRK  Abatron BDI    Raven BDM  CodeTAP  Humming   bird  MSI Wiggler  Abatron BDI    PowerTAP  MetroTRK  Raven COP  PowerTAP  Raven COP  PowerTAP  MetroTRK    MSI Wiggler  MetroTRK  Abatron  BDI       NOTE  The MSI Wiggler option is available for Windows hosted    development only        Targeting Embedded PowerPC PPC 125    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    Setting Up for Remote Debugging    This
264. t is equivalent to the  following definition  where number is the three digit number  of the PowerPC processor being targeted      tdefine _ PPCnumber__ 1    For the PowerPC 821 processor  for instance  the symbol  would be ___PPC821__  If you pick Generic  no such symbol  is generated     e Floating point support  The checkboxes for None  no floating  point   Software and Hardware are available for all proces   sors  even those processors without a floating point unit  If  your RTOS does not support handling a floating point excep   tion  you should select None or Software  When Hardware is  not selected  Use FAADD  amp  FMSUB is disabled     Floating point options    This set of radio buttons determines how floating point operations  in your code are handled  Each option is described below     WARNING  To specify how the compiler should handle floating   point operations for your project  you need to do two things   choose a floating point radio button in this preference panel  and  include the corresponding runtime library in your project     For example  if you click the None radio button  you also need to  include the library Runtime PPCEABI N a in your project        See    Runtime Libraries for Embedded PowerPC    on page 212 for  further information on these libraries           PPC 82 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    None If this option is selected  floating point operations are not  allowed   
265. t or class name from a  typedef statement  followed by any number of member referenc   es  This evaluates to the offset of the member from the start of the  struct  For example     lwz r4 Rect top r3   addi r6 r6 Rect left       Targeting Embedded PowerPC PPC 227    Inline Assembler for Embedded PowerPC  Working With Assembly    As a side note  this line     la rD d rA        is the same as this line     addi rD rA d       You also can use the top or bottom half word of an immediate word  value as an immediate operand  To do this  use one of the   modifi   ers  as illustrated below     long gTheLong     asm void foo void          fralloc    ori r6  gTheLong  ha   upper halfword of address of  gTheLong   ori r7  gTheLong h   upper halfword of address of  gTheLong   addi r7  gTheLong l   lower halfword of address of  gTheLong           frfree  blr    The following example shows the preferred technique     long gTheLong    asm void foo  void       fralloc  lwzr7 gTheLong  RTOC   frfree  ble       PPC 228 Targeting Embedded PowerPC    Inline Assembler for Embedded PowerPC  Working With Assembly    However  the access patterns are     lisx var ha  lax  var l  x        or    lisx var h  orix x var l    In this example  1a is the simplified form of addi to load an  address  las is like la but shifted  Refer to the Motorola PowerPC    manuals for more information     Using  ha is preferred since you can write     lisx var ha  lwzv var l  x        which you can t do with  h because it
266. te  38 400 x    Stop Bits  x    Data Bits Je hd   Flow Control iH one ka    Log Serial Data to Log Window  D Use Global Connection Settings       For more information  see    Connection Settings    on page 118     6  On the Connection Settings panel  select the appropriate baud  rate for the debug monitor that you are using from the Rate menu     For more information on MetroTRK baud rates  see Table 4 4 on  page 120     NOTE  The documentation that accompanied your SDS Monitor  may provide baud rate information for that debug monitor        Targeting Embedded PowerPC PPC 131    Debugging for Embedded PowerPC  Setting Up for Remote Debugging    Connecting with CodeTAP    You can use a CodeTAP device to connect your target board to your  network so that you can debug programs on the target board across  the network   For more information  see    Using a CodeTAP Debug   ging Device    on page 249         To connect your CodeTAP device to your network and target board     1  Assemble the CodeTAP components and configure the system for  network communication     For more information  see Emulator Installation Guide  available from  AMO      2  Plug the BDM cable into the BDM port on the board     Ensure that the BDM connector is inserted correctly  Align the red  stripe with pin 1 of the BDM port     3  On the Build Extras settings panel  Figure 5 3   select the Activate  Browser checkbox     Figure 5 3 Build Extras settings panel  Build Extras    F Use modification date caching 
267. tem requirements 21 24  target 22  Windows 21    T    Target Name text field  Target Settings panel 68  Target Processor 111  Target Resident Kernel See MetroTRK  target server 123  target settings 63 121  Connection Settings 118 121  debugging panels 101 121  EPPC Exceptions 116 117  EPPC Target Settings 101 113  modifying 43  63 65  overview 63 65  Remote Debugging Options 114 116  window 45  63  See also settings panels  Target Settings panel 67 69  Linker option 69  Output Directory option 69  Pre Linker option 69       Targeting Embedded PowerPC PPC 345    Index    Save Project Entries Using Relative Paths  option 69  Target Name text field 68  Target Settings window 63  Target system requirements 22  target  selecting a 67  targets  project stationery  types of 37  TCP IP  connection  choosing on the Connection  menu 103  options  on the Connection Settings panel 121  templates 33  third party editor 43  types  long long 227    U    UART libraries   and console I O 209   and processor speed 211  unsigned char size 169  unsigned int size 169  unsigned long long size 169       unsigned long size 169  unsigned short size 169  updating firmware  CodeTAP 255  PowerTAP 263  Use Extended Mnemonics 89  Use Full Path Names check box 92  Use Global Connection Settings checkbox 121  Use Linker Command File checkbox 96  using alternate C C   libraries 208    V    variables  register 174  vector 171  vector registers  AltiVec   displaying 147  Verbose Info 90    W    Watchpoint Type
268. ter options  depending on your  target processor  Choose a register from the menu  CodeWarrior  displays an information window for the register you choose  For ex   ample  Figure 3 18 shows a GPR register window        Targeting Embedded PowerPC PPC 53    Creating a Project for Embedded PowerPC  Working with a Project    Figure 3 18 GPR register window    E GPR for EPPC_C debug  elf x     0xo0010064  OxOQO00FFFS  0x0001C0E45  0x00010360    0xo00000000  Ox 00000000  0x0001504F  0xb0000000  0x00010360    0xo0000000  Ox00400000  0x00400000  0x00400000  0x00400000  OxOOO0LCADS  Oox00000000  oOxO0000000  0x00010074    oxO0000000  ox00000000  Oxoooo00000  Oxoooo00000  Oxooo00000  Oxoooo00000  ox0d0000000  OoxO0000000    Ooxdoo000000  0x00000000  oOx0O0000000  oOxO0000000  oOxO0000000  oxO0000001  OxOO3FoRF7S  oxdoo000004       Oxoo0000000    ceeoo110001000101100001000100010001  AER J10l0x2 OxvF       NOTE  When you work with your own projects  the registers in   cluded in the Register Window menu differ depending on the tar   get processor and board that you are using     10  Run  stop  and step through code     The toolbar of the Stack Crawl window  Figure 3 19  contains sev   eral buttons that function the same way as the execution commands  in the Project and Debug menus  Run  Stop  Kill  Step Over  Step  Into  and Step Out        PPC 54 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    Figure 3 19 Control buttons in the Stack Crawl
269. than or equal to the  value in the Small Data edit field are considered to be small data     Small Data2    The Small Data2 edit field controls the threshold size  in bytes  for  an item considered by the linker to be    small data     The linker  stores read only small data items in the Small Data2 address space   This space  which is similar to the Small Data address space  but  separate  has faster access than the regular data address space     Read only items whose byte size is less than or equal to the value in  the Small Data2 edit field are considered to be small data     Heap Size  k     The Heap Size edit field controls the amount of RAM allocated for  the heap  The value that you enter is in kilobytes  The heap is used if  your program calls malloc or new  This field is not applicable  when building a library project  heaps are associated only with ap   plications     See also    Heap Address    on page 93   Stack Size  k     The Stack Size edit field controls the amount of RAM allocated for  the stack  The value you enter is in kilobytes  This field is not appli   cable when building a library project  stacks are associated only  with applications     See also    Stack Address    on page 94     NOTE  You can allocate stack and heap space based on the  amount of memory that you have on your target hardware  If you  allocate more memory for the heap and or stack than you have  available RAM  your program will not run correctly        Targeting Embedded PowerPC PPC 73
270. these addressing modes without quotes     The optional code_mode codemode parameter tells the compiler  what kind of addressing mode to use for referring to executable rou   tines for a section     The permissible addressing modes for codemode are     e pc_rel   routines must be within plus or minus 24 bits of  where it is called from    e near_abs   routines must be within the first 24 bits of RAM    e far _abs   routines must be within the first 32 bits of RAM    The default addressing mode for executable code sections is  pc_rel     Specify one of these addressing modes without quotes     NOTE  All sections have a data addressing mode   data_mode datamode  and a code addressing mode   code_mode codemode   Although the CodeWarrior C C   com   piler for PowerPC embedded allows you to store executable code  in data sections and data in executable code sections  this prac   tice is not encouraged     Section access permissions    When you define a section using  pragma section  its default ac   cess permission is read only  If you change the current section for a  particular object type  the compiler adjusts the access permission to  allow the storage of objects of that type while continuing to allow  objects of previously allowed object types  Associating code_type  to a section adds execute permission to that section  Associating  data_type  sdata_type  or sconst_type toa section adds  write permission to that section        PPC 186 Targeting Embedded PowerPC          C and 
271. thods    on page 123     MetroTRK    MetroTRK is a highly modular  reusable debugging kernel that re   sides on the target board and communicates with the debugger   CodeWarrior provides you with the MetroTRK source code so that  you can customize MetroTRK to work with additional target  boards     For more information about MetroTRK  see    Using MetroTRK    on  page 157 and MetroTRK Reference           PPC 28 Targeting Embedded PowerPC    Getting Started  The Development Process with CodeWarrior    Metrowerks Standard Libraries    The Metrowerks Standard Libraries  MSL  are standard C and C    libraries for use in developing applications for Embedded PowerPC   The libraries are ANSI compliant  and all of the source for the librar   ies is provided for you to use in your projects  These are the same li   braries that are used for all CodeWarrior build targets  but they  have been customized and the runtime has been adapted for use in  Embedded PowerPC development     For more information about MSL  see MSL C Reference and MSL C    Reference  To learn how MSL has been adapted for use in Embedded  PowerPC applications  see    MSL for Embedded PowerPC    on page  207        The Development Process with CodeWarrior    While working with CodeWarrior  you will proceed through the de   velopment stages familiar to all programmers  writing code  compil   ing and linking  and debugging  See the IDE User Guide for     e Complete information on tasks such as editing  compiling   and li
272. tialization file can perform several functions     e Initialize registers and memory in targets that do not yet  have initialization code in ROM    e Configure exception handling  watchdogs timers  and so on   to support emulation     e Set PowerTAP or CodeTAP variables to control PowerTAP  or CodeTAP operation during debugging        Targeting Embedded PowerPC  PPC 289    Debug Initialization Files  Using Debug Initialization Files    You can specify the debug initialization file name in the EPPC Tar   get Settings panel  In addition  you can define values for emulator  commands in this panel  For more information  see    EPPC Target    Settings    on page 101        NOTE  Debug initialization file commands overwrite values set  on the EPPC Target Settings panel     This section contains the following topics     e Creating Stand alone Code    e Initializing Memory       e Enabling Debug Support       e Creating a Debug Initialization File    e Disabling the Software Watchdog Timer  e Using Emulator Operational Settings       Creating Stand alone Code    Add initializations other than memory or exception setup to the  init_hardware function in the Embedded PowerPC startup code  or your own start routine  By doing so  you ensure that initialization  occurs even when your program is run without a debugging device   such as the CodeTAP  PowerTAP  or Wiggler devices   Create your  startup code so that  after debugging is completed  the code initial   izes the memory management un
273. ting Embedded PowerPC PPC 265    Using the PowerTAP 6xx 7xx Debugging Device  Operational Notes       PPC 266 Targeting Embedded PowerPC    A    metrowerks o Flash Prog Fam mer       This appendix explains how to use the Embedded PowerPC utility  to burn flash images to your embedded PowerPC board     NOTE  Using the Flash to ROM target to flash your programs to  ROM is substantially faster than using the flash programmer  For    more information  see    Project Stationery Targets    on page 37     The Embedded PowerPC utility is located at the directory      CodeWarrior directory  Bin PPCComUtil exe    This appendix contains the following sections   e What You See  e Using the Flash Programmer          e Command File Syntax       NOTE  The Flash Programmer cannot be used with the AMC   Applied Microsystems Corporation  CodeTAP or PowerTAP de   bugging devices     What You See    There are three windows available in PPCComUtil exe   e Console    e Status and Errors    e Help       Targeting Embedded PowerPC PPC 267    Flash Programmer    What You See    Figure A 1    and one preference panel   e Preferences  Console  The Console window  shown in Figure A 1  displays all of the input    commands  the output of the commands  such as the output of re   admem   and the contents of internal registers     Console window    Console       Status and Errors    The Status and Errors window  shown in Figure A 2  shows the sta   tus of the communications link between the computer and the
274. tion level support 217  instructions 215 216  labels 221  local variables 222  operands 224  preprocessor use 222  special PowerPC instructions 220  stack frame 223  syntax 216  using for PowerPC 216 230  installing CodeWarrior 24  int size 169  integer formats 169  170  integer formats for PowerPC 169  interrupts  PowerTAP 264 265  intrinsic functions  described 234  for PowerPC 234 241  See also inline assembler 234  __isync   235    J    JTAG configuration files 309   jumper settings  Cogent CMA102 target board 318  Embedded Planet RPX Lite 8xx target   board 325   IBM 403 EVB target board 319  Motorola Excimer 603e target board 321  Motorola Maximer 7400 target board 326  Motorola MPC 8xx ADS target board 322  Motorola MPC 8xx FADS daughtercard 324  Motorola MPC 8xx FADS target board 324       Targeting Embedded PowerPC PPC 341    Index    Motorola MPC 8xx MBX target board 323   Motorola MPC 8260 VADS target board 327   Motorola MPC 505 509 EVB target board 319   Motorola Sandpoint 8240 target board 326   Motorola Yellowknife X4 603 750 target  board 321   Phytec miniMODUL PPC 505 509 target  board 328    L    labels in inline assembler 221  __labs   236  _Ihbrx   236  libraries  alternate C C   208  console I O 208  209 212  MSL for PowerPC Embedded 207 212  runtime 212 213  support for PowerPC Embedded 207 214  UART 209  using MSL 208 209  link order 192  linker   a files 192   O files 192  and executable files 192  described 27  for PowerPC 189 192  multiply defined sy
275. to  pragma function_align  See the  definition    function align    on page 179 for further information on  the use of this pragma     NOTE  The st_other field of the  symtab  ELF  entries has  been overloaded to ensure that dead stripping functions will not in   terfere with the alignment you have chosen  This may result in  code that is incompatible with some third party linkers  To elimi   nate this overloading  for those developers who need to export    CodeWarrior archives   see    Disable CW Extensions    on page 72     Processor    The Processor pop up menu specifies the targeted processor   Choose Generic if the processor you are working with is not listed  on this menu or you want to generate code that runs on any Pow   erPC processor  Choosing Generic allows the use of the core in   structions for the 603  604  740  and 750 processors and all optional  instructions        Targeting Embedded PowerPC PPC 81    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Selecting a particular target processor has the following results     e Instruction scheduling  If the Instruction Scheduling check   box  also in the EPPC Processor panel  is selected  the proces   sor selection will help determine how scheduling optimiza   tions are made     For more information on instruction scheduling optimiza   tion  see    Instruction Scheduling    on page 86    e Preprocessor symbol generation  A preprocessor symbol is  defined based on your target processor  I
276. trip Unused Symbols   When Deadstrip Unused Symbols is selected  the linker is in     structed to deadstrip any symbols that are not used  This option  makes your program smaller by stripping the symbols not refer        PPC 74 Targeting Embedded PowerPC    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    enced by the main entry point or extra entry points in the FORCE   ACTIVE linker command file directive     Require Resolved Symbols    When Require Resolved Symbols is selected  the linker is in   structed to require that all symbols in your partial link to be re   solved  If any symbols are not present in one of the source files or li   braries in your project  an error is triggered     NOTE  Some real time operating systems require that there be  no unresolved symbols in the partial link file  In this case  it is use   ful to enable this option     EPPC Assembler    The EPPC Assembler panel determines the format used for the as   sembly source files  and the code generated by the EPPC assembler   Figure 4 4 shows the EPPC Assembler panel        Targeting Embedded PowerPC PPC 75    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    Figure 4 4 EPPC Assembler panel       NOTE  If you used a previous version of this panel  you may  have noticed that the Processor region has disappeared  The pro   cessor settings for the assembler are now specified in the EPPC  Processor settings panel  using the Processor pull down menu 
277. u could step forward from the breakpoint to begin  debugging __ init_data    Click the Run Debug button to  execute ___init_data   and break at main           Targeting Embedded PowerPC PPC 59    Creating a Project for Embedded PowerPC  Working with a Project    NOTE  To disable the break at main feature  deselect the Stop  at temp breakpoint on application launch checkbox on the De   bugger Settings panel  Figure 3 24  of the Target Settings window   By default  the temporary breakpoint is main        Figure 3 24 Debugger Settings panel    Debugger Settings    Location of Relocated Libranes  Code Resources or Remote Debugging Folder    toot       Y Stop at temp breakpoint on application launch      Default User specified   main    Other Settings      Auto target Libraries W Cache symbolics between runs  T Log System Messages M Stop at  Watchpoints    F Update data every seconds          PPC 60 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    e  Click the Run Debug button to begin executing the program  again     A message appears indicating that a system call exception oc   curred  Figure 3 25      Figure 3 25 System call message window    Embedded PowerPC Exception   System Call Exception  TANET       f  Click OK to close the message window   g  Click the Run Debug button again   The program begins executing an infinite loop   h  Click the Stop button to see where you are in the program     From this point  you either can cont
278. uration Discusses the memory configuration  Files file commands  including com   mand syntax   Tested Jumper and Provides tested jumper and  Dipswitch Settings dipswitch settings for a number of    supported target boards     Command Line Tool Op  Describes the command line tool   tions options that are specific to  CodeWarrior for Embedded Pow   erPC        Where to Go from Here    All the manuals mentioned here are available as part of the  CodeWarrior documentation included with your product   If you are new to CodeWarrior     e Look for the CodeWarrior core tutorials in the CodeWar   rior Documentation directory        e Read    Development Tools for Embedded PowerPC    on page  25       For everyone     e For general information about the CodeWarrior IDE and de   bugger  see the IDE User Guide     e For information specific to the C C   front end compiler   see the C Compilers Reference     e For information on Metrowerks    standard C C   libraries   see the MSL C Reference and the MSL C   Reference     e For general information on MetroTRK and how to customize  MetroTRK to work with additional target boards  see Me   troTRK Reference        Targeting Embedded PowerPC PPC 15    Introduction  Where to Go from Here    For general information on Embedded PowerPC programming     To learn more about the Embedded PowerPC Application Binary  Interface  PowerPC EABI   refer to the following documents     e System V Application Binary Interface  Third Edition  published  by UNIX
279. us  language independent interme   diate representation  IR  of syntactically correct source code  Back   end compilers generate code from the IR for specific platform tar   gets  The CodeWarrior IDE manages the whole process     As a result of this architecture  the same front end compiler is used  in support of multiple back end build targets  In some cases  the  same back end compiler can generate code from a variety of lan   guages     All compilers are built as plug in modules  The interface between  the IDE and compilers and linkers is public  so third parties can  create compilers that work with CodeWarrior     Once the compiler generates object code  the plug in linker gener   ates the final executable  Some build targets have multiple linkers  available to support different object code formats     Development Tools for Embedded PowerPC    Programming for Embedded PowerPC is much like programming  for any other target in CodeWarrior  If you have never used  CodeWarrior before  the tools you will need to become familiar with  are     e CodeWarrior IDE   e CodeWarrior Compiler for Embedded PowerPC  e CodeWarrior Assembler for Embedded PowerPC  e CodeWarrior Linker for Embedded PowerPC     CodeWarrior Debugger for Embedded PowerPC  2 MetroTRK    e Metrowerks Standard Libraries                Targeting Embedded PowerPC PPC 25    Getting Started  Development Tools for Embedded PowerPC    If you are an experienced Code Warrior user  this is the same IDE  and debugger that y
280. w 155  special purpose 147  variables 174  vector registers 147  Release Notes 11  Relocate Dwarf Info 90  remote debugging 126 143  Remote Debugging Options settings panel 114   116  Require Resolved Symbols checkbox  EPPC Target  panel 75  requirements See system requirements  Reset on Connect checkbox 109  resetting emulator  CodeTAP 255  PowerTAP 263    _ rlwimi   237  _ rlwinm   237  _ rlwnm   237  ROM  flashing a program to  using project statio   nery targets 37  ROM Image Address edit field 100  RPX Lite 8xx dipswitch settings 325  RPX Lite 8xx jumper settings 325  runtime libraries  and MSL 208  customizing 213  for PowerPC Embedded 212 213  in projects 212  initializing hardware 213    S    Sandpoint 8240 dipswitch settings 326  Sandpoint 8240 jumper settings 326  Save Project Entries Using Relative Paths option   Target Settings panel 69  SDS Monitor  connecting with the 128  SDS Monitor debug monitor  choosing from the Protocol menu 109  section pragma 183  selecting a target 67  serial  cables  using to connect with a target  board  127  connection  choosing on the Connection menu 103  port  connecting using a 127  Port menu 119  Set Stack Depth menu option 150  _ _setflm   237  setMMRBaseAddr 303  setting  breakpoints 48  watchpoints 49  setting up emulator  CodeTAP 254  PowerTAP 262  settings panels  Access Paths See IDE User Guide       PPC 344 Targeting Embedded PowerPC    Build Extras See IDE User Guide  C C   Language See C Compilers Reference  Connection S
281. w cycles  Specifically  it sets or clears bits 30 and 31 of the  ICTRL register  For information on Show Cycles and the ICTRL reg   ister  see MPC860 User s Manual  available from Motorola      The choices include   e None   No show cycles are performed   e Indirect   All indirect change of flow     e Flow   All change of flow  direct and indirect    e AlI   AII fetch cycles     Speed    If you selected Wiggler as the Device  this edit field is where you  enter a software delay value from 1 to 64 000  Almost universally   entering 1 works the best  According to Macraigor Systems  MSI    you should never need to enter a number greater than 200        PPC 110 Targeting Embedded PowerPC    Table 4 3    Target Settings for Embedded PowerPC  Settings Panels for Embedded PowerPC    For other Devices  you can use values from 1 to 8  The following for   mula can be used to calculate the speed used for the Hummingbird  device     Speed   8   Board Mhz    For example  an 8MHz board uses a Speed of 1  A 4Mhz board uses  a speed of 2     Stack Size    The Stack Size is the size of the application s initial task stack  in  bytes     Target OS    To debug a board with a target OS  click this pop up menu and se   lect the operating system loaded on your board  If your board has  no target operating system  click the menu and select Bareboard     Target Processor    Use the Target Processor pull down menu to specify the processor  on your emulator or target board     Table 4 3 lists the Powe
282. w serial I O    libraries  see    Including UART libraries    on page 209     Allocating Memory and Heaps for Embedded  PowerPC    The heap you specify in the Heap Address field in the EPPC Linker  panel is the default heap  The default heap needs no initialization   The code responsible for memory management is only linked into  your code if you call malloc or new        You may find that you do not have enough contiguous space avail   able for your needs  In that case you can initialize multiple memory  pools to form a large heap     You create each memory pool with a call to init_alloc     You  can find an example of this call in __ppc_eabi_init cand   ppc_eabi_init cpp  You do not need to initialize the memory  pool for the default heap           Please see Heap Address and Stack Address in    EPPC Linker    on  page 90 for more information        Runtime Libraries for Embedded PowerPC    For any C or C   project  you must include one of following runt   ime libraries in your project           e Runtime PPCEABI N a or Run_EC   PPCEABI N a   No floating point support           e Runtime PPCEAB1 H a or Run_EC   PPCEABI H a   Hardware floating point operations                       e Runtime PPCEABI S a or Run_EC   PPCEABI S a   Software emulation of floating point operations     These files are located in the directory           CodeWarrior   PowerPC_EABI_ Support  Runtime Lib        PPC 212 Targeting Embedded PowerPC    Libraries and Runtime Code for Embedded PowerPC  Runt
283. w_emb_support metrowerks com  Sales  marketing   amp  licensing sales metrowerks com    CompuServe Goto  Metrowerks       Table of Contents       1 Introduction 11  Read the Release Notes      2    2                       11  Solaris  Host Specific Information                12  About This Book     ta  ac   bab es a AAA A 12  Where to Go from Here          2 2    56658006  15  Technical Support    ea  IA A a bg 3 18  Metrowerks Year 2000 Compliance       a a a a a       19   2 Getting Started 21  System Requirements   ac a dd ATA A Bw 21  Installing CodeWarrior for Embedded PowerPC         24  CodeWarrior Compiler Architecture                25  Development Tools for Embedded PowerPC           25   CodeWarrior IDE  2 PR A es 26  CodeWarrior Compiler for Embedded PowerPC         26  CodeWarrior Assembler for Embedded PowerPC            27  CodeWarrior Linker for Embedded PowerPC          27  CodeWarrior Debugger for Embedded PowerPC        28  MetroTR Kaie go Bo Se ae a a a aa de Ara 28  Metrowerks Standard Libraries            2   29  The Development Process with CodeWarrior            29  M    kefiles  20 acs a e ada a e e a A a 30  Editing Codes ss o de a a a a a Genus AG 31  Compras  aat o Ba G    aa dG  a Ad OS 31  LAU s cang al aaa da 31  Debugging e es a A EA 32  Viewing Preprocessor Output    2    a a we  32   3 Creating a Project for Embedded PowerPC 33  WY PES of Projects os s Sea Yokoi me Be Roe Ge ge ee SS ahs 33  ro aria 4  BR  ke lS  ok tee ek aoe ee Bee od 33   
284. werTAP device and the CodeWarrior IDE  using the resources shown in Table 11 1     PowerTAP device technical support contact information       Phone 800 ASK 4AMC  800 275 4262   Email support amc com  Web http   www amc com support html       When you contact AMC  provide the following information   e Your name and contact information  e Your company name    e The Applied System Identifier  ASI  number printed on a  label located on the underside of the PowerTAP    e Your CodeWarrior version number  e A description of the problem or error messages    e The exact sequence of actions leading to the problem       Targeting Embedded PowerPC PPC 259    Using the PowerTAP 6xx 7xx Debugging Device  PowerTAP Requirements    PowerTAP Requirements    To use a PowerTAP device with CodeWarrior  you must     1  Complete the emulator installation described in Emulator In   stallation Guide  available from AMC      x    2  Install CodeWarrior as described in    Installing CodeWarrior  for Embedded PowerPC    on page 24     The hardware requirements for debugging with a PowerTAP device  follow     e A PowerPC 6xx  7xx or 82xx target board with a JTAG port    e Two power supplies  one for your target board and the one  supplied with PowerTAP    e A PowerTAP device    Target Settings for PowerTAP    CodeWarrior for Embedded PowerPC provides project stationery  that you can use to create projects  The project stationery settings  are already set to reasonable default values  For more informatio
285. write the given data to the given IREG                 writeIREG  lt Internal Register Number gt   lt Immediate  value gt        REGO 0x11    NOTE  Load Internal Register Immediate doesn t have to be in   side startProgramLoop and endProgramLoop block to get the ad   dress        Targeting Embedded PowerPC PPC 281    Flash Programmer  Command File Syntax    Description    Usage    Description    Usage    Description    Usage    Loop Commands    The commands startProgramLoop  endProgramLoop  and untilVer   ifyData are used to program any memory location that falls between  the startAddr and endAddr  and will program  numBytesPerLoop at per loop        startProgramLoop  Specifies the start of the program loop     startProgramLoop  lt startAddr gt   lt endAddr gt    lt numBytesPerLoop gt      lt startAddr gt  is the beginning of the address range to be pro   grammed      lt endAddr gt  is the end of the address range to be programmed in  the loop      lt numBytesPerLoop gt  is how many bytes are programmed at a  time in the loop when the writeData command is called     endProgramLoop   Specifies the end of the program loop  All of the instructions be   tween startProgramLoop and endProgramLoop are executed  until there is no more data in the S Record file to process The in   structions in the loop are executed only for addresses that are be   tween startAddr and endAddr   endProgramLoop   writeData    Writes data numBytesPerLoop at a time    writedata       PPC 282 Targeting Emb
286. y written     To handle exceptions  your interrupt service routine must do the  following    1  Save the SSRO and SSR1 registers to memory    2  Set the MSRRI bit    3  Execute any exception processing    4  Clear the MSRRI bit    5  Restore the SSRO and SSR1 registers    6  Execute the rfi system call     For more information on recoverable interrupts  see the    Excep   tions    chapter of the appropriate Motorola User   s Manual        PPC 264 Targeting Embedded PowerPC    Using the PowerTAP 6xx 7xx Debugging Device  Operational Notes    Interrupts and the Machine Status Save   Restore Registers    When debugging interrupt service routines  avoid certain actions  near code that accesses the SRRO and SRR1 registers     Placing the CPU into debug mode is just another interrupt  For ex   ample  your code is in an interrupt epilogue and has just placed the  return address into SRRO when a breakpoint occurs  The breakpoint  causes the IP for the address of the breakpoint to be written to SRRO   destroying your original return address  Stepping through code that  accesses SRRO and SRR1 exhibits the same problem     To avoid this problem  always set your breakpoints before or after  code that accesses SRRO and SRR1  and never step through such  code  For example  you can set your breakpoint anywhere after the  interrupt prologue but before the epilogue     Instructions that involve the SRRO and SRR1 registers are    MTSPR  SRRO 1 RX        MFSPR RX SRRO 1     and RFI        Targe
287. zero         CEA     static void init_data void        _rom_copy_info  dc1   __ bss init_info  bii        Copy from ROM to RAM          dci   _rom_copy_info   while  1       if  dci  gt size    0  break         Ccopy_rom_section  dci  gt   addr  dci  gt rom  dci  gt size      dci         gs       Initialize with zeros           Line  231  af      c  Click the Kill button     Kill stops current execution and exits the debugger  ending the  current debug session        PPC 58 Targeting Embedded PowerPC    Creating a Project for Embedded PowerPC  Working with a Project    d  Click the Run Debug button in the Project window   The program stops at the breakpoint that you set on    _init_data    Figure 3 23    Figure 3 23 Program stopped at breakpoint set on __ init_data    mEPPC_C_debug  elf Ioj x   re xtA             bi   0400000150  dci   0x00000150  bss init info Ox00002340 0      _rom_copy_info 0x000022F8       __init_data                     destination RAM address  size number of bytes to zero    oo FEE HE FE HE HE HE FE IE IE FE FE FE FE FE FE FE FE SE ESE FE FE FE IE IE IEEE IE FE IE IE IE 56 36 36 IE IE IE 36 56 56 3 36 IE IE IE IE 36 36 36 36 IE IE IE IE 36 3 36 36 IE IE HEHE  static void init_data  void     e    __rom_copy_info  dci   __ bss init_info  bii        Copy from ROM to RAM            dci   _rom_copy_info  g  while  1        if  dci  gt size    0  break  y     y  Line  327 ay         If the code displayed in the Stack Crawl window were your star   tup code  yo
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
Technical Service Bulletin  取扱説明書  Bogart SE - MacroSystem Digital Video AG  Operators Manual Operators Manual Manuel De L  HP Jornada Serie 520 Pocket PC Guida d`uso  MANUEL DE SÉCURITÉ Barrière Linéaire IR pour  Creating Analog Behavioral Models  Samsung Blu-ray-afspiller J5500  HP P4000 Multi-Site HA/DR Solution Pack User Guide  3900 Dental Chair Service Manual    Copyright © All rights reserved. 
   Failed to retrieve file