rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit e85f14c88403da72c4974ac32269c0961ae43ebd
parent cbccaeed3ea148f27be286115e930bdb67a9df45
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 23 Feb 2024 09:17:46 +0900

move vtor to 0x10000000

Diffstat:
Mex3/boot2.s | 9++++++---
Mex3/main.s | 12++++++------
Mex3/memmap.ld | 2+-
3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/ex3/boot2.s b/ex3/boot2.s @@ -1,6 +1,11 @@ .cpu cortex-m0plus .thumb + .section .vectors +vectors: // this should be placed at 0x10000000 + .word 0x20040000 // initial SP + .word (reset+1) // entry point + .section .boot2 setup_xip: ldr r3, rom_base @@ -11,7 +16,7 @@ setup_xip: blx r2 blx r0 - ldr r0, flash_main + ldr r0, =0x10000000 ldr r1, m0plus_vtor str r0, [r1, #0] // M0PLUS: VTOR ldr r1, [r0, #4] // entry point @@ -22,8 +27,6 @@ setup_xip: .align 2 rom_base: .word 0x00000000 -flash_main: - .word 0x10000000 + 0x100 m0plus_vtor: .word 0xe0000000 + 0xed08 literals: diff --git a/ex3/main.s b/ex3/main.s @@ -1,12 +1,8 @@ .cpu cortex-m0plus .thumb - .section .vectors -vectors: - .word 0x20040000 // initial SP - .word (reset+1) // entry point - .section .text + .global reset reset: // unreset gpio, pll_sys, uart0 ldr r0, =(1 << 22 | 1 << 12 | 1 << 5) // uart0 | pll_sys | io_bank0 @@ -90,7 +86,11 @@ wait_vco: // set systick timer ldr r3, ppb_base - ldr r0, =0xffffff + // clear count + ldr r1, =0xe018 + str r0, [r3, r1] // M0PLUS: SYST_CVR + // set reset value + ldr r0, =0xf423f // 1 sec ldr r1, =0xe014 str r0, [r3, r1] // M0PLUS: SYST_RVR // enable systick timer diff --git a/ex3/memmap.ld b/ex3/memmap.ld @@ -7,12 +7,12 @@ MEMORY SECTIONS { .boot2 : { + *(.vectors) *(.boot2) . = 0x100; } > FLASH .text : { - *(.vectors) *(.text) } > FLASH }