Freertos-mpu with cortex m3

mariamario wrote on Thursday, April 08, 2010:

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,

rtel wrote on Thursday, April 08, 2010:

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


mariamario wrote on Thursday, April 08, 2010:

Thank you for your quick answer.
Below is the function call:

static const xTaskParameters xUSARTTASKParameters =
( signed char * ) “TASK”,
( void * ) 0x12345678,
(tskIDLE_PRIORITY + 2 ) ,
{ /* Base address Length Parameters */
       { 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,

rtel wrote on Thursday, April 08, 2010:

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.


mariamario wrote on Friday, April 09, 2010:


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,