Hello,
I'm using TI-RTOS with my TivaC. i want to know how to enable the bus fault under TI-RTOS "tirtos_tivac_2_16_01_14". so whenever the bus fault happens, it will jump direct to bus fault instead of hard fault.
Thanks,
Mohamed
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I'm using TI-RTOS with my TivaC. i want to know how to enable the bus fault under TI-RTOS "tirtos_tivac_2_16_01_14". so whenever the bus fault happens, it will jump direct to bus fault instead of hard fault.
Thanks,
Mohamed
Hi,
Bus fault is at 5 while hard fault is at 3. Please also note about the fault escalation for which you may be seeing.
Usually, the exception priority, together with the values of the exception mask registers, determines
whether the processor enters the fault handler, and whether a fault handler can preempt another
fault handler as described in “Exception Model” on page 101.
In some situations, a fault with configurable priority is treated as a hard fault. This process is called
priority escalation, and the fault is described as escalated to hard fault. Escalation to hard fault
occurs when:
■ A fault handler causes the same kind of fault as the one it is servicing. This escalation to hard
fault occurs because a fault handler cannot preempt itself because it must have the same priority
as the current priority level.
■ A fault handler causes a fault with the same or lower priority as the fault it is servicing. This
situation happens because the handler for the new fault cannot preempt the currently executing
fault handler.
■ An exception handler causes a fault for which the priority is the same as or lower than the currently
executing exception.
■ A fault occurs and the handler for that fault is not enabled.
If a bus fault occurs during a stack push when entering a bus fault handler, the bus fault does not
escalate to a hard fault. Thus if a corrupted stack causes a fault, the fault handler executes even
though the stack push for the handler failed. The fault handler operates but the stack contents are
corrupted.
Thank you Charles,
but I know why the escalation is happening. what i need to know, how can change the TI-RTOS configuration to jump directly to bus fault handler?
in other words, i have the below lines in one of my tasks
void (*fun_ptr)(void) = 0;
fun_ptr();
this shall cause bus fault, but instead it jump to hard fault of type forced. while it should go to the bus fault. because i think that the bus fault is disabled. so how can i enable the bus fault from the TI-RTOS configuration .cfg?
To get this effect you would set the BUSFAULTENA bit in SCB->SHCSR (aka SYSHNDCTRL). It looks like TivaWare provides this as "IntEnable(FAULT_BUS);".
I think writing this register requires Privileged Mode; I don't know whether that's easy in TI-RTOS.
[Edit: Fixed typo.]
It occurred to me that your example (call-to-0) would more likely generate a UsageFault (Invalid instruction) than a Bus Fault. For this you would need IntEnable(FAULT_USAGE);". There's also MemManage (FAULT_MPU), though I think location 0 is executable.
[Edit: interrupt.c is here:
https://dev.ti.com/tirex/explore/node?node=AGi52D8FGr8.qMQiFH7NEg__mic1X5.__LATEST
]
Hi,
I have not heard back from you. I hope you have resolved the issue with Bruce's suggestions. I will close the thread for now. If you have some update, you can just write back to this post and the thread will automatically reopen.