GCC 4.8.1 links ARM code for M0 target

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GCC 4.8.1 links ARM code for M0 target

264 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sat Sep 28 06:02:56 MST 2013
Hi,

I ran into big trouble. I installed GCC 4.8.1 yesterday.
When building a program that uses an integer divide operation, I end up with gcc linking in some code that contains ARM (32-bit) instructions.
These instructions crash the M0 of course, because that cannot be switched into ARM mode.

What command-line switch did I miss?
I link using gcc, not ld. I have to link using -lgcc because I supply -nostartfiles and -nostdlibs.
The ARM code comes out of thumb/libgcc.a
I does a mode switch by bx to an ARM integer divide function  |(

The switches
-mthumb
-mcpu=cortex-m0plus

don't make a difference. Maybe they only apply to compiling, not to linking.


Labels (1)
0 Kudos
1 Reply

254 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sun Sep 29 15:40:06 MST 2013
Found a solution:

http://gcc.gnu.org/ml/gcc-help/2012-12/msg00021.html
0 Kudos