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.

MSP430-GCC-OPENSOURCE: Printf format string length modifier "hh" not implemented in newlib


At present, macro PRIu8 resolves to "hhu", which does not seem to be supported by newlib's printf() implementation.

The same holds valid for the other PRI*8 macros. _intsup.h defines macro __INT8 to "hh". I guess this is technically correct, as "hh" should be correct for types of width CHAR_BITS, but it breaks in conjunction with newlib.

A quick search has shown that this problem comes up on other platforms as well:

Regression with printf 8-bit format macros (

inttypes.h macro PRIu8 generates wrong format string on cortex m0 · Issue #70 · platformio/platform-atmelsam · GitHub

I realise newlib's printf() has a trimmed-down feature-set as opposed to the POSIX version and may not support "hh" length modifiers for that specific reason. In this case, I propose to have macro __INT8 resolve to "h" on the MSP430 platform. This may not be POSIX compliant, but neither is the intended recipient at present.

**Attention** This is a public forum