SDK assert results in hardfault

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

SDK assert results in hardfault

571 Views
fruitmans
Contributor II

I am developing a project with the LPC5528 and us the generate SDK code for multiple pheripherals. I created a C++ project and started coding. Since i do not use the heap i set the size of the heap to 0 in my linker configuration. During my development i had great issues when calling the SPI_MasterSetBaud function and it took me a while to figure out what was going on. During the call the MCU jumped to the hard fault handler. The case was an invalid parameter which caused a call somewhere in the assert statement. I think because somewhere in the underlaying code something goes wrong with the allocation of memory due to the heap with size 0. but i do not think it is ok for the SDK code to crash into a hardfault. Can somebody explain to me what i should expect of the assert function defined in the SDK and how i should use it without heap?

0 Kudos
1 Reply

519 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Rik,

If you use MCUXpresso IDE, there is a note in User Guide :

• A value of 0 can be entered to prevent any heap use by an application.
• Note: For semihosted printf to operate without any heap space, you must enable the
“character only” version. For Redlib, define the symbol “CR_PRINTF_CHAR” (at the
project level) and remove other semhosting defines such as CR_INTEGER_PRINTF.
Character only semihosted printf is significantly slower than the default version and may
display differently depending on your debug solution.

0 Kudos