Nelson
Nelson

Reputation: 5

Creating FreeRTOS Vector table for Cortex A72

I want to port FreeRTOS to RPi4 (Cortex A72, 64-bit, ARMv8). I use this port (Cortex A72, 64-bit, ARMv8) and this port (Cortex A9, 32-bit, ARMv7) as base. In the FreeRTOS_asm_vectors.S the Software Interrupt (SWI) needs to be handled. I got In the code of A9 the SWI is already running with this code:

.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

The problem is that its 32-bit assembler. I need to change it to 64-bit assembler. My compiler says: Error: operand 1 must be an integer register -- ldr pc,_swi

but the main problem is that you cant write to pc (program counter) in ARMv8 directly. So the question is how i can write the ldr command as an ARMv8-instruction.

I read the ARMv8 reference manual (at least parts of it :) ) but cant figure it out.

UPDATE

I found out, that 64-bit vector tables are different. So how can I get the content of the code (FreeRTOS_Undefined, FreeRTOS_PrefetchAbortHandler, FreeRTOS_DataAbortHandler, FreeRTOS_FIQHandler) into the structure of Tlmada (Cortex A72, 64-bit, ARMv8):

.org 0
.text

    .globl _freertos_vector_table

.section .vectors
.balign 2048
_vector_table:

.set VBAR, _vector_table

.org VBAR
    b    _boot
.org (VBAR + 0x80)
    b    .
.org (VBAR + 0x100)
    b    .
.org (VBAR + 0x180)
    b    .

.org (VBAR + 0x200)
    b    .
.org (VBAR + 0x280)
    b    .
.org (VBAR + 0x300)
    b    .
.org (VBAR + 0x380)
    b    .

.org (VBAR + 0x400)
    b    .
.org (VBAR + 0x480)
    b    .
.org (VBAR + 0x500)
    b    .
.org (VBAR + 0x580)
    b    .

.org (VBAR + 0x600)
    b    .
.org (VBAR + 0x680)
    b    .
.org (VBAR + 0x700)
    b    .
.org (VBAR + 0x780)
    b    .

/******************************************************************************
 * Vector table to use when FreeRTOS is running.
 *****************************************************************************/
.set    FREERTOS_VBAR, (VBAR+0x1000)

.org(FREERTOS_VBAR)
_freertos_vector_table:
    b    FreeRTOS_SWI_Handler
.org (FREERTOS_VBAR + 0x80)
    b    FreeRTOS_IRQ_Handler
.org (FREERTOS_VBAR + 0x100)
    b    .
.org (FREERTOS_VBAR + 0x180)
    b    .

.org (FREERTOS_VBAR + 0x200)
    b    FreeRTOS_SWI_Handler
.org (FREERTOS_VBAR + 0x280)
    b    FreeRTOS_IRQ_Handler
.org (FREERTOS_VBAR + 0x300)
    b    .
.org (FREERTOS_VBAR + 0x380)
    b    .

.org (FREERTOS_VBAR + 0x400)
    b    .
.org (FREERTOS_VBAR + 0x480)
    b    .
.org (FREERTOS_VBAR + 0x500)
    b    .
.org (FREERTOS_VBAR + 0x580)
    b    .

.org (FREERTOS_VBAR + 0x600)
    b    .
.org (FREERTOS_VBAR + 0x680)
    b    .
.org (FREERTOS_VBAR + 0x700)
    b    .
.org (FREERTOS_VBAR + 0x780)
    b    .

.end


Can somebody point me in the right direction?

Upvotes: 0

Views: 141

Answers (0)

Related Questions