3
votes

I'm developing a program for ARM architecture (bare metal) using a GCC cross compiler (arm-none-eabi-). To keep the code size small, I use a "--specs=nano.specs" linker flag, to link against newlib-nano. The problem I've ran into is having "long long" support in printf, i.e.:

long long int val = 1234;
pritnf("%lld", val);

Adding "-u _printf_float" linker flag does not solve this. It does cause the code size to increase by 9kB, but it only seems to be adding float support, without "long long" support. Linking against newlib (removing the "--specs=nano.specs" flag) - although does solve the issue - is not acceptable, as it causes the code size to increase by 46kB.

Are there any flags that re-enable only the "long long" support for newlib-nano version of printf?

1
Consider printing it in hex instead, which can be done by simply splitting into two uint32_ts and printing those.unwind
That's not very helpful for printing -1234LLJonathan Wakely

1 Answers

2
votes

Do not know much about newlib-nano (is it some fork?), but newlib also have no default support for long long specifiers, so may be this will help:

  • reconfigure you newlib with --enable-newlib-io-long-long flag
  • rebuild