rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit 62de635eef84f10d862e88771739a678f9c8de71
parent aeaf4505ba3fc32b2d2bad04e468b6e43fd04eba
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Thu, 28 Mar 2024 08:04:17 +0900

hard fault when write to the psp

Diffstat:
Mex3/main.c | 4++--
Mex3/proc.s | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ex3/main.c b/ex3/main.c @@ -52,14 +52,14 @@ main(void) { ptab.tail = &p1; p0.id = 0; - p0.r[13] = 0x200000e0; // sp + p0.r[13] = 0x20000100; // sp p0.r[14] = (unsigned int) halt; // lr p0.r[15] = (unsigned int) proc0 + 1; // pc p0.r[16] = 0; p0.next = &p1; p1.id = 1; - p1.r[13] = 0x200000e0; // sp + p1.r[13] = 0x20000200; // sp p1.r[14] = (unsigned int) halt; // lr p1.r[15] = (unsigned int) proc1 + 1; // pc p1.r[16] = 0; diff --git a/ex3/proc.s b/ex3/proc.s @@ -123,7 +123,7 @@ isr_alarm: ldr r1, [r0, #(12 * 4)] // r12 str r1, [r2, #0x10] ldr r1, [r0, #(13 * 4)] // psp - msr psp, r1 + //msr psp, r1 // hard fault ldr r1, [r0, #(14 * 4)] // lr str r1, [r2, #0x14] ldr r1, [r0, #(15 * 4)] // ReturnAddress