F1C200S >> Assembly

Button


參考資料:
1. pdf
2. lichee
3. mangopi_r
4. allwinner

BOOT按鍵是接到PC2


暫存器


提昇電阻


main.s

  .global _start
  
  .equiv GPIO_BASE,  0x01c20800 
  
  .equiv PA,         (0x24 * 0)
  .equiv PC,         (0x24 * 2)
  .equiv PORT_CFG0,  0x00
  .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, =0x1000
  str r1, [r0, #(PA + PORT_CFG0)]
  ldr r1, =0x08
  str r1, [r0, #(PA + PORT_DATA)]
  
  ldr r1, =0x0000
  str r1, [r0, #(PC + PORT_CFG0)]
  ldr r1, =0x10
  str r1, [r0, #(PC + PORT_PUL0)]

0: 
  ldr r1, [r0, #(PC + PORT_DATA)]
  lsl r1, #1
  str r1, [r0, #(PA + PORT_DATA)]
  b 0b
  .end

完成


返回上一頁