[arm-gnu] GCC and NXP 1769 bare metal
James Kehl
jamesk at edmi.com.au
Fri May 25 03:40:36 UTC 2012
1) You're using -nostdlib. Why? That's why standard libraries (like libgcc for __aeabi_uldivmod, or libc/newlib for strlen) aren't being pulled in.
Note you may need to add some OS wrapper functions (like sbrk) for newlib, later - if FreeRTOS doesn't have those already.
2) Using ld directly, instead of using gcc for the final linking step, means you get to deal with all the joys of selecting the right multilib, etc. etc. Using the gcc driver is generally easier.
3) Sure FreeRTOS doesn't already have a linker file for your platform? Google suggests:
http://websvn.hylands.org/filedetails.php?repname=Projects&path=%2Ffree-rtos%2Flpc17xx%2Flpc17xx.ld&rev=318&sc=0
> -----Original Message-----
> From: arm-gnu-bounces at codesourcery.com [mailto:arm-gnu-
> bounces at codesourcery.com] On Behalf Of g4 at novadsp.com
> Sent: Friday, 25 May 2012 7:31 AM
> To: arm-gnu at codesourcery.com
> Subject: [arm-gnu] GCC and NXP 1769 bare metal
>
> Greetings.
>
> Thanks for the tooling. Invaluable.
>
> I'm trying to assemble the right spell for compiling and linking bare
> metal apps (FreeRTOS/lwip/FatFS) on the NXP 1769 using the arm-none-eabi
> compiler/linker.
>
> Currently the main problem is 'C' runtimes. By way of example the
> compilation command line arguments are (eliding is mine):
>
> arm-none-eabi-gcc.exe ./.../mmc.o -c -fmessage-length=0 -fno-builtin
> -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -MMD -MP
> -Ir:/data/...
>
> arm-none-eabi-ld -nostdlib -Map="rbmap" -Trb_debugld
> -or:/data.../rb.axf -L R:/apps/Mentor/lib/gcc/arm-none-eabi/4.6.1/thumb
>
> The problem here is that I end up with a handsome (edited) listing of
> undefined references as shown below:
>
> ./obj/system_lpc17xx.o: In function `SystemCoreClockUpdate':
> system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xb4): undefined
> reference
> to `__aeabi_uldivmod'
> system_lpc17xx.c:(.text.SystemCoreClockUpdate+0xd8): undefined
> reference
> to `__aeabi_uldivmod'
> system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x154): undefined
> reference to `__aeabi_uldivmod'
> system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x178): undefined
> reference to `__aeabi_uldivmod'
> system_lpc17xx.c:(.text.SystemCoreClockUpdate+0x1ee): undefined
> reference to `__aeabi_uldivmod'
> ./obj/system_lpc17xx.o:system_lpc17xx.c:(.text.SystemCoreClockUpdate+0
> x212):
> more undefined references to `__aeabi_uldivmod' follow
> ./obj/main.o: In function `prvTaskStatsCommand':
> main.c:(.text.prvTaskStatsCommand+0x1a): undefined reference to `strcpy'
> main.c:(.text.prvTaskStatsCommand+0x20): undefined reference to `strlen'
> ./obj/main.o: In function `prvRunTimeStatsCommand':
> main.c:(.text.prvRunTimeStatsCommand+0x1a): undefined reference to
> `strcpy'
> main.c:(.text.prvRunTimeStatsCommand+0x20): undefined reference to
> `strlen'
> ./obj/main.o: In function `prvManuallyPlaceLargeDataInAHBRAM':
> main.c:(.text.prvManuallyPlaceLargeDataInAHBRAM+0x7c): undefined
> reference to `memset'
> ./obj/spi-interface-to-sd-card.o: In function `prvWriteFilesToDisk':
> spi-interface-to-sd-card.c:(.text.prvWriteFilesToDisk+0x8c): undefined
> reference to `memset'
> ./obj/spi-interface-to-sd-card.o: In function `prvReadBackCreatedFiles':
> spi-interface-to-sd-card.c:(.text.prvReadBackCreatedFiles+0x94):
> undefined reference to `memset'
> .//obj/queue.o: In function `prvCopyDataToQueue':
> api_msg.c:(.text.err_tcp+0x3a): undefined reference to `fflush'
> api_msg.c:(.text.err_tcp+0x3e): undefined reference to `abort'
> queue.c:(.text.prvCopyDataToQueue+0x44): undefined reference to
> `memcpy'
> queue.c:(.text.prvCopyDataToQueue+0x7a): undefined reference to
> `memcpy'
>
> My first questions are these:
>
> 1. Which runtime libraries should be referenced when linking?
> 2. Linker scripts are a bit of a mystery - the NXP has 512K contiguous
> flash and 64K RAM in 2 possibly contiguous banks. Are there pro-forma
> scripts I can use?
>
> Any help greatly appreciated.
>
> ATB
>
> Jerry
>
>
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu
More information about the arm-gnu
mailing list