cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault in NetxDuo crypto_libraries in External Memory

Zainulabedeen
Associate III

Hey all,

For reference I am enabling the https server using NetxDuo Stack for firmware update in my device.

Initially we were using Internal Flash but now we are interested in External Flash particularly SDRAM. I was able to boot the application code from SDRAM, however i am facing a problem, whenever i call a rest API like GET request a hardfault occurs where the stack traces shows it is originated over _nx_crypto_sha256_update() function in the nx_crypto_sha2.c file over the use the memcpy(). The strange thing is everything works with no hardfault when application work in Internal Flash.

Furthermore, I am able to run RTOS on SDRAM and i can ping my IP on ethernet as well.

Kindly someone help me out for this, i will be grateful.

Also if i should report this behavior somewhere else?

Thanks

2 REPLIES 2

Perhaps show a register dump and code at the Fault

What memory addresses is the memcpy() acting on? Is it aligned?

An effective Hard Fault dump of registers, stack and opcodes will help get some action, as would a minimally buildable project illustrating the failure.

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

The memcpy at the entry or exit?

https://github.com/STMicroelectronics/stm32-mw-netxduo/blob/db332daede217a6536daf69c6ea474c223c909b0/crypto_libraries/src/nx_crypto_sha2.c#L189

How are you allocating the memory being used to store structures?

The memcpy's are typically acting on the context's buffer when the inputs are feed in blocks other than 64 byte multiples. Perhaps instrument the calling to see the flow dynamics prior to the hard fault failure. Perhaps you can use that to extract a minimally failing test case?

Check alignment of context buffer. Is that also in SDRAM ?

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