On 3/20/20 5:40 PM, David Sidrane wrote:
the error will crop back up if MPU support is enabled without also
performing a protected build since up_mpu.c is only included in a
protected build.
Just a heads up there are some case on some HW (imxrt, maybe the K66 for the
DMA) were the MPU is needed to enable the proper access but not in protected
build.
I've dug through the arm portion of the repo and there appear to be a
wide array of platforms affected. The solution consiss
1. For each chip, files that include mpu support need to add a
conditional to two included files
#ifdef CONFIG_ARM_MPU
# include "mpu.h"
# include "<chip>_mpuinit.h"
#endif
2. Edit the Make.defs for each chip
ifeq ($(CONFIG_ARM_MPU),y)
CMN_CSRCS += up_mpu.c
CHIP_CSRCS += stm32_mpuinit.c
endif
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += stm32_userspace.c
endif
An alternative form I found in the imxrt Make.defs (thanks for pointing
me in this direction David)
ifeq ($(CONFIG_ARM_MPU),y)
ifneq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c
endif
CHIP_CSRCS += imxrt_mpuinit.c
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += imxrt_userspace.c
endif
endif
I personally think this is harder to read, but wanted to get other's
opinions. Wrapping the <chip>_userspace.c inclusion feels unnecessary
since a protected build can only be enabled when the mpu is enabled
anyways. This block can also be split up so the inclusion of CMN and
CHIP sources don't happen together if that is preferred.
- John
CONFIDENTIALITY NOTICE: This communication may contain private, confidential
and privileged material for the sole use of the intended recipient. If you are
not the intended recipient, please delete this e-mail and any attachments
permanently.