Use libc within

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

cross mob
LuTa_4642501
Level 3
Level 3
Welcome!

Hi,

I need to use spritf with the demo cyfxusbdebug, but it doest compile::

tanureal@archtower $ make
make[1]: Entering directory '/media/workspace/usb_lessons/src'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-abort.o): in function `abort':
abort.c:(.text.abort+0x10): undefined reference to `_exit'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-signalr.o): in function `_kill_r':
signalr.c:(.text._kill_r+0x20): undefined reference to `_kill'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-signalr.o): in function `_getpid_r':
signalr.c:(.text._getpid_r+0x4): undefined reference to `_getpid'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-writer.o): in function `_write_r':
writer.c:(.text._write_r+0x28): undefined reference to `_write'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-fstatr.o): in function `_fstat_r':
fstatr.c:(.text._fstat_r+0x20): undefined reference to `_fstat'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-isattyr.o): in function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x28): undefined reference to `_lseek'
arm-none-eabi-ld: /opt/gcc-arm-none-eabi-9-2020-q2-update/arm-none-eabi/lib/libc.a(lib_a-readr.o): in function `_read_r':
readr.c:(.text._read_r+0x28): undefined reference to `_read'
make[1]: *** [makefile:48: main.elf] Error 1
make[1]: Leaving directory '/media/workspace/usb_lessons/src'
make: *** [makefile:2: all] Error 2

I can see the answer Using sprint() Function in EZ-USB® FX3™ - KBA90264 , but it only works for CPP applications, not plain C.

Only the GNU Linker for C++ applications has __heap_start and __heap_end definitions.

How Can I enable the use of libc functions into my plain C firmware?

0 Likes
1 Solution

Hello,

Please refer to the example project, the linker script file, and the RTOS port helper file attached with this KBA Printing Floating Values using FX3 SDK – KBA231244 and follow the steps mentioned in the Q2 .

Please let me know if it helps

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
4 Replies