help Yagarto linking 32 bit arm code into CM4

Guest #3098040
Rate this post
• ▲ 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 
problem
it is linking 32 bit ARM code instead of THUMB code for my STM32F4 uC

please have a look at ;

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex%5fmx%5fstm32%2fSTM32F4%20simple%20math%20calculation%20causes%20hardfault&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https%3A%2F%2Fmy%2Est%2Ecom%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex%5Fmx%5Fstm32%2FAllItems%2Easpx&currentviews=51

what is your advice for me to proceed ?

thank you
Guest #3098139
Rate this post
• ▲ useful
▼ not useful
General hint (does not necessarily solve the prob):

>$(LD) $(LDFLAGS) -T$(LINKER_SCRIPT) -o $(OUTPUT).out $(C_OBJECTS)
$(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,
i.e.

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 
are
linked.
#3098372
Rate this post
• ▲ useful
▼ not useful
Hello magnetron,

use this example here:
http://www.emb4fun.de/download/arm/examples/STM32F407Test.zip

Add your code:
1
  float hypo2;
2
  int32_t XH=7,YH=8;
3

4
  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:
http://www.emb4fun.de/arm/examples/index.html

Best regards,
Michael
Guest #3098480
Rate this post
• ▲ useful
▼ not useful
hello,

I changed this line from
>$(LD) $(LDFLAGS) -T$(LINKER_SCRIPT) -o $(OUTPUT).out $(C_OBJECTS) >$(ASM_OBJECTS) 
-lm libgcc.a

to
>$(LD) $(LDFLAGS) -T$(LINKER_SCRIPT) -o $(OUTPUT).out $(C_OBJECTS) >$(ASM_OBJECTS) 
-lm

and the error was removed

thank you for your answers

note: I was already using gcc instead of ld

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.