I'm currently using ChibiStudio19 with GCC 6.3 and RT 17.6.0 on a STM32F765
When I try to use C++ classes like std::string and std::vector, I get the linker error:
Code: Select all
c:/chibistudio/tools/gnu tools arm embedded/6.3 2017q1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv5/hard\libg.a(lib_a-fini.o): In function `__libc_fini_array':
fini.c:(.text.__libc_fini_array+0x26): undefined reference to `_fini'
collect2.exe: error: ld returned 1 exit status
From what I gather, _fini() is run after main() which doesn't normally happen with a microcontroller. I can work around this by adding:
Code: Select all
__attribute__((used))
void _fini(void) { }
In syscalls.c. Is this the correct way to handle this? Are there any potential problems with this approach.
Thanks!