diff options
| author | pennae <[email protected]> | 2023-07-20 16:08:59 +0200 |
|---|---|---|
| committer | pennae <[email protected]> | 2023-07-20 16:08:59 +0200 |
| commit | 4d6b3c57b1a0b99409cae743a102408f23ca828b (patch) | |
| tree | b521315db71e0030d47f3010ac385055fd7a2013 | |
| parent | 3382ca1a5429504c56c360e99ec09f4f641948a2 (diff) | |
rp: fix multicore stack guard setup
the region field of the register is four bits wide followed by the valid
bit that causes the rnr update we rely on for the rasr write. 0x08 is
just a bit short to reach the valid bit, and since rp2040 has only 8
regions it (at best) doesn't do anything at all.
| -rw-r--r-- | embassy-rp/src/multicore.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs index 468e8470a..89a2680ad 100644 --- a/embassy-rp/src/multicore.rs +++ b/embassy-rp/src/multicore.rs | |||
| @@ -74,7 +74,7 @@ fn install_stack_guard(stack_bottom: *mut usize) { | |||
| 74 | let subregion_select = 0xff ^ (1 << ((addr >> 5) & 7)); | 74 | let subregion_select = 0xff ^ (1 << ((addr >> 5) & 7)); |
| 75 | unsafe { | 75 | unsafe { |
| 76 | core.MPU.ctrl.write(5); // enable mpu with background default map | 76 | core.MPU.ctrl.write(5); // enable mpu with background default map |
| 77 | core.MPU.rbar.write((addr & !0xff) | 0x8); | 77 | core.MPU.rbar.write((addr & !0xff) | (1 << 4)); // set address and update RNR |
| 78 | core.MPU.rasr.write( | 78 | core.MPU.rasr.write( |
| 79 | 1 // enable region | 79 | 1 // enable region |
| 80 | | (0x7 << 1) // size 2^(7 + 1) = 256 | 80 | | (0x7 << 1) // size 2^(7 + 1) = 256 |
