commit 9161f03aa6a6f6628554d7559099dd73d8130721
parent 6b5151a303ab990352589a5482404ab008275301
Author: Matsuda Kenji <info@mtkn.jp>
Date: Mon, 10 Apr 2023 11:16:04 +0900
unknown bug
code stops working with only one nop inserted
Diffstat:
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/boot2/boot2.s b/boot2/boot2.s
@@ -106,7 +106,7 @@ wait_sreg:
ldr r2, =(XIP_BASE + 0x100)
ldr r3, =SRAM_BASE
- ldr r0, =0x1000
+ ldr r0, =0x100 // copy first 256 words.
sram_cpy:
ldr r1, [r2, #0]
str r1, [r3, #0]
diff --git a/mach.s b/mach.s
@@ -1,16 +1,38 @@
- .section .vectors
+.cpu cortex-m0plus
+.thumb
+
+ .section .vectors, "ax"
vectors:
.word 0x20040000 // initial SP
.word reset // entry point
- .section .text
+ .section .text, "ax"
.thumb_func
reset:
ldr r0, sram_base
ldr r0, [r0, #0]
mov sp, r0
+
+ ldr r2, =(xip_base + 0x200)
+ ldr r3, =(sram_base + 0x100)
+ //ldr r1, etext
+ //sub r1, r1, r3
+ //add r1, r1, #2
+ nop
+ ldr r0, =0x300
+sram_cpy:
+ ldr r1, [r2, #0]
+ str r1, [r3, #0]
+ add r2, r2, #0x4
+ add r3, r3, #0x4
+ sub r0, r0, #0x4
+ bne sram_cpy
+
bl main
+hang:
+ b hang
+
.global init
.thumb_func
init:
@@ -337,3 +359,6 @@ rosc_base:
sio_base:
.word 0xd0000000
+
+etext:
+ .word _etext