- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am completely puzzled by the above error that I get in PSOC creator 4.2. When I call the function processCommand() from main.c the linker throws an error. The function processCommand() is defined in console.c and its function prototype is in console.h. I Include console.h in main.c.
I get the following error message:
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2.exe: error: ld returned 1 exit status
The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.
I have been struggling with this and have tried several solutions from this forum. Can anyone propose a solution? I have attached my project below.
To reproduce the error, uncomment line 34 in main.c, which is: processCommand();
Solved! Go to Solution.
- Tags:
- psoc creator v4.2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I did some study about this error, and found that this error often happens when you use atof() or some functions related to the float.
So, I changed Build Settings > ARM GCC 5.4-2016... > Linker > General > Use newlib-nano Float Formatting to "True"
Then your project could be compiled.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi JS,
I had the undefined reference to sbrk in the past, too. In your project, it's defined in Cm0Start.c as a 'weak' function. This means that the linker will use a different function with the same name if defined by you. However, depending on the linker settings, the optimization process will remove a weak function, even if it should be use. I solved those issue by setting a different optimization level for the Cm0Start.c file.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I did some study about this error, and found that this error often happens when you use atof() or some functions related to the float.
So, I changed Build Settings > ARM GCC 5.4-2016... > Linker > General > Use newlib-nano Float Formatting to "True"
Then your project could be compiled.
moto