X-Git-Url: https://git.sur5r.net/?p=freertos;a=blobdiff_plain;f=FreeRTOS%2FSource%2Fportable%2FIAR%2FARM_CM33_NTZ%2Fnon_secure%2Fportasm.s;fp=FreeRTOS%2FSource%2Fportable%2FIAR%2FARM_CM33_NTZ%2Fnon_secure%2Fportasm.s;h=e7c888e7c01ac00d42fbd22f5c483fbb1c3e34c4;hp=31623f2f202f32b0847ad49474221613818e9ecd;hb=bd4279c4becad04daaeb5effbca8c4a7bce884d7;hpb=fc499288134765bbacd8c4fe78a6579b01a30587 diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s b/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s index 31623f2f2..e7c888e7c 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s +++ b/FreeRTOS/Source/portable/IAR/ARM_CM33_NTZ/non_secure/portasm.s @@ -25,6 +25,13 @@ * 1 tab == 4 spaces! */ +/* Including FreeRTOSConfig.h here will cause build errors if the header file +contains code not understood by the assembler - for example the 'extern' keyword. +To avoid errors place any such code inside a #ifdef __ICCARM__/#endif block so +the code is included in C files but excluded by the preprocessor in assembly +files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */ +#include "FreeRTOSConfig.h" + EXTERN pxCurrentTCB EXTERN vTaskSwitchContext EXTERN vPortSVCHandler_C @@ -34,8 +41,8 @@ PUBLIC vRestoreContextOfFirstTask PUBLIC vRaisePrivilege PUBLIC vStartFirstTask - PUBLIC ulSetInterruptMaskFromISR - PUBLIC vClearInterruptMaskFromISR + PUBLIC ulSetInterruptMask + PUBLIC vClearInterruptMask PUBLIC PendSV_Handler PUBLIC SVC_Handler /*-----------------------------------------------------------*/ @@ -142,15 +149,20 @@ vStartFirstTask: svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */ /*-----------------------------------------------------------*/ -ulSetInterruptMaskFromISR: - mrs r0, PRIMASK - cpsid i - bx lr +ulSetInterruptMask: + mrs r0, basepri /* r0 = basepri. Return original basepri value. */ + mov r1, #configMAX_SYSCALL_INTERRUPT_PRIORITY + msr basepri, r1 /* Disable interrupts upto configMAX_SYSCALL_INTERRUPT_PRIORITY. */ + dsb + isb + bx lr /* Return. */ /*-----------------------------------------------------------*/ -vClearInterruptMaskFromISR: - msr PRIMASK, r0 - bx lr +vClearInterruptMask: + msr basepri, r0 /* basepri = ulMask. */ + dsb + isb + bx lr /* Return. */ /*-----------------------------------------------------------*/ PendSV_Handler: @@ -175,9 +187,13 @@ PendSV_Handler: ldr r1, [r2] /* Read pxCurrentTCB. */ str r0, [r1] /* Save the new top of stack in TCB. */ - cpsid i + mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY + msr basepri, r0 /* Disable interrupts upto configMAX_SYSCALL_INTERRUPT_PRIORITY. */ + dsb + isb bl vTaskSwitchContext - cpsie i + mov r0, #0 /* r0 = 0. */ + msr basepri, r0 /* Enable interrupts. */ ldr r2, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */ ldr r1, [r2] /* Read pxCurrentTCB. */