Skip to content

Commit

Permalink
Merge pull request #653 from jannic/issue-641
Browse files Browse the repository at this point in the history
Fix calculation of MPU RBAR value
  • Loading branch information
jannic authored Jul 20, 2023
2 parents c8935b0 + ff8f8fe commit 8a0b9fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rp2040-hal/src/multicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ fn install_stack_guard(stack_limit: *mut usize) {
let subregion_select = 0xff ^ (1 << ((addr >> 5) & 7));
unsafe {
core.MPU.ctrl.write(5); // enable mpu with background default map
core.MPU.rbar.write((addr & !0xff) | 0x8);
const RBAR_VALID: u32 = 0x10;
core.MPU.rbar.write((addr & !0xff) | RBAR_VALID);
core.MPU.rasr.write(
1 // enable region
| (0x7 << 1) // size 2^(7 + 1) = 256
Expand Down

0 comments on commit 8a0b9fc

Please sign in to comment.