cancel
Showing results for 
Search instead for 
Did you mean: 

Access Null pointer - M4 vs M33

ari_v2
Senior

Hello,

Code that was compiled for stm32F407 ( core M4) has an bug that accesses null pointer. The assembly code is as follows:

STRB  r1, [r0, #0x01]

Where r0=0 and r1=0.

Although MCU accesses null pointer, it does not enter hard-fault.

But, the same code on stm32U585 (core M33, w/o trust zone), runs into hard-fault.

Is there a way to make the stm32U585 to behave as the stm32F407, in this aspect.

This code cannot get changed and it must run on both MCUs.

Any Ideas?

Thank you,

Ari

5 REPLIES 5

There's the FPB and you can also return from Hard Faults..

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

Thanks for reply.

Could you give me a link how to implement a safe return from hardfault for M33 core?

The LR call-gate indicates which stack frame the context is pushed on too. Check the faulting opcode, and advance the PC

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

But this means change in the code

Ok, pretty sure F4 and U5 have entirely different memory maps. I'm throwing paint in the air, hoping some of it will stick somewhere.

My guess would be there is *some* flexibility, and the issue here is some library, object or blob, where source is unavailable, then again it's not like that stuff can't get patched.

Let's say I can move the VTOR, and manipulate a vector, or two..

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