Hardfault doesn't appear in debug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hardfault doesn't appear in debug

Jump to solution
541 Views
Armageddon
Contributor I

Hello,

I program on MKV56F1M0 and I want to debug a program whose role is to call a second program stored at another address of the chip.

I have two distinct projects but the second one is only to increment a variable at an address shared with the main program.

So I have :

SOFT_1 --> call --> SOFT2

SOFT_2 --> var increment --> SOFT_1

 

The problem is that when my SOFT_1 calls SOFT_2, my program returns a HardFault with an INVSTATE.

When I use the debugger in step by step with "Instruction Stepping Mode", my program enters well at the good address and increments my variable but on the other hand, if I let the program enter WITHOUT the step by step, then HardFault.

INVSTATE Indicates that the processor has tried to execute an instruction with an invalid Execution Program Status Register value. Ok... but what do I have to do to make sure this is not the case?

I don't know much about ARM so how can I debug this problem? Thank !

0 Kudos
1 Solution
499 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

I'm not very familiar with the ARM Cortex core, but I searched for keywords in the Arm Cortex-M7 Devices Generic User Guide and found: Restrictions when using PC or SP. Maybe this is the reason.

Restrictions when using PC or SP.png

By the way:
This problem seems to be related to the use of ARM Cortex. I am afraid that you can get a more accurate answer by contacting ARM's technical support.


Best Regards,
Robin

View solution in original post

0 Kudos
3 Replies
521 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will by supporting your case, I am reviewing your case, but could you elaborate further about your case?

Best regards,
Pavel

 

0 Kudos
511 Views
Armageddon
Contributor I

I think I have the beginning of a solution but I'm still trying to figure it out for now.

My SOFT_1 calls my SOFT_2 which starts at address 0x10081000. In step by step mode, everything goes well but in normal execution I have a HardFault with the PC register at 0x10081000.

The problem does not appear if I call my program at address 0x10081001. And so I try to understand what is the impact of the thumb mode and the EPSR register.

For example here is what I have at address 0x10081000:

Screenshot2.png

If I scroll up just a little bit, I get this pop:

Screenshot1.png

So I understand I shall avoid to call the address 0x10081000 and start to 0x10081001 but without explained it yet.

0 Kudos
500 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

I'm not very familiar with the ARM Cortex core, but I searched for keywords in the Arm Cortex-M7 Devices Generic User Guide and found: Restrictions when using PC or SP. Maybe this is the reason.

Restrictions when using PC or SP.png

By the way:
This problem seems to be related to the use of ARM Cortex. I am afraid that you can get a more accurate answer by contacting ARM's technical support.


Best Regards,
Robin

0 Kudos