參考資料:
http://nano.lichee.pro/
https://mangopi.org/mangopi_r
按鍵A是接到PD12
暫存器
提昇電阻
main.s
.global _start .equiv GPIO_BASE, 0x01c20800 .equiv PD, (0x24 * 3) .equiv PE, (0x24 * 4) .equiv PORT_CFG0, 0x00 .equiv PORT_CFG1, 0x04 .equiv PORT_CFG2, 0x08 .equiv PORT_DATA, 0x10 .equiv PORT_PUL0, 0x1c .arm .text _start: .long 0xea000016 .byte 'e', 'G', 'O', 'N', '.', 'B', 'T', '0' .long 0, __spl_size .byte 'S', 'P', 'L', 2 .long 0, 0 .long 0, 0, 0, 0, 0, 0, 0, 0 .long 0, 0, 0, 0, 0, 0, 0, 0 _vector: b reset b . b . b . b . b . b . b . reset: ldr r0, =GPIO_BASE ldr r1, =0x100000 str r1, [r0, #(PE + PORT_CFG0)] ldr r1, =0x20 str r1, [r0, #(PE + PORT_DATA)] ldr r1, =0x0000 str r1, [r0, #(PD + PORT_CFG2)] ldr r1, =0x40 str r1, [r0, #(PD + PORT_PUL0)] 0: ldr r1, [r0, #(PD + PORT_DATA)] lsr r1, #14 str r1, [r0, #(PE + PORT_DATA)] b 0b .end
完成