Global variable and freetos

I’m assuming the target device you are using supports MPU as the target was not specified in the question.

If that’s the case you can specify the memory regions (start address [pvBaseAddress] and length [ulLengthInBytes]) of any non-stack variables (TTLPosition and BEDPosition in your example) you need restricted access in the xRegions field of each task’s with privilege levels (ulParameters) as per each task’s requirement.

You can refer to the MPU demos (example - CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil) in the FreeRTOS/FreeRTOS/Demo folder for more information and detailed examples.

More details: FreeRTOS-MPU

1 Like