SPRAD28 October 2022 AM2431 , AM2432 , AM2434 , AM2631 , AM2631-Q1 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1 , AM263P4 , AM263P4-Q1 , AM26C31 , AM26C31-EP , AM26C31M , AM26C32 , AM26C32-EP , AM26C32C , AM26C32M , AM26LS31 , AM26LS31M , AM26LS32A , AM26LS32AC , AM26LS32AM , AM26LS33A , AM26LS33A-SP , AM26LS33AM , AM26LV31 , AM26LV31E , AM26LV31E-EP , AM26LV32 , AM26LV32E , AM26LV32E-EP , AM26S10 , AM2732 , AM2732-Q1
When an abort happens, the program gets halted at the Exception Vector Table in address 0xFFFF00##:
Value of V bit | Exception vector base location |
---|---|
0 | 0x00000000 |
1 (HIVECS) | 0xFFFF0000 |
The last two nibbles in the address (0xFFFF00##) indicates the type of abort as shown.
Exception | Offset From Vector Base |
---|---|
Reset | 0x00 |
Undefined Instruction | 0x04 |
Software Interrupt | 0x08 |
Abort (prefetch) | 0x0C |
Abort (data) | 0x10 |
IRQ | 0x18 |
FIQ | 0x1C |
All exceptions end up in the address specified in the Exception Vector Table. The program execution can then branch to application-specific handlers. The branch target address differs based on the application. Two such examples are discussed below:
Void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HWiP_prefetch_abort_handler(void)
{
volatile uint32_t loop = 1;
while(loop)
;
}
There are three important Arm Cortex-R5 registers that can also be used to confirm the current state of the processor.
CPSR:
The CPSR can be used to verify the current mode of the processor. The mode bits of the CPSR register can be used to check if the current mode is Abort:
M[4:0] | Mode |
---|---|
10000 | User |
10001 | FIQ |
10010 | IRQ |
10011 | Supervisor |
10111 | Abort |
11011 | Undefined |
11111 | System |
SPSR:
The SPSR can be used to check the previous mode just before entering the exception. For example, if the processor moves from System to Abort Mode, SPSR shows the mode as “System” while CPSR shows the mode as “Abort”. The bit definitions of SPSR register are the same as that of the CPSR register.
R14 Register (Link Register):
The R14 register is used to find the actual instruction or function call that caused the synchronous abort. The actual address of the instruction that triggered the Exception is R14 - x, where “x” depends on the type of exception.
Aborts are usually unintended exceptions resulting due to invalid or unsuccessful access of memory. Some of the causes for aborts are as follows.
If the exception is confirmed to be a Data Abort, as the first step check the value of the Data Fault Status Register (DFSR) of the Cortex-R CPU. The DFSR holds status information about the last data fault.
Figure 5-1 shows the DFSR register bit assignments.
Use the “S” Bit [10] and “Status Bits” [0:3] to understand the nature of the Data Abort. For status description, see Table 5-1.
Priority | Sources | FSR[10,3:0] | FAR |
---|---|---|---|
Highest | Alignment | 0b00001 | Valid |
Background | 0b00000 | Valid | |
Permission | 0b01101 | Valid | |
Synchronous external abort | 0b01000 | Valid | |
Asynchronous external abort | 0b10110 | Unpredictable | |
Synchronous parity or ECC error | 0b11001 | Valid | |
Asynchronous parity or ECC error | 0b11000 | Unpredictable | |
Debug event | 0b00010 | Unpredictable |
SD Bit:
The SD Bit distinguishes between an AXI Decode or Slave error on an external abort. This bit is valid only for external aborts. For all other types of abort, this bit is set to zero.
RW Bit:
The RW bit indicates whether a read or write access caused the abort.