I'm trying to use the bus/memory/usage fault handlers to create simple exception logs.
So I have defined the following bus/memory/usage fault handlers and enabled the corresponding register flags:
CyIntSetSysVector(CY_INT_BUS_FAULT_IRQN, faultHandler); CyIntSetSysVector(CY_INT_MEM_MANAGE_IRQN, faultHandler); CyIntSetSysVector(CY_INT_USAGE_FAULT_IRQN, faultHandler); SCB->SHCSR |= SCB_SHCSR_USGFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk | SCB_SHCSR_MEMFAULTENA_Msk; // enable Usage-/Bus-/MPU Fault
To verify the proper functioning of the bus fault handler, I've implemented the following code, according to an example project:
const uint32_t makingFault = 0u; uint32_t *ptrFault = (uint32_t *) &makingFault; *ptrFault = 100u;
However, this code does not lead to a bus or memory management fault. Is it due to the reason that there is no MPU available in PSoC5? Or did I miss something else?
Yes, your understanding is correct. Cortex M3 in PSoC5 is compiled without any MPU. The exception number for MemFault is 0x04 and it is reserved in PSoC 5LP. Please make use of available exceptions in PSoC 5LP from Table 4-2. PSoC 5LP Exceptions.