# Link Issue

**URL:** <https://forums.freertos.org/t/link-issue/325>\
**Category:** Kernel\
**Created:** [February 4, 2016, 3:22pm UTC](https://forums.freertos.org/t/link-issue/325 "2016-02-04T15:22:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2016, 3:22pm UTC](https://forums.freertos.org/t/link-issue/325/1 "2016-02-04T15:22:13Z")

</div>

**[gary-newman](https://sourceforge.net/u/gary-newman/)** wrote on [Thursday, February 04, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/0695f314/#94de):

Hi,

I have ported the Cyclone V SOC Demo onto the Arria V Soc which is all up and working fine.

I’ve got to benchmark some code, so I thought I’d just check I could get some debug out of the serial.  
I updated printf-stdarg.c to uart0 & added + a printf to LEDs.c.  
All worked fine.

The problem came when adding a printf to main\_blinky.c  
Now the linker is failing with the following errors:

‘Building target: ALGDemo.elf’  
‘Invoking: Cross GCC Linker’  
arm-altera-eabi-gcc -Xlinker -TTEST.ld -Xlinker --defsym=\_\_cs3\_isr\_irq=FreeRTOS\_IRQ\_Handler -Xlinker --defsym=\_\_cs3\_isr\_swi=FreeRTOS\_SWI\_Handler -Xlinker -Map=RTOSDemo.map -Xlinker --gc-sections -Xlinker --allow-multiple-definition -o “ALGDemo.elf” ./Standard\_Demo\_Tasks/Minimal/BlockQ.o ./Standard\_Demo\_Tasks/Minimal/EventGroupsDemo.o ./Standard\_Demo\_Tasks/Minimal/GenQTest.o ./Standard\_Demo\_Tasks/Minimal/IntSemTest.o ./Standard\_Demo\_Tasks/Minimal/PollQ.o ./Standard\_Demo\_Tasks/Minimal/QPeek.o ./Standard\_Demo\_Tasks/Minimal/QueueOverwrite.o ./Standard\_Demo\_Tasks/Minimal/QueueSet.o ./Standard\_Demo\_Tasks/Minimal/QueueSetPolling.o ./Standard\_Demo\_Tasks/Minimal/TaskNotify.o ./Standard\_Demo\_Tasks/Minimal/TimerDemo.o ./Standard\_Demo\_Tasks/Minimal/blocktim.o ./Standard\_Demo\_Tasks/Minimal/countsem.o ./Standard\_Demo\_Tasks/Minimal/death.o ./Standard\_Demo\_Tasks/Minimal/dynamic.o ./Standard\_Demo\_Tasks/Minimal/flop.o ./Standard\_Demo\_Tasks/Minimal/integer.o ./Standard\_Demo\_Tasks/Minimal/recmutex.o ./Standard\_Demo\_Tasks/Minimal/semtest.o ./FreeRTOS\_Source/portable/MemMang/heap\_4.o ./FreeRTOS\_Source/portable/GCC/ARM\_CA9/port.o ./FreeRTOS\_Source/portable/GCC/ARM\_CA9/portASM.o ./FreeRTOS\_Source/croutine.o ./FreeRTOS\_Source/event\_groups.o ./FreeRTOS\_Source/list.o ./FreeRTOS\_Source/queue.o ./FreeRTOS\_Source/tasks.o ./FreeRTOS\_Source/timers.o ./FreeRTOS+CLI/CLI\_Examples/Sample-CLI-commands.o ./FreeRTOS+CLI/CLI\_Examples/UARTCommandConsole.o ./FreeRTOS+CLI/FreeRTOS\_CLI.o ./Altera\_Code/SoCSupport/cache\_support.o ./Altera\_Code/SoCSupport/fpga\_support.o ./Altera\_Code/SoCSupport/mmu\_support.o ./Altera\_Code/SoCSupport/uart0\_support.o ./Altera\_Code/HardwareLibrary/alt\_16550\_uart.o ./Altera\_Code/HardwareLibrary/alt\_address\_space.o ./Altera\_Code/HardwareLibrary/alt\_bridge\_manager.o ./Altera\_Code/HardwareLibrary/alt\_cache.o ./Altera\_Code/HardwareLibrary/alt\_can.o ./Altera\_Code/HardwareLibrary/alt\_clock\_manager.o ./Altera\_Code/HardwareLibrary/alt\_dma.o ./Altera\_Code/HardwareLibrary/alt\_dma\_program.o ./Altera\_Code/HardwareLibrary/alt\_ecc.o ./Altera\_Code/HardwareLibrary/alt\_fpga\_manager.o ./Altera\_Code/HardwareLibrary/alt\_generalpurpose\_io.o ./Altera\_Code/HardwareLibrary/alt\_globaltmr.o ./Altera\_Code/HardwareLibrary/alt\_i2c.o ./Altera\_Code/HardwareLibrary/alt\_interrupt.o ./Altera\_Code/HardwareLibrary/alt\_mmu.o ./Altera\_Code/HardwareLibrary/alt\_nand.o ./Altera\_Code/HardwareLibrary/alt\_qspi.o ./Altera\_Code/HardwareLibrary/alt\_reset\_manager.o ./Altera\_Code/HardwareLibrary/alt\_sdmmc.o ./Altera\_Code/HardwareLibrary/alt\_spi.o ./Altera\_Code/HardwareLibrary/alt\_system\_manager.o ./Altera\_Code/HardwareLibrary/alt\_timers.o ./Altera\_Code/HardwareLibrary/alt\_watchdog.o ./LEDs.o ./main.o ./main\_blinky.o ./main\_full.o ./printf-stdarg.o ./reg\_test.o ./serial.o  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-sbrkr.o): In function `_sbrk_r': sbrkr.c:(.text+0x18): undefined reference to `\_sbrk’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-writer.o): In function `_write_r': writer.c:(.text+0x20): undefined reference to `\_write’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-closer.o): In function `_close_r': closer.c:(.text+0x18): undefined reference to `\_close’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-fstatr.o): In function `_fstat_r': fstatr.c:(.text+0x1c): undefined reference to `\_fstat’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-isattyr.o): In function `_isatty_r': isattyr.c:(.text+0x18): undefined reference to `\_isatty’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-lseekr.o): In function `_lseek_r': lseekr.c:(.text+0x20): undefined reference to `\_lseek’  
c:/altera/15.1/embedded/host\_tools/mentor/gnu/arm/baremetal/bin/…/lib/gcc/arm-altera-eabi/4.9.2/…/…/…/…/arm-altera-eabi/lib\libc.a(lib\_a-readr.o): In function `_read_r': readr.c:(.text+0x20): undefined reference to `\_read’  
collect2.exe: error: ld returned 1 exit status  
make: \*\*\* [ALGDemo.elf] Error 1

Im at a bit of a loss as to why the linker would be satisfied by printf-stdarg.o for one C file but not with another. Any ideas would be gratefully received.

Regards

Gary

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [February 4, 2016, 4:38pm UTC](https://forums.freertos.org/t/link-issue/325/2 "2016-02-04T16:38:46Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, February 04, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/0695f314/#2500):

These are coming from the library, which is expecting the host to provide implementations of the functions that are missing. The functions should not actually be called, not by FreeRTOS or printf-stdarg.c in any case, so can be stubbed out. Just provide an implementation of the function (you can get the prototypes from the header files or a Google search) and just an infinite loop or an assert() in the functions implementations - that way if it actually does get called you will know because it will stop your code executing.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 4, 2016, 4:50pm UTC](https://forums.freertos.org/t/link-issue/325/3 "2016-02-04T16:50:34Z")

</div>

**[gary-newman](https://sourceforge.net/u/gary-newman/)** wrote on [Thursday, February 04, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/0695f314/#756b):

Thanks
