rp2040

RP2040 Programming without SDK
Log | Files | Refs

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

move vtor

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

diff --git a/ex3/boot2.s b/ex3/boot2.s @@ -1,11 +1,6 @@ .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 @@ -16,7 +11,7 @@ setup_xip: blx r2 blx r0 - ldr r0, =0x10000000 + ldr r0, =0x10010000 ldr r1, m0plus_vtor str r0, [r1, #0] // M0PLUS: VTOR ldr r1, [r0, #4] // entry point diff --git a/ex3/main.s b/ex3/main.s @@ -1,8 +1,13 @@ .cpu cortex-m0plus .thumb + .section .vectors + .global 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 diff --git a/ex3/memmap.ld b/ex3/memmap.ld @@ -1,13 +1,13 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2048k + FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 1024k + VECTORS(r): ORIGIN = 0x10010000, LENGTH = 1024k SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 264k } SECTIONS { .boot2 : { - *(.vectors) *(.boot2) . = 0x100; } > FLASH @@ -15,5 +15,9 @@ SECTIONS .text : { *(.text) } > FLASH + + .vectors : { + *(.vectors) + } > VECTORS }