Skip to main content
ari_v2
Senior
October 6, 2022
Question

Access Null pointer - M4 vs M33

  • October 6, 2022
  • 5 replies
  • 1710 views

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

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
October 6, 2022

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

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ari_v2
ari_v2Author
Senior
October 6, 2022

Thanks for reply.

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

Tesla DeLorean
Guru
October 6, 2022

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Pavel A.
October 7, 2022

But this means change in the code