Skip to content

Commit

Permalink
Fix enabling v7M MPU too early
Browse files Browse the repository at this point in the history
See issue ARMmbed#380.

Move call to vmpu_mpu_lock() after vmpu_load_box(). This guarantees that all
RBAR/RASR registers have been written-to (by vmpu_mpu_invalidate()) before the
MPU is enabled.
  • Loading branch information
Nathan Chong committed Dec 20, 2016
1 parent 07dde17 commit b703f91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions core/vmpu/src/armv7m/vmpu_armv7m.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ void vmpu_arch_init(void)
/* Initialize static MPU regions. */
vmpu_arch_init_hw();

vmpu_mpu_lock();

/* Dump MPU configuration in debug mode. */
#ifndef NDEBUG
debug_mpu_config();
Expand Down
3 changes: 3 additions & 0 deletions core/vmpu/src/vmpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ void vmpu_init_post(void)

/* load boxes */
vmpu_load_boxes();

/* enable mpu */
vmpu_mpu_lock();
}

static int copy_box_namespace(const char *src, char *dst)
Expand Down

0 comments on commit b703f91

Please sign in to comment.