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.
我正在尝试将 MPU #defines 调和为 HalCoGen 在 os_portmacro.h 中为目标生成的:
#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 */
使用 ARM R4中的访问控制寄存器手册:
然后说: #define portMPU_PRIV_RW_USER_RW_EXEC (0x0300UL)/**<在特权模式下不能读取/写入别名,在用户模式下读取/写入并执行*/
应为 X300 =位8和9、 AP b011、这是完全读取/写入任何模式 且执行正常。 但为什么描述中会显示“别名不可读/写…… "?
实际上每行都有"否"、因此这必须是拼写错误。
还想问:
#define portMPU_PRIV_NA_USER_NA_EXEC (0x0000UL)/**<在特权模式下无访问权限、在用户模式下无访问权限并执行*/
与
#define portMPU_PRIV_NA_USER_NA_NOexec ( 0x1000UL )/**<别名:在特权模式下无访问权限,在用户模式下无访问权限,不执行*/
根据,在任何模式下,宏似乎都不能访问,但仍可执行。 ? (全0 1)。
另一方面、如果我想拥有特权模式只能读取、但非特权(例如、正常任务不是内核)读取和写入的区域、 人们该怎么做? 或者这毫无意义吗?
(例如,如果我要保护 用户模式任务不受内核的影响... 是的,这听起来很糟糕,但假设我确实这么做了)
您好!
描述中有几个拼写错误。 仅当 AP=1/2/3时、存储器区域在特权模式下可为 R/W、AP=5/6、在特权模式下为 RO。
是的、当 AP=0时、两种模式下都无法访问存储器区域。
从 ARM TRM 中、不存在这种 设置:用户模式为 R/W、特权模式为 RO。