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 )