Page 1 of 1

Liking error only with GCC 6.3

Posted: Wed Nov 22, 2017 6:43 pm
by Fede
Dear All,

I'm currently working with last stable version of chibios (17.6.3) and chibistudio (preview 19).

What is hapenning is that if I launch chibistudio with "Chibi Studio GCC 4.7" shortcut everything goes smooth: 0 error 0 warning.
While when I've tried to build exactly the same project with "Chibi Studio GCC 6.3" I got: 0 warning but this linker error:
...
Compiling main.c
Linking build/ch.elf
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\libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2.exe: error: ld returned 1 exit status


have you ever experienced this issue?

thanks all, cheers,
Fede

Re: Liking error only with GCC 6.3

Posted: Thu Nov 23, 2017 9:08 am
by Giovanni
Hi,

This is caused by your application calling something in the C library that requires memory allocation, the library requires an implementation of sbrk() provided by the OS.

Under /os/various there is a syscalls.c module that, if added to the project, should fix the problem. It maps sbrk() on the ChibiOS core allocator.

Giovanni

Re: Liking error only with GCC 6.3

Posted: Thu Nov 23, 2017 9:52 am
by Fede
Dear Giovanni,

Thanks it solve the issue. But, just to understand, do you know why I need to add this file only with GCC 6.3 ?

Thanks again,
Fede

Re: Liking error only with GCC 6.3

Posted: Thu Nov 23, 2017 10:16 am
by Giovanni
Probably the old compiler included stub functions, this would not mean it would work.

Giovanni