-
Notifications
You must be signed in to change notification settings - Fork 12
%zu not supported by newlib's printf in Arduino_STM32 toolchain #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @fronders , Glad you got it working. How would you like to resolve this? I am happy to pin it, to make it easier for others to find and re-use your solution. Best wishes, |
fronders
added a commit
to haydenth/SparkFun_u-blox_SARA-R5_Arduino_Library
that referenced
this issue
Feb 5, 2024
This fixes sparkfun#38 When used with ARM GCC Toolchain supplied with Arduino_STM32 newlib nano version is built without C99 formats support, so the %zu format specifier doesn't work, and instead of putting the number it puts "zu" into the resulting string
Merged
Hi @PaulZC, I think the best would be to update the code to make it usable for everyone, even ARM toolchain with nano version of newlib. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
People have been reporting same problem when using newlib printf. This is what's included into Arduino STM32 toolchain and so the
%zu
format specifier doesn't work, and instead of putting the number it puts"zu"
into the resulting string.As a consequence the
getFileBlock()
just freezes and never returnsSparkFun_u-blox_SARA-R5_Arduino_Library/src/SparkFun_u-blox_SARA-R5_Arduino_Library.cpp
Lines 5602 to 5605 in d35bce3
Here's the debugger screenshot:

Changing those to
%lu
fixes the issue.UPD:
By default, the sketches use newlib nano option which passes linker flags
--specs=nano.specs
I'm usually compiling using the "newlib nano + float printf" which is
--specs=nano.specs -u _printf_float
cause I need floats support in printfs. After switching to the full-featured "newlib standard" (which doesn't pass any additional flags) the%zu
specifier worked! I assume the nano option supplied with ARM toolchain newlib is built without C99 formatting support. But I don't use it because it makes the flash size (program storage space) explode - the same sketch went from 82376 to 188208 bytes, as well as RAM went +1kB!The text was updated successfully, but these errors were encountered: