stm32plus
stm32plus copied to clipboard
Some examples failing to link due to missing syscalls on Debian
Using arm-none-eabi toolchain from Debian repository some examples (the first being fatfs_iterate) fail to link due to missing _write, _read, _close and _lseek implementations. This is not manifesting with ARM's GCC toolchain because they build newlib with CFLAGS_FOR_TARGET '-g -O2 -ffunction-sections -fdata-sections'.
What happens here is that DirectoryEntryIterator::calculateUnixTime ref. mktime ref. _tzset_unlocked ref. _tzset_unlocked_r ref. siscanf ref. __seofread which comes from stdio.o which also has __sread and that requires _read. If stdio.o had separate sections for all the functions, __sread wouldn't get linked in (thanks to --gc-sections).
The build can be pacified by using --specs=nosys.specs.