Linking to _sbrk

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
A319
Posts: 48
Joined: Thu Feb 05, 2015 9:52 am
Has thanked: 2 times
Been thanked: 3 times

Linking to _sbrk

Post by A319 »

Hi,

I want to print out some data from my calculations, which I want to do with my STM32. But sbrkr.c is unable to link _sbrk.

Code: Select all

double t = 0;
while(t < 90) {
   sgp4(&m, tsince, &e, pos, vel);
   char buff[30];
   sprintf(buff, "%f %f %f %f\n", t, pos[0], pos[1], pos[2]);
   uartStartSend(&UARTD2, sizeof(buff), buff);
   t += 1;
}


Code: Select all

/home/sven/gcc-arm-none-eabi-4_8-2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2: error: ld returned 1 exit status


I've checked, that CH_CFG_USE_MEMCORE is set TRUE (See http://stackoverflow.com/questions/3244 ... 6#32446906).
I've also checked, that $(CHIBIOS)/os/various is included. (See viewtopic.php?t=630&p=6424)

Regards
Sven
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Linking to _sbrk

Post by Giovanni »

Hi,

Is syscalls.c included in the makefile? you could simply use chprintf() too.

Giovanni
A319
Posts: 48
Joined: Thu Feb 05, 2015 9:52 am
Has thanked: 2 times
Been thanked: 3 times

Re: Linking to _sbrk

Post by A319 »

No. I compared another example Makefile.

I added

Code: Select all

$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \

to CSRC

and

Code: Select all

$(CHIBIOS)/os/hal/lib/streams

to INCDIR

And it works now :)

Thanks
Sven
Post Reply