Freertos-mpu with cortex m3

Hi all, I’m developing a project with freertos-mpu v6.0.0 on STM32 (mcu based on cortex m3) with IAR 5.4 compiler.
I noticed that the parameters “portPRIVILEGE_BIT” of the function “xTaskCreateRestricted” has no effect.
Example : I created a task in user mode, but this stack is always able to access all region even the privileged one.
Please correct me if I’m wrong. Thank you in advance,
Marwa.

Freertos-mpu with cortex m3

Can you post the function call used to create the task, and the structure passed into the function call.  Thanks. Regards.

Freertos-mpu with cortex m3

Hi,
Thank you for your quick answer.
Below is the function call: static const xTaskParameters xUSARTTASKParameters =
{
prvUSARTTASKParameters,
( signed char * ) “TASK”,
configMINIMAL_STACK_SIZE,
( void * ) 0x12345678,
(tskIDLE_PRIORITY + 2 ) ,
xUSARTTASKStack,
{ /* Base address Length Parameters */
       {cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE,  portMPU_REGION_PRIVILEGED_READ_ONLY },
       { 0x00, 0x00, 0x00 },
        { 0x00, 0x00, 0x00 }
}
}; void main (void)
{
xTaskCreateRestricted( &xUSARTTASKParameters, NULL );
} static void prvUSARTTASKParameters( void *pvParameters )
{      for( ;; )
{
          
              
                cPrivilegedOnlyAccessArray = ‘a’;
}
} Your help is much appreciated,
Regards,
Mariamario.

Freertos-mpu with cortex m3

I cannot see where you are using portPRIVILEGE_BIT in this code, but presume this is because you are trying to create a User mode task, as per your original post.  Also, I cannot see where you are starting the scheduler, but assume this is just because you have cut the code out to post it here. Hang on – you said an STM32?  The only STM32 devices I know of that have an MPU are the ones that were announced last month.  Does your STM32 have an MPU at all?  That would explain the problem. Regards.

Freertos-mpu with cortex m3

Hi, Yes, my board has an MPU, I have an STM32F103ZG board.
The task I’m creating is in user mode, that’s why I didn’t put the “portPRIVILEGE_BIT”.
The problem is that despite that this task is created in user mode, it can access  the previliged regions.
the scheduler is staretd in the main function (after creating all tasks). It contains the MPU setup. Thns in advance,
Mariamario