Link Issue

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=cs3isrirq=FreeRTOSIRQHandler -Xlinker –defsym=cs3isrswi=FreeRTOSSWIHandler -Xlinker -Map=RTOSDemo.map -Xlinker –gc-sections -Xlinker –allow-multiple-definition -o “ALGDemo.elf” ./StandardDemoTasks/Minimal/BlockQ.o ./StandardDemoTasks/Minimal/EventGroupsDemo.o ./StandardDemoTasks/Minimal/GenQTest.o ./StandardDemoTasks/Minimal/IntSemTest.o ./StandardDemoTasks/Minimal/PollQ.o ./StandardDemoTasks/Minimal/QPeek.o ./StandardDemoTasks/Minimal/QueueOverwrite.o ./StandardDemoTasks/Minimal/QueueSet.o ./StandardDemoTasks/Minimal/QueueSetPolling.o ./StandardDemoTasks/Minimal/TaskNotify.o ./StandardDemoTasks/Minimal/TimerDemo.o ./StandardDemoTasks/Minimal/blocktim.o ./StandardDemoTasks/Minimal/countsem.o ./StandardDemoTasks/Minimal/death.o ./StandardDemoTasks/Minimal/dynamic.o ./StandardDemoTasks/Minimal/flop.o ./StandardDemoTasks/Minimal/integer.o ./StandardDemoTasks/Minimal/recmutex.o ./StandardDemoTasks/Minimal/semtest.o ./FreeRTOSSource/portable/MemMang/heap4.o ./FreeRTOSSource/portable/GCC/ARMCA9/port.o ./FreeRTOSSource/portable/GCC/ARMCA9/portASM.o ./FreeRTOSSource/croutine.o ./FreeRTOSSource/eventgroups.o ./FreeRTOSSource/list.o ./FreeRTOSSource/queue.o ./FreeRTOSSource/tasks.o ./FreeRTOSSource/timers.o ./FreeRTOS+CLI/CLIExamples/Sample-CLI-commands.o ./FreeRTOS+CLI/CLIExamples/UARTCommandConsole.o ./FreeRTOS+CLI/FreeRTOSCLI.o ./AlteraCode/SoCSupport/cachesupport.o ./AlteraCode/SoCSupport/fpgasupport.o ./AlteraCode/SoCSupport/mmusupport.o ./AlteraCode/SoCSupport/uart0support.o ./AlteraCode/HardwareLibrary/alt16550uart.o ./AlteraCode/HardwareLibrary/altaddressspace.o ./AlteraCode/HardwareLibrary/altbridgemanager.o ./AlteraCode/HardwareLibrary/altcache.o ./AlteraCode/HardwareLibrary/altcan.o ./AlteraCode/HardwareLibrary/altclockmanager.o ./AlteraCode/HardwareLibrary/altdma.o ./AlteraCode/HardwareLibrary/altdmaprogram.o ./AlteraCode/HardwareLibrary/altecc.o ./AlteraCode/HardwareLibrary/altfpgamanager.o ./AlteraCode/HardwareLibrary/altgeneralpurposeio.o ./AlteraCode/HardwareLibrary/altglobaltmr.o ./AlteraCode/HardwareLibrary/alti2c.o ./AlteraCode/HardwareLibrary/altinterrupt.o ./AlteraCode/HardwareLibrary/altmmu.o ./AlteraCode/HardwareLibrary/altnand.o ./AlteraCode/HardwareLibrary/altqspi.o ./AlteraCode/HardwareLibrary/altresetmanager.o ./AlteraCode/HardwareLibrary/altsdmmc.o ./AlteraCode/HardwareLibrary/altspi.o ./AlteraCode/HardwareLibrary/altsystemmanager.o ./AlteraCode/HardwareLibrary/alttimers.o ./AlteraCode/HardwareLibrary/altwatchdog.o ./LEDs.o ./main.o ./mainblinky.o ./mainfull.o ./printf-stdarg.o ./regtest.o ./serial.o
c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-sbrkr.o): In function _sbrk_r': sbrkr.c:(.text+0x18): undefined reference tosbrk’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-writer.o): In function _write_r': writer.c:(.text+0x20): undefined reference towrite’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-closer.o): In function _close_r': closer.c:(.text+0x18): undefined reference toclose’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-fstatr.o): In function _fstat_r': fstatr.c:(.text+0x1c): undefined reference tofstat’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-isattyr.o): In function _isatty_r': isattyr.c:(.text+0x18): undefined reference toisatty’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-lseekr.o): In function _lseek_r': lseekr.c:(.text+0x20): undefined reference tolseek’ c:/altera/15.1/embedded/hosttools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.2/../../../../arm-altera-eabi/liblibc.a(liba-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

Link Issue

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.

Link Issue

Thanks