rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit e6965362328b88220647bb1b1e51b0410d8abf25
parent 605194f0e3891c5ac5441b2a9ac33760a92b633c
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sun,  9 Apr 2023 08:53:53 +0900

try to read from flash without xip

Diffstat:
Mmach.s | 28+++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/mach.s b/mach.s @@ -1,7 +1,7 @@ .section .text .global init init: - push {lr} + push {r4, r5, r6, lr} // unreset gpio and pll_sys and uart0 mov r1, #1 lsl r0, r1, #5 // io_bank0 @@ -119,18 +119,25 @@ pll_lock: lsl r1, r1, #5 str r1, [r0, #0x2c] // UART0_UARTLCR_H - mov r1, #8 - ldr r2, =0x20000000 -loop: - ldr r0, [r2, #0] + mov r4, #16 + mov r5, #0 + ldr r6, xip_ssi_base +read_loop: + str r5, [r6, #0x60] // SSI: DR0 +wait_ssi_loop: + ldr r1, [r6, #0x28] // SSI: SR + mov r2, #1 + and r1, r2 // BUSY + bne wait_ssi_loop + ldr r0, [r6, #0x60] // SSI: DR0 bl printh mov r0, #0x0A bl putchar - add r2, #4 - sub r1, #1 - bne loop + add r5, r5, #0x4 + sub r4, #1 + bne read_loop - pop {pc} + pop {r4, r5, r6, pc} unreset: // unreset subsystems specified by r0 @@ -389,6 +396,9 @@ atomic_set: atomic_clr: .word 0x00003000 +xip_ssi_base: + .word 0x18000000 + clocks_base: .word 0x40008000