XDK API  3.6.0
Documentation
Macros | Functions | Variables
FaultHandler.c File Reference
#include "BCDS_BSP_Board.h"
#include "stdio.h"
+ Include dependency graph for FaultHandler.c:

Macros

#define NVIC_AFSR   (*(volatile unsigned int*) (0xE000ED3Cu))
 
#define NVIC_BFAR   (*(volatile unsigned int*) (0xE000ED38u))
 
#define NVIC_BFSR   (*(volatile unsigned char*) (0xE000ED29u))
 
#define NVIC_DFSR   (*(volatile unsigned int*) (0xE000ED30u))
 
#define NVIC_HFSR   (*(volatile unsigned int*) (0xE000ED2Cu))
 
#define NVIC_MFSR   (*(volatile unsigned char*) (0xE000ED28u))
 
#define NVIC_UFSR   (*(volatile unsigned short*)(0xE000ED2Au))
 
#define SYSHND_CTRL   (*(volatile unsigned int*) (0xE000ED24u))
 

Functions

 __attribute__ ((naked))
 
void Bus_Fault_Handler (unsigned int *pulBusFaultStackAddress)
 
static void extractFaultInfo (unsigned int *pStack)
 
void Hard_Fault_Handler (unsigned int *pulHardFaultStackAddress)
 
void Mem_Fault_Handler (unsigned int *pulMemFaultStackAddress)
 
void Usage_Fault_Handler (unsigned int *pulUsageFaultStackAddress)
 

Variables

struct {
   volatile unsigned int   afsr
 
   volatile unsigned int   bfar
 
   union {
      struct {
         unsigned int   BFARVALID:1
 
         unsigned int   IBUSERR:1
 
         unsigned int   IMPREISERR:1
 
         unsigned int   PRECISERR:1
 
         unsigned int   STKERR:1
 
         unsigned int   UNSTKERR:1
 
         unsigned int   UnusedBits:2
 
      }   bits
 
      volatile unsigned int   byte
 
   }   bfsr
 
   union {
      struct {
         unsigned int   BKPT:1
 
         unsigned int   DWTTRAP:1
 
         unsigned int   EXTERNAL:1
 
         unsigned int   HALTED:1
 
         unsigned int   VCATCH:1
 
      }   bits
 
      volatile unsigned int   byte
 
   }   dfsr
 
   union {
      struct {
         unsigned int   DEBUGEVT:1
 
         unsigned int   FORCED:1
 
         unsigned int   UnusedBits:1
 
         unsigned int   UnusedBits2:28
 
         unsigned int   VECTBL:1
 
      }   bits
 
      volatile unsigned int   byte
 
   }   hfsr
 
   union {
      struct {
         unsigned char   DACCVIOL:1
 
         unsigned char   IACCVIOL:1
 
         unsigned char   MMARVALID:1
 
         unsigned char   MSTKERR:1
 
         unsigned char   MUNSTKERR:1
 
         unsigned char   UnusedBits:1
 
         unsigned char   UnusedBits2:2
 
      }   bits
 
      volatile unsigned char   byte
 
   }   mfsr
 
   struct {
      volatile unsigned int   lr
 
      volatile unsigned int   pc
 
      union {
         struct {
            unsigned int   APSR:5
 
            unsigned int   EPSR:19
 
            unsigned int   IPSR:8
 
         }   bits
 
         volatile unsigned int   byte
 
      }   psr
 
      volatile unsigned int   r0
 
      volatile unsigned int   r1
 
      volatile unsigned int   r12
 
      volatile unsigned int   r2
 
      volatile unsigned int   r3
 
   }   SavedRegs
 
   union {
      struct {
         unsigned int   BUSFAULTACT:1
 
         unsigned int   BUSFAULTENA:1
 
         unsigned int   BUSFAULTPENDED:1
 
         unsigned int   MEMFAULTACT:1
 
         unsigned int   MEMFAULTENA:1
 
         unsigned int   MEMFAULTPENDED:1
 
         unsigned int   MONITORACT:1
 
         unsigned int   PENDSVACT:1
 
         unsigned int   SVCALLACT:1
 
         unsigned int   SVCALLPENDED:1
 
         unsigned int   SYSTICKACT:1
 
         unsigned int   UnusedBits1:1
 
         unsigned int   UnusedBits2:3
 
         unsigned int   UnusedBits3:1
 
         unsigned int   USGFAULTACT:1
 
         unsigned int   USGFAULTENA:1
 
         unsigned int   USGFAULTPENDED:1
 
      }   bits
 
      volatile unsigned int   byte
 
   }   syshndctrl
 
   union {
      struct {
         unsigned short   DIVBYZERO:1
 
         unsigned short   INVPC:1
 
         unsigned short   INVSTATE:1
 
         unsigned short   NOCP:1
 
         unsigned short   UNALIGNED:1
 
         unsigned short   UNDEFINSTR:1
 
         unsigned short   UnusedBits:4
 
      }   bits
 
      volatile unsigned short   byte
 
   }   ufsr
 
HardFaultRegs
 

Detailed Description

The fault handler module can aid software developers to analyze exceptions thrown by the MCU.

This module defines a exception's handler function for each CMSIS defined fault handlers.

In case of exceptions, the hard fault exception handler will be called which will save the context into C variables which can be checked in the debugger after the exception event as the event handler blocks the application.

Note
The SCB structure from CMSIS can be monitored in the debugger to get additional information about the hard fault failure. For example, SCB->CFSR can tell what kind of exception occurred.
The module is only active in debug builds!

Release builds must be built with the NDEBUG symbol defined in the makefile.

Note
The library is specifically designed for ARM based MCUs implementing the ARM Embedded ABI.

Macro Definition Documentation

#define NVIC_AFSR   (*(volatile unsigned int*) (0xE000ED3Cu))
#define NVIC_BFAR   (*(volatile unsigned int*) (0xE000ED38u))
#define NVIC_BFSR   (*(volatile unsigned char*) (0xE000ED29u))
#define NVIC_DFSR   (*(volatile unsigned int*) (0xE000ED30u))
#define NVIC_HFSR   (*(volatile unsigned int*) (0xE000ED2Cu))
#define NVIC_MFSR   (*(volatile unsigned char*) (0xE000ED28u))
#define NVIC_UFSR   (*(volatile unsigned short*)(0xE000ED2Au))
#define SYSHND_CTRL   (*(volatile unsigned int*) (0xE000ED24u))

Function Documentation

__attribute__ ( (naked)  )

Debug function which is entered whenever an unrecoverable system fault occurs.

Parameters
pulFaultStackAddressPointer to the saved fault stack.Hard Fault exception handler

Usage Fault exception handler

BUS Fault exception handler

Memory Manager Fault exception handler

void Bus_Fault_Handler ( unsigned int *  pulBusFaultStackAddress)

+ Here is the call graph for this function:

static void extractFaultInfo ( unsigned int *  pStack)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Hard_Fault_Handler ( unsigned int *  pulHardFaultStackAddress)

+ Here is the call graph for this function:

void Mem_Fault_Handler ( unsigned int *  pulMemFaultStackAddress)

+ Here is the call graph for this function:

void Usage_Fault_Handler ( unsigned int *  pulUsageFaultStackAddress)

+ Here is the call graph for this function:

Variable Documentation

volatile unsigned int afsr
unsigned int APSR
volatile unsigned int bfar
unsigned int BFARVALID
union { ... } bfsr
struct { ... } bits
unsigned int BKPT
unsigned int BUSFAULTACT
unsigned int BUSFAULTENA
unsigned int BUSFAULTPENDED
volatile unsigned int byte
unsigned char DACCVIOL
unsigned int DEBUGEVT
union { ... } dfsr
unsigned short DIVBYZERO
unsigned int DWTTRAP
unsigned int EPSR
unsigned int EXTERNAL
unsigned int FORCED
unsigned int HALTED
struct { ... } HardFaultRegs
union { ... } hfsr
unsigned char IACCVIOL
unsigned int IBUSERR
unsigned int IMPREISERR
unsigned short INVPC
unsigned short INVSTATE
unsigned int IPSR
volatile unsigned int lr
unsigned int MEMFAULTACT
unsigned int MEMFAULTENA
unsigned int MEMFAULTPENDED
union { ... } mfsr
unsigned char MMARVALID
unsigned int MONITORACT
unsigned char MSTKERR
unsigned char MUNSTKERR
unsigned short NOCP
volatile unsigned int pc
unsigned int PENDSVACT
unsigned int PRECISERR
union { ... } psr
volatile unsigned int r0
volatile unsigned int r1
volatile unsigned int r12
volatile unsigned int r2
volatile unsigned int r3
struct { ... } SavedRegs
unsigned int STKERR
unsigned int SVCALLACT
unsigned int SVCALLPENDED
union { ... } syshndctrl
unsigned int SYSTICKACT
union { ... } ufsr
unsigned short UNALIGNED
unsigned short UNDEFINSTR
unsigned int UNSTKERR
unsigned int UnusedBits
unsigned int UnusedBits1
unsigned int UnusedBits2
unsigned int UnusedBits3
unsigned int USGFAULTACT
unsigned int USGFAULTENA
unsigned int USGFAULTPENDED
unsigned int VCATCH
unsigned int VECTBL

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:41 by doxygen 1.8.8