EmbDev.net

Forum: ARM programming with GCC/GNU tools Yagarto: Cortex-m3 linked ok, Cortex-m0 not


von Kreyl L. (kreyl_l)


Rate this post
useful
not useful
I have a lot of projects with stm32f1xx CPUs (cortex-m3), all is good 
with them.
Now I decided to make project with stm32f051 (cortex-mo), and linker 
works with errors.
I have several cpp files (task is to light-up LED), they are compiled 
with no errors when any of cortex-m3 or cortex-m0 is set as mcpu.
But linker works ok with mcpu=cortex-m3 option, and with errors with 
mcpu=cortex-m0. But still linker says that job is done.
I use Yagarto with GCC v.4.7.2.
Here is output:

arm-none-eabi-g++ -T"D:\Nute\_tmp_\f0test\STM32F051R8.ld" -Xlinker 
--gc-sections -Wl,-Map,f0test.map -mcpu=cortex-m0 -mthumb -o 
"f0test.elf"  ./src/main.o  ./lib/src/stm32f0xx_rcc.o 
./lib/startup_stm32f0xx.o ./lib/system_stm32f0xx.o  ./kl_lib/kl_lib_f0.o

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
lib/crt0.o:  Conflicting CPU architectures 11/1

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: ./lib/src/stm32f0xx_rcc.o: Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: ./lib/system_stm32f0xx.o: Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb/v6m\libgcc.a(_udivsi 
3.o):  Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
lib/thumb/v6m\libc.a(lib_a-atexit.o):  Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
lib/thumb/v6m\libc.a(lib_a-fini.o):  Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
lib/thumb/v6m\libc.a(lib_a-init.o):  Unknown CPU architecture
Finished building target: f0test.elf

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
lib/thumb/v6m\libc.a(lib_a-__atexit.o):  Unknown CPU architecture

c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/ 
bin/ld.exe:  error: 
c:/yagarto/bin/../lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtend.o: 
Unknown CPU architecture

Invoking: ARM Yagarto Windows GNU Create Flash Image
arm-none-eabi-objcopy -O ihex f0test.elf  "f0test.hex"
Finished building: f0test.hex

When I use option -nostartfiles, obviously I have an error that _init() 
is not found.

What is wrong with cortex-m0? Cortex-m3 is ok with same options.
Thanks in advance!

von hp-freund (Guest)


Rate this post
useful
not useful

von Kreyl L. (kreyl_l)


Rate this post
useful
not useful
Hmm, and what can I do with these letters 3 years old? Was those patch 
not included in GCC v.4.7.2?

von Martin Thomas (Guest)


Rate this post
useful
not useful
You may try to replace -mcpu=cortex-m0 with -march=armv6-m and rebuild. 
Maybe it's just a small issue with the multilib-setting/cores-defintions 
in Yagarto but MiFi can tell more about the configuration.

The prebuild toolchains from https://launchpad.net/gcc-arm-embedded, 
http://sourceforge.net/projects/devkitpro/files/devkitARM/ or 
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ 
may also be worth a try. All of them are arm-none-eabi toolchains 
created from gcc/binutils/newlib sources very similar to Yagarto.

von Kreyl L. (kreyl_l)


Rate this post
useful
not useful
Thank you, Martin, I will try tools you mentioned.
Actually, I solved the issue by adding -nostartfiles to linker options 
and implementing empty _init() function.

von prasad (Guest)


Rate this post
useful
not useful
I am trying to build arm compiler tool chain for cortex a9 processor for 
freescale on redhat platform.. can any one suggest me the compatible 
versions of gcc lib, gcc, gnuutil along with kernel header files..

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
prasad wrote:
> I am trying to build arm compiler tool chain for cortex a9 processor for
> freescale on redhat platform.. can any one suggest me the compatible
> versions of gcc lib, gcc, gnuutil along with kernel header files..

Please open another thread if your question is not related to the 
original post. Anyway: the question implies that you are looking for an 
arm-linux cross-compiler. Information, Code and Binaries available from 
http://www.linaro.org/ should be a good starting-point.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.