This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28335: Inquiry Regarding uint8_t Undefined in C2000 Project

Part Number: TMS320F28335

Dear, Technical Support Engineers

I am currently working on a library project targeting TMS320F28335 using Code Composer Studio (CCS) V12.6.0.00008 and the ti-cgt-c2000_22.6.1.LTS compiler.

During the build process, I am encountering the following compilation error:

error #20: identifier "uint8_t" is undefined

The error occurs in my test code (Unit Test source).

I would like to inquire:

  1. Is it expected that uint8_t cannot be used in the current project environment?

  2. If not, what is the recommended way to use C99 standard fixed-width integer types (e.g., uint8_t) in a C2000 environment?

Additionally, I would like to know whether this issue might be related to the compiler version, the target MCU, or both.

Thank you for your assistance.

Hyeondo

  •  Hyeondo 

    C2000 architecture is 16-bit word-addressable, meaning the smallest addressable unit is 16 bits, not 8 bits.
    Hence char, short, and int are all 16 bits. You will have to use uint16_t instead of uint8_t.

    Best Regards

    Siddharth

  • Hi Siddharth,

    If I force compilation by manually defining uint8_t as typedef unsigned char uint8_t;, would this pose a significant risk during actual operation?

    Given that char is 16 bits in this environment, I am concerned that any logic relying on 8-bit overflow behavior, bit masking, or structure packing/alignment could break or behave unexpectedly.
    In this case, is it correct to assume that using uint16_t (or uint_least8_t) is the only recommended and safe practice on the C2000?

    Thanks,
    Hyeondo

  • Hyeondo 

    In general, using uint16_t  is recommended approach 

    In case , you want  to access data in 8-bit increments (bytes) within 16-bit words, primarily for handling packed byte data, you will have to use 
    "__byte" compiler intrinsic 

    For e.gL

         uint16_t my_word = 0xABCD; // 16-bit value
    
        // Read the Low Byte (LSB) -> 0x00CD
        uint16_t low_byte = __byte(&my_word, 0);
    
        // Read the High Byte (MSB) -> 0x00AB
        uint16_t high_byte = __byte(&my_word, 1);

    Best Regards

    Siddharth