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.

CCS/MSP430FR59941: Compiler option to use 32-bit variables

Part Number: MSP430FR59941

Tool/software: Code Composer Studio

Hi Team,

A customer is getting 16 bit resolution from uint32_t variables and pointers in CCS 10.0.0.010, compiler is TI v20.2.1.LTS with C11 mode. He would like to know if there is a compiler option for using the entire 32 bits?

Here are the process options: silicon=mspx, code memory model=large, data model=large and data near=none.

Is it possible to process a 32-bt integer in a 16-bit processor?

Regards,

Danilo

  • I work with 32 bits in my uint32_t-s without doing anything special. How is "resolution" being determined?

  • For one source file where this happens ...

    Danilo Austria said:
    A customer is getting 16 bit resolution from uint32_t variables and pointers

    ... please follow the directions in the article How to Submit a Compiler Test Case.  In addition, please point out the exact statement(s) where this problem occurs.  With as much detail as possible, please show the input values, the result expected, and the result actually seen.

    Thanks and regards,

    -George

  • It turns out that the issue was related to how the variable was being displayed with printf.  With previous GNU tools on linux system a %u or %d did not require a %lu or %ld to render a uint32_t as 32 bits.  When ported using Code composer the printf with just a %d or %u was truncating the value to a 16 bit value. Changing the %u to %lu resolved the issue.

  • craig Keller said:
    When ported using Code composer the printf with just a %d or %u was truncating the value to a 16 bit value. Changing the %u to %lu resolved the issue.

    inttypes.h has format specifiers which are used for portable formatting of values along different platforms where sizes of the primitive number types might differ. E.g. the PRIu32 macro is for printing uint32_t variables as decimal.

    The TI MSP430 compiler has inttypes.h.

    What is unquoted `PRIu32` in printf in C? has some background information.