微處理器 - RockChip RV1103 (Luckfox Pico Mini B) - Assembly - Button



參考資訊:
https://github.com/xboot/xrock
https://github.com/trebisky/Rockchip
https://wiki.luckfox.com/luckfox-pico/luckfox-pico-quick-start/
https://github.com/steward-fu/website/releases/download/datasheet/rockchip_rv1106_rm.pdf

GPIO0位址


Input Pull-up


Input Data


Direction


main.s

    .global _start

    .equ GPIO0_BASE, 0xFF380000
    .equ GPIO1_BASE, 0xFF530000
    .equ GPIO0_IOC,  0xFF388000
    .equ GPIO1_IOC,  0xFF538000
    .equ PA_DAT_L,   0x00
    .equ PA_DAT_H,   0x04
    .equ PA_DIR_L,   0x08
    .equ PA_DIR_H,   0x0c
    .equ PA_INPUT,   0x30
    .equ PA_PULL,    0x38
    .equ PA_EXT,     0x70
       
    .arm
    .text
_start:
    ldr r4, =GPIO0_BASE
    ldr r5, =GPIO1_BASE
    ldr r6, =GPIO0_IOC
    ldr r1, =0xffff0000
    str r1, [r4, #PA_DIR_L]
    ldr r1, =0xffffffff
    str r1, [r5, #PA_DIR_L]
    ldr r1, =0xffff0000 | (1 << 8)
    str r1, [r6, #PA_PULL]

    ldr r2, =0xffff0000
0:
    ldr r1, [r4, #PA_EXT]
    lsr r1, r1, #2
    eor r1, r1, #(1 << 2)
    orr r1, r1, r2
    str r1, [r5, #PA_DAT_L]
    b 0b
    .end

完成