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.

TMS570LS1227: FreeRTOS MPU #defines for Cortex R4 (TMS570LS1227) and ARM R4 manual..

Expert 2025 points
Part Number: TMS570LS1227
Other Parts Discussed in Thread: HALCOGEN

I'm trying to reconcile the MPU #defines as HalCoGen generates in os_portmacro.h for the target:

#define portMPU_PRIV_NA_USER_NA_EXEC    ( 0x0000UL ) /**< Alias no access in privileged mode, no access in user mode and execute */
#define portMPU_PRIV_RW_USER_NA_EXEC    ( 0x0100UL ) /**< Alias no read/write in privileged mode, no access in user mode and execute */
#define portMPU_PRIV_RW_USER_RO_EXEC    ( 0x0200UL ) /**< Alias no read/write in privileged mode, read only in user mode and execute */
#define portMPU_PRIV_RW_USER_RW_EXEC    ( 0x0300UL ) /**< Alias no read/write in privileged mode, read/write in user mode and execute */
#define portMPU_PRIV_RO_USER_NA_EXEC    ( 0x0500UL ) /**< Alias no read only in privileged mode, no access in user mode and execute */
#define portMPU_PRIV_RO_USER_RO_EXEC    ( 0x0600UL ) /**< Alias no read only in privileged mode, read only in user mode and execute */
#define portMPU_PRIV_NA_USER_NA_NOEXEC  ( 0x1000UL ) /**< Alias no access in privileged mode, no access in user mode and no execution */
#define portMPU_PRIV_RW_USER_NA_NOEXEC  ( 0x1100UL ) /**< Alias no read/write in privileged mode, no access in user mode and no execution */
#define portMPU_PRIV_RW_USER_RO_NOEXEC  ( 0x1200UL ) /**< Alias no read/write in privileged mode, read only in user mode and no execution */
#define portMPU_PRIV_RW_USER_RW_NOEXEC  ( 0x1300UL ) /**< Alias no read/write in privileged mode, read/write in user mode and no execution */
#define portMPU_PRIV_RO_USER_NA_NOEXEC  ( 0x1500UL ) /**< Alias no read only in privileged mode, no access in user mode and no execution */
#define portMPU_PRIV_RO_USER_RO_NOEXEC  ( 0x1600UL ) /**< Alias no read only in privileged mode, read only in user mode and no execution */

with the Access Control Register from ARM R4 manual:

And say : #define portMPU_PRIV_RW_USER_RW_EXEC    ( 0x0300UL ) /**< Alias no read/write in privileged mode, read/write in user mode and execute */

that should be x300 = bits 8 & 9,  AP b011 which is Full Read/Write any mode  and exec ok.   But why does description say "Alias no read/write .. " ?

Actually there is "no" in every line, so this must be typo..

Also would like to ask:

#define portMPU_PRIV_NA_USER_NA_EXEC    ( 0x0000UL ) /**< Alias no access in privileged mode, no access in user mode and execute */
vs
#define portMPU_PRIV_NA_USER_NA_NOEXEC  ( 0x1000UL ) /**< Alias no access in privileged mode, no access in user mode and no execution */

By the macros is seems possible to have no access in any mode yet executable .. ? (the all 0s one).

On the other hand, if I wanted to have a region where privileged mode could only Read, but Unprivileged (e.g normal task not kernel) Read & Write,   how would one do it? Or this doesn't make sense ?
(Say, if i'm protecting  User mode task from Kernel ... yea that sounds bad, but let's say I do )

  • Hello,

    There are several typos in the description. Only when AP=1/2/3, the memory region can be R/W in Privileged mode, AP=5/6, it is RO in privileged mode. 

    Yes, when AP=0, the memory region is not accessible in both modes.

    From the ARM TRM, there is not this kind of setting: R/W for user mode, but RO for privileged mode.