commit d4782618cbd2c8cc737cba77a7fec5379b8d6bee
parent 3cb08405293f0153822e7301496fc07d15080b37
Author: Matsuda Kenji <info@mtkn.jp>
Date: Fri, 8 Mar 2024 08:01:25 +0900
move to sram bank 4
Diffstat:
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/ex3/boot2.s b/ex3/boot2.s
@@ -11,11 +11,21 @@ boot2:
blx r2
blx r0
+ // clear sram contents
+ mov r0, #0
+ ldr r3, sram_base
+ ldr r4, sram_end
+mem_clear_loop:
+ str r0, [r3, #0]
+ add r3, #4
+ cmp r3, r4
+ blt mem_clear_loop
+
// load main program to sram
ldr r0, =prog_start
ldr r1, =prog_size
mov r2, #0
- ldr r3, sram_base
+ ldr r3, sram4_base
copy:
cmp r1, r2
blt end
@@ -39,6 +49,10 @@ rom_base:
.word 0x00000000
sram_base:
.word 0x20000000
+sram4_base:
+ .word 0x20040000
+sram_end:
+ .word 0x20042000
m0plus_vtor:
.word 0xe0000000 + 0xed08
literals:
diff --git a/ex3/memmap.ld b/ex3/memmap.ld
@@ -1,7 +1,8 @@
MEMORY
{
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2m
- SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 264k
+ SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
+ SRAM4(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
}
SECTIONS
@@ -13,13 +14,13 @@ SECTIONS
} > FLASH
.text : {
*(.text)
- } > SRAM AT > FLASH
+ } > SRAM4 AT > FLASH
.data : {
*(.data)
- } > SRAM AT > FLASH
+ } > SRAM4 AT > FLASH
.rodata : {
*(.rodata)
- } > SRAM AT > FLASH
+ } > SRAM4 AT > FLASH
prog_start = LOADADDR(.text);
prog_size = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata);
}