Skip to main content
QHa.1
Associate
July 9, 2021
Question

How to check register instructions?

  • July 9, 2021
  • 2 replies
  • 1032 views

Hey all,

I'm working on a project with the HAL removed (it interfered with otheraspects of the project), and am facing some memory issues. I've located the issue to the pc register, at address 0xf3af4804, and was wondering if it was possible to check where in the code address referring to? And if so, how to go about accessing it.

Cheers!

This topic has been closed for replies.

2 replies

SBEN .2
Visitor II
July 9, 2021

Hello @QHa.1​ ,

the PC value is not valid and wouldn't help you find the issue's real reason. You can create a break point in the hard fault handler, for example, and check the values of other registers (LR is especially of interest as it should contain the address + 1 of the calling instruction) which would be located in the stack (LR position in the stack depends on the microcontroller you're using).

Otherwise, the information you've provided is not enough to help you in any significant way.

Best regards,

@Samy BEN DAMIA​ 

Tesla DeLorean
Guru
July 9, 2021

Looks like you've branched to an invalid address, perhaps stack issues, memory corruption, etc.

Likely Hard Faulted.

Try using a Hard Fault Handler that can output actionable data to better understand the cause/source of the fault.

Instrument your code so you understand the path or sequence prior to the failure.

Add code to sanity check pointers, stack depth/usage.

Use debugger, and apply usual techniques.

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