(ARM Cortex-A7) V3S (Lichee Pi Zero) >> Assembly

Button


參考資訊:
1. pdf

司徒將按鍵連接到PG4


GPIO位址


PG_CFG0


PG_DATA


PG_PUL0


main.s

    .global _start

    .equ GPIO_BASE, 0x01c20800
    .equ PG_CFG0,   (GPIO_BASE + (0x24 * 6) + 0x00)
    .equ PG_DATA,   (GPIO_BASE + (0x24 * 6) + 0x10)
    .equ PG_PUL0,   (GPIO_BASE + (0x24 * 6) + 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, =PG_CFG0
    ldr r1, =0x00000001
    str r1, [r0]

    ldr r0, =PG_PUL0
    ldr r1, =0x00000100
    str r1, [r0]

    ldr r0, =PG_DATA
0:
    ldr r1, [r0]
    lsr r1, #4
    str r1, [r0]
    b 0b
    .end

完成


返回上一頁