main.s (952B)
1 .cpu cortex-m0plus 2 .thumb 3 4 .global vectors 5 vectors: 6 .word 0x20040000 // initial SP 7 .word (reset+1) // entry point 8 9 .section .text 10 reset: 11 // unreset gpio 12 mov r0, #1 13 lsl r0, r0, #5 // io_bank0 14 ldr r3, resets_base 15 ldr r1, atomic_clr 16 str r0, [r3, r1] // RESETS: RESET 17 18 reset_chk: 19 ldr r1, [r3, #0x8] // RESETS: RESET_DONE 20 tst r0, r1 21 beq reset_chk 22 23 // set gpio functions 24 ldr r3, io_bank0_base 25 mov r0, #5 // sio 26 mov r1, #0xcc 27 str r0, [r3, r1] // IO_BANK0: GPIO25_CTRL 28 29 // enable gpio output 30 ldr r3, sio_base 31 mov r0, #1 32 lsl r0, r0, #25 // gpio25 33 str r0, [r3, #0x24] // SIO: GPIO_OE 34 35 // blink led on gpio25 36 ldr r4, sio_base 37 mov r5, r0 38 loop: 39 str r5, [r4, #0x1c] // SIO_GPIO_OUT_XOR 40 bl delay 41 b loop 42 43 delay: 44 mov r0, #1 45 lsl r0, r0, #20 46 delay_loop: 47 sub r0, r0, #1 48 bne delay_loop 49 bx lr 50 51 // literals 52 .align 2 53 atomic_clr: 54 .word 0x00003000 55 resets_base: 56 .word 0x4000c000 57 io_bank0_base: 58 .word 0x40014000 59 sio_base: 60 .word 0xd0000000 61