Kai Liu

Porting KL25Z from gcc-arm-embedded to codesourcery failed

Discussion created by Kai Liu on Jul 22, 2013
Latest reply on Jul 30, 2013 by Monica Arvizu

The original project comes from Andrew Payne. The code is built under gcc-arm-embedded under Linux. Now I am trying to port it to Codesourcery arm-none-eabi-gcc under Windows, because this toolchain is used by Arduino/Maple in open source projects.

 

After checking differences between two gccs, I made some changes on makefile and mkl25z4.ld, for CFLAGS.

 

During porting project between two toolchains, I got following errors during linking:

 

D:/maple-ide-0.0.12-windowsxp32/hardware/tools/arm/bin/arm-none-eabi-gcc -ffunction-sections -fdata-sections -Wall -Wa,- adhlns=demo.lst -fmessage-length=0 -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -g3 -gdwarf-2 -Os -I . -c demo.c D:/maple-ide-0.0.12-windowsxp32/hardware/tools/arm/bin/arm-none-eabi-gcc -ffunction-sections -fdata-sections -Wall -Wa,- adhlns=demo.lst -fmessage-length=0 -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -g3 -gdwarf-2 -Os -I . -T mkl25z4.ld -o demo.out demo.o libbare.a libbare.a(_startup.o): In function `_reset_init': E:\labs_codesourcery_gcc_cortex_m\bare-metal-arm-master/_startup.c:307: undefined reference to `__cs3_start_c' d:/maple-ide-0.0.12-windowsxp32/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/lib/armv 6-m\libc.a(lib_a-abort.o): In function `abort': abort.c:(.text+0xa): undefined reference to `_exit' d:/maple-ide-0.0.12-windowsxp32/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/lib/armv 6-m\libc.a(lib_a-signalr.o): In function `_getpid_r': signalr.c:(.text+0x2): undefined reference to `_getpid' d:/maple-ide-0.0.12-windowsxp32/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/lib/armv 6-m\libc.a(lib_a-lseekr.o): In function `_lseek_r': lseekr.c:(.text+0x10): undefined reference to `_lseek' collect2: ld returned 1 exit status make: *** [demo.out] Error 1 rm demo.o

 

I believe gcc-arm-embedded and codesourcery have different approaches on startup code, interrupt and exit. For example, _start() calls main() in gcc-arm-embedded, while codesourcery uses __cs3_start_c() to call main(). But it complaints as undefined reference! And indeed this symbol is not included in any *.a file.

 

Does anyone have a complete Kinetis project for Codesourcery? Thanks in advance.

Original Attachment has been moved to: bare-metal-arm-master.zip

Outcomes