Explanation of "exceptions.c" file

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

Explanation of "exceptions.c" file

Jump to solution
700 Views
MateoSegura413
Contributor III

Context

When creating a new project in S32 Design Studio for the S32K344 platform, a folder named Project_Settings/Startup_Code is generated, with the following files

MateoSegura413_0-1657908406097.png

In the file exceptions.c file, there are Fault Handlers defined

MateoSegura413_1-1657908633435.png

And although there's a small explanation in this link for the S32K14 in this page for the first 4 functions, I could not find anything for the bottom 5.

Question:

Perhaps this is a lack of knowledge on our end, but

- Could I get pointed in the right direction for the contents of this file? Or could someone explain what these handlers do?

- How can I find what the reason is for things like the HardFault_Handler? As it can get triggered by a lot of reasons, I'd like to find why my program got here, as well as whether the fault bit remains set after a functional reset?

 

Thanks in advance for your time and help!

 

 

0 Kudos
1 Solution
685 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @MateoSegura413,

  • All the handler functions there are weakly defined and can be redefined in you custom code or by drivers that you use.
  • The first four handlers are fault exceptions handlers and I believe is it well enough explained in the document you linked to this thread.
  • If you get a HardFault, please debug it as shown in the document. Although the K3 series has CM7 core not CM4, it is the same.
  • The last handler (undefined) is used in place of unused interrupt handlers (to detect spurious interrupt).
  • NMI (non-maskable interrupt) is exampled in the S32K3 RM rev.4. For example, Section 46.4.1.
  • For more information about the resets of the handler, refer to ARM documentation like the ARM Cortex-M7 Processor Technical Reference Manual (https://developer.arm.com/documentation/ddi0489/b/) or search it on the internet.

 

BR, Daniel

 

View solution in original post

2 Replies
686 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @MateoSegura413,

  • All the handler functions there are weakly defined and can be redefined in you custom code or by drivers that you use.
  • The first four handlers are fault exceptions handlers and I believe is it well enough explained in the document you linked to this thread.
  • If you get a HardFault, please debug it as shown in the document. Although the K3 series has CM7 core not CM4, it is the same.
  • The last handler (undefined) is used in place of unused interrupt handlers (to detect spurious interrupt).
  • NMI (non-maskable interrupt) is exampled in the S32K3 RM rev.4. For example, Section 46.4.1.
  • For more information about the resets of the handler, refer to ARM documentation like the ARM Cortex-M7 Processor Technical Reference Manual (https://developer.arm.com/documentation/ddi0489/b/) or search it on the internet.

 

BR, Daniel

 

680 Views
MateoSegura413
Contributor III

Thank you for your response @danielmartynek , this helps make things more clear.

Mateo.

0 Kudos