I’m trying to understand the FreeRTOS port code for the Zynq7’s Cortex A9 processor and have some questions that I could not solve on my own or by googling them:
.extern FreeRTOS_IRQ_Handler .extern FreeRTOS_SWI_Handler .section .freertos_vectors _freertos_vector_table: B _boot B FreeRTOS_Undefined ldr pc, _swi B FreeRTOS_PrefetchAbortHandler B FreeRTOS_DataAbortHandler NOP /* Placeholder for address exception vector*/ LDR PC, _irq B FreeRTOS_FIQHandler _irq: .word FreeRTOS_IRQ_Handler _swi: .word FreeRTOS_SWI_Handler
Why does the vector table use b (branch) for some entries and for others it loads an address into the PC directly? As far as I can tell, both code do the same, so why not use b for every entry? Has it something to do with storing the caller’s address to the link register?
The FreeRTOS_IRQ_Handler has this code in his first line:
FreeRTOS_IRQ_Handler: /* Return to the interrupted instruction. */ SUB lr, lr, #4
I don’t get what it does… Apparently the address in the link register is decremented by 4. What’s the effect of this code?