rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit 566e5a00c4a65b8c4249cd04751c589332a34d29
parent e5f0dcfee34f861d3a26333ebe510220660c7d4b
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue, 11 Apr 2023 10:07:28 +0900

use .word instead of .equ

Diffstat:
Aboot2/boot2.bin | 0
Aboot2/boot2.o | 0
Mboot2/boot2.s | 32+++++++++++++++++++-------------
Aboot2/boot2_crc.s | 21+++++++++++++++++++++
4 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/boot2/boot2.bin b/boot2/boot2.bin Binary files differ. diff --git a/boot2/boot2.o b/boot2/boot2.o Binary files differ. diff --git a/boot2/boot2.s b/boot2/boot2.s @@ -1,21 +1,16 @@ .cpu cortex-m0plus .thumb -.equ XIP_BASE, 0x10000000 -.equ XIP_SSI_BASE, 0x18000000 -.equ SRAM_BASE, 0x20000000 -.equ PADS_QSPI_BASE, 0x40020000 -.equ PPB_BASE, 0xe0000000 boot2: push {r4, lr} - ldr r4, =PADS_QSPI_BASE + ldr r4, pads_qspi_base ldr r1, =(2 << 4 | 1) // 8mA, slew fast str r1, [r4, #0x4] // PADS_QSPI: GPIO_QSPI_SCLK // r4 should not be changed from this point on - ldr r4, =XIP_SSI_BASE + ldr r4, xip_ssi_base // set SSI standard SPI // disable SSI @@ -85,7 +80,7 @@ wait_sreg: mov r1, #0xeb // fast read quad i/o str r1, [r4, #0x60] // SSI: DR0 // continuous read is not documented in w25q16j datasheet... - // it says mode bits shoud be Fxh (x: don't care)... + // it says mode bits should be Fxh (x: don't care)... // in w2580bv datasheet, these bits are said to be 0bxx10xxxx. // why w25q16j lacks the description? mov r1, #0x20 @@ -104,8 +99,8 @@ wait_sreg: mov r1, #1 str r1, [r4, #0x8] // SSI: SSIENR - ldr r2, =(XIP_BASE + 0x100) - ldr r3, =SRAM_BASE + ldr r2, boot2_end + ldr r3, sram_base ldr r0, =0x100 // copy first 256 words. sram_cpy: ldr r1, [r2, #0] @@ -122,8 +117,8 @@ sram_cpy: beq initial_boot bx r0 initial_boot: - ldr r0, =SRAM_BASE - ldr r1, =(PPB_BASE + 0xed08) + ldr r0, sram_base + ldr r1, m0plus_vtor str r0, [r1, #0] // M0PLUS: VTOR ldr r1, [r0, #4] // entry point ldr r0, [r0, #0] // stack pointer @@ -139,7 +134,7 @@ assert_rxd_fifo_empty: pop {r1, r2, pc} wait_ssi: - // asumes that r4 is XIP_SSI_BASE + // asumes that r4 is xip_ssi_base ldr r1, [r4, #0x28] // SSI: SR mov r2, #4 // TFE tst r1, r2 @@ -149,4 +144,15 @@ wait_ssi: bne wait_ssi bx lr +boot2_end: + .word 0x10000000 + 0x100 +xip_ssi_base: + .word 0x18000000 +sram_base: + .word 0x20000000 +pads_qspi_base: + .word 0x40020000 +m0plus_vtor: + .word 0xe0000000 + 0xed08 literals: + .ltorg diff --git a/boot2/boot2_crc.s b/boot2/boot2_crc.s @@ -0,0 +1,21 @@ +.cpu cortex-m0plus +.thumb + +.section .boot2, "ax" + +.byte 0x10, 0xb5, 0x33, 0x4c, 0x34, 0x49, 0x61, 0x60, 0x2f, 0x4c, 0x00, 0x21, 0xa1, 0x60, 0x02, 0x21 +.byte 0x61, 0x61, 0x01, 0x21, 0xf0, 0x22, 0xa1, 0x50, 0x30, 0x49, 0x21, 0x60, 0x01, 0x21, 0xa1, 0x60 +.byte 0x06, 0x21, 0x21, 0x66, 0x00, 0xf0, 0x46, 0xf8, 0x21, 0x6e, 0x31, 0x21, 0x21, 0x66, 0x02, 0x21 +.byte 0x21, 0x66, 0x00, 0xf0, 0x3f, 0xf8, 0x21, 0x6e, 0x21, 0x6e, 0x05, 0x21, 0x21, 0x66, 0x21, 0x66 +.byte 0x00, 0xf0, 0x38, 0xf8, 0x21, 0x6e, 0x21, 0x6e, 0x01, 0x22, 0x11, 0x42, 0xf5, 0xd1, 0x00, 0x21 +.byte 0xa1, 0x60, 0x23, 0x49, 0x21, 0x60, 0x00, 0x21, 0x61, 0x60, 0x22, 0x49, 0xf4, 0x22, 0xa1, 0x50 +.byte 0x01, 0x21, 0xa1, 0x60, 0xeb, 0x21, 0x21, 0x66, 0x20, 0x21, 0x21, 0x66, 0x00, 0xf0, 0x22, 0xf8 +.byte 0x00, 0x21, 0xa1, 0x60, 0x1c, 0x49, 0xf4, 0x22, 0xa1, 0x50, 0x01, 0x21, 0xa1, 0x60, 0x11, 0x4a +.byte 0x12, 0x4b, 0x1a, 0x48, 0x11, 0x68, 0x19, 0x60, 0x04, 0x32, 0x04, 0x33, 0x04, 0x38, 0xf9, 0xd1 +.byte 0x10, 0xbc, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd0, 0x00, 0x47, 0x0c, 0x48, 0x0d, 0x49, 0x08, 0x60 +.byte 0x41, 0x68, 0x00, 0x68, 0x85, 0x46, 0x08, 0x47, 0x06, 0xb5, 0xa1, 0x6a, 0x08, 0x22, 0x11, 0x42 +.byte 0xfa, 0xd1, 0x06, 0xbd, 0xa1, 0x6a, 0x04, 0x22, 0x11, 0x42, 0xfb, 0xd0, 0x01, 0x22, 0x11, 0x42 +.byte 0xf8, 0xd1, 0x70, 0x47, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20 +.byte 0x00, 0x00, 0x02, 0x40, 0x08, 0xed, 0x00, 0xe0, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00 +.byte 0x00, 0x00, 0x5f, 0x00, 0x21, 0x22, 0x00, 0x00, 0x22, 0x20, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed, 0x9e, 0x56, 0xf8