cancel
Showing results for 
Search instead for 
Did you mean: 

Buiding C/C++ mixing project and occur hard fault - malloc is not working ? -

s-shige
Associate II
Posted on October 22, 2016 at 07:35

Hello.

I need to build C/C++ mixing project with microlib.

Building is completed but occur hardfault after loading soon.. not reached to main().

Call stack

    HardFault_Handler   -- 0x080xxxx

    malloc                       -- 0x0000000

Could you let me know how to fix this issue ?

P.S

after, I checked building withouth microlib.

the result was same but the  call stack :

    _sys_open            0x0800xxx

       freopen              0x08000xxx

       _initio              0x800xxxx

    0x000000

What is the root cause ? something wrong with my application ?

Regards

Shige

1 REPLY 1
Posted on October 22, 2016 at 16:15

Have a Hard Fault handler that can actually output diagnostic information so you can identify where/how it is failing. Then look at that code critically.

Have adequate heap for your expected allocations and constructors. Have an adequate stack for your auto/local variables. Understand your code and its footprint.

Turn off ''run to main()'' so you can debug the code before main(), ie the code in SystemInit(), and that initializing the statics.

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