-
Notifications
You must be signed in to change notification settings - Fork 13
Description
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 returns
SparkFun_u-blox_SARA-R5_Arduino_Library/src/SparkFun_u-blox_SARA-R5_Arduino_Library.cpp
Lines 5602 to 5605 in d35bce3
| size_t cmd_len = filename.length() + 32; | |
| char* cmd = sara_r5_calloc_char(cmd_len); | |
| sprintf(cmd, "at+urdblock=\"%s\",%zu,%zu\r\n", filename.c_str(), offset, requested_length); | |
| sendCommand(cmd, false); |
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!