cancel
Showing results for 
Search instead for 
Did you mean: 

__libc_init_array and STM32Cube hardfault

eddiemat
Associate II
Posted on May 18, 2016 at 17:18

Hello,

I'm using an STM32F373C-EVAL and both the Atollic and AC6 IDE tool.

When I try to import a project from the STM32CubeF3 V1.4.0 into both the IDE, I get a hardfault error during the __libc_init_array branch instruction.

However, if I create a new project from scratch using the STM32CubeMX, I have no problem.

What could be the problem?

#libc_init_array
3 REPLIES 3
Posted on May 19, 2016 at 00:56

Do you use C++, do you have a list of constructors to be initialized?

Review the startup file and linker script, with a merge/diff tool if required, and identify what is being initialized differently. Review the .MAP files if that helps, and any command line options passed to the compiler/linker from the makefile.

What is the address of __libc_init_array? Are you linking against the correct Thumb based library? 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
alex.shirley
Associate II

I had this same problem as well but with SW4STM32. I found that I needed to add:

-specs=nosys.specs -specs=nano.specs

to the Linker Flags

AvaTar
Lead

Perhaps you have copied startup files from one project to another ?

The startup code is quite toolchain specific and tailored to the libs provided by the toolchain, even if they look similar, and use similar/same labels.