Forum: ARM programming with GCC/GNU tools help Yagarto linking 32 bit arm code into CM4

von magnetron (Guest)

Rate this post
0 useful
not useful
hello forum,

a simple math calculation caused my STM32F4 going into hardfault

first I asked my problem at ST forum
however it turned out that my eclipse + yagarto is the cause of the 
it is linking 32 bit ARM code instead of THUMB code for my STM32F4 uC

please have a look at ;


what is your advice for me to proceed ?

thank you

von hnuneüpe (Guest)

Rate this post
0 useful
not useful
General hint (does not necessarily solve the prob):

$(ASM_OBJECTS) -lm libgcc.a

You didn't present your def of $(LD), but it smells like you are calling 
the linker directly there.

Usually it is advisable to use gcc also for the linking step,

LD = arm-none-eabi-gcc

rather than

LD = arm-none-eabi-ld

(or whatever prefix the yagarto tools are using) and then omit
the libgcc.a from the command.

The gcc compiler driver has built-in intelligence to link the
proper runtime libs - depending on the mach options it is passed.

And when specifying a lib on the command line, the usual syntax is
-lgcc to link a lib named libgcc.a (in the same way as -lm links a
lib named libm.a - the "lib" prefix and ".a" suffix are omitted ). But 
that might be handled differently between Unix and
Windows platforms.

Also have the linker produce a map file and verify that the right libs 

von Michael F. (mifi)

Rate this post
0 useful
not useful
Hello magnetron,

use this example here:

Add your code:
  float hypo2;
  int32_t XH=7,YH=8;
  hypo2= (XH*(XH*1.0) + YH*(YH*1.0));

It will work :o)
As hnuneüpe has written before, do not use the linker
direct. Use the GCC for linking too. At my page you will
find some small examples to start:

Best regards,

von magnetron (Guest)

Rate this post
0 useful
not useful

I changed this line from
-lm libgcc.a


and the error was removed

thank you for your answers

note: I was already using gcc instead of ld


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.