MPU definition for SC000

My controller (SC000) allows you to use the MPU. To do this, I have to select the region number in one register, and then write the settings (size, properties) into another register.
Please, advise me how to link (convert) these settings with the settings in FreeRTOS-MPU?

Looking at this document, the programmer’s model for SC000 is same as Cortex-M0. If you want to statically program the MPU, then you can do that after boot up either by directly accessing the MPU registers or using CMSIS APIs. If you are looking for a FreeRTOS MPU port where you can have per task MPU regions, we do not have that for Cortex-M0. What do you want to achieve using MPU?

If you use the first option (static definition), how in this case link the MPU region and the space allocated for the task?

First of all, you need to define what you want to achieve. An example is -

  1. Mark all the data region as not executable to prevent code injection attacks.
  2. Mark all the code region as read only.

You can then program 2 MPU regions achieve the above.

If you want to have separate MPU regions for each task, then you need MPU support in the FreeRTOS port so that the MPU is programmed on every context switch.

What problem are you trying to solve?

I have an understanding of how to define the properties of the MPU region.
My question is how to specify in which area to allocate the privileged task. How to chain startTask with memory allocation?
There is no need to allocate a memory area every time.
Each must be task is located in its own MPU region.
Regions of MPU setup define staticly in StartUp file

Your description of the problem is not very clear. I’ll still try to answer based on my understanding of your problem.

When you create a task, 2 regions of memory are needed -

  1. Stack
  2. Task Control Block (TCB)

You can use the xTaskCreateStatic API which takes both of these memory buffer from the application and then you can place them wherever you want.

You want to have a static MPU configuration at startup and place both Stack and TCB of each task in a separate region? If so, yes, you can do so. I’d recommend again to list down the threats that you are trying to address and ensure that those are addressed by your solution.

two tasks are launched, one works with the serial port and receives jobs. the second task runs in the protected region and performs the calculations passing the results through the queue.

And are you facing any issue in this configuration?

where in task parameters I have to define location in memory? Or may be I have use wrong function to define tasks?

See the puxStackBuffer and pxTaskBuffer parameters - This page describes the FreeRTOS xTaskCreateStatic() API function which allows an RTOS task to be created using statically allocated RAM.

Perhaps I did not describe the problem very accurately. I would like the code of the protected task to be placed in a certain area of memory

You can achieve that by specifying a section for the task code and then placing it in a memory region using linker script.


void myTaskFunction( void * pvParams )  __attribute__( ( section( "protected_task" ) ) )
    /* Task definition. */

Linker Script:

    . = ALIGN(4);
    . = ALIGN(4);
  } >FLASH

Thank you a lot! Thank you a lot! Thank you a lot!