[En-Nut-Discussion] devnut_m3n branch linker severely broken?
Ulrich Prinz
ulrich.prinz at googlemail.com
Wed Feb 1 16:59:46 CET 2012
Hi all,
in devnut_m3n the linker setup is severely broken.
I t is impossible to link a system without big code overhead. It looks
like both, stdlib and nutos wrappers, are linked into the system.
I tried several approaches to compile a tiny bootloader that was only
6..8k in an older version of the branch and now is 14k or even bigger.
It compiled without any problems if -lnutcrt is omitted.
In the current branch state nutcrt library cannot be omitted an any
way and whole libc.a is included too.
Any trial by adding -nostdlib ended in either having nothing or having all.
That means:
Either you get
arm-none-eabi-gcc canboot.o stm32/stm32_can.o stm32/stm32_appl.o
stm32/stm32_adc.o paulus/bl_canopen.o paulus/bl_crc.o paulus/bl_user.o
paulus/bl_flash.o cmc_led.o cmc_sid.o -mcpu=cortex-m3 -mthumb
-mlittle-endian -D__CORTEX__ -g -nostartfiles -L./ -Tstm32f10x_boot.ld
-Wl,-Map=canboot.map,--cref,--no-warn-mismatch
-L../../nutbld-stm32-gcc/lib -nostdlib -Wl,-
-start-group ../../nutbld-stm32-gcc/lib/nutinit.o -lnutos -lnutdev
-lnutarch -Wl,--end-group -o canboot.elf
paulus/bl_canopen.o: In function `doCANopen':
bl_canopen.c:(.text.doCANopen+0x1b8): undefined reference to `memcpy'
bl_canopen.c:(.text.doCANopen+0x1ea): undefined reference to `memcpy'
paulus/bl_flash.o: In function `flashData':
bl_flash.c:(.text.flashData+0x22): undefined reference to `memset'
../../nutbld-stm32-gcc/lib\libnutos.a(heap.o): In function
`NutHeapRootAllocClear':
heap.c:(.text.NutHeapRootAllocClear+0x10): undefined reference to `memset'
../../nutbld-stm32-gcc/lib\libnutos.a(heap.o): In function `NutHeapRootRealloc':
heap.c:(.text.NutHeapRootRealloc+0xa0): undefined reference to `memcpy'
../../nutbld-stm32-gcc/lib\libnutos.a(heap.o): In function `NutHeapDump':
heap.c:(.text.NutHeapDump+0x12): undefined reference to `fprintf'
../../nutbld-stm32-gcc/lib\libnutos.a(thread.o): In function `GetThreadByName':
thread.c:(.text.GetThreadByName+0x12): undefined reference to `strcmp'
../../nutbld-stm32-gcc/lib\libnutos.a(timer.o): In function `NutClockSet':
timer.c:(.text.NutClockSet+0x8): undefined reference to `memset'
../../nutbld-stm32-gcc/lib\libnutos.a(confos.o): In function `NutLoadConfig':
confos.c:(.text.NutLoadConfig+0x1c): undefined reference to `memcmp'
confos.c:(.text.NutLoadConfig+0x26): undefined reference to `strcpy'
../../nutbld-stm32-gcc/lib\libnutos.a(confos.o): In function `NutSaveConfig':
confos.c:(.text.NutSaveConfig+0x10): undefined reference to `memcpy'
../../nutbld-stm32-gcc/lib\libnutarch.a(context.o): In function
`NutThreadCreate':
context.c:(.text.NutThreadCreate+0x46): undefined reference to `memcpy'
../../nutbld-stm32-gcc/lib\libnutarch.a(stm32_flash.o): In function
`Stm32FlashRead':
stm32_flash.c:(.text.Stm32FlashRead+0x2): undefined reference to `memcpy'
../../nutbld-stm32-gcc/lib\libnutarch.a(stm32_flash.o): In function
`Stm32FlashWrite':
stm32_flash.c:(.text.Stm32FlashWrite+0x7a): undefined reference to `memcpy'
stm32_flash.c:(.text.Stm32FlashWrite+0x96): undefined reference to `memcpy'
../../nutbld-stm32-gcc/lib\libnutarch.a(stm32_flash.o):stm32_flash.c:(.text.Stm32FlashWrite+0xa0):
more undefined references to `memcpy' follow
../../nutbld-stm32-gcc/lib\libnutarch.a(stm32_flash.o): In function
`Stm32FlashParamWrite':
stm32_flash.c:(.text.Stm32FlashParamWrite+0x2c): undefined reference to `memcmp'
collect2: ld returned 1 exit status
make: *** [canboot.elf] Error 1
Or you get
LDFLAGS:
-mcpu=cortex-m3 -mthumb -mlittle-endian -D__CORTEX__ -g -nostartfiles
-L./ -Tstm32f10x_boot.ld -Wl,-Map=canboot.map,--cr
ef,--no-warn-mismatch -L../../nutbld-stm32-gcc/lib
**************************************************
arm-none-eabi-gcc canboot.o stm32/stm32_can.o stm32/stm32_appl.o
stm32/stm32_adc.o paulus/bl_canopen.o paulus/bl_crc.o paulus/bl_user.o
paulus/bl_flash.o cmc_led.o cmc_sid.o -mcpu=cortex-m3 -mthumb
-mlittle-endian -D__CORTEX__ -g -nostartfiles -L./ -Tstm32f10x_boot.ld
-Wl,-Map=canboot.map,--cref,--no-warn-mismatch
-L../../nutbld-stm32-gcc/lib -Wl,--start-group
../../nutbld-stm32-gcc/lib/nutinit.o -lnutos -lnutdev -lnutarch
-Wl,--end-group -o canboot.elf
c:/programme/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.0/../../../../arm-none-eabi/bin/ld.exe:
canboot.elf section `.text' will not fit in region `FLASH0'
c:/programme/yagarto/bin/../lib/gcc/arm-none-eabi/4.6.0/../../../../arm-none-eabi/bin/ld.exe:
region `FLASH0' overflowed by 5616 bytes
collect2: ld returned 1 exit status
make: *** [canboot.elf] Error 1
Our you get
lots of missing _fopen() _fwrite() _sbrk_r()... of the newlib.
I actually have no idea of how to fix that... I tried comparision of
the different versions but do not find the modification that is the
cause for this.
Best regards
Ulrich
More information about the En-Nut-Discussion
mailing list