rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit 0756ba9580dbea415d64cee5d98d3724ac0135a2
parent 13c96d1181684dbb12fd6a76a5c4e921f0df0826
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 24 Mar 2023 10:14:21 +0900

enable clk_peri

Diffstat:
Mmain.s | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/main.s b/main.s @@ -92,6 +92,13 @@ pll_lock: // enable clk_peri lsl r1, r1, #11 str r1, [r0, #0x48] + + // enable clk_peri + ldr r0, clocks_base + mov r1, #1 + lsl r1, r1, #11 + add r1, r1, #128 // xosc_clksrc + str r1, [r0, #0x48] // CLOCKS_CLK_PERI_CTRL // enable uart0 ldr r0, uart0_base @@ -111,8 +118,8 @@ pll_lock: str r1, [r0, #0x2c] // UART0_UARTLCR_H loop: - bl p0 - bl uart0_read + bl p2 + mov r0, #0x41 bl uart0_write b loop @@ -149,7 +156,7 @@ uart0_txff: bl p0 ldr r7, [r5, #0x18] // UART0_UARTFR and r7, r7, r6 - //bne uart0_txff + bne uart0_txff str r4, [r5, #0] // UART0_UARTDR pop {r4, r5, r6, r7, pc} @@ -202,6 +209,14 @@ p1: bl led_blink pop {pc} +p2: + // blink led on gpio22 and gpio24 + push {lr} + mov r0, #5 + lsl r0, r0, #22 + bl led_blink + pop {pc} + led_blink: push {r4, r5, lr} ldr r4, sio_base