TMS570LC4357: MPU and RTOS working together issue

Hello

I use TMS570LC4357 microcontroller. I read that when I use this microcontroller with rtos, I can select how many region I want to use.

I know that In default settings, I have 3 task configurable region and 1 stack region. I can use this 3 region different every single task defination with xTaskCreateRestricted.

In practice, I’m using this default settings and I define this 3 task configurable regions with xTaskCreateRestricted. I’m trying ‘‘No Access’’ to ram memory at 0x08003000, 0x08003020 and 0x08003040 addresses. However when I look at the memory map, ı see that I can define only 2 region, 3th region isn’t defined. Why could it be.

static const xTaskParameters xTaskParameters1={
vTask1,
NULL,
128,
(1|portPRIVILEGE_BIT),
STACK1,
{
     {(void*)(STACK1), 32, portMPU_PRIV_NA_USER_NA_NOEXEC},
     {(void*)(STACK1+8), 32, portMPU_PRIV_NA_USER_NA_NOEXEC},
     {(void*)(STACK1+16), 32, portMPU_PRIV_NA_USER_NA_NOEXEC}
}
};

This is my parameters.

Ekran Alıntısı3

Best regards,
MCS

The TMS port in our download doesn’t support the MPU, but I believe TI’s fork does. Where did you get this code from?

1 Like

I made mpu settings and generate it with HalCoGen. If I select 3 task configurable region or else, tasks can use 2 or n-1.

Unfortunately I’m not familiar with the kernel port or mpu settings in HalCoGen.

Looking at this document, the MPU regions you are trying to configure do not satisfy the hardware requirements:

  • The region start address needs to be a multiple of the region size.
  • The regions size must be a power of 2.

Also, are you trying to prevent access to task’s stack? If so, I am not sure it will work as the task needs access to its stack memory. What are you trying to achieve?

Thanks.

Actually, my last address is multiple of the region size and my region size is power of 2. So ı can define 2 region this way. But 3th region isn’t working even if everything is the same. According to this settings, 3th region must work like the others.

I will protect my task stacks and I want to use effective this feature. So I want to solve this problem.

You are right.

How are you verifying that? Can you try to access any location after0x80003040 from your task?

Thanks.

Hello, I’ve tried but it worked as same

Can you elaborate on what you tried and what works? Also, can you please share the complete source file which demonstrates the issue you are facing?

Thanks.