cancel
Showing results for 
Search instead for 
Did you mean: 

How to check register instructions?

QHa.1
Associate

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!

2 REPLIES 2
SBEN .2
Senior II

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​ 

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 Venmo
Up vote any posts that you find helpful, it shows what's working..