.section .text .equ rst_base, 0x40020000 // Subsystems reset reg base 7.5.3 .equ rst_clr, 0x40023000 // Adding 0x3000 according 2.1.3 .equ io_bank, 0x40028000 .equ io_bank_gp25, 0x400280cc .equ sio_base, 0xd0000000 .equ big_num, 0x00f00000 // For the delay. .equ pads_base, 0x40038000 // Pad control registers base. .equ pads_set, 0x4003a000 .equ pads_clr, 0x4003b000 .equ resets_wrd, 0b100001001000000 // Bits 14 (PLL_SYS), 9 (PADS_BANK0) and 6 (IO_BANK0) .thumb_func // This makes sure that the address of start has its LSB set to signal thumb mode. .global hello_start hello_start: // Bring PLL, PADS and IO out of reset ldr r0, =rst_clr ldr r2, =resets_wrd str r2, [r0, #0] check_rst: ldr r0, =rst_base ldr r1, [r0, #0x8] // Offset to RESET_DONE from rst_base and r1, r1, r2 // Check bit 14, 9 and 6 to ensure the subsystems we care about are out of reset. cmp r1, r2 bne check_rst clocks_setup: // TODO: Configure the crystal oscilator and set it as the reference clock. // TODO: Configure the PLL and wait for it to lock. // TODO: Change the sys clock source to the PLL. configure_peripheral: // See: https://github.com/raspberrypi/pico-sdk/blob/ee68c78d0afae2b69c03ae1a72bf5cc267a2d94c/src/rp2_common/hardware_gpio/gpio.c#L38 // Set pad input and output enabled. ldr r0, =pads_set mov r2, #0b1000000 // Set bit 6 to enable input. str r2, [r0, #0x68] ldr r0, =pads_clr mov r2, #0b10000000 // Clear bit 7 to enable output. str r2, [r0, #0x68] // Set function 5 (SIO) to GPIO25 ldr r0, =io_bank_gp25 mov r1, #5 // FSEL 5 (SIO) str r1, [r0] // Remove isolation control on the pad control now that it's connected to its peripheral (SIO). ldr r0, =pads_clr mov r2, #1 // Clear bit 8 to remove isolation control. lsl r2, r2, #8 str r2, [r0, #0x68] // Enable the output ldr r0, =sio_base mov r1, #1 lsl r1, r1, #25 // Only enable gpio25 str r1, [r0, #0x38] // GPIO_OE_SET offset blink: ldr r0, =sio_base mov r1, #1 lsl r1, r1, #25 led_loop: str r1, [r0, #0x18] // GPIO_OUT_SET ldr r3, =big_num bl delay str r1, [r0, #0x20] // GPIO_OUT_CLR ldr r3, =big_num bl delay b led_loop delay: sub r3, #1 bne delay bx lr // An interrupt handler that just spins. .thumb_func .global isr_default isr_default: b isr_default