SPRAD88A march   2023  – april 2023 TMS320C28341 , TMS320C28342 , TMS320C28343 , TMS320C28343-Q1 , TMS320C28344 , TMS320C28345 , TMS320C28346 , TMS320C28346-Q1 , TMS320F28P550SJ , TMS320F28P559SJ-Q1

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Byte vs Word Terminology
  5. 3Key Points to Consider
    1. 3.1 8-Bit Data Types are not Supported
    2. 3.2 Memory Size is Expressed in 16 Bits
    3. 3.3 Arrays and Structures: Individual Element Offsets are Different
    4. 3.4 Difference in Standard Data Type Widths
    5. 3.5 Dealing With 8-Bit Communication Protocols
  6. 4References
  7. 5Revision History

Memory Size is Expressed in 16 Bits

The memory sizes mentioned in the linker cmd files, .map files are all expressed in 16 bits. The sizeof() function always returns the size with respect to smallest addressable memory units (8 bits for Arm and 16 bits for C28x).

Be careful to not hardcode the size information in the application. One common scenario is while using memset/cpy/cmp functions, the size parameter to these functions are in terms of smallest addressable units.

GUID-20230313-SS0I-1JKN-0FPZ-889VXHHTX6N4-low.png

Also, note the difference in data packing after memset usage:

C28x Arm
myStruct
000A000A 000A000A
myStruct
0A0A0A0A 0A0A0A0A