This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137-EP: FreeRTOS: Configuring MPU

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: HALCOGEN, TMS570LS3137

Hello,

I am using TMS570LS3137 with FreeRTOS (codes are created in HALCoGen). I also use SPI and Flash Memory. I can initialize SPI or read/write flash memory before FreeRTOS scheduler starts. However, after the scheduler starts, I cannot initialize SPI, or read/write flash memory. This is because mpu is reconfigured in vTaskStartScheduler()-> xPortStartScheduler()-> prvSetupDefaultMPU(). So far I have found 2 solutions:

-Edit os_mpu_wrappers.c so that you can write functions that disables and enables mpu and switch between user mode and priviliged mode; and use these functions before and after a critical operation.

-Edit prvSetupDefaultMPU() so that you can configure which areas are accessible in user mode.

I am now focused on the second solution, and setting portPRIVILIGED_FLASH_REGION to portMPU_PRIV_RW_USER_RW_EXEC instead of portMPU_PRIV_RO_USER_NA_EXEC, I can read/write flash memory using ti_fee. However, I could not handle SPI initialization, and I don't think this is a very well solution since kernel code is also in flash memory and can be damaged.

What can I do? Any help is appreciated.

Regards,

Mary Jane