Linker Error in RTC001_Example1_XMC11: undefined reference to `_sbrk'

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Seems, linker-error comes from sprintf-Function.
Getting same Error with all other examples of sprintf.
It seems, there is missing a "nolibsys"-Library.
Does anyone knows the solution?
0 Likes
8 Replies
Not applicable
Hi,

Are you using DAVE 3.1.10? The Apps used in the example are older versions. Why not try to do Apps Migration 1st?

BR,
Zain
0 Likes
Not applicable
Good idea,
using 3.1.10.
make clean Project, called "noop", add Code

uint8_t data[50];
sprintf((char*)data,"My Value: %d", 123);

getting Link Error...
I think, I must not write my own '_sbrk'-function, isn't it?
rgds G.
0 Likes
Not applicable
@Zain: Message arrived.

We should close this task with the resolution:
Indeed I must migrate also the sample Projects to synchronize with the actual Version of Dave.
But sometimes it's nessecary to rebuild the complete project as described in the readme.

F.e. in this sample with sprintf, I migrate a sample project with Uart, add some lines of code to format an integer with sprintf and output to Uart.
The result is, that the application crashes after 300..600 bytes received (it depends on the format-string). Removing sprintf and output a constant string, it works.
But, build an new project with UART and sprintf-function, it works also.

@Infineon: I think, it's a good idea, to add a check in DAVE, if an imported project is from old version of DAVE and possibly will not work.

rgds
0 Likes
Not applicable
Hi,

Thanks for sharing. I agree to re-build a new project whenever possible.

BR,
Zain
0 Likes
Not applicable
Hi both,

Below are my comment and question:
1) Our development team is working very hard to adapt the example projects to the latest DAVE. The public release will be in couple of months and go by batches
2) With reference to "_sbrk" function, it has already been defined in System_LibcStubs.c
3) Does the problem of "application crashes after 300..600 bytes received" still exist? If yes, would you pls provide some more details?

Best regards,
Sophia
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi, Sophia,

Understand 1 + 2.
3.) yes. attached a very "sophisticated" project, which will (sometimes) send "Hello World" with 9600 on uart.
At the end of main.c are come comments, which line of code will cause which behavior. Without using sprintf it will run, with using sprintf it will crash.
And it will crash after different calls off sprintf (there ist also a for() around sprintf, just to call sprintf more than once.)
rgds
0 Likes
Not applicable
Hans-Jürgen,

We'd like to understand the nature of the problem before confirming a real fix. Hence, we may need a bit more information on the tools you used. For instance, the version of gcc etc.?

Best regards,
Sophia
0 Likes
Not applicable
Hi, Spohia,

I get same behavior, if destination buffer is to short. (In my sample it's 120chars, should be enough.)
I use Dave 3.1.10.

rgds
Hans-Juergen
0 Likes