Other Parts Discussed in Thread: HALCOGEN
Hi,
I'm trying to port FreeRTOS 10 to the RM46, based on what is provided by Halcogen.
One of the problems I'm encountering is MPU support.
To support the MPU, we need to define the following definitions in portmacro.h
- portIS_PRIVILEGED()
- portRAISE_PRIVILEGE()
- portRESET_PRIVILEGE()
Those definitions will be used in the mpu_wrappers.c. For example:
void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ) /* FREERTOS_SYSTEM_CALL */ { if( portIS_PRIVILEGED() == pdFALSE ) { portRAISE_PRIVILEGE(); portMEMORY_BARRIER(); vTaskDelete( pxTaskToDelete ); portMEMORY_BARRIER(); portRESET_PRIVILEGE(); portMEMORY_BARRIER(); } else { vTaskDelete( pxTaskToDelete ); } }
While portRAISE_PRIVILEGE is defined in the SWI jump table, xIsPrivileged() and vResetPrivilege() are not.
The table in question, as defined in portASM.asm
;------------------------------------------------------------------------------- ; SWI Handler, interface to Protected Mode Functions .def vPortSWI .asmfunc vPortSWI stmfd sp!, {r11,r12,lr} mrs r12, spsr ands r12, r12, #0x20 ldrbne r12, [lr, #-2] ldrbeq r12, [lr, #-4] ldr r14, table ldr r12, [r14, r12, lsl #2] blx r12 ldmfd sp!, {r11,r12,pc}^ table .word jumpTable jumpTable .word swiPortYield ; 0 - vPortYieldProcessor .word swiRaisePrivilege ; 1 - xPortRaisePrivilege .word swiPortEnterCritical ; 2 - vPortEnterCritical .word swiPortExitCritical ; 3 - vPortExitCritical .word swiPortTaskUsesFPU ; 4 - vPortTaskUsesFPU .word swiPortDisableInterrupts ; 5 - vPortDisableInterrupts .word swiPortEnableInterrupts ; 6 - vPortEnableInterrupts .endasmfunc
I need help defining the assembly required to support the xIsPrivileged() and vResetPrivilege() functions.
Is the TI compiler has a SVC of some sort? A bit like :
#define portRAISE_PRIVILEGE() __asm volatile ( "svc %0 \n" ::"i" ( portSVC_RAISE_PRIVILEGE ) : "memory" );
Regards,
Gabriel