From 2e45d8ec65dc1b6bd39625cb86278326073708c7 Mon Sep 17 00:00:00 2001 From: andygpz11 <111971637+andygpz11@users.noreply.github.com> Date: Fri, 20 Jan 2023 15:10:01 +0000 Subject: [PATCH] Update source code to use the correct bit - fixes #993 (#1180) --- src/rp2_common/pico_runtime/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c index 70dd3bb..05197e6 100644 --- a/src/rp2_common/pico_runtime/runtime.c +++ b/src/rp2_common/pico_runtime/runtime.c @@ -54,7 +54,7 @@ void runtime_install_stack_guard(void *stack_bottom) { // mask is 1 bit per 32 bytes of the 256 byte range... clear the bit for the segment we want uint32_t subregion_select = 0xffu ^ (1u << ((addr >> 5u) & 7u)); mpu_hw->ctrl = 5; // enable mpu with background default map - mpu_hw->rbar = (addr & (uint)~0xff) | 0x8 | 0; + mpu_hw->rbar = (addr & (uint)~0xff) | M0PLUS_MPU_RBAR_VALID_BITS | 0; mpu_hw->rasr = 1 // enable region | (0x7 << 1) // size 2^(7 + 1) = 256 | (subregion_select << 8)