Home
        Compiler Reference Manual
         Contents
1.           Set or clear  bitval  0   gt  clear  bitval  1   gt  set    the bit specified by bitnum in v    If revbitnum is not equal to 0    then the updated bit is actually 31   bitnum    Condition code flags are sampled per _sfXX extension   if used    See eTPU reference manual for details on condition code  computation with bit set clear     int24 bit n update int24 v  int24 bitnum     int bitval  int revbitnum       int24 bit_n_update_sf8 int24 v  int24 bitnum        int bitval  int revbitnum       int24 bit_n_update_sf16 int24 v  int24 bitnum        int bitval  int revbitnum       int24 bit_n_update_sf24 int24 v  int24 bitnum        int bitval  int revbitnum       5 4 7 4 6 Exchange Bit Support        if  vf  if      if      if    Exchange the bit in v specified by the bitnum   with C condition code flag    If revbitnum is not equal to 0  then the updated bit   is actually 31   bitnum rather then bitnum    Condition code flags are sampled per _sfXX extension   if used    See eTPU reference manual for details on condition code  computation with bit exchange     int24 __ bit n exchange C int24 v  int24 bitnum     int revbitnum       int24 bit n exchange C sf8 int24 v  int24 bitnum     int revbitnunm       int24 bit n exchange C sf16 int24 v  int24 bitnum     int revbitnum       int24 bit n exchange C sf24 int24 v  int24 bitnum     int revbitnum        C  2007 2015 Compiler Reference Manual  page 43    5  eTPU Programming Model    5 4 7 4 7 MAC MDU Support    All MAC MDU int
2.      Verify WCTL of a specific thread within a class   pragma verify wctl UART  SendOneBit 25 steps 7 rams     C  2007 2015 Compiler Reference Manual  page 133    12  Appendix A   Pragma Support    12 7    12 8    12 9    page 134  Compiler Reference Manual       Verify WCTL of the longest thread within an entire class   pragma verify wctl UART 30 steps 9 rams    Forcing the WCTL    In some cases a thread  eTPU function  or an eTPU class may not be able to be analyzed   This can occur when multiple loop are encountered or when the program flow is too  convuluted for a static analyses  In these cases  the maximum WCTL can be forced using  the following  pragma      pragma force_wctl  lt Name gt   lt max_steps gt  steps  lt max_rams gt  rams    An example of this is the square root function in the standard library used in Freescale s set  4  This has two loops where the maximum number of times through each of the loops is  inter dependent  and this complicated loop limit relationship is well  not supported ETEC s  worst case thread length analyses  The following  pragma is used to establish this limit     pragma force wctl mc_sqrt 82 steps 0 rams    Excluding a thread from WCTL    A thread can be excluded from the WCTL calculation of a function  This is normally used  for initialization or error handling threads that in normal operation would not contribute to  the Worst Case Latency  WCL  calculation  The format is as follows      pragma exclude wctl  lt eTPU Function gt     l
3.    0D14  OxDFEFD984 ram p_31 24      channel int8    0x10    3 chan clear MatchRecognitionLatchB         so it always enabled window is fully open     MatchA is left pending      in this channel mode     it doesn t request service    page 60  Compiler Reference Manual  C  2007 2015    0D18  Ox1EF2AFFF  OD1C  OxCFFFF984        lt  REMOVED gt     0D34  OxBFEF9F89  0D38  Ox1F783FFF    OD3C  Ox7FFFFF9F    0D40  Ox005FA439  0D44  OxCFFFF987        lt REMOVED gt   0D50  OxBFEF9F95  0D54  0xBC787B91    0D58  Ox009FA459  OD5C  OxCFFFF987        lt REMOVED gt     0D94  OxBFEFFF95  0D98  0xBC787B93        lt REMOVED gt     OE4C  OxBFEFFF95  0E50  0xBC787B91    5  eTPU Programming Model    Blank _Tooth_Count     alu p  31 24   p 31 24 0x0 1    ram    channel int8    0x10    p 31 24         case CRANK_ FIRST EDGE      Timeout time  ertb   Tooth_ Time   First Tooth Timeout     alu ter2     u24  0  0x0   ram diob      channel int24    0x25     alu ertB   p diob      WriteErtBToMatchBAndEnable      chan clear MatchRecognitionLatchB  matchB   ertB   set MatchEnableLatchB       ClearMatchBLatch       Crank_State   CRANK_SECOND_EDGE   alu p_31_24     u24  0  0x15    ram    channel int8    0x1C    p_31_24    ter2   0     case CRANK_SECOND_EDGE   Tooth Period A   Tooth Time   Last Tooth Time     alu ter2     u24  0  0x0   ram diob      channel int24    Ox55     alu p   p diob     ram    channel int24    0x45    p_23_0    Crank_State   CRANK_TEST_POSSIBLE_GAP    alu p_31_24     u24  0  0x26     r
4.    etpu_if_sint32     0x0014     etpu_if_sint32    Period     ActiveTime     Coherent Period     Coherent_ActiveTime     LastFrame     NextEdge       etpu_if PWM CHANNEL FRAME PSE     page 82  Compiler Reference Manual     C  2007 2015    7 1 4    7  Auto Header Generation    The exception to this naming convention is for eTPU data of struct  union or _Bool type      these cases are discussed in the ensuing sections     Often there are gaps in the data overlay where no named data to be referenced exists   These gaps are filled by appropriately sized unnamed bit fields     eTPU Structures Unions    When eTPU variables of struct or union type are encountered  they are    flattened    by  concatenating the variable and member name  or members of there are multiple levels to  the struct union   The original eTPU struct type cannot be re generated on the host side  because eTPU structures can have size and alignment that are not possible to replicate in  host code  For example  the global variable definition     struct CBA     char a  b   unsigned int c     cba     Results in     typedef struct         0x0000     etpu_if_uint8 cbha_a   etpu if uint8   8   etpu if uint8  etpu if uint8     0x0004     etpu_if_uint8 cbha_b   etpu_if_uint8    etpu_if_uint8  etpu_if_uint8       etpu_if GLOBAL DATA    typedef struct                   o                   0x0000     etpu_if_uint32 cba c      0x0004     etpu_if_uint32   32     etpu_if GLOBAL DATA PSE      C  2007 2015 Compiler Reference Man
5.   7  Auto Header Generation    up to 3 different overlay structures are generated for PSE access  One includes all 24 bit  data  while the other two are signed and unsigned only  and are only generated if there is  24 bit signed data  and or 24 bit unsigned data      7 1 2 Naming Conventions    The auto generated structures are typedef    ed to the following names        global non 24 bit data  etpu if GLOBAL DATA        global 24 bit data  PSE access   etpu_if GLOBAL DATA PSE        engine non 24 bit data  eTPU2 only   etpu if ENGINE DATA        engine 24 bit data  eTPU2 only   etpu if ENGINE DATA PSE         lt func class name gt  non 24 bit data  etpu if  lt func class name gt  CHANNEL FRAME         lt func class name gt  24 bit data  etpu if  lt func class name gt  CHANNEL FRAME PSE     Every data member has one of 6 basic types  Rather than use raw C type names  another  naming convention is used  Users of the auto struct file must provide their own type  definitions for these type names     etpu if sint8     signed 8 bit data  etpu if uint8     unsigned 8 bit data  etpu if sint16     signed 16 bit data  etpu if uint16     unsigned 16 bit data      signed 32 bit data       also used for 24 bit data   etpu_if_sint32       unsigned 32 bit data       also used for 24 bit data   etpu_if_uint32     For every auto struct that is generated  a macro is also defined  The macro is defined to  the expected size of the structure  The idea is that the user should use this to perform 
6.   For example  given the following type definitions     struct S1     int x   int y       struct S3     struct S1 s1 1   int x   char a   struct S1 s1_2         If used for global variables  this would yield the following in the _ defines file        defines for type struct S1      size of a tag type       including padding as defined by sizeof operator      value  sizeof    GLOB TAG TYPE SIZE S1   define GLOB TAG TYPE SIZE S1 0x08      raw size  padding not included  of a tag type     value  raw size    GLOB TAG TYPE RAW SIZE S1   define GLOB TAG TYPE RAW SIZE S1 0x07      alignment relative to a double even address     of the tag type  address  amp  0x3       value   GLOB TAG TYPE ALIGNMENT S1_    define GLOB TAG TYPE_ALIGNMENT_S1_ 0x01      offset of struct union members                      page 92  Compiler Reference Manual  C  2007 2015    7  Auto Header Generation       from variable base location      the offset of bitfields is specified in bits      otherwise it is bytes      address   SPRAM    variable SPRAM offset         GLOB MEMBER BYTEOFFSET S1 x_   define GLOB MEMBER BYTEOFFSET S1 x 0x00   define GLOB MEMBER BYTEOFFSET_S1_ y 0x04      defines for type struct S3           define GLOB TAG TYPE_SIZE_S3 0x14   define _GLOB_TAG TYPE_RAW_SIZE_S3 0x14   define _GLOB_TAG TYPE_ALIGNMENT_S3_ 0x00        define GLOB MEMBER BYTEOFFSET S3 sl 1 0x01   define GLOB MEMBER BYTEOFFSET_S3_x 0x09   define GLOB MEMBER BYTEOFFSET S3 a 0x00   define GLOB MEMBER BYTEOFFSET S3 sl 2 0x0
7.   In the ETEC compiler toolkit  C preprocessing is performed by a standalone tool called   ETEC_cpp exe  When source code is put through the ETEC compiler  it automatically   spawns ETEC_cpp exe as a process and passes the source through the C preprocessor  first     The following macros are pre defined in the compilation environment and passed to  ETEC_cpp exe when spawned by ETEC_cc exe     __ETEC__    __ETEC_VERSION__ is defined to a text string of the compiler version  The form is   lt major version gt   lt minor version gt  lt build letter gt      One of __TARGET_ETPU1  option specified     __TARGET_ETPU2__ depending upon the  target    ee      ETEC_cpp has other pre defined macros per the C99 specification     DATE The date of translation of the preprocessing translation unit  a character  string literal of the form  Mmm dd yyyy   where the names of the months are the  same as those generated by the asctime function  and the first character of dd isa  space character if the value is less than 10  If the date of translation is not available  an  implementation defined valid date shall be supplied        FILE The presumed name of the current source file  a character string        C  2007 2015 Compiler Reference Manual  page 77    6  C Preprocessing          literal     LINE The presumed line number  within the current source file  of the current  source line  an integer constant     STDC The integer constant 1  intended to indicate a conforming  implementation   _ _STDC_H
8.   Next variables of size 2 bytes are located  followed by 1 byte variables last     The set of channel frame variables  likely declared as parameters to an eTPU function in  compatibility mode      int x  y     24 bit vars   char cl  e2    3  c4  c5  c6    short a  b  c     16 bit vars   struct SomeStruct somestruct     sizeof SomeStruct     8    Would get packed like     SDM Channel Frame MSByte 3 LSBytes  Address Offset       Note that tight packing can potentially introduce coherency issues  such as at address  offsets 16  a  b  and 20  c3  c4  c   In general  it is best to avoid 16 bit data in eTPU code   and to avoid 8 bit data ending up in non optimal locations     page 26  Compiler Reference Manual  C  2007 2015    5 3 6    5 3 7    5  eTPU Programming Model    Local Stack Variables    The ETEC compiler aggressively uses registers for local   temporary variables when  possible  but sometimes such variables need to be stored in memory  e g  when they have  the  amp  address operator applied to them   ETEC uses a stack based approach for local  variable overflow  Each stack variable takes up at least one 4 byte data word  and more if  the variable has size greater than 4 bytes  allowing for efficient access to such variables     Structures  amp  Unions    Like channel frames  structures can be packed in either a       PACKTIGHT    mode or a     FASTACCESS    mode  For structures  one additional mode exists        LEGACY     An  additional variable is ANSI mode  which for
9.   Not readable from the eTPU     Shared Data Memory  Multi ported data memory  accessible from the host CPU and the eTPU   Historically this memory has been referred to as  parameter RAM      C  2007 2015    5 1    5  eTPU Programming Model    9    eTPU Programming Model    This section discusses the two major portions of the eTPU hardware programming model      direct access to the eTPU hardware  and the syntax for defining entry tables  Unlike a  more conventional microprocessor  the eTPU does not typically process in any kind of  continuous manner  Rather  it behaves more like a set of interrupt handlers reacting to  events  Entry tables map events to the code   threads that need to process the event  In  between such activations the eTPU microengine is completely idle     ETEC uses a stack based approach for local variables and function calls  The user must  allocate stack space in SDM  This portion of the programming model is discussed in more  detail in the section 4 7     eTPU Types    The C basic types map to the eTPU hardware as follows     T    char  unsigned char 8 bits int8 is a synonym for char    short  unsigned short int16 is a synonym for short        C  2007 2015 Compiler Reference Manual  page 19    5  eTPU a EP Programming Model S G Model    long int  unsigned long int  32 bits int32 is a synonym for long int  32 bit  int usage is limited as the eTPU ALU  only operates on 24 bits  Essentially  only load store operations are  supported  Any use of 32 bit dat
10.   The second class is everything  else  Currently  the following are the supported code pragmas        atomic begin   e atomic_end   e optimization boundary all  e optimization disable start  e optimization_disable_end  e wctl loop iterations    The code pragmas syntactically work like C statements  and thus they must be placed  within the source code like a C statement  The examples below show an incorrect  placement and a valid code pragma placement    L   sis              pragma optimization boundary all    will fail     C  2007 2015 Compiler Reference Manual  page 129    12  Appendix A   Pragma Support    12 1    page 130  Compiler Reference Manual    else          While the below would work     Pt C38            else        pragma optimization_boundary_all    ok         Verify Version    A  pragma to verify that the proper version of the ETEC Compiler is being used to  generate a particular piece of source code is available       r A      a     LA f   pragma verify_version  lt comparator gt   lt version string gt       lt error message gt        When such a  pragma is processed by the compiler  a comparison is performed using the  specified  lt comparator gt  operation  of the ETEC Compiler   s version and the specified      lt version string gt      The supported comparators are     GE   greater than equal  GT   greater than   EQ   equal   LE   less than equal   LT   less than    The specified version string must have the format of     lt major version number gt   lt mi
11.   and issue a warning if it finds such code     The ETEC compiler supports an alternative syntax for fragment declarations  The    page 56  Compiler Reference Manual  C  2007 2015    5 6 1    9 7    5 7 1    5  eTPU Programming Model         _eTPU_ fragment    keyword can be used interchangeably with  void __attribute_    noreturn     which is a GNU based syntax     _eTPU_thread Calls    ETEC supports    calls    to _eTPU_thread functions     these act like calls to fragments in  that they execute a jump rather than call  Although this is functional  in most cases it is  recommended that such common code be placed in an eTPU fragment instead and  called from two locations  rather than directly calling an eTPU thread  Threads   _eTPU_thread functions  may contain additional prologue code that the caller does not  actually want to execute  although such code does not cause invalid behavior     State Switch Constructs    ETEC provides a specialized version of the C switch statement that provides reduced  thread length operation and in most cases reduced code size  at the cost of user control  over state values and some of the robustness features of the standard C switch statement   The tradeoffs should be carefully considered before choosing to use this feature  This     state switch     as it is referred to  makes efficient use of the eTPU architecture   s dispatch  instruction  The dispatch instruction allows a jump  or call  to the instruction at the address  of the current p
12.   char a  struct S b  int c  int d  int e          return b        The resulting stack may look like     caller SF   N   0   register A saved  for  example   s sake  it was in use at time of call     caller SF   N   4   current stack frame saved      NEW CALLEE STACK FRAME        callee SF   0   parameter    b     callee SF   4   parameter    b    continued  callee SF    amp    parameter    e           C  2007 2015 Compiler Reference Manual  page 69    5  eTPU Programming Model    5 9 3    page 70  Compiler Reference Manual       callee SF   12   return value location    callee SF   16   return value location  continued    callee SF   20  register RAR saved  callee SF   24   register D saved    callee SF   28   register C saved    callee SF   32   parameter    a    moved from  register    to this stack location        any additional callee stack usage starts here    Note that in most real eTPU code  much less stack space is required for a function call   good eTPU code should not pass  amp  return structures      The ETEC compiler pre defines a macro __ETEC_EABI_STACK_V1_0__ when the  above calling convention is in use  Should the calling convention ever change in future  versions of the compiler  this macro   s version number will also be changed  This allows  users who write code  e g  inline assembly  that depends upon the calling convention to  detect a change and prevent to possible compilation of non function code     Scratchpad based Model    When the scratchpad based 
13.   exits with a non zero exit  code without compilation     Display Licensing Info    Outputs the licensing  information for this tool     Error on Warning    Turn any warning into a  preprocessing error     Warning Disable  wamDis  lt WARNID gt    Off  all    warnDis 343  warnings  enabled     Disable a specific  preprocessing warning  via its numerical  identifier         C  2007 2015 Compiler Reference Manual  page 121    9  Command Line Options    9 3    page 122  Compiler Reference Manual    Console Message Verbosity   Verb     A value of zero causes all error and warning messages to be suppressed  The only  feedback from the tool suite is the exit code which is zero on success and non zero on  error     A value of one causes only the number of errors and warnings to be printed to the screen   The actual error and warning messages are suppressed     cc Success  3 Warnings  EntryTable c   gt  EntryTable eao  Asm Success EntryTable sta   gt  EntryTable eao  Link Success EntryTable Shift       gt  EntryTable gxs    A value of three      NOTE  the console utility will buffer up the first line     Assembling file Shift sta         and  only prints it out on detection of one or more errors       ce Success EntryTable c   gt  EntryTable eao  Assembling file Shift sta  Warning  blah blah blah  Warning  blah blah blah  Warning  blah blah blah  Asm Success  3 warnings  Shift sta   gt  Shift eao  Linking file Shift eao  Linking file Pwm eao  Linking file Test2 eao  Warning  blah bla
14.   i  JE    write only  write only  write only  write only  write only  write only  writeable   writeable   writeable   write only  write only  write only  write only  write only  write only  write only  write only  write only  write only  writeable     writeable  testable   writeable  testable   test only  test only  test only  test only  test only  writeable   writeable   write only    testable  entry condition  testable  testable    testable   setting to  1 triggers semaphore free      also  entry   also  entry    via FLC    condition  via FLC    condition    testable  testable     C  2007 2015    Compiler Reference Manual  page 35    5  eTPU Programming Model    5 4 5    page 36  Compiler Reference Manual    MRLEB int   1      write only    chan _ struct     The following changes have been made to the eTPU2 chan_struct channel hardware  programming model from the eTPU      New fields are     MRLEA   Now writeable  clearable  independent of MRLEB   MRLE still clears both latches     MRLEB   Now writeable  clearable  independent of MRLEA   MRLE still clears both latches     In order to allocate variable storage to eTPU2 engine relative space  the address space  type qualifier Engine should be used     Register Access  The eTPU has several special purpose registers for which direct C level access is    appropriate  In fact all registers can be accessed using the TR18037 named register  feature  The following named register keywords have been implemented in ETEC     _CHANBASE 
15.  17  18  19  30  31      but not 10 11  20 23 since they were already taken        The if else array can end in a dangling else that covers any remaining entry slots in the  table  A dangling else is required if all of the    if expressions do not fully cover a table   Typically the dangling else executes error code     In each thread defined by the if else array  the default is for the Match Enable  ME  entry  to be set true  matches enabled  The Match Enable can be set explicitly  or disabled  by  making one of the below intrinsic function calls or macro synonyms somewhere in the  thread  no code is generated by the intrinsic  only the entry ME bit is affected      match enable      match disable         synonyms   enable match       disable match      EnableMatchesInThread      DisableMatchesInThread        For more information on entry tables and entry conditions reference eTPU documentation     Code Fragments    Given the thread based nature of eTPU execution  ETEC provides the concept of    no   return    function calls     such functions are called    fragments    and are specified by using  the special return type    _eTPU_ fragment     Give the no return functionality    _   eTPU_ fragment is essentially equivalent to the void type     When a call to a fragment is made  the compiler generates a jump opcode rather than a call  opcode since no return occurs  Additionally  no state such as registers  stack frame  etc  is  saved since execution cannot return to the calle
16.  Annotated Assembly format   EAO  file format is an open format developed  for the purpose of providing an object file format that a compiler or assembler outputs and  that is an input to a linker or optimizer  This format is based on the existing and well  documented GNU file format output by the GNU compiler when the    S  retain assembly  file  is specified  COFF output only   A few distinguishing features of this format are listed  below     Text format that is human readable  no special visualization tool is required   Not re inventing the wheel  the existing GNU format is the baseline     Where required  additional tags are invented  e g  valid p_31_24 values on a dispatch  operation     All required debugging information is included such as originating source file names  line  numbers  data  scoping  etc     a f a      Jile ne ce      FileName    i    Name of the source code file from  which all proceeding  line  line        C  2007 2015 Compiler Reference Manual  page 145    14  Appendix C   eTPU Annotated Object File Format   number  tags refer  Relative  pathing relative to CWD is  employed    line fee Source code line number from    lt LineNum gt  which proceeding opcodes are  generated  Numbering goes from  I toN     dispatch SRE Indicates valid p_31_24 dispatch   0 3 7 3     values  Tag precedes the single  dispatch instruction that it  describes  A range is indicated  using the  lt StartVal gt   lt EndVal gt    Ranges are separated by commas    Optimization Enab
17.  B   Data Packing Details    13    Appendix B   Data Packing  Details    This appendix provide further detail on the non default data packing modes   FASTACCESS   and more details on how ANSI mode affects packing  Again  note that  these algorithms are not set in stone and code that uses them  and more specifically host  code  should use the auto defines data for working with data in the SDM     Channel Frame FAST ACCESS Mode    In FASTACCESS mode channel variables are allocated at address locations where they  can be most efficiently accessed  amp  operated on  Like TIGHT mode  larger objects are  packed first  Note that 1 byte parameters can also occupy the low byte of the 3 LSByte  area     Given a set of channel frame variables     int x  y     24 bit vars  char cl  e2    3   lt  4    5  c    e7   short a  b  c     16 bit vars  struct SomeStruct somestruct       sizeof  SomeStruct        The packing would look like      C  2007 2015 Compiler Reference Manual  page 139    13  Appendix B   Data Packing Details    SDM Channel Frame MSByte 3 LSBytes  Address Offset    Ca foe  Pa fy    some struct    eae  RE PE KEE  RE EEE ES ES  ee TE       13 2 Structure FASTACCESS Mode    The FASTACCESS struct packing algorithm is again similar to FASTACCESS channel  frame pack mode  A few examples are shown below     struct TwoCharStruct     char x     offset 0  char y     offset 3        sizeof         struct Int16_8Struct     int16 twobytes     offset 2  int8 onebyte     offset 0        
18.  Engine Data Size   RAM ENGINE DATA SIZE    Code Image     C       SCM SCM_CODE_MEM_ARRAY None  array    MISC Value MISCCMPR   MISC_VALUE None  Error    Bookmark not   defined     Constant Lookup   SCM Address   CONSTANT_LOOKUP_ADDR_ lt Na   Bytes  Table Base me gt   Address    N A    Function Mode  CXSCR FM  Bits       page 100  Compiler Reference Manual  C  2007 2015    7 211    7 2 12    7 2 13    7 2 14    7 2 15    7  Auto Header Generation    Include Race Keepout    In order to avoid the possibility of infinite recursive inclusion of header file  the following  text precedes all other  defines      ifndef  lt GlobalMnemonic gt _ lt FileName gt _H _   define  lt GlobalMnemonic gt _ lt FileName gt _H _    For the same reason  the following is found at the end of the file      endif     lt GlobalMnemonic gt _ lt FileName gt _H _    Freescale API compatibility    Freescale provides a set of API for interfacing to eTPU code  The auto generated file is  included into the source code for that API     ASH WARE Simulator Compatibility    All auto header generated text is compatible with the eTPU simulator such that the header  file can be included into the simulator and the resulting  defines can be used as arguments  in the script command line  Additionally  ETEC provides supporting macros that when  combined with the auto defines file  make simulator script writing a simpler task  The  simulator macro library can be found in the etec_sim_autodefs h file found under the Sim  di
19.  Global Error Thread    ETPU_VECTOR1  0  1  0  0  1  x  x  Global Error Thread    ETPU _VECTORI  0  x  1  0  0  0  O  Test New Data TX     ETPU _VECTORI  0  x  1  0  0  1  0  Send Serial Data TX    ETPU _VECTORI  0  x  1  0  0  0  1  Receive Serial Data RX    ETPU _VECTORI  0  x  1  0  0  1  1  Receive Serial Data RX    ETPU _VECTORI  0  x  1  0  1  0  O  Test New Data TX     ETPU VECTORI  0  x  1  0  1  1  0  Send Serial Data TX    ETPU _VECTORI  0  x  1  0  1  0  1  Receive Serial Data RX      C  2007 2015    Compiler Reference Manual  page 51    5  eTPU Programming Model    5 5 3    page 52  Compiler Reference Manual    ETPU_VECTOR1  0  x  1  0  1  1  1  Receive_Serial_Data_RX    ETPU_VECTOR1  0  x  0  1  O  0  0  Global Error Thread    ETPU_VECTOR1  0  x  0  1  O  1  0  Global Error Thread    ETPU_VECTOR1  0  x  0  1  0  0  1  Detect New Data RX    ETPU_VECTOR1  0  x  0  1  0  1  1  Detect_New_Data_RX    ETPU_VECTOR1  0  x  0  1  1  0  0  Global Error Thread    ETPU_VECTOR1  0  x  0  1  1  1  0  Global Error Thread    ETPU_VECTOR1  0  x  0  1  1  O  1  Detect_New_Data_RX    ETPU_VECTOR1  0  x  0  1  1  1  1  Detect_New_Data_RX    ETPU_VECTOR1  0  x  1  1  0  0  0  Test New Data TX    ETPU_VECTOR1  0  x  1  1  0  1  0  Send Serial Data TX    ETPU_VECTOR1  0  x  1  1  0  0  1  Detect New Data RX    ETPU_VECTOR1  0  x  1  1  0  1  1  Detect_New_Data_RX    ETPU_VECTOR1  0  x  1  1  1  0  0  Test New Data TX    ETPU VECTORI  0  x  1  1  1  1  0  Send Serial Data TX    ETPU VEC
20.  MaxRams gt  rams    Note that global threads must be scoped with a class that references it  In other words   say there is a common global thread referenced from several different classes entry tables   The following syntax would be required where the class name is the name of one class  that references the global thread      pragma verify wctl  lt Class gt     lt GlobalThread gt   lt MaxSteps gt   steps  lt MaxRams gt  rams    Some called functions     C    functions or member functions  may have routes that return to  the caller but also may end the thread  In such causes the verify_wctl acts on the longer  of these two     The WCTL analyses assumes that called functions are well behaved in terms of call stack  hierarchy  For instance  if Func   calls FuncBQ  and FuncB   calls FuncCO   a return in  FuncA   will go to the location in FuncB   where the call occurred  Additionally  a return  within FuncB   will then return to Func   where that call occurred  In order for this to  occur  the rar register must be handled correctly  which is guaranteed in ETEC compiled  code  as long as inline assembly does not modify the RAR register  It is also guaranteed in  assembly as long as RAR save restore operations are employed in a function   s prologue  and epilogue     The WCTL calculations remain valid even when a thread ends in a called function     The following are examples uses of verify_wctl        Verify WCTL of a global function   pragma verify wctl mc_sqrt 82 steps 0 rams  
21.  Reference Manual    4  Keywords and Abbreviations    4    Keywords and Abbreviations    Channel Frame    Channel  Variable    ETEC    eTPU    eTPU C    eTPU Class    eTPU Function    The collection of channel variables associated with a  single eTPU Function or ETEC eTPU Class     A variable that is addressed relative to the channel  base register  This storage is static and there is one  copy per channel to which it is assigned at run time   Sometimes channel variables are referred to as  parameters     eTPU Embedded C Compiler  Enhanced Time Processor Unit  and derivatives     The C code development system for the eTPU by Byte  Craft Limited     The native ETEC programming model aggregates all  threads  methods  C functions   channel variables and  entry tables associated with a single application into a    class like structure called an eTPU class     An eTPU C term that refers to a C function that defines     C  2007 2015 Compiler Reference Manual  page 17    4  Keywords and Abbreviations    eTPU Thread    SCM    SDM    page 18  Compiler Reference Manual    a set of channel variables  an entry table  and the  threads that make up the vectors for that entry table     With regards to ETEC  it refers to entry tables  channel  variables and threads that are all associated  an ETEC     class        An ETEC term  A C function that can be used as an  entry vector  but cannot be called from any other C  code     Shared Code Memory  The location of the eTPU code  and entry tables
22.  State Switch    For each eTPU state switch enum tag type there can be up to one  _eTPU_state_switch statement  It is the contents of this statement that determine the  state  enumerator  values  The linker issues an error if it finds more than one  _eTPU_state_switch associated with the same _eTPU_state_switch_enum tag type   Statements denoted with _eTPU_state_switch are very much like the standard    C    switch  statement  with a few exceptions     e The controlling expression in an eTPU state switch statement must have an  _eTPU_state_switch_enum tag type     e No    default    case is allowed in an eTPU state switch     e Allenumerators in the eTPU state switch enum tag type used in the controlling  expression must be associated with a case  even if it does nothing but    break        e When multiple cases are associated with the same piece of code  the compiler  implicitly inserts a NOP   between them     it must do this to ensure that each  enumerator is the _eTPU_state_switch_enum tag type gets a unique value     e Norange or validity check is done on the controlling expression value   Programmers using this feature MUST ensure that the state variable does not get  assigned an invalid value  The compiler assists with this via its strict type checking  on _eTPU_state_switch_enum tag types     Note that a state variable  although it can only be used in a single _eTPU_state_switch  statement  can be used other places in a normal    C    switch statement      C  2007 201
23.  _P_31_24     C  2007 2015    _P 23 16  _P 15 8  70  _E 31 16   P 15 0   P 31 0  _CC    5  eTPU Programming Model    These names are qualifiers to the    register    storage class keyword  Typedefs have been  defined for the entire register set  using the names register_ lt name gt  in order to be  compatible with many existing applications  see etpu_hw h   They are as follows     typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef  typedef    register  register  register  register    register  register  register  register  register  register  register  register  register  register  register    register  register  register  register  register  register  register  register  register  register    register _     register      _TRR  _CHANBASE   P 31  24   P 23  16   P 15 8  _P_7_0  _P_31_16  _P_15_0   P 31 0  _cc    register_ac   register_b   register_c   register_d   register_chan   register_diob   register_erta   register ertb   register link   register mach   register macl   register p   register rar   register sr   register tcrl   register tcr2   register tpr   register trr   register chan base   register p31 24   register p23 16   register p15 8   register p7 0   register p31 16   register p15 0   register p31 0   register cc     register cc  register  CC  does not map to an actual physical regist
24.  a single unsigned byte     State enumeration literals must be unique among all the enumeration literals  state  or regular  of all the code that is to be linked together  This limitation is due to the  fact that the enumeration literals only get computed at link time and if the literals  are not uniquely named there can be clashes     An example of a state enumeration type declaration is as follows     eTPU_state_switch_enum CrankStates            CRANK_ SEEK   CRANK BLANK  TIME    CRANK_BLANK TEETH   CRANK_FIRST_EDGE   CRANK_SECOND_EDGE    CRANK TEST POSSIBLE GAP   CRANK_VERIFY GAP   CRANK GAP VERIFIED   CRANK_COUNTING    CRANK_TOOTH BEFORE GAP    CRANK  TOOTH AFTER GAP    CRANK  TOOTH AFTER GAP NOT HRM                State Variable    A    state    variable must be declared with a state enumeration type  Variables of this  special tag type are 1 byte in size  and unlike variables of the standard enum tag type  strict  type checking is performed by the compiler  Such a state variable cannot be assigned to a     C  2007 2015    5 7 3    5  eTPU Programming Model    constant integer value  for example  or assigned the value of another variable of integer  type  It can only be assigned to one of the _eTPU_state_switch_enum enumerators  or to  another variable of exactly the same type        declare state variable  eTPU_state_switch_enum CrankStates Crank_State           compilation error   must assign to an enumerator  Crank State   0        valid  Crank_State   CRANK_SEEK    
25.  capability is available in either  the stack based or scratchpad based programming model     The ETEC compiler pre defines a macro __ETEC_EABI_ SCRATCHPAD _V1_0__  when the above calling convention is in use  Should the calling convention ever change in  future versions of the compiler  this macro   s version number will also be changed  This  allows users who write code  e g  inline assembly  that depends upon the calling  convention to detect a change and prevent to possible compilation of non function code      C  2007 2015 Compiler Reference Manual  page 73    5  eTPU Programming Model    5 10    page 74  Compiler Reference Manual    In Line Assembly    The ETEC compiler supports an in line assembly capability  However  it is important to  note that whenever C code and assembly are mixed  the potential for buggy code  increases  It is recommended that other avenues  such as the use of intrinsic functions  be  explored before resorting to inline assembly  That being said  there are times where only  inline assembly can solve the problem at hand  This reference manual describes the syntax  for specifying inline assembly  but not the actual assembly syntax itself  see the assembler  reference manual for those details     Inline assembly can be specified in one of two ways  Single line assembly instructions can  be packaged in  asm         asm ram p   gt  by diob      For multiple lines of inline assembly  the better technique is to bracket the text with a   asm    endasm pa
26.  channel frame address 13  24 bits   The default  is to let the tools decide which preload results in the best code  recommended   In ETEC  mode  the preload is specified by specifying a second parameter to the eTPU thread    _eTPU_preload_low    or  _eTPU_preload_ high        Functions that affect code generation     read_mer       triggers the contents of the A and B match registers to be transferred into     C  2007 2015 Compiler Reference Manual  page 39    5  eTPU Programming Model    5 4 7 2    5 4 7 3    page 40  Compiler Reference Manual    the erta ertb registers     NOPQ      injects a no op opcode into the code stream that does not get optimized out     ETEC Coherency  amp  Synchronization Control    These next set of functions allow users clearly state their needs in terms of coherency   ordering  etc     _AtomicBegin    _AtomicEnd     code located between a pair of these calls will be packed  into a single opcode  if this cannot be done a compilation error results  Another side effect  of these stomic regions is that the optimizer will not optimize the code out  or move any of  the sub instructiosn apart from each other  Other sub instructions may be optimized into  the atomic opcode  See also 11 1 4 for pragmas that provide the same capability     _SynchBoundaryAI      disables any code from moving across the boundary during the  optimization process  See 11 1 5 for the matching pragma definition     TBD     a bunch of additional stuff to control coherency  orde
27.  command line   or found via  include  or search      ABS   output the  filename with its full  absolute path      msgLimit  lt CNT gt   msgLimit 20    Compiler Reference Manual  page 111     I  lt PATH gt   I    Include    where PATH is a text  string representing either  a relative or absolute  directory path  The  entire option must be in  quotes if the path  contains spaces      C  2007 2015    9  Command Line Options    Source File Search Path   Mode  lt MODE gt  SOURCER       Mode EL IMode CWDRE  De  where MODE can be  L  Specifies any    directories  after the   SOURCEREL   search   current paths specified with  I  are relative to the source  file being compiled       CWDREL   search  paths specified with  I  are relative to the current  working directory     Macro Definition  d  lt MACRO gt   d DBG_BUILD    Supplies a macro where if MACRO is an   definition to the pre  identifier than it is pre    processing stage of defined to a value of 1    compilation  otherwise it can be of the  form macro definition   where macro gets the  value specified in     definition        Output File  out  lt FILENAME gt   out file  ob     Overrides the default   where FILENAME is  behavior of generating   written with the    an object file with the  same base name as the FILENAME does not    compilation output  If    source file  but with      have an extension   eao is  the  eao extension     added automatically    The entire option must be  in quotes if FILENAME  contains spaces     S
28.  for the called function     The arguments to the function are processed  The first argument that can fit ina  24 bit register is allocated to the A register  The next argument that can fit ina  register is allocated to the SR register  Finally  the next argument that can fit ina  register is allocated to the MACL register  Any further arguments  or those that  do not fit in a register  e g  a structure larger than 24 bits   are placed on the stack  in order     The stack frame  register B  is updated to the new value if necessary  and the call  is made  Note that if the called function has a return type value that fits in a  register  it will be returned in register A  Otherwise  space is allocated on the  stack after the parameters     On the callee side  the following is done     If the callee itself makes further function calls  it saves the RAR  return address      C  2007 2015    5  eTPU Programming Model    register onto the stack     e If the function uses any of the non volatile registers  registers C and D   it saves  them to the stack     e Last  passed parameters are moved to their final locations  if they are different   For example  a parameter passed via register may get allocated to a stack location   or a parameter passed on the stack may be moved to a register     Based on the sample code below     struct     int x  y         in a function    char a    struct S b    int      d  4    struct S f   CalcPos a  b  c  d  e     rest of function     struct S CalcPos
29.  of alternate type   0 or 1     flagl        is equivalent to channel  FLAG1    Besides one exception  tests of these conditions can be logically ANDed and ORed  together to determine the conditions for entry into a given thread  Host service request   hsr  conditions can never be ANDed together     When defining an entry table of alternate type  specifying just one hsr condition from a  grouped set is sufficient to cover that group   s entries  For example  if  hsr    1          is  equivalent to if   hsr    1  Il  hsr    4  Il  hsr    5            The latter format is  recommended as it is clearer to read  amp  understand     Within an entry condition specification  the operators Il   amp  amp          and    are allowed   The    and   operators are not allowed for use with the hsr condition  only the other  Boolean conditions  The Boolean conditions may also be specified just by themselves  not  hsr   e g  if  m1          which is equivalent to if  ml    1              The conditions in successive if expressions can overlap  the latter if only covers any  remaining open entry table slots for which its conditions apply  If no open slots remain a  compilation error is reported  Here   s an example of a standard entry table definition     If  hsr    1        page 54  Compiler Reference Manual  C  2007 2015    5 6    5  eTPU Programming Model       Else if  ml  amp  amp  m2               covers entry slots 10  11  20  21  22  23     Else if  m1           covers entry slots 16 
30.  one way is to pack from the MSB of the enclosing data unit  and the other is to pack from  the LSB of the enclosing data unit  The auto struct capability supports both techniques by  enclosing bit field _Bool member declarations in conditional compilation clauses controlled  by the macros MSB_BITFIELD_ORDER and LSB_BITFIELD_ORDER  The user of  the auto struct header file must define one of these two macros for the code to compile      if defined MSB BITFIELD ORDER   etpu if uint8   5     etpu if uint8 63    d    etpu if uint8  b2    1    etpu_if_uint8  B1   1    elif defined LSB_BITFIELD_ORDER    etpu_if_uint8 BE   4    etpu_if_uint8  ba   LE    etpu_if_uint8 DS   L     etpu if uint8   5    else   error Users of auto struct must define either  MSB_BITFIELD ORDER or LSB BITFIELD ORDER   endif    A second reason for handling bit fields different from other members of the auto struct is  that host code may need access to the enclosing data unit of the bit field  This is because  writing a bit field member generates read modify write code that is not coherent     this  may not be acceptable in some cases  Or  a user may need to write read multiple bit fields  simultaneously  Thus bit fields  and _Bools  are placed under a union in the auto struct   along with the data unit  This union is given an auto generated name _BF_UNIT_ lt addr  offset gt   where  lt addr offset gt  is the byte offset within the data overlay segment of the bit   field unit  An entire bit field unit declara
31.  somestruct     sizeof SomeStruct        Would get packed like     Struct Offset MSByte 3 LSBytes    0   I actually since the unused  base struct address is  e to start at    Cow   o  ee   To    24  23  unused       page 142  Compiler Reference Manual  C  2007 2015    13  Appendix B   Data Packing Details    32  31  somestruct    36  35        13 5 Array FASTACCESS Mode    With array FASTACCESS mode the array stride size is always a multiple of 4  This also  means that when using this mode  incrementing a pointer to char changes the address by 4  bytes rather than 1  Thus care must be taken when using this mode  however  it can  generate significantly more efficient code when array access is required  Arrays of  elements with a size of 1 byte are aligned on modulo 4 addresses  Elements of size 2 bytes  are aligned at modulo 4 plus 2     Some example declarations and the ensuing memory allocations are shown below     char a 6      although only burns 6 bytes  sizeof      24  int b 3     struct FiveByteStruct      char fl    int   2    char   3      el2     int24 x    int8 y    int16 z     The resulting memory allocation map would look like     SDM Channel Frame MSByte 3 LSBytes  Address Offset    eer EN     C  2007 2015       Compiler Reference Manual  page 143    13  Appendix B   Data Packing Details       page 144  Compiler Reference Manual  C  2007 2015    14  Appendix C   eTPU Annotated Object File Format    14    Appendix C   eTPU Annotated  Object File Format    The eTPU
32.  un initialized  variables are located  or areas  due to the funny 24 bit nature of the eTPU  where there  are simply no variables located  Holes get initialized to zero  Holes may be interspersed  between valid initialized data     The data itself is packaged in macros output into the  lt output file name gt _idata h file   These macros take the form of MacroName  address_or_offset   data_value    In the   lt output file name gt _idata c file the macros are used to create initialized arrays  ready for  use by host side eTPU initialization code     By default the data is packaged as 32 bit unsigned integers  The linker option    data8 can  be used to output the data as unsigned 8 bit instead     Initialized Global Memory    The global memory data structure has the following form     unsigned int  lt GlobalMnemonic gt global_mem_init           0x00A02433                 C  2007 2015 Compiler Reference Manual  page 103    8  Initialized Data Files    8 2    page 104  Compiler Reference Manual    The start address is the DATA RAM base plus the offset found in the auto defines file   The actual text in the _idata c file is different because the array initialization is done using  the macros from the matching _idata h  as follows        Global Memory Initialization Data Array  unsigned int _global_mem_init            undef _ GLOBAL MEM INIT32    define _ GLOBAL MEM INIT32  addr   val   val    include  DeclTest_B_idata h     undef __GLOBAL MEM INIT32         Initialized Channel Mem
33. 5 Compiler Reference Manual  page 59    5  eTPU Programming Model    An example of a state switch  shown in a listing file  is shown below  some code removed  for brevity   Note that every enumerator is covered by a case  and note the NOPs  inserted where multiple cases fall through to the same code     _eTPU_ state switch  Crank State   OCF4  OxCFEFF987 ram p_31 24      channel int8    Ox1C     OCF8  OxFFDFDEF9 seq goto ProgramCounter   p_31_24  flush       case CRANK_BLANK_TIME      timeout is expected    Blank Time Expired Flag   1   OCFC  0x000FA439 alu p  31 24     u24  0  0x1    0D00  OxCFFFF986 ram    channel int8    0x18    p 31 24         Timeout time  ertb   Tooth_ Time   Blank Time     0D04  OxBFEC2F87 alu ertA   tcr1 0x0   H ram diob      channel int24    0x1D     0D08  0x1F783FFF alu ertB   p diob       schedule an immediate match to open the window  erta   tcrl     ClearMatchALatch        ODOC  Ox58FFFEI1F chan clear MatchRecognitionLatchA  matchA   ertA   set MatchEnableLatchA   clear MatchRecognitionLatchB   matchB   ertB  set MatchEnableLatchB   detectA   off    ClearMatchBLatch       WriteErtAToMatchAAndEnable      WriteErtBToMatchBAndEnable         don t detect transition during blank time  OnTransA  NoDetect       tcr2   0   0D10  OxOFFFIFFF alu ter2     u24  0  0x0     seq end     break     case CRANK BLANK TEETH      schedule an immediate match     to open the window  erta   tcrl      clear MatchB      amp  don t set new match value  ClearMatchBLatch    
34. 7 4 3 Shift Register Support      F    Shift the SR register right one bit     void shift right SR           fi  fi          oi  fi       Shift v right by one bit and return it    Register SR also gets shifted right by one   bit and SR bit 23 gets the bit shifted out of v   Condition code flags are sampled   per _sfXX extension  if used    See eTPU reference manual for details   on condition code computation with add shift right    int24 shift_right_SR48 int24 v     int24 shift_right_SR48_sf8 int24 v    int24 shift_right_SR48_sf16 int24 v    int24 shift_right_SR48_sf24 int24 v                  5 4 7 4 4 Shift By 2 N 1  Support    if  if  iy  if      if        Shift 24 bit value v left or right by 2   bitexp 1  bits   where bitexp can be   0  1  2 6    3    Condition code flags are sampled   per _sfXX extension  if used    See eTPU reference manual for details   on condition code computation with multi bit rotate     int24 _ shift left 2n int24 v  int24 bitexp     int24 shift_left_2n_sf8 int24 v  int24 bitexp     int24 shift_left_2n_sf16 int24 v  int24 bitexp       page 42  Compiler Reference Manual           C  2007 2015    5  eTPU Programming Model    int24 shift left 2n sf24 int24 v  int24 bitexp     int24 shift right 2n int24 v  int24 bitexp     int24 shift right 2n sf8 int24 v  int24 bitexp     int24 shift right 2n sf16 int24 v  int24 bitexp     int24 shift right 2n sf24 int24 v  int24 bitexp                      5 4 7 4 5 Set Clear Bit Support            if  if          
35. Compiler Reference Manual    by    John Diener and Andy Klumpp    ASH WARE  Inc   Version 2 40 ASH  11 1 2015        C  2007 2015 ASH WARE Inc     page 2  Compiler Reference Manual    Combpiler Reference Manual    Table of Contents    Foreword 9  Part 1 Introduction 11  Part2 Supported Targets 13  Part3 References 15  Part 4 Keywords and Abbreviations 17  Part5 eTPU Programming Model 19   51   OT PUT ype s veccreccs NE AANEEN nd eee ententes SEEREN OSSE 19   5 2  Pointers caora aan gaaat iaaa telnet ee ee tenant iE aaia EE 22   53  eTPU  Data Packing EUS ES ne eves dete ved EATER AANER 22   Global Variable Sa A aa a his en ne aa E aa ee Eaa aa me aA AE A eena aeae na a enana             Static Variables in Callable C Functions      eTPU2 Engine Relative Address Space nine  eTPU Channel Frame Variables eee  Channel Frame PACKTIGHT Mode  Local Stack Variables ss DE EEN nr haahi aiana  Structures  amp   Unions a E E E E ess ennes tte ane  Structure PACKTIGHT Mode         Channel Hardware ACCESS          scssscsescssecseesenessesenesseesenesseeseeeseeseesnnerseessnesseeessersnees  Baseline eTPU Channel Hardware Programming Model  eTPU  Extensions to the Channel Hardware Programming Model  eTPU2 Extensions to the Channel Hardware Programming Model  Register AcceSS E Ni ri ner nr nn ee E   ALU Condition Code Access mm esserne    Built in    Intrinsic FUnCtions 2 005 lind          Compiler Reference Manual  page 3    Compiler Reference Manual    Compatibility Functions  ETEC Coheren
36. D    Bitfield member offsets are specified in bits  and also have bit size information     Yields     struct S3    struct Si s1 1     int m   10    int n   10    int o 10     must go in next  unit   int p 1     int g   1    int   4    inter  1     struct S1 s1 2            defines for type struct S3           define CHAN TAG TYPE SIZE S3 0x10   define CHAN TAG TYPE RAW SIZE S3 Ox0F   define CHAN TAG TYPE_ALIGNMENT_S3_ 0x01        define CHAN MEMBER BYTEOFFSET Test S3 sl 1 0x00   define CHAN MEMBER BITOFFSET Test S3 m 0x4E   define CHAN MEMBER BITSIZE Test _S3 m 0x0A   define CHAN MEMBER BITOFFSET Test S3 n 0x44   define CHAN MEMBER BITSIZE Test S3 n _ 0x0A   define CHAN MEMBER BITOFFSET Test S3 o 0x6E   define CHAN MEMBER BITSIZE Test S3 o _ 0x0A   define CHAN MEMBER BITOFFSET Test S3 p 0x6D        C  2007 2015 Compiler Reference Manual  page 93    7  Auto Header Generation     define CHAN MEMBER BITSIZE Test S3 p 0x01  define CHAN MEMBER BITOFFSET Test S3 q 0x6C   define CHAN MEMBER BITSIZE Test S3 q 0x01   define CHAN MEMBER BITOFFSET Test S3 r 0x67   define CHAN MEMBER BITSIZE Test S3 r 0x01   define CHAN MEMBER BYTEOFFSET Test S3 sl 2 0x04       Enumeration information is exported using the settings mnemonic ENUM_LITERAL and  with a  lt Misc gt  portion that is the enum name and literal concatenated  For example     enum timebase_t     tcrl_base   tcr2 base          Yields        defines for type enum timebase t      values of the literals of an enum type      value   CHA
37. ETPU_function  lt function name gt       standard   alternate        etpd_input   etpd_output        lt function number gt        lt function name gt  must match and precede a function in the source code of the same name   with a void return type and whose parameters represent the eTPU function   s channel  variables     The standard   alternate setting controls the entry table type for the function  standard is  default      The entry table pin direction auto defines macro generation is controlled by the etpd_input    etpd_output item  If not specified  nothing is generated into the auto defines file  default of  input       lt function number gt  is processed and passed to the linker  Function numbers are  automatically assigned at link time if a static number was not specified     It is assumed the function called out has an appropriate format of if else blocks to defined  the entry table  and compilation will fail if not  or if they do not match the standard or  alternate setting     No other legacy  pragma options are supported at this time     page 128  Compiler Reference Manual  C  2007 2015    12  Appendix A   Pragma Support    12    Appendix A   Pragma Support    This section covers the  pragmas supported by the ETEC compiler  Note that these are  generally also supported by the ETEC assembler  There are two classes of  pragmas    one class are  code  pragmas  The code pragmas affect how code is generated and  optimized AND their location within the code is important
38. G   OF44  Ox4FFFFFFF nop      case CRANK_TOOTH_BEFORE_GAP   OF48  Ox4FFFFFFF nop      case CRANK_TOOTH_AFTER_GAP   OF4C  Ox4FFFFFFF nop          case CRANK TOOTH AFTER GAP NOT HRM   Error Status   Error Status    CRANK_INTERNAL_ERROR   OF50  OxCFEFF982 ram p_31_24      channel int8    0x8     OF54  O0x0C42AB82 alu p_31 24   p_31_24   Ox10    OF58  OxC7FFF982 ram    channel int8    0x8    p_31_24   A seq end     break           page 62  Compiler Reference Manual  C  2007 2015    5 7 4    5 8    5  eTPU Programming Model    Additional Notes    The compiler linker calculated state enumeration values are output through all the  supported host interface mechanisms  For example  given the examples above  this is what  is output for the CrankStates state enumeration        defines for type _eTPU_state_switch_enum CrankStates      size of a tag type      value  sizeof    CHAN TAG TYPE SIZE CrankStates_    define _CHAN TAG TYPE_SIZE_CrankStates_ 0x01      values of the literals of an enum type      value   CHAN ENUM_LITERAL Crank CrankStates CRANK SEEK    define CHAN ENUM LITERAL Crank CrankStates CRANK SEEK  0x91    define CHAN ENUM LITERAL Crank _ CrankStates CRANK BLANK TIME 0x00   define CHAN ENUM_LITERAL Crank _CrankStates CRANK BLANK TEETH_ 0x06   define CHAN ENUM LITERAL Crank _ CrankStates CRANK FIRST EDGE 0x0E   define CHAN ENUM LITERAL Crank _ CrankStates CRANK SECOND EDGE 0x15   define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_TEST_POSSIBLE_GAP_ 0x26   define _CHAN_ENUM_LI
39. ISO compliant generated code   ansi  mode only     An incomplete global array definition encountered  it is assumed  to have only one element     An inner scope identifier name is masking the same name from  an outer scope     Multiple of the same type qualifiers detected   No function return type is specified  defaulting to int return type   A declared local variable encountered that is not ever used     Signed and unsigned values are being compared and thus may  yield unexpected results  comparison is unsigned      Value to be assigned is not of the same type  an implicit  conversion is done        320 An array string initializer is too large to fit in the array  it is  truncated     Shift by a negative constant is ignored     page 158  Compiler Reference Manual  C  2007 2015    15  Appendix D   Error  Warning and Information Messages    Message Explanation  Identifier  Shift by a zero constant is ignored     Constant conversion to fact was saturated         C  2007 2015 Compiler Reference Manual  page 159    
40. N ENUM LITERAL FPM timebase t_tcrl base   define CHAN ENUM LITERAL FPM timebase t tcrl base 0x00   define CHAN ENUM LITERAL FPM timebase_t_tcr2_base_ 0x01    7 2 9 Global Mnemonic  The GlobalMnemonic is text that is prepended to  ifdef   s and  define   s in the auto header    file  It is intended to be used to avoid clashes with similar constructs in other files  The  default GlobaIMnemonic is an the underscore character     _        7 2 10 Settings  Register Fields  and Mnemonic    Setting Register  Mnemonic  Field    Entry Table Base   ETPUECR  ENTRY TABLE BASE ADDR Byte  Address       page 94  Compiler Reference Manual  C  2007 2015    7  Auto Header Generation    Setting Register  Mnemonic  Field    Entry Table Type   CXCR ETCS  ENTRY_TABLE_TYPE   standard   alternate     Entry Table Pin  CXCR ETPD  ENTRY TABLE PIN DIR 0 Input  Direction  input  1 Outpu  Output  t    8 bit Channel CXCR CPBA  CPBAB  Variable Offset    CPBA_BOOLBITOFFSET    16 bit Channel CXCR CPBA  CPBAI6 Bytes  Variable Offset    24 bit Channel CXCR CPBA  CPBA24 Bytes  Variable Offset  32 bit Channel CXCR CPBA  CPBA32 Bytes  Variable Offset    Array Channel CXCR CPBA  CPBA_ARRAY Bytes   Variable Offset  amp    Length Stride CPBA TYPE ARRAY  lt type gt   DIM_ lt N gt  LENGTH Count    DIM_ lt N gt _STRIDE Bytes    Struct Channel CXCR CPBA  CPBA_STRUCT Bytes  Variable Offset  Union Channel CXCR CPBA  CPBA_ UNION     C  2007 2015       Compiler Reference Manual  page 95    7  Auto Header Generation    Settin
41. OSTED_ _ The integer constant 1 if the implementation is a hosted  implementation or the integer constant O if it is not   _ _STDC_VERSION_ _ The integer constant 199901L    TIME The time of translation of the preprocessing translation unit  a character       string literal of the form  hh mm ss  as in the time generated by the asctime  function  If the time of translation is not available  an implementation defined valid time  shall be supplied     The ETEC compiler also specifies the     mode ETPUC    to ETEC_cpp exe  This triggers  some minor exceptions to regular C preprocessing in order work with existing code better     ETEC_cpp exe can be used as a standalone tool to perform C preprocessing  See section  8 1 1 for details on ETEC_cpp exe command line options     page 78  Compiler Reference Manual  C  2007 2015    7 1    7  Auto Header Generation    7    Auto Header Generation    The linker can generate header files that contains information for the host CPU build  This  includes information such as variable offset information  code image information  function  number  etc     The auto struct header file is generated by default  and provides C structures for the host   side code that overlay the actual memory layout  Auto struct generation can be disabled     The auto defines header file is automatically generated by default  but can be disabled    and the text within the file is generated by concatenating things like the user assigned  function name with the user assig
42. Packing    Control how members  are placed in a  structure     page 114  Compiler Reference Manual    resulting in optimal  load store performance  but potentially  increased memory  usage      packstruct  lt OPTION gt    PACKTIG    where OPTION can be       PACKTIGHT   packs  members as tight as  possible  offsets of  sequentially declared  members are not  necessarily sequential   Additionally  accesses  to some members may  not be coherent with    regards to neighboring  data  when this setting  is used     FASTACCESS   packs  members so as to  provide the fastest  access possible by  locating data in optimal  spots  Uses more  memory but increases  code speed and  removes coherency  conflicts     LEGACY   packs  members similar to  PACKTIGHT  but  with slight differences  as it attempts to     C  2007 2015    packstruct FAST  ACCESS       9  Command Line ee BE tne Ot    poate mimic legacy  tools structure packing  algorithms     ANSI Mode  ansi  ansi  Enforces ANSI  behavior with structure   amp  array packing   Where ANSI compliant  code is not generated a  warning is issued  Care  should be taken using  this is it can reduce  code efficiency and  increase memory  usage     Compiler Reference Manual  page 115       Preprocessor Only  ppOnly  This option stops  compilation after the C  preprocessing stage  If  an output file has been  specified via    out  the  results go to that   otherwise the  preprocessed source is  output on stdout     Signed Char  signedchar  When s
43. Support ss 127  11 3 Compatibility Mode Support ss mnssssnnrrrrennenennennnnnes 128   Entry Table Support ni nirnrnrrnnnnenenrerenannannesneeneeneeneenennrnaneannne 128   HPFAGM A SUPPOFT       csecesseeseeessessersnessenseeseesseesseenseesseeseesaeesaessaesseersaesseesaneesesnaneeseens 128   Part 12 Appendix A  Pragma Support 129   12 1 Verify Version cece scccccecsectteecscteccceeeeccebessececnotesceteessreccaets ceebeseececutsesiensdses 130  12 2 Disabling Optimization in Chunks of Code             c ceeeceeeeeeeeeeeeeeeeeeeeeeeees 131  12 3 Disabling Optimizations by Type ss 131  12 4 Atomicity  Control s diciesceccc cane cde cede cate ce enicdecadenccccdesacdecedecacccesreddeentecteceaese 132  12 5 Optimization Boundary  Synchronization  Control               sceceeeeeeeeeeeeees 132  12 6 Thread Length Verification  WCTL                                   ss 132  127  Forcing  the  WCT oesie eanna teen enr nie   t entiere 134  12 8 Excluding a thread from WCTL ss 134  12 9 Loop Iteration Count                            ss nsssssnnrrrrrnnnneenennnnennennnnnee 134  12 10 Code Size Verification ss ssssnnrennnnnse 135  12 11 Memory Size  Usage  Verification            cccceseeceeeeeeeeeeeeeeeeeeeeeseeeeeeneeeeeeees 135  12 12 Same Channel Frame Base Address                                                       136  12 13 Auto defines Export    ss ssssssressnnsennennseeneennseenennnne 136  12 14 Private Channel Frame Variables    138    Part 13 Appendix B   Data Packing    De
44. TERAL_Crank_CrankStates_CRANK_VERIFY_GAP 0x54   define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_GAP_VERIFIED_ 0x7E   define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_COUNTING_ 0x92    define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_TOOTH_BEFORE_GAP 0x93   define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_TOOTH_AFTER_GAP 0x94   define _CHAN_ENUM_LITERAL_Crank_CrankStates_CRANK_TOOTH_AFTER_GAP_NOT_HRM  0x95                                     If the code that makes up the state switch exceeds 255 opcodes  there may be some cases  that still require the dispatch jump plus a regular jump  Such cases can be minimized but  putting the most code intensive case s  at the end of the state switch     The user can easily convert ETEC specific state switch code to ANSI compliant code by  utilizing macros such as      define _eTPU_state_switch switch   define _eTPU_state_switch_enum enum          eTPU Constant Tables    The eTPU instruction set provides a fairly efficient way to create 24 bit constant lookup  tables in the code  These special lookup tables are not any more efficient than the use of a  regular C arrays for lookup tables  and in fact access is almost always slightly slower   However  they do offer one key difference that can be advantageous in some cases   the  constant table is stored in the code memory rather than the data memory  If system being  programmed is out of data memory  SDM   but is not using all of code memory  SCM    then the use of this constant lookup 
45. TORI  0  x  1  1  1  0  1  Detect New Data RX    ETPU VECTORI  0  x  1  1  1  1  1  Detect New Data RX          The linker would assign a function number to the UART entry table assigned above  and    the auto header output would not contain information for host on setting the entry table to  the input or output pin     Entry tables must contain all 32 of the entry vectors shown above for either a standard or  alternate table  however  there is no constraint on the ordering of the entries  They can be  re arranged for ease of reading  etc     Compatibility Mode    In compatibility mode  entry tables are encoded via if else blocks within functions  designated as eTPU Functions  eTPU Functions are designated with a  pragma  different  formats shown  that can include table type  amp  function number information      pragma ETPU_function  lt func_name gt      implies standard   pragma ETPU_function  lt func_name gt     lt func_num gt      implies standard   pragma ETPU_function  lt func_name gt    alternate   standard      pragma ETPU_function  lt func_name gt    alternate   standard     lt func_num gt      The special if else block resides at the top scope level of the function  with each if  expression defining the entry conditions for the ensuing thread  Each compound statement  following an if else represents aneTPU thread   TBD note  statement following if else  must be a compound statement     at the current time for proper compilation   Below  a  skeleton of an eTPU Functi
46. TPU Function TESTIO    The above variable definitions would be exported in the defines file as something like      define GLOB STRUCT g GlobalStructVar_ 0x10   define CPBA UNION TESTIO ChanFrameUnionVar 0x05       Individual members of these variables can then be located using the additional type  information provided  as described in section 6 2 8      C  2007 2015 Compiler Reference Manual  page 91    7  Auto Header Generation    7 28 Tag Types  Structures  Unions  Enumerations     When global  GLOB mnemonic   engine relative  eTPU2 only  ENG mnemonic  or  channel frame  CHAN mnemonic  variables have a tag type  struct  union  or enum   information on that type will be exported in the auto header file  In the case of structs  amp   unions  this information can be used to build up the exact location of each member  Size  and alignment information is also included  Two pieces of size data are provided     one is  the size that the sizeof   operator would return  which includes any padding in order to  reach the array stride size of the struct union  The second is the raw size used by the  structure  and does not include padding  The alignment data indicates the offset  within a  32 bit word  where the struct union begins  A struct that consists of two 24 bit members  would have an alignment of 1  and a raw size of 7  From a host perspective  the number of  32 bit words that must be allocated to hold an eTPU structure is    lt alignment gt     lt raw  size gt    3   gt  gt  2 
47. U_VECTOR1 0  0  0  1  1  0  x  Global Error Thread    ETPU_VECTOR1 0  0  0  1  1  1  x  Global Error Thread    ETPU_VECTOR1 0  0  1  0  0  0  x  HandleMatch     ETPU_VECTOR1 0  0  1  0  0  1  x  HandleMatch    ETPU_VECTOR1 0  0  1  0  1  0  x  HandleMatch    ETPU_VECTOR1 0  0  1  0  1  1  x  HandleMatch    ETPU_VECTOR1 0  0  1  1  0  0  x  HandleMatch    ETPU_VECTOR1 0  0  1  1  0  1  x  HandleMatch    ETPU_VECTOR1 0  0  1  1  1  0  x  HandleMatch    ETPU_VECTOR1 0  0  1  1  1  1  x  HandleMatch    ETPU_VECTOR1 0  1  0  0  O  0  x  Global Error Thread    ETPU_VECTOR1 0  1  0  0  O  1  x  Global Error Thread    ETPU_VECTOR1 0  1  0  0  1  0  x  Global Error Thread    ETPU_VECTOR1 0  1  0  0  1  1  x  Global Error Thread    ETPU_VECTOR1 0  1  0  1  x  0  x  Global Error Thread    ETPU_VECTOR1 0  1  0  1  x  1  x  Global Error Thread    ETPU_VECTOR1 0  1  1  0  x  0  x  HandleMatch    ETPU_VECTOR1 0  1 1  0  x  1  x  HandleMatch                       An example of an alternate entry table might look like     DEFINE_ENTRY_TABLE  UART  UART  alternate  outputpin  autocfsr       Ti HSR LSR M1 M2 PIN FO F1 vector  ETPU_VECTOR2  2 3  x  x  x  0  0  x  Global Error Thread    ETPU_VECTOR2  2 3  x  x  x  0  1  x  Global Error Thread    ETPU_VECTOR2  2 3  x  x  x  1  0  x  Global Error Thread    ETPU_VECTOR2  2 3  x  x  x  1  1  x  Global Error Thread    ETPU_VECTOR3 1 4 5  x  x  x  x  x  x  TX_INIT    ETPU_VECTOR2  6 7  x  X  My  X  MX  x  RX_INIT      ETPU_VECTOR1  0  1  0  0  O  x  x 
48. a     C  2007 2015 Compiler Reference Manual  page 81    7  Auto Header Generation    run time check to ensure that the structure is compiling correctly under their host compiler   The auto naming convention of the macros is as follows      define   define   define   define   define   define    7 1 3    etpu  etpu  etpu  etpu  etpu    etpu_    if_GLOBAL_DATA       if_GLOBAL_DATA       if_ENGINE_DATA       if_ENGINE_DATA       _if  lt func class    if_ lt func class    eTPU Data in Auto Structs    name gt  CHANNEL FRAME EXPECTED SIZE  name gt  CHANNEL FRAME EXPECTED SIZE PSE    EXPECTED SIZE  lt size gt   EXPECTED SIZE PSE  lt size gt   EXPECTED SIZE  lt size gt   EXPECTED SIZE PSE  lt size gt      lt size gt    lt size gt     For eTPU variables of basic type  the variable name is used as is as the member name in  the auto generated data overlay structure  For example  the Freescale PWM function has  the following eTPU code that defines its channel frame     void PWM int8 Flag   int24 Coherent_Period   int24 Coherent ActiveTime           int24 Period  int24 ActiveTime     static int24 LastFrame   static int24 NextEdge     ll       As can be seen  the variable names become the member names in the data overlay  structure  note that the 8 bit    Flag    variable ends up in the non 24 bit data structure  which  is not shown      typedef struct            0x0000     etpu_if_sint32     0x0004     etpu_if_sint32     0x0008     etpu_if_sint32     0x000c     etpu_if_sint32     0x0010  
49. a in an  expression that involves arithmetic   operations outside assignment  load    store  result in compilation errors   Conversion via typecast to signed   unsigned int32 is supported     long long int  unsigned long  32 bits treated like long types  see comment  long int above     1 bit   8 bits _Bool needs to hold 0 or 1  By default   it is packed into 1 bit that is part of an  8 bit unit  Global _Bool variables  consume an entire 8 bit unit by  themselves so that external linking  works correctly  Up to 8 channel  frame _ Bool variables can packed into  one 8 bit unit     Arrays of _Bool are treated as special     bit arrays    and are limited to a length  of 24     If the    ansi mode is specified  then all   _Bools consume and 8 bits and arrays  of _Bools are similar to arrays of  chars     Not supported Not supported       page 20  Compiler Reference Manual  C  2007 2015    5  eTPU Programming Model    float Not supported Not supported    Not supported Not supported    The TR 18037 Embedded C extensions defines additional types  ETEC supports these as  follows        no TR18037 defined type  8 bits  s 7 format   fract8 is a synonym     use  fract8      no TR18037 defined type   8 bits  0 8 format   unsigned fract8 is a synonym     use    unsigned fract8      short _Fract 16 bits  s 15 fract16 is a synonym for short _Fract  format    unsigned short _Fract 16 bits  0 16 unsigned fract16 is a synonym for  format unsigned short _Fract    24 bits  s 23 fract24 is a synon
50. ables     including compiler allocated stack base to  be filled in during host eTPU initialization     engine 0  channel 5 channel variables  engine I  channel 0 channel variables    engine I  channel 3 channel variables     including compiler allocated stack base to  be filled in during host eTPU initialization         C  2007 2015 Compiler Reference Manual  page 67    5  eTPU Programming Model       engine 1  channel 27 channel variables    5 9 2 Calling Convention    The stack based programming model uses registers  and if necessary stack space  to pass  parameters when function calls are made  Stack is also used to save function state such  as volatile registers that are in use at the time of the call  The detailed calling convention  procedure is outlined below     page 68  Compiler Reference Manual    First  any volatile registers that are in use at the time of the function call are saved  onto the stack  if any  Volatile registers are  P  A  SR  MACH  MACL  The  exception to this are named register variables  The registers used for such  variables are not saved and restored during a function call  which allows for  implicit parameter passing via register  as is done in some legacy applications      Next  if the stack frame offset is changing  the stack is used by the current  function for local variables  or any volatile registers have been saved   the current  stack frame  register B  is saved to the stack     At this point the current stack pointer is the stack frame
51. ach   If the actual size of the function exceeds MaxSize  the linker  issues an error     This pragma is available in both the Assembler and Compiler     Memory Size  Usage  Verification    The memory usage verification pragma  verify_memory_size  allows the user to verify at  build time that their memory usage meets size requirements  Memory usage is verified on  a memory section basis  The pre defined  default  memory sections are named  amp   described below     GLOBAL_VAR   user declared global variables    GLOBAL SCRATCHPAD local variables allocated    out of global memory  scratchpad   GLOBAL_ALL   all global memory usage  ENGINE_VAR   user declared variables    in engine relative memory space   eTPU2 only     ENGINE_SCRATCHPAD local variables allocated  out of engine relative memory     engine scratchpad  eTPU2 only     ENGINE_ALL   all engine relative memory usage     C  2007 2015 Compiler Reference Manual  page 135    12  Appendix A   Pragma Support    12 12    12 13    page 136  Compiler Reference Manual     eTPU2 only     STACK     maximum stack size  User defined memory sections can also be verified  Currently only channel frames are  supported     these are verified by specifying the appropriate eTPU class or function name   The pragma has the following syntax options     pragma verify memory size  lt memory section gt   lt MaxSize gt  bytes   pragma verify memory size  lt memory section gt   lt MaxSize gt  words   pragma verify memory size  lt eTPU class functio
52. am    channel int8    0x1C    p_31_24    ter2   0     case CRANK_TEST_POSSIBLE_GAP   Tooth Period B   Tooth Time   Last Tooth Time   ram diob      channel int24    0x55     alu p   p diob   ram    channel int24    0x4D    p_23_0      case CRANK_VERIFY_GAP   Tooth_Period_A   Tooth Time   Last Tooth Time   ram diob      channel int24    0x55     alu p   p diob   ram    channel int24    0x45    p 23 0       C  2007 2015 Compiler Reference Manual  page 61    5  eTPU Programming Model       Gap is verified  if   muliur Tooth Period B  Gap Ratio    gt  Tooth Period _ A   0E54  OxBFEFFB93 ram p_23 0      channel int24    Ox4D     0E58  OxBFEFFF86 ram diob      channel int24    0x19     OE5C  Ox2F78FFE9 alu mac   p     u24  diob     0E60  O0xF3587307 seq if MacBusy  true then goto 0xE60  flush    0E64  OxBFEFFB91 ram p_23_0      channel int24    0x45     0E68  Ox1C17FEEF alu nil   mach p  SampleFlags    OE6C  OxF4D87607 seq if LowerOrEqual  true then goto OxECO  flush             Crank_State   CRANK_GAP_VERIFIED   0E70  Ox01FFA459 alu p_31 24     u24  0  0x7E    OE74  OxCFFFF987 ram    channel int8    0x1C    p_31_24          lt REMOVED gt     case CRANK_GAP_VERIFIED   Tooth_Count     OEF4  OxCFEB3980 ram p_31_24      channel int8    0x0    i chan set ChannelFlagl  set SvcdChan Channellntr    OEF8  0x0002A439 alu p  31 24   p 31 24 0x1    OEFC  OxCFFFF980 ram    channel int8    0x0    p 31 24             lt REMOVED gt     case CRANK SEEK   OF40  Ox4FFFFFFF nop      case CRANK_COUNTIN
53. as     typedef struct      CIRC int   2     write only   ERWA int   1      write only   ERWB int   1      write only   FLC int   3      write only   IPACA int   3      write only   IPACB int   3      write only   LSR int   1     writeable  testable  entry condition  MRLA int   1      writeable  testable  MRLB int   1     writeable  testable  MRLE int   1     write only   MTD int   2     write only   OPACA int   3     write only   OPACB int   3     write only   PDCM int   4      write only   PIN int   3      write only   TBSA int   4      write only   TBSB int   4      write only   TDL int   1      write only   SMPR int   2      writeable  testable        setting to  1 triggers semaphore free      C  2007 2015    5 4 3    5  eTPU Programming Model    FLAGO int 1     writeable  also via FLC   entry condition  FLAGI int 1     writeable  also via FLC   entry condition  FMO int 1     test only  FM1 int   1     test only  PSS int   1     test only  PSTI int   1      test only  PSTO int   1      test only  TDLA int   1      test only  TDLB int   1      test only      chan struct     See eTPU documentation for the details on each field     Note that the ETpu_Std h header file defines many macros that simplify interaction with  the channel hardware and make it more user friendly     eTPU  Extensions to the Channel Hardware Programming Model    For the eTPU   chan_struct has been modified and extended to the following     typedef struct      CIRC int      write only   ERWA int      wri
54. ations  Volatile registers are  P  A  SR  MACH  MACL   The exception to this are named register variables  The registers used for such  variables are not saved and restored during a function call  which allows for  implicit parameter passing via register  as is done in some legacy applications      The arguments to the function are processed and each is placed into a unique  scratchpad location  Note that this scratchpad location is the same for each  invocation of the function  thus scratchpad eliminates the ability to use recursion      The call is made  Note that if the called function has a return type value that fits in  a register  it will be returned in register A  Otherwise  scratchpad space is  allocated    On the callee side  the following is done     If the callee itself makes further function calls  it saves the RAR  return address   register into scratchpad     If the function uses any of the non volatile registers  registers C and D   it saves  them to scratchpad     Last  passed parameters are moved to their final locations  if they are different  than the location via which they were passed  For example  a parameter may be  moved to a register     The ETEC compiler does provide a mechanism that allows users some control as to how  parameters are passed  Function parameters can be designated with a named register  storage class  and thus the specified parameter will be passed in the specified register   This capability should be used with caution  however  This
55. ble Offset    16 bit Global  Variable Offset    24 bit Global  Variable Offset    32 bit Global  Variable Offset    Array Channel  Variable Offset  amp   Length Stride    Struct Channel  Variable Offset    Union Channel  Variable Offset    Struct Union  Member Offsets    page 98  Compiler Reference Manual    Register  Mnemonic Units  Field  ERBA TYPE    GLOB VAR8 Bytes  GLOB VAR8 BOOL BIT OFFSET   Bits  GLOB  VARIG    GLOB_VAR24  GLOB_VAR32    DIM_ lt N gt _STRIDE    GLOB_STRUCT  GLOB UNION    GLOB MEMBER  TYPE    GLOB MEMBER BYTEOFFSET  GLOB_MEMEBR_BITOFFSET       RAM GLOB_ARRAY  GLOB_TYPE_ARRAY  DIM_ lt N gt _LENGTH     C  2007 2015    7  Auto Header Generation    Setting Mnemonic eat  GLOB MEMBER BITSIZE Bits  GLOB MEMBER  lt name gt  DIM  lt  gt    Tag Type Data GLOB TAG TYPE SIZE Bytes  GLOB TAG TYPE RAW SIZE  GLOB TAG TYPE ALIGNMENT    Variable Type    GLOB VAR TYPE  Global V ariable RAM GLOBAL VAR SIZE  Size    Global Scratchpad   RAM GLOBAL SCRATCHPAD  SIZE Bytes  Size  when global   scratchpad   programming   model is enabled    Global Data Int   RAM GLOBAL INIT DATA ADDR Bytes  Address   Maximum Stack   RAM STACK SIZE Bytes  Size  AM    Engine Variable ENGINE VAR SIZE  Size     C  2007 2015    Enum literal GLOB ENUM LITERAL  values       Compiler Reference Manual  page 99    7  Auto Header Generation    Setting Register  Mnemonic Units  Field    Engine RAM ENGINE_SCRATCHPAD_SIZE Bytes  Scratchpad Size   when engine  scratchpad  programming  model is used    A   A   
56. by applying a series of optimizations to the code  thereby  reducing code size  improving worst case thread length  reducing the number of RAM  accesses  etc  Although these optimizations are generally disabled en masse from the  command line using  opt   it is also possible  but hopefully never  required to individually  disable specific optimizations within a source code file using the following option      pragma disable_optimization  lt Num gt   This disables optimization number   lt num gt   in entire translation unit s  in which the source  code or header file is found     The optimization numbers are not documented and must be obtained directly from ASH  WARE  Note that the purpose of disabling specific optimizations is to work around  optimizer bugs in conjunction with ASH WARE support personnel      C  2007 2015 Compiler Reference Manual  page 131    12  Appendix A   Pragma Support    12 4    12 5    12 6    Atomicity Control    An atomic region can be specified by the enclosing pragmas     pragma atomic begin     code to be atomic   7 ses     pragma atomic end    The contents of an atomic region must compile into a single opcode or an error results   This atomic opcode is guaranteed to be kept together throughout the optimization process     Optimization Boundary  Synchronization  Control    The pragma   pragma optimization boundary all    prevents any opcodes or sub instructions from moving across the  pragma point in the  source code  Generally this should not be 
57. ces the compiler to allocate members in  monotonically increasing offset order  even though the result can be significant wasted  memory     Unions do not need to be packed  per se  as union members overlay each other  However   by ANSI ISO standard every union member is expected to be placed at an offset of 0 from  the union base    but that is not very practical on the eTPU with its unusual addressing  constraints  Take this union for example     union ExampleUnion     int24 s24   int8 array 4    int16 s16   int8 s8       For efficient access  the byte offsets for the union members are best s24   gt  1  array   gt  0   s16   gt 2  s8   gt  0  When ANSI mode is enabled  such a union would generate a warning   the compiler will not  at this time  attempt to generate ANSI compatible unions     The data packing of C structures faces some of same issues discussed in channel frame  packing  with an additional twist  Per ANSI AISO standard  struct member offsets are  expected to be in monotonically increasing order  however  on the eTPU this can result in  impractical data packing and significant memory waste  Once again there are essentially  two data packing flavors     PACKTIGHT    attempts to minimize the amount of wasted  memory  while structures are laid out in    FASTACCESS    mode to promote efficient  access  potentially at the cost of extra memory usage  The third mode     LEGACY     is  only for handling certain cases where existing code is highly dependent upon the pac
58. cy  amp  Synchronization Control        TR18037 Fixed point Library Support       ALU MDU Intrinsics         5 5 ETEC eTPU Class    Extension Syntax Details    Native ETEC Format  Com patibility Mode  Code Fragments  _eTPU thread Calls  State Switch Constructs  State Enumeration  State Variable  State Switch  Additional Notes    5 6    5 7       5 8  5 9    Stack based Model  Calling Convention    Scratchpad based Model    Calling Convention    5 10 In Line Assembly    Calling the Error Handler from User Code  ETEC Standard Header Files    5 11    Part6 C Preprocessing    Part 7    7 1 Auto Struct File    Naming Conventions    eTPU Data in Auto Structs    eTPU Structures Unions    page 4  Compiler Reference Manual    Rotate Right SUPPOFt      is  Absolute Value Support    ss  Shift Register SUPPOFt      rare er ere ATEENAS  Shift By 2 N 1  SUpport                                                    Set Clear Bit SUPPOrt                reen  Exchange Bit Support  MAC MDU Support       eTPU Constant Tables    Auto Header Generation    ETEC Local Variable Model  amp  Calling Conventions    24 bit vs  Non 24 bit Accesses    Combpiler Reference Manual    Arrays in AUtO Structs nn nrrreereenennennnnnnannsnesnesnesneennenrenranrenrenneaneanee   Bit field and _Bool Variables       Exam ple Code SBB EET EDEN eee  7 2 Auto Defines File 2 222202  242cccceseedcetssaeccecdaszzecteatecqccansdcotessicceadeaseceteatigcccats    Global Prepended Mnemonic  Auto Header File Name 2     Text Genera
59. dd AW613E Main    type 0   endcodelabel     page 152  Compiler Reference Manual  C  2007 2015    14  Appendix C   eTPU Annotated Object File Format    14 2 Entries    Each entry table entry must have the following form  The  index directive indicates which  of the 32 entries for this table is being defined  All 32 entries must be defined    defentry   ettype standard   etpin input   etpuclass Add      ettable AW6B2D NAMELESS ENTRY TABLE   etlabel DanglingElse   index 0    val 0x4000   line 70   etcfsr 5   endentry      C  2007 2015 Compiler Reference Manual  page 153    page 154  Compiler Reference Manual    15  Appendix D   Error  Warning and Information Messages    15    Appendix D  Error  Warning and  Information Messages    The ETEC tool suite provides a lot of feedback with regards to compilation errors   warnings and informational messages  The tables below list the messages that can be  issued by the tools     15 1 Compiler Error Messages    Message Explanation  Identifier    Currently unsupported feature  planned to be supported in the  future     Invalid command line option encountered   Could not open specified source file        002 Factory error     should never occur  but if it does report error to  the factory      C  2007 2015 Compiler Reference Manual  page 155    15  Appendix D   Error  Warning and Information Messages    Message Explanation  Identifier    Overflow of the C preprocessor buffer  may be passing too  many long    d options  or to many long    I 
60. ditions allowed per  table  As part of the entry table definition  table qualifiers such as type  standard or  alternate   pin direction  and CFSR  function number  value are specified     The example below shows the overall eTPU class syntax     _eTPU_class ClassName         channel frame variable s   int24 _data24        thread  s    _eTPU thread Initialize _ eTPU matches disabled     _eTPU thread HandleMatch _eTPU matches enabled   _eTPU_preload_high          method s   int24 CalculateOutput  int24 inputl  int24 input2         entry table s       entry table characteristics       standard vs  alternate  etc       are defined at definition time  eTPU_entry table EntryTableName              _eTPU thread ClassName   Initialize _eTPU_matches_disabled       FL sa   _data24   tcrl    PL sx       _eTPU thread ClassName  HandleMatch _ eTPU matches enabled   _eTPU_ preload high     page 46  Compiler Reference Manual  C  2007 2015    ifs    _data24    it           5  eTPU Programming Model      CalculateOutput erta  data24      int24 ClassName   CalculateOutput  int24 inputl  int24    input2           class method can directly access channel variables  return inputl   input2   _data24     The entry table definition is not shown here  but is covered in the detail in proceeding    sections     eTPU classes have the additional feature of being able declare components of the class to  have public or private visibility  By default  all elements of an eTPU class are public  The  visibilit
61. does not   affect the tool exit   code      msgStyle  lt STYLE gt  ETEC  msgStyle  MSDV  where STYLE can be     ETEC   default ETEC  message style     GNU   output  messages in GNU      C  2007 2015 Compiler Reference Manual  page 119    9  Command Line Options    style  This allows the  default error parsers of  tools such as Eclipse to  parse ETEC output  and allow users to  click on an error  message and go to the  offending source line   DIAB   output  messages in the style  used by Diab   WindRiver   compilers    MSDV   output in  Microsoft Developer  Studio format so that  when using the  DevStudio IDE errors   warnings can be  clicked on to bring  focus to the problem  source code line     Console Message Path Style    msgPath  lt STYLE gt     Controls how the path where STYLE can be   and filename are   displayed on any warning       SIS   output the  error messages that filename as it is input  contain filename on the command line    information   or found via  include  or search        ABS   output the  filename with its full  absolute path        page 120  Compiler Reference Manual  C  2007 2015    9  Command Line Options    Console Message Limit  msgLimit  lt CNT gt   msgLimit 20    Controls the number of  messages output   warning or error   before  output goes silent  Note  that if the first error  occurs after the message  limit is exceeded  that  first error is still output     Display Version  version  version    Displays the tool name  and version number and
62. e I  channel 27 channel variables       On the eTPU2  there is one engine space allocated per engine  and the scratchpad can be  allocated out of this address space if specified with the     engineScratchpad    option  The  diagram below shows an example SDM layout for a dual engine target  Note that the  engine space allocations could be anywhere in memory  with the only limitation being they  begin on a 256 byte boundary      C  2007 2015 Compiler Reference Manual  page 71    5  eTPU Programming Model    global variables start at address 0    engine 0 engine relative space  user engine relative data    engine relative scratchpad    engine I engine relative space    user engine relative data    engine relative scratchpad    engine 0  channel 0 channel variables    engine 0  channel I channel variables  engine 0  channel 5 channel variables  engine I  channel 0 channel variables  engine I  channel 3 channel variables  engine I  channel 27 channel variables    5 9 4 Calling Convention       The scratchpad based programming model uses scratchpad space to pass all parameters  when function calls are made  Scratchpad is also used to save function state such as  volatile registers that are in use at the time of the call  The detailed calling convention    page 72  Compiler Reference Manual  C  2007 2015    5  eTPU Programming Model    procedure is outlined below     First  any volatile registers that are in use at the time of the function call are saved  into unique scratchpad loc
63. e global eTPU  threads cannot generate code that requires the stack  as such a thread does not have  knowledge of the stack base     eTPU thread functions take one parameter type that defines whether matches are disabled  or enabled during thread processing  In other words  the parameter affects the entry  Match Enable  ME  setting  The new keywords that support this are     eTqPU matches disabled  and   eTPU matches enabled   It is generally  recommended that users write their functions threads in such a way that matches can be  enabled during thread processing  If possible  only initialization  amp  shutdown threads should  have matches disabled  A second  optional parameter type explicitly controls the preload     C  2007 2015 Compiler Reference Manual  page 45    5  eTPU Programming Model    setting for the thread   the preload setting is the  PP  Preload Parameter bit in an entry  If  this second parameter is not specified  then the preload is left to the compiler linker to set   which it does in the most optimal way  recommended   However  to explicitly control the  preload  the new type keywords are  _eTPU_preload_low  and  _eTPU_preload_high      The last main piece of an eTPU class is the entry table definition  A class may be  associated with one or more eTPU entry tables  each of which has a unique eTPU  function number  These entry tables are defined like initialized arrays and the user must  explicitly specify an eTPU thread for each of the 32 different entry con
64. e gt      defentry     ettype    standard      alternate       etpin  input    output       etpuclass   lt name gt      ettable   lt name gt     page 148  Compiler Reference Manual     C  2007 2015    Used to name and link to  structure union enum definitions   It can only be used inside a  def    endef pair     Provides the type attribute for a  symbol  It can only be used  inside a  def  endef pair     Sets the address  offset  or value  of a symbol  It can only be used  inside a  def  endef pair     Marks a symbol as a channel  frame variable and associates  with the proper eTPU function  It  can only be used inside a  def    endef pair     Used to begin the definition of a  single entry in an entry table     Type of entry table    Optional entry table pin direction  conditional  Used by auto header  for setting the CxCr  ETPD      Entry Table Pin Direction    Optional name of the eTpuClass  to which this entry is associated     Optional name of the entry table   Note that in some applications a  class may have multiple entry  tables        14  Appendix C   eTPU Annotated Object File Format     etlabel Code label name that is the    lt name gt  destination of this label   If it is  not mangled  the label must exist  within the class or must be  global      index  lt N gt  Index of this entry  valid range is  0 to 31     val  lt Value gt  Value of this entry where the  Preload Parameter  PP  and  Match Enable  ME  have been  encoded  but the Microcode  Address has not      
65. eeByteStruct     int16 twobytes     offset 1  int8 onebyte     offset 0        sizeof      3  gets packed like an int24    The set of struct members     int x  y     24 bit vars   char cl  c2  c3  c4  c5  c6    short a  b  c     16 bit vars   struct SomeStruct somestruct     sizeof  SomeStruct     Il  Il  0     C  2007 2015    5  eTPU Programming Model  Would get packed like   SDM Channel Frame Fo 3 LSBytes  Address Offset    somestruct    ES  re       The sizeof   this struct would be 28  including the two padding bytes at the end     5 3 9 Structure Bit Fields    Bitfields can be made out of int8  int16 or int24 types  Bitfields are allocated starting with  least significant bit of the storage unit  and are never split across storage units by ETEC     struct BitFieldExample       int24 x   10     bit offset    14   int24 y   10     bit offset    4   int24 z   10     bit offset    46        sizeof      8    Structures  and thus bitfields  can also be mapped onto a register using the TR18037  named register concept  e g     struct tpr_struct       C  2007 2015 Compiler Reference Manual  page 29    5  eTPU Programming Model    unsigned int16 TICKS 1   unsigned int16 TPR10 i    unsigned int16 HOLD v     unsigned int16 IPH Le   unsigned int16 MISSCNT   2    unsigned int16 LAST 1     register _TPR tpr_reg     5 3 10 Arrays    5 3 11    page 30  Compiler Reference Manual    The packing of arrays is also tied into how pointer arithmetic is handled in the compilation  process  Point
66. el frame  and thus each channel with a  function that uses the stack has a stack base parameter that must be initialized when the  rest of the channel is initialized  Note that channels on each eTPU should share the same  stack base  which is a byte address in the eTPU SDM address space  Ona dual eTPU  system  each eTPU engine must have unique stack base addresses      C  2007 2015 Compiler Reference Manual  page 65    5  eTPU Programming Model    On the eTPU  on a dual engine system  the SDM layout may look as follows     global variables start at address 0    engine O stack  engine I stack    engine 0  channel 0 channel variables    engine 0  channel I channel variables     including compiler allocated stack base to  be filled in during host eTPU initialization     engine 0  channel 5 channel variables  engine I  channel 0 channel variables    engine I  channel 3 channel variables     including compiler allocated stack base to  be filled in during host eTPU initialization     engine I  channel 27 channel variables    On the eTPU2  the SDM layout may look something like the following if there is user        page 66  Compiler Reference Manual  C  2007 2015    5  eTPU Programming Model    defined engine relative data     global variables start at address 0    engine space variables  engine 0     user engine data    engine space variables  engine 1     user engine data    engine 0 stack  engine I stack    engine 0  channel 0 channel variables    engine 0  channel I channel vari
67. er arithmetic follows the array stride size settings  which are governed by  the array packing mode  Once again  the modes are termed PACKTIGHT  default  and  FASTACCESS  Because this setting affects pointer arithmetic  e g  in FASTACCESS  mode incrementing a char pointer results in an increment by 4 bytes   care should be taken  in using the non default setting  Additional PACKTIGHT mode specifics are given below   further FASTACCESS information is in the appendix     Note that FASTACCESS and ANSI modes are incompatible and compilation will error     Array PACKTIGHT Mode    In array PACKTIGHT mode  the array stride size matches the element size with the  exception of 24 bit elements  For element types with a byte size of 3  the array stride size  is 4 bytes  thus leaving an unused byte between each element  These unused bytes are  open to be allocated  except if ANSI mode is enabled  Once an element is greater than 4  bytes in size  the stride size is rounded up to the next multiple of 4 bytes  Once again  the  unused memory between array elements is open for allocation  under default settings      Some example declarations and the ensuing memory allocations are shown below     char a 6    int b 3    struct FiveByteStruct      char f1    int   2    char   3        2    int24 x   int8 y   int16 z      C  2007 2015    5  eTPU Programming Model    The resulting memory allocation map would look like  PACKTIGHT channel frame pack  mode      SDM Channel Frame MSByt 3 LSBytes   Add
68. er that can be read   written by the eTPU  The register cc type provides direct access to the ALU and MDU  condition codes  This is discussed further in the next section      C  2007 2015    Compiler Reference Manual  page 37    5  eTPU Programming Model    5 4 6    page 38  Compiler Reference Manual    The register chan base  register _CHANBASE  type provides a way to specify a  channel relative pointer     For the most part  the variables of the general purpose register types should not need to be  declared  e g  a  p  diob  b  c  d  sr  macl  mach   In some cases variables of these registers  act as aliases only     they do not allocate them for the sole use of the variable  e g  p    However  registers a  b  c  d  diob and sr can be allocated directly by the user  locking out  the compiler from using them  except stack access can override b  amp  diob   This capability  should be used very carefully as it can prevent the compiler from generating code resulting  in compilation errors     An important difference between named register variables declared in a function scope   and local variables which the compiler assigns to registers  occurs on function calls   Named register variables are not saved restored to prevent overwriting by the called  function  instead they are treated as if they have a global scope  True local variables  on  the other hand  are saved restored if necessary when function calls are made     The special purpose registers need to frequently be direct
69. erence Manual    Native ETEC Format    The entry table definition takes the form of an array initializer  with a total of 32 entries   one for each possible unique entry  The entry table is qualified by whether it is alternate or  standard  whether it is based upon an input or output pin value  and what channel function  select number it should be assigned  The input output setting generates a  define in the  auto header for use during host initialization of the eTPU  note that some microcontrollers  only support an input pin setting  It does not actually affect eTPU code generation  The  entry table will be given the specified function number  unless during link a conflict is found  in which case linking fails  If no function number is specified  autocfsr   the linking process  automatically assigns a function number  Each entry vector is specified by its entry  conditions  and the thread activated by those conditions  Vectors may be specified in any  order as long as the complete set of 32 is defined  To simplify the entry table definition   several macros have been defined  The first begins the table definition      define DEFINE ENTRY TABLE  className  tableName  tableType  pinDirection  cfsrValue     The className and tableName must match the names used in the class declaration  The  tableType parameter must be standard or alternate  The pinDirection argument can be  either inputpin or outputpin  Finally  the cfsrValue can be either a number from  0 31    or it can be au
70. erence manual contains details on how to create these assembly functions      C  2007 2015    5 10 1    5 11    5  eTPU Programming Model    The Inline Assembly Porting Guide contains additional detailed information on ETEC   s  support of inline assembly     Calling the Error Handler from User Code    The entry points into the error handler are exposed in the eTpu_Lib h standard header file     _eTPU_thread Error handler entry      _eTPU thread Error handler scm off weeds      _eTPU thread Error handler fill weeds     In ETEC mode  users can specify these entry points in any of their entry tables  When  user code calls one of these  ETEC actually generates a jump opcode under the hood since  these    eTPU threads    end with a    seq end    thread exit     ETEC Standard Header Files    The ETEC distribution contains three standard header files  ETEC does not implement the  C Standard Library  The ETEC standard header files are     ETpu_Hw h     contains key programming model definitions required by most code     ETpu_Std h     macros built on top of the programming model to make code more readable   Since this includes both ETpu_Hw h and ETpu_Lib h  it is the only standard header that  actually needs to be included     ETpu_Lib h     function prototypes for the built in    library    functions  including the fixed  point library functions      C  2007 2015 Compiler Reference Manual  page 75    page 76  Compiler Reference Manual    6  C Preprocessing    6    C Preprocessing  
71. etcfsr Optional entry table channel   lt Value gt 5 function select value  This  handles the  hopefully rare  case    when the user specifies a specific  CFSR value for a function    For initializing global and  channel variables       Storage class values have the following meaning      C  2007 2015 Compiler Reference Manual  page 149    14  Appendix C   eTPU Annotated Object File Format    ee TT  Te TT  Eee TT  RES       page 150  Compiler Reference Manual  C  2007 2015    14  Appendix C   eTPU Annotated Object File Format       Type attributes have the following meaning     Value Type Attribute  0 Void type  1 Signed character  2 Character  3 Short integer   C  2007 2015    Compiler Reference Manual  page 151    14  Appendix C   eTPU Annotated Object File Format    4 Integer   5 Long integer   6 Floating point   7 Double word   8 Structure   9 Union   10 Enumeration   11 Long double precision  12 Unsigned character  13 Unsigned short integer  14 Unsigned integer   15 Unsigned long integer    14 1 Code Labels    Code labels have the following form   codelabel  lt name gt   type  lt N gt   codelabelend     Where  lt name gt  is the mangled name of the code label   lt N gt  is the code label type where a  type of 0 indicates a natural label  and a type of 1 indicates a compiler contrived type  An  example of a contrived type is the labels generated by an if else    C    construct     The following is an example of a code label that is generated by the assembler    codelabel A
72. example the channel frame     is hardcoded to 0x100    undef Test_CHAN FRAME INIT32       value     address    value     one channel  base     define Test CHAN FRAME INIT32  offset  value              ETPU DATA SPACE U32      0x100 offset    value    include  DeclTest_B idata h    undef Test CHAN FRAME INIT32        C  2007 2015          Compiler Reference Manual  page 105    page 106  Compiler Reference Manual    9 1    9  Command Line Options    9    Command Line Options    This section covers the command line options for both the compiler and the preprocessor     Compiler Command Line Options    The compiler is called ETEC_cc exe  and it has the following format     ETEC_cc exe  lt options gt   lt source file name gt     where options can be any of the following     Display Help      or     This option overrides all  others and when it  exists no compilation is  actually done     Open Manual    Opens the electronic  version of this  Assembler Reference        C  2007 2015 Compiler Reference Manual  page 107    9  Command Line Options    a RE EE    Open a Specific Manual    man  lt MANUAL gt  Off  man ETPUCIM    Opens an electronic   where MANUAL is one  version of the specified   of the following     manual   TOOLKIT  Toolkit  User Manual   COMP  Compiler  Reference Manual    LINK  Linker  Reference Manual     ASMES  eTPU  Assembler Reference  Manual   Freescale  Syntax     ASMAW  eTPU  Assembler Reference  Manual   ASH  WARE Syntax     ETPUSIM  Stand   Alone eTpu Simulato
73. ey may point to any of the 8 bits  in a _Bool unit  It is recommended pointers to type _Bool not be used  unless in ANSI  mode     5 3 eTPU Data Packing    Because of the unique memory  amp  addressing architecture of the eTPU  memory allocation  of variables and data packing is a much more complex process than in many processor  architectures  The sections below provide details on how global variables are allocated   channel frame variables  and lastly the aggregate types  structures unions and arrays  Note  that the array packing option also impacts the behavior of pointer arithmetic  see section    page 22  Compiler Reference Manual  C  2007 2015    5 3 1    5  eTPU Programming Model    4 3 11 for details   Most of the packing algorithms are based around the following information     The natural data sizes of the eTPU memory architecture are 1 byte  3 byte and 4 byte   limited 4 byte support  however     just load store      Single byte data is best accessed when placed in a modulo 4 address  unless it does not  share a 3 byte location with any other data     3 byte data is best accessed when placed in an address that is modulo 4 plus 1     Packing multiple non 3 byte   lt  3  data into 3 byte locations can result in data coherency  issues     Multiple data packing modes are available in order to help tailor compilation to the  application requirements  Note however  that linking object files compiled under different  modes will result in link errors in many cases  It is h
74. flows  registers  rather than go onto a dynamic stack  it is allocated to static addresses in global  memory  engine relative available on the eTPU2   While generally less efficient with  regards to memory usage than a stack solution  the eTPU instruction set is such that the  resulting code tends be slightly more efficient in size and performance  The greatest  weakness of this solution is that it can lead to a very insidious bug in the original eTPU  or  whenever global scratchpad is used      when the same function runs simultaneously on both  eTPUs of a dualeTPU engine micro  and the function uses scratchpad memory  there can  be corruption coherency issues as both eTPUs simultaneously use the same scratchpad  memory  Users of the global scratchpad model must be very careful to use functions that  access scratchpad on only one eTPU at a time     Both models are discussed in further details in the sections below  Note that source  compiled to different models can be linked successfully  it is recommended that for most  cases one model or the other should be chosen for all code that is to be linked into an  executable image     Stack based Model    ETEC uses a stack based approach for local variables and function calls by default  Any  eTPU threads   functions for which local variables overflow register availability  or perform  function calls  reference a stack base variable  This stack base parameter is allocated as a  channel variable in the function   s  class     chann
75. g Register  Mnemonic Units  Field          Tag Type Data CHAN_TAG_TYPE_SIZE  CHAN_TAG_TYPE_RAW_SIZE    CHAN_TAG_TYPE_ALIGNMENT       Enum literal  values    CHAN_ENUM_LITERAL    Variable Type    Struct Union CHAN_MEMBER_TYPE   Member Offsets  CHAN MEMBER BYTEOFFSET  CHAN_MEMEBR_BITOFFSET  CHAN MEMBER BITSIZE  CHAN MEMBER  lt name gt  DIM  lt  gt     Channel Frame CXCR CPBA  FRAME SIZE Bytes  Size   Initialized Frame   RAM FRAME CONTENTS Bytes  Constants    8 bit Channel ECRX ERBA  ERBA8 Bytes  Variable Offset   ERBA BOOLBITOFFSET Bits  16 bit Channel ECRX ERBA  ERBA16 Bytes  Variable Offset     C  2007 2015       page 96  Compiler Reference Manual    7  Auto Header Generation    24 bit Channel ECRX ERBA  ERBA24  Variable Offset  32 bit Channel ECRX ERBA  ERBA32  Variable Offset    Array Channel ECRX ERBA  ERBA_ARRAY Bytes   Variable Offset  amp    Length Stride ERBA TYPE ARRAY  lt type gt   DIM   lt N gt  LENGTH Count  DIM_ lt N gt _STRIDE Bytes    Struct Channel ECRX ERBA  ERBA STRUCT  Variable Offset    Union Channel ECRX ERBA  ERBA UNION  Variable Offset    Struct Union G_MEMBER_TYPE  lt type gt   Member Offsets  G MEMBER BYTEOFFSET Bytes  G_MEMEBR_BITOFESET Bits  G MEMBER BITSIZE Bits  ENG MEMBER  lt name gt  DIM  lt  gt           ENG TAG TYPE SIZE    Tag Type Data  ENG TAG TYPE RAW SIZE  ENG TAG TYPE ALIGNMENT    ENG ENUM LITERAL FE     C  2007 2015          Compiler Reference Manual  page 97    7  Auto Header Generation    Setting    Variable Type    8 bit Global  Varia
76. g_a2 1  1    0x34                    if  GDM  gt g sl s8     signed char  0x87   ErrorEncountered       if  GDM  gt g sl s16     signed short  0x8765   ErrorEncountered       if  GDM_PSE  gt g_sl_s24    Oxff876543     ErrorEncountered        page 88  Compiler Reference Manual  C  2007 2015    7 2    7 2 1    7 2 2    7 2 3    7  Auto Header Generation    Auto Defines File    The auto defines header file contains all the compiler generated information necessary for  the host to initialize  amp  control the eTPU  and to place  amp  find data  The contents of this file  is explained in detail in the ensuing sections     Global Prepended Mnemonic    A global mnemonic is prepended to all generated text  The default global mnemonic is the  underscore character     _     This can be overridden with the linker command line option     GM  lt text gt     see the linker reference manual for more information     Auto Header File Name    The name of the auto generated defines header file is the constructed as shown below   This can be overridden using the linker option   defines  lt FileName gt     see the linker  reference manual for more details      lt ExectutableFileName gt _defines h    Text Generation    The purpose of the auto generated text is to produce a series of  defines that are used on  the host CPU side code to initialize and run the eTPU function  A series of the  defines  are generated that appear as follows      define  lt Name gt   lt Value gt     The  lt name gt  is ge
77. h blah  Warning  blah blah blah  Link Success EntryTable Shift       gt  EntryTable gxs    A value of five  which is the default     Version    asdffasf  Assembling file Shift sta  Optons      Build stats      Success  0 errors  13 warnings   A value of greater than five prints out more information in a way that is specific to each  tool in the suite      C  2007 2015    9 4    9  Command Line Options    Version   Version     This command line option displays the tool name and version number and exits with a non   zero exit code without doing anything other than generating this message  no compile  no  link  etc   A non zero  failing  exit code is returned in case the user has accidentally  injected this command line argument into a make  The output is guaranteed to appear as  follows so that a user can develop a parsing tool to determine the version of the tool being  used a particular build      lt ToolName gt  Version  lt MajorRevNum gt   lt MinorRevNum gt  Build  lt BuildLetter gt     Where ToolName is the name of the tool being used and is either    ETEC Compiler         ETEC Assembler    or    ETEC Linker     MajorRevNum is the tools major revision  number  MinorRevNum is the tools minor revision number  and Build Letter is the build  number of the tool  The following is an example using the ETEC Linker     C  Mtdt TestsHigh ETEC_linker exe  Version  The following output is generated using an early prototype linker   ETEC Linker Version 0 27 Build C     C  2007 2015 Com
78. hannel frames are configured and located at run time  channel variable  allocation is static to the channel frame base and thus the compilation process  The  mechanism for declaring channel variables differs between compatibility mode and  enhanced ETEC mode  but in either case there are two packing modes for channel  variables  The default mode is called    PACKTIGHT     and its goal is to use the least  memory possible in the allocation of the channel frame while still providing reasonable  performance  The other mode is called    FASTACCESS     which places variables at their  most natural locations for efficient processing  even though it can result in more    holes    of  unused memory in a channel frame and thus greater memory usage  In either case  the  order of declaration does not necessarily result in monotonically increasing address offsets     The default PACKTIGHT mode is described in more detail below  FASTACCESS is  described in an appendix  In either case the algorithm could change slightly over time  OR  the optimizer could re arrange parameters depending upon level of optimization specified   Should a user want complete control over the location of channel variables they should use  the explicit locating mechanism described in section 4 3 8  TBD       C  2007 2015 Compiler Reference Manual  page 25    5  eTPU Programming Model    5 3 5 Channel Frame PACKTIGHT Mode    The PACKTIGHT mode packing algorithm first locates every variable of size 3 bytes or  larger
79. hese programming models  the ETEC Tools Suite  itself such as command line options  as well as details on the various outputs of the ETEC  Compiler Tools Suite      C  2007 2015 Compiler Reference Manual  page 11    page 12  Compiler Reference Manual    2  Supported Targets    2    Supported Targets    The ETEC C compiler toolkit current supports the following targets     eTPU   select Qorivva MPCSSxx parts  select Coldfire MCF52xx parts  compiler linker  option   target etpu1      eTPU2   select Qorivva MPCS6xx parts  select STMicro SPC563Mxx parts  compiler   linker option   target etpu2        eTPU2    select Qorivva MPCS7xx parts  There is not a separate target option for  eTPU2    use the eTPU2 target  The eTPU2  has no instruction set differences versus  the eTPU2  The only programming model difference is that a third bit has been added to  the missing tooth count field in the tooth program register  TPR   If using the default TPR  struct defined in the ETpu_Hw h header file  this third bit is accessed via the previously  unused TPR 10 field      C  2007 2015 Compiler Reference Manual  page 13    page 14  Compiler Reference Manual    3  References    3    References    ISO IEC 9899 TC2 Programming Languages     C    ISO IEC TR 18037 Programming Languages     C     Extensions to support embedded  processors    Enhanced Time Processing Unit  eTPU  Preliminary Reference Manual  ETPURM D  5 2004 Rev 1      C  2007 2015 Compiler Reference Manual  page 15    page 16  Compiler
80. ighly recommended that all object files  to be linked be compiled with the same data packing settings  the linker has checks for  this      Global Variables    Because global variables can be declared in one translation unit  source file   and  referenced externally by other translation units  the global variable packing algorithm must  properly account for this in order to have a reasonable linking process  To that end  all  global variables are allocated at natural locations for their size  Thus all 1 byte data  variables are located at modulo 4 addresses  all 3 byte variables at modulo 4 plus 1  addresses  etc  Note that by default global variables are located starting at address 0 of  shared data memory  SDM      Given these global declarations   char cl  c2  c3  cd   int32 s32   unsigned int16 ul6   int s24   struct SomeStruct somestruct     sizeof SomeStruct     8    The memory allocation looks like     SDM Address MSByt 3 LSBytes        C  2007 2015 Compiler Reference Manual  page 23    5  eTPU Programming Model    5 3 2    page 24  Compiler Reference Manual       Note that the order of declaration does not necessarily match the address order of the  variable locations  This is necessary to avoid significant wasted memory  Also note that  global variables declared in different translation units may be intermixed in the final linked  memory map depending upon sizes and fitting  link  order     Static Variables in Callable C Functions    Because these types of C function
81. igned int24 x   void _ divu24  unsigned int24 x     unsigned i  unsigned i    page 44  Compiler Reference Manual    with second argument 8     16  or 24 bit    gument 8  16  or 24 bit  nt8 y    int16 y      int24 y      24 y    The    and the fractional portion ends    i   bit fractional value f  The  and the fractional portion ends    f    8 bit fractional value f  The  and the fractional portion ends    fract8 f      16 bit fractional value f  The    and the fractional portion ends    unsigned fract16 f      unsigned int8 y      nt16 y    nt24 y       C  2007 2015    up    up    up    up    5 5    5  eTPU Programming Model    ETEC eTPU Class    The ETEC programming model for the eTPU uses some minor extensions to the C  language in order to cleanly match the eTPU hardware  A class like syntax is used to link  together all the pieces that apply to a single eTPU channel  or group of eTPU channels that  must work in concert and share a channel frame  This class like syntax  referred to as an     eTPU class     is used to aggregate the data and code that is used to perform a single  eTPU function application  While similar in syntax to a C   class  it is a much simplified  version in that there are no concepts like overloading  public private  or derivation  supported  Rather it acts as a way to aggregate all the necessary pieces of an eTPU  application  typically maps to one channel  but can map to multiple channels  into a clean  package  These pieces consist of three main th
82. ilable in ETEC     Compatibility Functions    The following built in functions provide user control of eTPU hardware settings  amp   features  but generate no code  they provide compatibility with existing solutions     match_enable     when called out in a thread  it causes matches to be enabled during the  thread by setting the match enable bit in the entry table for all vectors pointed at the thread   Note that threads default to matches enabled  Not needed in ETEC enhanced mode     match_disable     when called out in a thread  it causes matches to be disabled during the  thread by setting the match enable bit in the entry table for all vectors pointed at the thread   Note that threads default to matches enabled  Not needed in ETEC enhanced mode     preload_p01     when called out in an eTPU C thread  specifies that the low preload entry  option is to be used   this means p gets loaded with the data at channel frame address 0  32  bits   and diob gets loaded with the data at channel frame address 5  24 bits   The default  is to let the tools decide which preload results in the best code  recommended   In ETEC  mode  the preload is specified by specifying a second parameter to the eTPU thread    _eTPU_preload_low    or  _eTPU_preload_ high        preload_p23     when called out in an eTPU C thread  specifies that the high preload entry  option is to be used   this means p gets loaded with the data at channel frame address 8  32  bits   and diob gets loaded with the data at
83. ings  The data is called the    channel  frame     or channel frame variables  In the eTPU programming model  there is a static  copy of the channel frame for each channel  or set of channels  to which the eTPU class is  assigned  The assignment itself is done via a combination of the channel function select  register  CFSR  and allocating room for the channel frame in SDM  SPRAM  and  properly setting the channel parameter base address  CPBA      The second piece of an eTPU class is the set of C functions associated with it  These  take two flavors  either    eTPU threads    or class methods  eTPU threads are C functions  that are activated directly by eTPU entry conditions  and when they end they relinquish  control back to the eTPU scheduler  Only eTPU threads may be referenced in an entry  table  and they may not be called by any other functions  eTPU threads do not actually  return any value  and they take one dummy parameter that specifies whether matches are  enabled or disabled during thread processing  Since no parameter variable is actually  defined  just specifying the match type is sufficient  On the other hand  class methods are  regular callable C functions  but they may access channel frame variables as if they were  local variables to the function  Global eTPU threads and functions are allowed  although  they have no direct access to channel frame variables  They are defined like C functions  without any class scoping reference  Note that on eTPU eTPU  hardwar
84. ir      asm     if  hd_common  gt timer  HD_TCR1      ram diob  lt   hd common   alu diob   diob   0x04   ram p31_24  lt   by diob       p   timer  alu nil   p31_24  ccs     endasm    In either case  C pre processing is applied to the text just like any other portion of the  source  The  asm   endasm  and  asm   directives do not have to be the first text on a  source line  thus they can be used in macros to group sets of inline assembly instructions   Note that the C preprocessor is run in ETPUC mode  and thus treats     asm    and      endasm    text special  allowing them to pass as is within function like macros     Inline assembly can make references to C global variables and channel frame variables   References to static symbols can be made in either RAM instructions  or in ALU  instructions where a register is getting loaded with an address of a symbol  In these cases   ETEC supports symbol reference expressions of the form  lt complex symbol reference gt       offset     offset        where items in    are optional  A complex symbol reference can    include the         and          operators if the symbol is of the appropriate type   struct union or  array  The referenced address must be static     Assembly and C treat code labels in a similar way  Labels have function scope and thus  jumps gotos outside of the current function scope do not work  C functions can be called  from assembly code  and pure assembly    functions    can be called from see  the assembler  ref
85. itive   however  there can be no spaces between the option  the          if any  and the option data   Option data that contains spaces must be enclosed in quotes  the whole option      C Preprocessor Command Line Options    The C Preprocessor executable is called ETEC_cpp exe  and it has the following format   ETEC_cpp exe  lt options gt   lt source file gt     Where available options are listed  amp  described below  Note that the source file name is  not constrained to follow the list of options  Also note that command line options are not  case sensitive  however  there can be no spaces between the option  the          if any  and  the option data  Option data that contains spaces must be enclosed in quotes  the whole  option       C  2007 2015 Compiler Reference Manual  page 117    9  Command Line 2 command PAS OpHOnS E 4    Setting    Display Help    This option overrides all  others and when it exists  no compilation is actually  done     Macro Definition    Supplies a macro  definition for use during  preprocessing     Source File Search Paths    Specifies any directories   after the current one  to  be searched for included  files  Multiple paths can  be specified and they are  searched in the order of  their appearance in the  command line     Mode  Compatibility     Tells the C preprocessor  to run in the specified  mode     Preprocessor Output File    Sends the preprocessed    page 118  Compiler Reference Manual    ORR     d  lt MACRO gt  None  where if MACRO is a
86. king  done by legacy tools  e g  a mix of C code and inline assembly      LEGACY    packing is     C  2007 2015 Compiler Reference Manual  page 27    5  eTPU Programming Model    5 3 8    page 28  Compiler Reference Manual    very similar to    PACKTIGHT    except that members such is 8 bit variables will pack in  holes only within the last 4 bytes  they will not get packed back at the very first hole  available in the structure     The default mode packing algorithm  PACKTIGHT  is detailed below  The algorithm may  change over time so it is recommended to always use the auto define data for referencing  structures from the host side  If complete control of data packing is required  the explicit  member locating constructs should be used  Also note that the ANSI mode affects  structure packing by forcing offsets to monotonically increasing     Structure PACK TIGHT Mode    This is the default mode of the compiler  and uses the same algorithm as the channel frame  PACKTIGHT pack mode  The one difference occurs on small structs where the  component member   s size totals 3 bytes or less  In this case the struct is packed to fit in  the same slot that basic typed variables of the same size would occupy  Some examples     struct ByteBitfield     int8 a 2   int8 b 3   int8 c 3         sizeof      1  gets packed like a char in channel  frame  array  etc     struct TwoByteStruct     char x     offset 0  char y     offset 1        sizeof      2  gets packed like an int16    struct Thr
87. le    Optimization Disable     optdis  lt opt    gt    region  lt type gt   lt type gt  is the region type     RegionName     coherency  ramsyncpoint   intsyncpoint  atomic   chanchange   RegionName  should match at region start and  end      regionend     RegionName       Version of assembler or compiler  that generated the  eao file      version   lt major gt     lt minor gt     lt build gt     producer   cc    asm         page 146  Compiler Reference Manual  C  2007 2015    14  Appendix C   eTPU Annotated Object File Format    Begins debugging information for  a symbol name  The definition  extends until the  endef directive  is encountered     def  bb  def  bf     endef Ends a symbol definition begun  with a  def directive    global   lt symbolName    Makes symbol with symbolName  visible for linking  extern      Sets the storage class value for a  symbol  It can only be used  inside a  def  endef pair     size  lt size   gt     Sets the storage size of a symbol   The numbers is in bytes  except if  the symbol represents a bitfield   in which case it is in buts  It can  only be used inside a  def  endef  pair     def  eos Ends a struct  union  or enum  definition  The members of such  are listed between the initial  object  def  endef and the  def    eos         C  2007 2015 Compiler Reference Manual  page 147    14  Appendix C   eTPU Annotated Object File Format     tag   lt structName gt      type  lt type   gt    val   lt address gt      etpufunction   lt functionNam  
88. lize a special  eTPU microcode instruction  there are several limitations associated with them       tables can contain at most 256 elements      because the table lives in immutable  inaccessible code memory  the only operation that  can be performed on the table symbol is a full array de reference  No conversion to a  pointer or other operations       tables can only be defined at global scope  or static to a function scope    page 64  Compiler Reference Manual  C  2007 2015    5 9    5 9 1    5  eTPU Programming Model    ETEC Local Variable Model  amp  Calling Conventions    When local variables are declared  amp  used  they are allocated to available registers if  possible  but the resources are limited  The same situation arises when function calls with  parameters are made     some parameters may be passed by registers but again it is a very  limited resource on the eTPU  Thus local variables  parameters  and other data that needs  to be saved restored on function calls must be kept somewhere in memory  The default  model that ETEC uses for this is a stack that builds upwards in memory as function call   tree depth increases     The stack approach allows any C code to compile and run without fail  within memory  limits   but in some cases may not generate as optimal code as that compiled using a     scratchpad    model  ETEC supports       globalScratchpad        engineScratchpad    options to  enable compilation with this model  When scratchpad is enabled and data over
89. ly accessed  and are therefore  are declared in the ETpu_Hw h header file as follows     register_chan chan      5 bits   register_erta erta      24 bits  register_erta ertA      24 bits  register_ertb ertb      24 bits  register_ertb ertB      24 bits  register_tcrl terl      24 bits  register_tcr2 ter2      24 bits  register_tpr tpr      16 bits  register_trr tir      24 bits  register_link link      8 bits    ALU Condition Code Access    Although best to avoid as a general coding practice  the ALU and MDU condition codes  can be accessed  tested  directly via _CC  register_cc   The comment in ETpu_Hw h  best describes this feature       register cc type is syntactically accessed like a struct  bitfield        of the following declaration      typedef struct      Ty unsigned int V   1     ALU overflow condition code     unsigned int N   1     ALU negative condition code  FE unsigned int C   1     ALU carry condition code  LS unsigned int Z   1     ALU zero condition code     C  2007 2015    5 4 7    5 4 7 1    5  eTPU Programming Model    77 unsigned int MV   1     MDU overflow condition code  fi unsigned int MN   1     MDU negative condition code  a7 unsigned int MC   1     MDU carry condition code   Pie unsigned int MZ   1     MDU zero condition code   v7 unsigned int MB   1     MDU busy flag   ed unsigned int SMCLK   1     semaphore locked flag         register_cc     Built in   Intrinsic Functions    This section covers available built in library intrinsic functions ava
90. model is enabled  local variables that overflow register  availability  and function state that needs to be saved when function calls are made   including parameters  get allocated in what is called    scratchpad       space  On the eTPU   scratchpad is just global memory  placed after  above  user global variables  When  compiled for the eTPU2 target  scratchpad data may be assigned to engine relative space  rather than global address space  Each eTPU2 engine sees its own independent engine   relative space  the global location of these engine relative spaces is configured via a host  CPU register  One down side of the eTPU2 engine relative space is that it can only be     C  2007 2015    5  eTPU Programming Model    configured to begin on 256 byte boundaries  and thus may result in wasted Shared Data  Memory  SDM   Additionally  in some cases engine relative memory accesses are less  efficient than global address accesses  If the protection provide by engine relative  addressing on a dual eTPU is not needed  it is not recommended that it be used     On the eTPU  or when    globalScratchpad is specified on the eTPU2   the SDM layout  looks essentially the same whether it is a single or dual engine part     global variables start at address O    global scratchpad allocation    engine 0  channel 0 channel variables  engine 0  channel I channel variables    engine 0  channel 5 channel variables  engine I  channel 0 channel variables  engine I  channel 3 channel variables  engin
91. n  identifier than it is pre    defined to a value of 1   otherwise it can be of the   form macro definition    where macro gets the   value specified in      definition         d  DBG_BUILD     I  lt P ATH gt   I    Include    where PATH is a text  string representing either  a relative or absolute  directory path  The  entire option must be in  quotes if the path  contains spaces      mode  lt MODE gt   mode ETPUC    where MODE can be       ETPUC   handle  existing code better      out  lt FILENAME gt   out etpu_pwm i    where FILENAME is        C  2007 2015    source to the specified  file  rather than placing it  on stdout per the default     Console Message Verbosity    Control the verbosity of  the compiler message  output     Console Message  Suppression    Suppress console  messages by their type   class  Multiple types can  be specified with multiple     verbSuppress options     Console Message Style    Controls the style of the  error warning output  messages  primarily for  integration with IDEs       9  Command Line Options    written with the source  file preprocessing result      verb  lt N gt   verb 9  where N can be in the   range of 0  no console   output  to 9  verbose   message output       verbSuppress  lt TYPE gt    Off  verbSuppress   SUMMARY   where TYPE can be    BANNER   the ETEC   version  amp  copyright   banner    SUMMARY   the   success failure   warning error count   summary line   WARNING   all   warning messages   ERROR   all error   messages  
92. n gt   lt MaxSize gt  bytes   pragma verify memory size  lt eTPU class function gt   lt MaxSize gt  words    The maximum allowable size for a given memory section  or channel frame  can be  specified in bytes or words  4 bytes word   If the actual size of the memory section  exceeds MaxSize  the linker issues an error     This pragma is available in both the Assembler and Compiler     Same Channel Frame Base Address    When multiple channels use the same channel frame base address  there is no need to re   load channel variables when the channel is changed  In certain cases this can result in  improvements in code speed and size  The following tells the compiler that the CPBA  register value will be the same for all channel changes of within the specified function      pragma same_channel_frame_base  lt etpu_function gt     The etpu_function argument is the name of an eTPU function  C function  or eTPU class     An example where this is useful is in the Freescale set 1 SPI function  which controls  multiple channels that all share the same channel frame base address  The SPI function  can compile tighter when the ETEC tools know about this  which can be done by adding      pragma same_channel_frame_base SPI    Auto defines Export    Two  pragmas allow export of macros in the eTPU compilation environment  or user   defined text  into the auto defines file  The export macro pragma has the following syntax      C  2007 2015    12  Appendix A   Pragma Support     pragma export_au
93. ned variable name  Additionally  the user can specify a  global mnemonic that is pre pended to all generated text for the purpose of avoiding  clashes     Auto Struct File    The global memory space  engine memory space  eTPU2 only  and each channel frame  are output in the form of structures that from the host side overlay the corresponding  portions of the Shared Data Memory  SDM  between the host CPU and eTPU  These  structures allow for simple reading writing of SDM from the host via structure member  references  Note that this file only contains data structures     the auto defines file contains  many other eTPU interface items such as function numbers that are needed  The auto   struct is generated by default  but can be disabled on request via the linker option         C  2007 2015 Compiler Reference Manual  page 79    7  Auto Header Generation    page 80  Compiler Reference Manual    autostruct  By default  the name is the base executable output file name extended by     _struct h     but the user can also specify a name by supplying it with    autostruct  lt auto   struct file name gt      For example  an auto struct generated from the Freescale PWM function may look like     typedef struct          0x0000       etpu_if_sint32 Period       0x0004      etpu_if_sint32 ActiveTime       0x0008      etpu_if_sint32 Coherent Period      0x000c      etpu_if_sint32 Coherent_ActiveTime      0x0010      etpu_if_sint32 LastFrame       0x0014      etpu_if_sint32 NextEdge       et
94. nerated by concatenating the global mnemonic  the function or class  name  if applicable   the settings mnemonic  and any additional text that is available  such  as the variable name   Additionally  each concatenation is separated by underscores  as  follows     _ lt GlobalMnemonic gt _ lt SettingMnemonic gt _ gt  lt FunctionName gt _ lt Misc gt _    Note that when the class and the table name are identical then the table name is not  included  With regards to variables and their type information  the settings mnemonic is a  concatenation of address space and mnemonic      C  2007 2015 Compiler Reference Manual  page 89    7  Auto Header Generation    7 24 Type Information    For every variable and tag type member  type information is provided  The possible type  values are    T_bool  T_sint8  T_uint8  T_sint16  T_uint16  T_sint24  T_uint24  T_sint32  T_uint32  T_sfract8  T_ufract8  T_sfract16  T_ufract16  T_sfract24  T_ufract24  T_ptr  T_array  T_struct  T_union    For arrays  the element type is provided  as is done for struct and union members  The  base type for pointers is also provided  For both arrays and pointers  the element base type  may be found through multiple dimensions or multiple levels of indirection      define _GLOB VAR TYPE g s8 T_uint8   define GLOB VAR TYPE g s16 T_sint16           define CHAN MEMBER TYPE DefinesTest Stype s16 T_sint16   define CHAN MEMBER TYPE DefinesTest_ Stype s24 T_sint24                       define _CPBA TYPE DefinesTest__al_ T_a
95. nor  version number  2 digits  gt  lt build letter  letter A Z  gt      The last token of the  pragma  verify_version is a user supplied error message that will be output should the comparison  fail     For example  if the compiler were to encounter the following in the source code     pragma verify_version GE   1 20C    this build requires  ETEC version 1 20C or newer   The ETEC Compiler will perform the test  lt ETEC Compiler version gt   gt      1 20C     and if  the result is false an error occurs and the supplied message is output as part of the error   With this particular example  below are some failing  amp  passing cases that explain how the  comparison is done     C  2007 2015    12 2    12 3    12  Appendix A   Pragma Support        equal to specified    1 20C      ETEC Compiler version   1 20C   gt  true        major version is less than that specified   ETEC Compiler version   0 50 G   gt  false        minor version 21 greater than that specified   ETEC Compiler version   1 21A   gt  true        build letter greater than that specified   ETEC Compiler version   1 20E   gt  true    Disabling Optimization in Chunks of Code    If it is desired to disable optimization on a section of code  the pragmas   pragma optimization_disable_start   and   pragma optimization disable end    can be used to do so  All optimizations are disabled within the specified region  so this  feature should be used with care     Disabling Optimizations by Type    The ETEC optimizer operates 
96. nsole Message Style  msgStyle  lt STYLE gt   msgStyle MSDV    Controls the style of the   Where STYLE can be     error warning output  messages  primarily for    ETEC   default ETEC    integration with IDEs message style   GNU   output  messages in GNU   style  This allows the  default error parsers of  tools such as Eclipse to  parse ETEC output  and allow users to click  on an error message  and go to the offending  source line     DIAB   output  messages in the style  used by Diab   WindRiver  compilers     MSDYV   output in  Microsoft Developer  Studio format so that  when using the  DevStudio IDE errors   warnings can be  clicked on to bring  focus to the problem       page 110  Compiler Reference Manual  C  2007 2015    9  Command Line Options    Console Message Path  Style    Controls how the path  and filename are  displayed on any  warning error messages  that contain filename  information     Console Message Limit    Controls the number of  messages output   warning or error    before output goes  silent  Note that if the  first error occurs after  the message limit is  exceeded  that first  error is still output     Source File Search Paths    Specifies any  directories  after the  current one  to be  searched for included  files  Multiple paths  can be specified and  they are searched in the  order of their  appearance in the  command line         msgPath  lt STYLE gt  ASIS  msgPath ABS    where STYLE can be       ASIS   output the  filename as it is input  on the
97. on is shown as an example     pragma ETPU_function TEST  standard      C  2007 2015    5  eTPU Programming Model       A  B  and C are channel variables  void TEST int A  int B  int C           D is allocated as a channel variable  static int D   int E     local variable  if   hsr  1   amp  amp   pin  0   amp  amp   flag0  0       int F     local variable     thread 1  else if  hsr  1      thread 2  else if  hsr  2      thread 3  else if  lsr  1      thread 4  else if   lsr  0   amp  amp   ml  0   amp  amp   m2  1        thread 5  else if   lsr  0   amp  amp   ml  1   amp  amp   pin  0        thread 6    else if   lsr  0   amp  amp   ml  1   amp  amp   m2  0   amp  amp   pin  1          thread 7       default  catch all  thread    There are up to 7 different inputs into the entry table  although all seven are never     C  2007 2015 Compiler Reference Manual  page 53    5  eTPU Programming Model  meaningful at the same time  The seven entry conditions are   hsr    host service request   valid value 1 7    channel  LSR    link service request   0 or 1         isr  is equivalent to channel LSR    ml    match A or transition B   0 or 1  m2    match B or transition A   0 or 1  channel  PIN    pin value  host setting determines whether       it is the input or output pin    0 or 1         pin    is equivalent to channel PIN    channel   FLAGO    channel flag0   0 or 1     flag0        is equivalent to channel  FLAGO    channel  FLAG1    channel flagl   only used in entry tables    
98. ory    Each channel  and sometimes groups of channels  has a private copy of its own memory   It is this private memory that allows  say  a channel running the PWM function to have its  own unique Period and Pulse Width  even when many channels may be running the same  PWM function  The data structure has the following form  where name is the name of the  class  in ETEC mode  or the eTPU Function  in compatibility mode      unsigned int  lt GlobalMnemonic gt  lt Name gt _frame_init         0x0022A317            As with the initialized global data  the actual arrays in the _idata c file are built up from  macros in the matching _idata h file  eTPU Function    Test               Test Channel Frame Initialization Data Array  unsigned int _Test_frame_init            undef Test CHAN FRAME INIT32    define Test CHAN FRAME INIT32  addr   val   val    include  DeclTest_B_idata h     undef Test CHAN FRAME INIT32                      C  2007 2015    8  Initialized Data Files    8 3    Using the Initialized Data Macros in the Simulator    The initialized data macros in the _idata h file can be used in the eTPU Stand Alone  simulator to simulate the host side initialization of global data and channel frames  An    example is show below        load the global initialized data    undef __ GLOBAL MEM INIT32    define   GLOBAL MEM INIT32  address       ETPU DATA SPACE U32       include  DeclTest_B idata h     undef __ GLOBAL MEM INIT32       load the    Test    channel frame for     in this 
99. paths      The C Preprocessor could not be run  is installation correct     The C Preprocessor could not be run  is installation correct       Preprocessing error occurred  message will provide further  details     Invalid declaration   Multiple default labels found in a switch statement     iteration statement     A continue statement found outside any enclosing iteration  statement     Invalid if else statement found   Invalid switch statement found     Case expression invalid  note that case expressions must be  constant expressions      For loop test expression is invalid   For loop initialization expression is invalid        A break statement found outside any enclosing switch or    page 156  Compiler Reference Manual  C  2007 2015    15  Appendix D   Error  Warning and Information Messages    Identifier       15 2 Compiler Warning Messages    Message Explanation  Identifier    Currently unsupported feature  that can be ignored    Empty source file sent through compiler     no tokens found     A bad command line option found that can be ignored   An unrecognized  pragma encountered     An invalid optimization ID was specified with    optEn or            C  2007 2015 Compiler Reference Manual  page 157    15  Appendix D   Error  Warning and Information Messages    Message Explanation    Identifier  optDis  it is ignored   C preprocessing warning message     An identifier longer than 255 characters found and truncated to  255 significant characters     Warn about non ANSI 
100. pecified     char     variables are treated as  signed  The ETEC  default is to treat     char    as unsigned      C  2007 2015    9  Command Line Options    Use Global Scratchpad  globalScratchpad  globalScratchpad   Model  When specified  code is  compiled using the  scratchpad  programming model  rather than the stack   based programming  model  The scratchpad  is located in global  memory  and thus care  must be taken to avoid  conflicts on dual eTPU  systems     Unsigned Char  unsignedchar    When specified     char     variables are treated as  unsigned  This is the  ETEC default so this  option is superfluous     Use Engine Scratchpad  engineScratchpad  Model    When specified  code is  compiled using the  scratchpad  programming model  rather than the stack   based programming  model  The scratchpad  is located in engine   relative address space   This option is only  available on the     engineScratchpad       page 116  Compiler Reference Manual  C  2007 2015    9 2    9  Command Line Options    mr ES ES    Error on Warning Off    Turn any warning into a  compilation error    Note  this is the same  option as  warnError  which has been  deprecated     Warning Disable  warnDis  lt WARNID gt    Off  all  warnDis 343    Disable a specific  compilation warning via  its numerical identifier        Note that the source file name is not constrained to be the last command line argument  but  that is the standard practice  Also note that command line options are not case sens
101. piler Reference Manual  page 123    page 124  Compiler Reference Manual    10 1    10  Limitations    10    Limitations    Generally  the latest support details can be found at http   www ashware com  The sections  below do outline some limitations that are expected to never change     Restrictions to the ISO IEC 9899 C Definition    No floating point  float or double types  support     The ETEC system does not provide any portions of the C standard library      C  2007 2015 Compiler Reference Manual  page 125    page 126  Compiler Reference Manual    11  Supported Features    11    Supported Features    The following  C  language features are supported by the ETEC compiler     11 1 General C Language Support    The current ETEC version has some limitations  The list below details the portions of the  C language that are as yet unsupported     e Function pointers      Structure initializers   e Designators   e   Variable length arrays    e _Accum type not supported  subset of _Fract capability supported    11 2 eTPU Programming Model Support    Fully supported      C  2007 2015 Compiler Reference Manual  page 127    11  Supported Features    11 3 Compatibility Mode Support    This section refers to constructs and syntax specific to existing code     11 3 1 Entry Table Support    The if else block entry table model is fully supported     11 3 2  pragma support    Items in    are optional  Only one of the items in a     is allowed    pragma ETPU_ function    Syntax      pragma 
102. pu_if_PWM_CHANNEL_FRAME_PSE    Assuming in the host code a pointer of type    etpu_if_PWM_CHANNEL_FRAME_PSE     has been initialized correctly  named    etpu_pwm_pse_chan_7    for sake of example   the  host code could initiate a coherent update of the PWM signal with code like   etpu_pwm_pse_chan_7  gt Coherent_Period   new period data   etpu_pwm_pse_chan_7  gt Coherent_ActiveTime   new active time data       set coherent update host service request   Additionally  host debugging tools will be able to cleanly see the eTPU data through these  structures for an enhanced debugging experience           24 bit vs  Non 24 bit Accesses    For each memory space  global  engine  channel frames   up to two data overlay structures  may be auto generated  The first is for accessing non 24 bit data  and the other is for  accessing 24 bit data  The idea is that the 24 bit data struct will overlay the PSE   parameter sign extended  mirror  which allows easy read write of 24 bit parameters  through 32 bit accesses on the host side  The non 24 bit data struct is meant to overlay the  regular SDM  shared data memory  window  One important item to note regarding 24 bit  data  is that on readback through the PSE  the data is always sign extended regardless of  whether the data type is signed or unsigned  Unsigned data read through the PSE should  still have the top 8 bits masked off     In order to simplify the access of signed and unsigned 24 bit data through the PSE mirror      C  2007 2015  
103. r  Reference Manual     MTDT  Common  reference manual  covering all simulator   debugger products  EXCEPT the eTPU  Stand Alone  simulator     LICENSE  License  reference manual    Display Version  version Er    version     C  2007 2015       page 108  Compiler Reference Manual    9  Command Line Options    Displays the tool name  and version number and  exits With a non zero  exit code without  compilation     Display Licensing Info j  license    Outputs the licensing  information for this tool     Target Selection  target  lt TARGET gt   target ETPU2    Select the destination where TARGET can be   processor for the    compilation    ETPUI   compile for  the baseline eTPU  processor   ETPU2   compile for    the eTPU2 processor  version   TBD     Console Message  verb  lt N gt   Verbosity    where N can be in the  range of 0  no console  output  to 9  verbose  message output      Console Message  verbSuppress  lt TYPE gt    Off     Suppression verbSuppress SU  Suppress RESEN where TYPE can be  MMARY  messages by their type   7 BANNER   the ETEC  class  Multiple types version  amp  copyright  can be specified with banner   multiple  verbSuppress    SUMMARY   the  options  success failure   warning error count     C  2007 2015    Control the verbosity of  the compiler message  output        Compiler Reference Manual  page 109    9  Command Line Options    summary line    WARNING   all  warning messages    ERROR   all error  messages  does not  affect the tool exit  code     Co
104. r  thereby saving unnecessary overhead   Fragments support passing parameters just like normal functions  and the calling     C  2007 2015 Compiler Reference Manual  page 55    5  eTPU Programming Model    conventions are the same except for the state save  on both caller and callee sides   Note  that on the fragment  callee  side  there is also reduced state saving     non volatile registers  do not need to be saved  nor does the return address register  Internally  fragments work  just like any other C function     they can make calls  even to other fragments  A simple  example of using common initialization code is show below     _eTPU thread PPA   INIT_TCR1 _eTPU_matches_ disabled              set up time base for TCR1    ActionUnitA  MatchTCR1  CaptureTCR1  GreaterEqual     CommonInit       no return from this call    _eTPU thread PPA    INIT TCR2 _ eTPU matches disabled              set up time base for TCR2     ActionUnitA  MatchTCR2  CaptureTCR2  GreaterEqual     CommonInit       no return from this call    _eTPU_fragment PPA   CommonInit          DisableOutputBuffer       required for Puma          Needed so ouptut pin does not get toggled  OnMatchA  NoChange          Needed so ouptut pin does not get toggled  OnMatchB  NoChange       ClearAllLatches     Measurement   Inactive        Enable service request when first edge occurs  SingleMatchSingleTransition                  Note that the compiler will attempt to detect stranded code that follows a call to a  fragment
105. rectory in the ETEC installation     Support for Additional Languages    Currently the auto header capability is targeted at    C     Please contact the factory should  you require support for additional languages such as Fortran  ADA  Java  etc     SCM ARRAY    The SCM_ARRAY is written to its own file  lt output file name gt _scm c  By default it is  output as an initialized array of 32 bit unsigned integers  The linker    data8 option causes it  to be output as an array of unsigned 8 bit data      C  2007 2015 Compiler Reference Manual  page 101    7  Auto Header Generation    7 2 16 PWM Example    The following is generated from the PWM       This file is auto generated by ETEC      It contains information for host CPU side driver code     ifndef PWM_ETEC PWM H   define PWM_ETEC PWM H             Register ECR  field ETB  byte address  Each Engine     ECR ETB      ENTRY TABLE BASE ADDR  gt  gt 10   define ENTRY TABLE BASE ADDR 0x2800             Register CXCR  Field ETCS  channels using PWM             CXCR ETCS   PWM ENTRY TABLE TYPE   define PWM_ENTRY TABLE TYPE 1       etc      endif    PWM_ETEC_PWM_H       page 102  Compiler Reference Manual  C  2007 2015    8 1    8  Initialized Data Files    8    Initialized Data Files    The initialized data files contains data structures that  in conjunction with the memcpy    function  can be used to initialize your global and channel frame memory     Note that there may be    holes    in the initialized data  Holes are areas where
106. ress Offset e  eer o  eo   FREE 18 E    b 0     5 3 12 ANSI Mode       ANSI mode  controlled with the    ansi option  has been mentioned several times above   Essentially it forces ANSI ISO compatibility wherever possible  particularly in data packing   structs are always packed in order  for example   Also  _Bools are packed as 8 bit units  rather than as single bits  LSB holds the 0 or 1 value   It is not recommended for use in  production eTPU code as it typically increases memory usage and decreases performance      C  2007 2015 Compiler Reference Manual  page 31    5  eTPU Programming Model    5 4    5 4 1    5 4 2    page 32  Compiler Reference Manual    eTPU Hardware Access    Most eTPU hardware access involves the channel hardware or portions of the register set   The underlying hardware programming model described here is defined m the ETpu Hw h  header file that is part of the ETEC distribution     Channel Hardware Access    The channel hardware is represented by a large structure of bitfields  Each field  represents an accessible piece of channel hardware  This structure type has the name  chan_struct and as part of the standard programming model a    variable    of this type  named    channel    is declared  No actual memory space is allocated  Most fields are  write only  none are readable in the normal sense  Some are test only  whereas a few are  both writeable and testable     Baseline eTPU Channel Hardware Programming Model    The eTPU chan struct is defined 
107. ring     TR18037 Fixed point Library Support    _Fract support includes a portion of the fixed point library specified in TR 18037  as well as  some extensions  Supported functions are     int mulir int  _Fract      under ordinary arithmetic conversion rules the result of a  multiplication of an integer and a _Fract is a Fract  There are applications where instead  the desired result is the integer portion of the result  this library function provides that  capability     unsigned int muliur unsigned int  unsigned _Fract      unsigned version   Other versions to support 8 and 16 bit int fract multiplication    int8 muli8r8 int8  fract8     unsigned int8 muli8ur8 unsigned int8  unsigned fract8     intl6 mulil 6r16 int16  fract16      unsigned int16 mulil6ur16 unsigned int16  unsigned fract16       C  2007 2015    5 4 7 4    5  eTPU Programming Model    int24 muli24r8 int24  fract8    unsigned int24 muli24ur8 unsigned int24  unsigned fract8    int24 muli24r16 int24  fract16      unsigned int24 muli24ur16 unsigned int24  unsigned fract16      ALU MDU Intrinsics    The eTPU has a number of hardware features that are not directly accessible via standard  C syntax  The intrinsics defined here provide C function like access to these capabilities   The eTPU Reference Manual should be consulted for additional details  particularly as    related to condition code calculations     5 4 7 4 1 Rotate Right Support       Rotate right by 1 bit the lower 8 bits        result 6 0    v 7 1   re
108. rinsic functions include a spin while busy loop after the operation is  begun  The optimizer will attempt to fill the pipeline with non dependent opcodes and    eliminate the spin loop        Signed multiplication         mach macl    x   y   void __mults8 int24 x  int8 y    void __mults16  int24 x  int16 y    void __mults24 int24 x  int24 y         Unsigned mutliplication  with second ar  void __multu8  unsigned int24 x  unsigned i  void __multul6 unsigned int24 x  unsigned  void __multu24  unsigned int24 x  unsigned     Signed 24 bit multiply accumulate        mach macl     x   y   void __macs int24 x  int24 y        Unsigned 24 bit multiply accumulate        mach macl     x   y    void __macu  unsigned int24 x  unsigned int       Multiply signed value x and unsigned 8 bit fractional value f     mantissa      portion of the result ends up in mach    in macl    void __fmults8 int24 x  unsigned fract8 f      Multiply signed value x and unsigned 16  mantissa      portion of the result ends up in mach    in macl    void __fmults16  int24 x  unsigned fract16      Multiply unsigned value x and unsigned    mantissa     portion of the result ends up in mach   in macl   void __fmultu8  unsigned int24 x  unsigned     Multiply unsigned value x and unsigned  mantissa     portion of the result ends up in mach   in macl     void __fmultul6 unsigned int24 x      Unsigned division  24 bit   8 16 24 bit      macl  x   y   mach  remainder   void __divu8  unsigned int24 x   void __divul6  uns
109. rogram counter  plus a variable displacement which can be up to 255  instructions opcodes  This feature is activated through two new keywords        similar to    switch    keyword in C syntax  eTPU_state_switch      similar to    enum    keyword in C syntax  eTPU_state_switch_enum          The sections below provide the details on this feature     State Enumeration    A state enumeration must be declared as only expressions of this type may be used in state  switches  A state enumeration is like a regular    C    enum  with a few of exceptions     e A state enumeration is denoted with the   eTqPU state switch enum  rather than     enum    keyword     e The enumerators in a state enumeration cannot be assigned values  Code such     C  2007 2015 Compiler Reference Manual  page 57    5  eTPU Programming Model    5 7 2    page 58  Compiler Reference Manual          _eTPU_state_switch_enum CrankState   STALL   5        will result in a compile  error     The enumerator values assigned by the compiler linker may not match the ANSI  standard for C code  wherein they start at 0  and increment by 1 with each  successive enumerator  Rather  the compiler linker assigns values such that the  dispatch instruction used for the matching _eTPU_state_switch works correctly     _eTPU_state_switch_enum tag types  or typedef thereof  cannot be used in  typecasts  This is to prevent potentially dangerous code     Variables declared with an eTPU state switch enum tag type are always  allocated as
110. rray   define _CPBA TYPE ARRAY DefinesTest__al_ T_uint8   define GLOB VAR TYPE g s24 ptr T_ptr    define GLOB VAR TYPE PTR g s24 ptr T_sint24       page 90  Compiler Reference Manual  C  2007 2015    7 2 5    7 2 6    7 2 7    7  Auto Header Generation    Array Variables    Offsets to variables of array type are output in similar manner to basic type variables   except that the settings mnemonic contains ARRAY  CPBA_ARRAY  ERBA_ARRAY  or GLOB_ARRAY   The element type Additionally  for each dimension of the array two  additional definitions are supplied     the number of elements in the dimension and the stride  size  For these  lt Misc gt  takes the form  lt var name gt _DIM_ lt dimension   gt  LENGTH and  lt var  name gt _DIM_ lt dimension   gt _STRIDE    For example   int24 g_s24 array 10    may yield     define GLOB ARRAY g s24 array 0x01   define _GLOB_ARRAY g s24 array DIM 1 LENGTH 0x10   define _GLOB_ARRAY g s24 array DIM 1 STRIDE 0x04             _Bool Type Variables    Besides the byte offset of the variable   s location  _Bool types also list the bit offset within  the 8 bit unit of the variable with the mnemonic BOOLBITOFFSET      define _CPBA8_Test__b4 0x00   define _CPBA8 BOOLBITOFFSET_b4_ 0x05       Struct Union Variables    Again  offsets to variables of struct union type are output in a similar manner to other  variables  The aggregate type of the variable is encoded in the settings mnemonic     struct S1 g GlobalStructVar   union Ul _ChanFrameUnionVar     in e
111. rray through  the PSE   Here are a few examples of this  compiled with default  packtight  memory     page 84  Compiler Reference Manual  C  2007 2015    7  Auto Header Generation    packing options     char g_al 4    char g_a2 2   2      Yields the following in the auto struct      0x00a4       etpu_if_uint8 g_al 4       0x00a8     etpu if uint8 g_a2 2   2      The memory architecture of the eTPU prevents all array cases being handled as cleanly as  the above  unfortunately  In all other cases the array is  flattened  like struct and union  type variables are handled  In the array case  the element index gets appended to the base  array name  The most typical case where this must be done is when arrays of elements of  type struct or union are encountered  The other case is that of  gapped  arrays  Gapped  arrays can occur when other memory packing modes besides  packtight  are used    fastaccess    For example  arrays of 8 bit integers get packed in the upper byte of each  4 byte word  leaving 3 byte gaps between elements  These gaps can be filled by other  data  When the following declarations are compiled in  fastaccess  mode     int8 g_s8_array 4    int16 g_s16   They yield the following in the auto struct     typedef struct          0x0000       etpu_if_sint8 g_s8_array_0   etpu_if_uint8   8    etpu_if_sint16 g_s16       0x0004      etpu if sint8 g_s8_ array 1     etpu if uint8   8    etpu if uint8   8    etpu if uint8   8       0x0008      etpu if sint8 g s8 array 2   e
112. s are not associated with a particular eTPU Function  or  eTPU Class   any static variables declared within them cannot be assigned to a channel  frame  Thus they are assigned global storage  WARNING  if using a dual eTPU part  e   g  MPC5554  and running code containing such static variables on BOTH eTPUs  there is  risk of collisions between the two  This must be taken into consideration when using such  a construct  use of semaphore protection may be required depending upon the intended  application      C  2007 2015    5 3 3    5 3 4    5  eTPU Programming Model    eTPU2 Engine Relative Address Space    Variables can specified for allocation in engine relative address space through use of the  _ENGINE intrinsic address space type qualifier  Note that automatic variables cannot be  so qualified  variables declared within the scope of a function with the ENGINE qualifier  must have a storage class of either static or extern  Such variables are allocated with  respect to the user configured engine base address register     _ENGINE int24 e duty cycle     On a dual eTPU2 microcontroller  each engine references unique copies of e_duty_cycle   assuming the engine relative base address has been configured properly for each eTPU2   It is generally recommended that the use of engine relative variables be avoided as they  complicate the memory layout  An exception is if the user is also selecting the engine  scratchpad programming model     eTPU Channel Frame Variables    Although c
113. sions have been added into the C99 grammar as follows     Several productions have been added to type specifier     type specifier     etpu class specifier  _eTPU thread   eTPuU entry table      only to be used in thread declaration   definition  _eTPU matches enabled      only to be used in thread declaration   definition  _eTPU matches disabled      only to be used in thread declaration   definition  _eTPU preload_ low      only to be used in thread declaration   definition  _eTPU preload high       page 48  Compiler Reference Manual  C  2007 2015    5  eTPU Programming Model    etpu class specifier      function declarators are    allowed in the struct declaration list  _eTPU class identifier   struct declaration list      The following production has been added to declarator     declarator   scope director declarator    scope   scope name    scope name   identifier    eTPU class name    The following productions have been added to type qualifier     they can only apply to the  _eTPU_entry_table type     Type qualifier     _eTPU standard ET  _eTPU_ alternate ET  _eTPU_inputpin ET  _eTPU_outputpin_ET  _eTPU_cfsr_ 0 31 _ET  _eTPU_cfsr_autocfsr_ET    In order to support the public private feature  two productions have been added to  struct_declaration   struct_declaration  specifier qualifier list struct_declarator_list         public    1       private               C  2007 2015 Compiler Reference Manual  page 49    5  eTPU Programming Model    5 5 2    page 50  Compiler Ref
114. sizeof         struct Int16_8 8Struct    page 140  Compiler Reference Manual  C  2007 2015    13 3    13  Appendix B   Data Packing Details    int16 twobytes     offset 2  int8 onebyte_1     offset 0  int8 onebyte 2     offset 4        sizeof         Otherwise  see the FASTACCESS mode packing example in section 12 1     Structure PACKTIGHT with ANSI Mode Enabled    The ANSI pack modes have similar rules to the non ANSI versions  except that each  struct member is considered in order for packing  and must have an offset greater than its  predecessor  Note that member order can have significant impact on how tightly the data  packs     The set of channel frame variables     int x  y     24 bit vars   char cl  c2  c3  c4  c5  c6    short a  b  c     16 bit vars   struct SomeStruct somestruct     sizeof SomeStruct     8    Would get packed like     Struct Offset MSByt 3 LSBytes  e    0   1 actually since unused x  the base struct   address is considered   to start at x         C  2007 2015 Compiler Reference Manual  page 141    13  Appendix B   Data Packing Details    20  19  somestruct       13 4 Structure FAST ACCESS with ANSI Mode Enabled    This mode is similar to FASTACCESS packing  but with guaranteed ascending order of the  member offsets  Note that member order can have significant impact on how tightly the  data packs     The set of channel frame variables     int x  y     24 bit vars   char cl  c2  e3  c4    5  c6  c7    short a  b  c     16 bit vars   struct SomeStruct
115. sult 7    v 0     is result  23 8    v 23 8          Condition code flags are sampled on 8 bits   int24 _ rotate_right_1_b7_0 int24 v        Rotate right by 1 bit the lower 16 bits        result 14 0    v 15 1   result 15    v 0       result  23 16    v 23 16          Condition code flags are sampled on 16 bits   int24 __rotate right 1 b15 0 int24 v        Rotate right by 1 bit all 24 bits        result 22 0    v 23 1   result 23    v 0         Condition code flags are sampled on 24 bits   int24 __rotate right 1 int24 v        Rotate the 24 bit value v      to the right by 2   bitexp 1  bits       where bitexp can be   7710  1  2 er 3       Condition code flags are sampled      per _sfXX extension  if used       See eTPU reference manual for details      on condition code computation      with multi bit rotate    int24 _ rotate_right_2n int24 v  int24 bitexp    int24 _ rotate_right_2n_sf8 int24 v  int24 bitexp             C  2007 2015    Compiler Reference Manual  page 41    5  eTPU Programming Model    int24 __rotate right 2n sf16 int24 v  int24 bitexp    int24 __rotate right 2n sf24 int24 v  int24 bitexp      5 4 7 4 2 Absolute Value Support    IF                    Compute the absolute value of v    Condition code flags are sampled   per _sfXX extension  if used    See eTPU reference manual for details   on condition code computation with absolute value     int24 _ abs  int24 v     int24 _ abs_sf8  int24 v    int24 _ abs_sf16  int24 v    int24 _ abs_sf24  int24 v      5 4 
116. t ExcludedInitThread gt   For example the following excludes a UART s initialization thread from the worst case      pragma exclude wctl UART  init    Loop Iteration Count    Loops in eTPU code are generally not a good programming practice because the eTPU is  an event response machine in which long threads  such as those caused by loops  can  prevent the quick response time to meet many applications    timing requirements     However  loops are occasionally required  and are therefore supported by the optimizer     But there is no way to analyze the worst case thread length for threads that contain loops   and therefore loops prevent analyses unless loop bounding iteration tags are added      C  2007 2015    12  Appendix A   Pragma Support     pragma wctl_ loop _ iterations  lt max loop count gt    lt Some Loop gt     12 10 Code Size Verification    12 11    The code size verification pragma  verify_code_ size  allows the user to verify at build time  that their code meets size requirements  Code size verification is done on a function scope  basis  The pragma has the syntax options    pragma verify code size  lt Function gt   lt MaxSize gt  bytes    pragma verify code size  lt Function gt   lt MaxSize gt  words    pragma verify code size  lt Class gt    lt Function gt   lt MaxSize gt  bytes    pragma verify code size  lt Class gt    lt Function gt   lt MaxSize gt  words   The maximum allowable size for a given function can be specified in bytes or words   opcodes  4 bytes e
117. table construct can be very helpful  Below  the syntax     C  2007 2015 Compiler Reference Manual  page 63    5  eTPU Programming Model    and usage is described  For much more detail on eTPU constant lookup tables  including  how to perform run time data calibration  please see the Assembler Reference Manual  Constant Lookup Table section     In C code  constant tables are defined as arrays of the special type   _eTPU_constant_table   The arrays can be multi dimensional  Typically an initializer  should be used to load the constant table  Any uninitialized array elements are given a  value of 0  When a 24 bit value is retrieved from the table  it is treated as a signed integer  by default  Type casting can be used to change to unsigned  _ Fract  fractional   or  whatever type is desired        constant table definition  global   _eTPU_constant_table sin_table 64      0x000000   0x034517               external declaration for reference from other files  extern _eTPU_constant_table sin_table 64         multi dimensional  _eTPU_constant_table switch table 2  2        3  2       1   0            table static to a scope  static _eTPU constant table coef table 8      0x0   Ox200            Syntactically  accessing elements of the table is handled just like normal array element  access     int coef   coef_table index      get the coefficient  specified by index  fract24 sin val    fract24 sin_table angle    Because constant tables exist in code memory which is not writeable and uti
118. tails 139  13 1 Channel Frame FASTACCESS Mode                cceeeceeeeeeeeeeeeeeeeeeeeeseeeeeeeeee 139  13 2 Structure FASTACCESS Mode ss mmmrmnnennmnnnneee 140  13 3 Structure PACKTIGHT with ANSI Mode Enabled                                     141  13 4 Structure FASTACCESS with ANSI Mode Enabled                                    142  13 5 Array FASTACCESS Mode ss mmnnrrernnnneennnnnnees 143    Part 14 Appendix C   eTPU Annotated  Object File Format 145    14 1    Code  E  h oY  K  Sa E E EE E E E E 152    page 6  Compiler Reference Manual    Combpiler Reference Manual    14 2  Entries  ea lente wn d neue va dbcusecs una en nine 153    Part 15 Appendix D   Error  Warning and    Information Messages 155  15 1 Compiler Error Messages ss issnnrnnnnnns 155  15 2 Compiler Warning Messages ss 157    Compiler Reference Manual  page 7    page 8  Compiler Reference Manual    Combpiler Reference Manual    Compiler Reference Manual  page 9    page 10  Compiler Reference Manual    1  Introduction    1    Introduction    The eTPU Embedded C Compiler System is based upon the ISO IEC 9899 C standard      C99     and the ISO IEC TR 18037 Embedded C extension  ETEC is a highly optimizing  C compiler for all versions of the eTPU  ETEC has its own version of the programming  model with regards to entry table definition and thread function definition  but also has a  compatibility mode for compiling software written using existing programming paradigms   This document covers the details of t
119. tatic Data Packing  packstatic  lt OPTION gt    PACKTIG a     C  2007 2015       page 112  Compiler Reference Manual    Allow control of the  style for packing   allocating static channe  frame data  It does not  apply to global  variables  which are  packed as if  FASTACCESS were  applied to them     Array Data Packing    Controls how data in  arrays is packed for arrays  of 8 and 16 bit types  This  setting also affects the  corresponding pointer type  arithmetic  1e  pointers  increment decrement by  the same amount as the  corresponding array stride  size     9  Command Line Options    where OPTION can be     117 PACKTIGHT   packs    data as tight as  possible  locations of  sequentially declared  variables are not  necessarily sequential   Additionally  accesses  to some data types  may not be coherent  with regards to  neighboring data  when  this setting is used     FASTACCESS   packs  data so as to provide  the fastest access  possible by allocating  space in optimal spots   Uses more memory  but increases code  speed and removes  coherency conflicts      packarray  lt OPTION gt    PACKTIG    where OPTION can be       PACKTIGHT   for 8  and 16 bit types  the  array stride size is the  same as the base size   1 and 2 bytes  respectively    FASTACCESS   the  stride size for 8 or 16  bit type arrays is  always 4 bytes         C  2007 2015    packstatic FAST  ACCESS    packarray FAST  ACCESS    Compiler Reference Manual  page 113    9  Command Line Options    Struct Data 
120. te only   ERWB int      write only   FLC int      write only   IPACA int      write only   IPACB int      write only   LSR int      writeable  testable  entry condition  MRLA int      writeable  testable  MRLB int       writeable  testable  MRLE int      write only   MTD int    write only    OPACA int  OPACB int  PDCM int  PIN int  TBSA int  TBSB int  TDL int  UDCMRWA int  SMPR int         write only        write only        write only        write only        write only        write only        write only        write only        writeable  testable       setting to  1 triggers semaphore free     NPrPP  amp  WPWWDNDP RP RPP wWDWdwoe HA Ww     C  2007 2015 Compiler Reference Manual  page 33    5  eTPU Programming Model    FLAGO    FLAG1    FMO  FM1  PSS  PSTI  PSTO  TDLA  TDLB    int   1    int   1    int  int  int  int  int  int    PRPRPPRPRPPRPPR    int      chan_struct     if              i       iF          oF  af    writeable  also via FLC    testable  entry condition  writeable  also via FLC    testable  entry condition  test only   test only   test only   test only   test only   writeable  testable  writeable  testable    The following changes have been made to the eTPU  chan_struct channel hardware  programming model from the baseline     New fields are     UDCMRWA    Modified fields are     CIRC    Value      Controls writing of erta register to the UDCM register   Writing a value of 0 to this field triggers  the write to the UDCM register       This field has been e
121. text   define   EXPORT AUTODEF STR   abc       pragma export_autodef_text   define   EXPORT _AUTODEF FUNC MACRO  ARG1  ARG2     n ARG1   ARG2       C  2007 2015    Compiler Reference Manual  page 137    12  Appendix A   Pragma Support    Yields the following in the auto defines file        exported autodef text from user   pragma  export_autodef_text  commands    define EXPORT_AUTODEF_VAL 1    define EXPORT_AUTODEF_STR  abc     define EXPORT_AUTODEF_FUNC_MACRO ARG1  ARG2     ARG1   ARG2     12 14 Private Channel Frame Variables    When using the eTPU C programming model  channel frame variables can be kept   private   that is  their information is not exported in the auto defines file  by declaring them  via the  static  technique and using the private channel frame pragma   pragma  private_static_channel_frame   The default behavior  no pragma  is to have all channel  frame variables in an eTPU C function be public  See the example below      pragma ETPU_function PWM  alternate    pragma private_static_channel_frame    void PWM int24 Flag     all parameters always exported to  auto defines   int24 Period    int24 ActiveTime    int24 Coherent Period    int24 Coherent _ActiveTime      static int24 LastFrame     not exported to auto   defines because of pragma above    static int24 NextEdge     iy    A matching pragma to switch back to the default public model is      pragma public static channel frame    page 138  Compiler Reference Manual  C  2007 2015    13 1    13  Appendix
122. tion looks like     union    etpu_if_uint8 _UNIT   struct     if defined MSB_BITFIELD_ORDER    etpu_if_uint8   5   etpu_if_uint8  b3   1   etpu_if_uint8 _b2   1   etpu_if_uint8  bi   1      C  2007 2015 Compiler Reference Manual  page 87    7  Auto Header Generation     elif defined LSB BITFIELD ORDER     etpu_if_uint8 PL s   1   etpu if uint8 62 4 dl   etpu if uint8 _b3   1     etpu if uint8   5    else   error Users of auto struct must define either  MSB_BITFIELD ORDER or LSB BITFIELD_ ORDER   endif    _BF     BF UNIT 0018     The host could read or write all three bits simultaneously through the construct  global data ptr  gt  BF UNIT 0018  UNIT       Individual bits are accessed via constructs like  global data ptr  gt  BF UNIT 0018  BF  bl       7 1 7 Example Code    Below is a short sample of code that initializes global memory section data mapping  structure pointers  and then accesses eTPU shared code memory via them        initialize data overlay pointers for global memory  etpu_if_GLOBAL_DATA  GDM    etpu_if_GLOBAL_DATA   ETPU_PRAM_BASE   etpu_if_GLOBAL_DATA_PSE  GDM_PSE    etpu_if_GLOBAL_DATA_PSE    ETPU_PRAM PSE_BASE      check the data overlay structs  auto struct   if  sizeof etpu_if GLOBAL DATA     etpu if GLOBAL DATA EXPECTED SIZE   return FAIL   if  sizeof  etpu if GLOBAL DATA PSE      etpu if GLOBAL DATA PSE EXPECTED SIZE   return FAIL      write and read some global data  GDM  gt g_s8   0x12   GDM  gt g_s16   0x1234   GDM_PSE  gt g_s24   0x123456   GDM  gt 
123. tion scene  Type Information 2  Array Variables suser   Bool Type Variables nn nrrrnrrsrasnesnesnesnrsnnsneenranennranrareanenennenes  Struct Union Variable Si SELDE aaaea eari aeaa aeai aa araara EES  Tag Types  Structures  Unions  Enumerations   Global MNEMONIC e NN ae E eee  Settings  Register Fields  and Mnemonic  Include Race Keepout successer b    Freescale API Com patibility sm uens Er EEN   ASH WARE Simulator Com patibility 1 222  Support for Additional Languages ia  SCM ARRAY   6 EE eus ei pese orne go ann tor anne toc sn ones nn deu  PWM Exam ple a a oraraa aae raaraa ea aarden aa Kepo deaan aE hoaraa a dodone panaan                 Part 8 initialized Data Files 103    8 1 Initialized Global Memory    103  8 2 Initialized Channel Memory serres 104  8 3 Using the Initialized Data Macros in the Simulator                                  105    Part9 Command Line Options 107    9 1 Compiler Command Line Options    sms 107  9 2 C Preprocessor Command Line Options ss 117  9 3 Console Message Verbosity   Verb            ccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 122  9 4 Version   Version                            seeenerseecenneseessneensses 123    Part 10 Limitations 125  10 1 Restrictions to the ISO IEC 9899 C Definition               c csscessesecsseeeeeseceenes 125    Part 11 Supported Features 127  11 1 General C Language Support ss nssssssnrrrrnneneenennnnenee 127    Compiler Reference Manual  page 5    Compiler Reference Manual    11 2 eTPU Programming Model 
124. tocfsr  in which case the linker assigns the entry table a CFSR value     Then  three different macros are used to specify each entry vector  Three are required  since depending upon entry table type  up to 3 HSR values can contribute to the entry    define ETPU_VECTOR1 hsr1  lsr  ml  m2  pin  flag0  flagl  threadName     define ETPU_VECTOR2 hsr1  hsr2  lsr  ml  m2  pin  flag0  flagl  threadName     define ETPU_VECTOR3 hsr1  hsr2  hsr3  lsr  ml  m2  pin  flag0  flagl  threadName    Below is an example of the definition of a standard entry table with a user specified CFSR  value     DEFINE ENTRY TABLE  ClassName  EntryTableName  standard  inputpin  3           HSR LSR M1 M2 PIN FO F1 vector  ETPU_VECTOR1 1  x  x  x  0  0  x  Initialize    ETPU_VECTOR1 1  x  x  x  0  1  x  Initialize    ETPU_VECTOR1 1  x  x  x  1  0  x  Initialize    ETPU_VECTOR1 1  x  x  x  1  1  x  Initialize    ETPU_VECTOR1 2  x  x  x  x  x  x  Global Error Thread    ETPU_VECTOR1 3  x  x  x  x  x  x  Global Error Thread    ETPU VECTORI 4  x  x  x  x  x  x  Global Error Thread    ETPU_VECTOR1 5  x  x  x  x  x  x  Global Error Thread    ETPU_VECTOR1 6  x  x  x  x  x  x  Global Error Thread    ETPU_VECTOR1 7  x  x  x  x  x  x  Global Error Thread    ETPU_VECTOR1  0  r BA 1  1  x  0  x  HandleMatch       C  2007 2015    5  eTPU Programming Model    ETPU_VECTOR1 0  1  1  1  x  1  x  HandleMatch    ETPU_VECTOR1 0  0  0  1  O  0  x  Global Error Thread    ETPU_VECTOR1 0  0  0  1  0  1  x  Global Error Thread    ETP
125. todef_macro   lt output_macro_name gt      lt output_macro_value gt     The following lines in eTPU source      define TEST_INIT_HSR 7    define TEST_STR  xyz     pragma export_autodef_macro  ETPU_TEST_INIT_HSR    TEST_INIT_HSR    pragma export_autodef_macro  TEST_STR   TEST_STR    Results in the following in the auto defines file        exported autodef macros from user   pragma  export_autodef_macro  commands    define ETPU_TEST_INIT_HSR 7    define TEST_STR  xyz     The standard header file  ETpu_Std h  has a few  helper macros  available that can  potentially make the eTPU source easier to read  Using the macros like      define TEST_ODD_PARITY_FM 1    pragma export_autodef_macro EXPORT_AUTODEF_MACRO   TEST ODD PARITY FM     pragma export autodef macro EXPORT AUTODEF MACRO PRE    ETPU    TEST ODD PARITY FM     Results in        exported autodef macros from user   pragma  export_autodef_macro  commands    define TEST_ODD_PARITY_FM 1    define ETPU_TEST_ODD_PARITY_FM 1    There is also a pragma to export any user defined text  Note that this text must be  parseable by whatever compiler processes the auto defines file when compiling host code   or it will break the compilation  The export text  pragma has this syntax      pragma export_autodef_text   lt user_defined_text gt      The text must use C escape sequences when necessary  and can even include newlines for  the output  For example      pragma export_autodef_text   define EXPORT_AUTODEF_VAL 1    pragma export_autodef_
126. tpu if uint8   8    etpu if uint8   8    etpu if uint8   8       0x000c      etpu_if_sint8 g_s8_array_3   etpu_if_uint8   8      C  2007 2015 Compiler Reference Manual  page 85    7  Auto Header Generation    etpu if uint8  etpu if uint8    8   8       etpu if GLOBAL DATA     In the case of an array of struct type  the declaration below    typedef struct           Sl     unsigned int8 a   unsigned int16 b   unsigned int24 c   unsigned int32 d      1 g_si 2      generates the following section of auto struct  non PSE only  the PSE struct contains the  references to member  c          0x0048     etpu_if_uint8  etpu_if_uint8  etpu_if_uint8  etpu_if_uint8     0x004c     etpu_if_uint32     0x0050     etpu_if_uint8  etpu_if_uint8  etpu_if_uint16     0x0054     etpu_if_uint8  etpu_if_uint8  etpu_if_uint8  etpu_if_uint8     0x0058     etpu_if_uint32     0x005c     etpu_if_uint8  etpu_if_uint8  etpu_if_uint16    page 86  Compiler Reference Manual     C  2007 2015    g_s1_ 0 a     g sl 0 d     g_s1_ 0 b     g s1 1 a     g s1 1 d     g s1 1 b     7 1 6    7  Auto Header Generation    Bit field and Bool Variables    Bit field struct union members and _ Bool variables  _ Bool variables can act like bit fields  in that they are assigned to an 8 bit unit  and in some cases  multiple _ Bool variable can be  packed into different bits of one unit  are handled differently than other members of the  auto struct  One reason for this is that compilers can pack bit fields in different manners     
127. ual  page 83    7  Auto Header Generation    Unions present additional challenges to auto struct generation  The algorithm for  generating an auto struct when a union is encountered is as follows  For a given byte  address  find the first union member located at that address and use it to determine the  auto struct member name and type  Note that this is done for both the 24 bit pas and the  non 24 bit pass  So a union such as     union Utype     signed char s8   short s16   int s24   int32 s32     gul     Results in     typedef struct          0x0000       etpu if sint8 g ul s 8   etpu if uint8   8   etpu_if_sint16 g ul s16       etpu if GLOBAL DATA   typedef struct        0x0000     etpu_if_sint32 g ul s24     etpu if GLOBAL DATA PSE     Through ordering of the union members  users can potentially get the auto struct output  they are looking for     Bit field members present special issues and are discussed in the next section  Note that  arrays of struct union types are not supported at this time     7 1 5 Arrays in Auto Structs    Arrays are handled two different ways by auto struct  depending upon the element type of  the array and the packing of the array  If it all possible the array defined in eTPU space is  output into the auto struct as an array  This can be done when the following conditions are  met   1  the element type is a basic type  and  2  the stride size and element size are the  same  exception  an array of 24 bit basic typed elements can be output as an a
128. used as it will result in degraded performance   but if a case arises wherein optimization produces unwanted behavior  it can be a useful  construct     Thread Length Verification  WCTL     The verify_wctl pragma are used for the following     e No thread referenced from a Class or eTPU Function  including both member  threads and global threads  exceed a specified number of steps or RAM accesses     e A specific thread does not exceed a specified number of steps or ram accesses        For classes with multiple entry tables  the worst case thread of any entry table can  be specified  currently only available in ETEC mode      e A global    C    function or member    C    function does not exceed a specified number  of steps or ram accesses   The syntax is as follows      pragma verify wctl  lt eTPUFunction gt   lt MaxSteps gt   steps  lt MaxRams gt  rams    page 132  Compiler Reference Manual  C  2007 2015    12  Appendix A   Pragma Support     pragma verify wctl  lt eTPUFunction gt    lt Thread gt   lt MaxSteps gt   steps  lt MaxRams gt  rams     pragma verify_wctl  lt Class gt   lt MaxSteps gt  steps   lt MaxRams gt  rams   pragma verify _wctl  lt Class gt    lt Thread gt   lt MaxSteps gt  steps   lt MaxRams gt  rams   pragma verify wctl  lt Class gt    lt Table gt   lt MaxSteps gt  steps   lt MaxRams gt  rams   pragma verify_wctl  lt Class gt     lt CFunc gt   lt MaxSteps gt  steps   lt MaxRams gt  rams     pragma verify wctl  lt GlobalCFunc gt   lt MaxSteps gt  steps   lt
129. xtended by 1 bit   with this new bit treated as inverted   The 3 bit CIRC field then has the following meanings      CIRC 2     CIRC 1  CIRC 0  Meaning    page 34  Compiler Reference Manual    0 channel interrupt request from  service channel  same as eTPU    1 data transfer request from  service channel  same as eTPU    0 global exception  same as eTPU    1 do nothing  don t request  interrupt  same as eTPU    0 channel interrupt request from  current channel   1 data transfer request from  current channel   0 channel interrupt  amp  data  transfer request from current  channel   1 channel interrupt  amp  data    transfer request from service     C  2007 2015    FLAGO    FLAG1    TDLA    TDLB    Now    Now    Now    Now    5  eTPU Programming Model    channel    testable for conditional jumps    testable for conditional jumps    writeable  clearable  independent of TDLB    writeable  clearable  independent of TDLA    5 4 4 eTPU2 Extensions to the Channel Hardware Programming Model    For the eTPU2  chan_struct has been modified and extended to the following     typedef struct      CIRC  ERWA  ERWB  FLC  IPACA  IPACB  LSR  MRLA  MRLB  MRLE  MTD  OPACA  OPACB  PDCM  PIN  TBSA  TBSB  TDL  UDCMRWA  SMPR    FLAGO    FLAG1    FMO  FM1  PSS  PSTI  PSTO  TDLA  TDLB  MRLEA    int  int  int  int  int  int  int  int  int  int  int  int  int  int  int  int  int  int  int  int    int    int    int  int  int  int  int  int  int  int    NPPPRBWRWWNHRPRPRPRPWWWRPPW    PRPPPRPRPPR     gt  yI
130. y is controlled with the  public  and  private  keywords  much like in C    Items get  their visibility setting based on the nearest visibility keyword declared above them  or are   public  if no visibility keywords are present  Currently the visibility setting only applies to  data  channel frame variables  and whether their interface information is exported into the  auto defines and auto struct files  Private data is not referenced in the generated auto   defines and or auto struct  Below is an example class definition showing this feature     _eTPU_class Test        public   int  int  int  int    private   int  int  int    public   int  int  int  int    El   r2    3   r4     opl   op2   op3     r5   r6   ET   r8      C  2007 2015    Compiler Reference Manual  page 47    5  eTPU Programming Model    private   int op4   int8 op5   int16 op6   struct S op7        methods       threads  _eTPU thread Main _eTPU matches enabled          entry tables  eTPU entry table Test            The channel frame variables r1   r8 are public and their location information will be output    in the auto defines and auto struct files  The opN variables are private and will not be  exposed in the auto generated interface files     The ETEC compiler supports an alternative syntax for thread declarations  The   _eTPU_ thread  keyword can be used interchangeably with  void __attribute__    interrupt_handler     which is a GNU based syntax     5 5 1 Extension Syntax Details    The ETEC syntax exten
131. ym for _Fract  format    unsigned _Fract 24 bits  0 24 unsigned fract24 is a synonym for  format unsigned _Fract    long _Fract 32 bits  s 31 fract32 is a synonym for long  Fract   format Note the eTPU ALU MDU does not   support 32 bit operations so 32 bit fract  operations are relegated to load store         C  2007 2015    Compiler Reference Manual  page 21    5  eTPU Programming Model    unsigned long _ Fract 32 bits  0 32 unsigned fract32 is a synonym for  format unsigned long _Fract  Note the eTPU    ALU MDU does not support 32 bit  operations so 32 bit fract operations  are relegated to load store        5 2 Pointers    Pointers in the eTPU programming model are sized to 24 bits as this is the natural size of  the machine  16 bits would provide sufficient range  however   In the default mode   pointers to 8 bit types increment in 1 byte steps  16 bit types increment in 2 byte steps  and  pointers to 24 bit types increment in 4 bytes steps  Some data packing modes cause all  pointers to basic types to increment in 4 byte steps  see later sections      All pointers are always kept in global address space  Thus when the address operator is  applied to a channel frame variable the address is computed to be the sum of the channel  frame offset and the CPBA register  The same is true with eTPU2 engine relative  address space     _Bool pointer note  Pointers to type _Bool are allowed  and will increment decrement like  a pointer to an 8 bit  Depending upon _Bool bit packing th
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
QoRTs Package User Manual    Ref. 5328  トンボplus 01    Industrial PC Blind Nodes - AV  Fisher & Paykel OR24SDPWGX1 Installation Worksheet  塩ー語 の注音はカタログ ー 取扱説明書をお読みください。    Copyright © All rights reserved. 
   Failed to retrieve file