Skip to content

Instantly share code, notes, and snippets.

@jonasdn
Last active August 11, 2020 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasdn/2507cc5b11588e2b11508f0adfa0e5ab to your computer and use it in GitHub Desktop.
Save jonasdn/2507cc5b11588e2b11508f0adfa0e5ab to your computer and use it in GitHub Desktop.
.section .text
.equ GPIO_BASE, 0x10012000 # Memory address of FE310-G002 GPIO
.equ GPIO_RED, 0x400000 # (00000000010000000000000000000000)
.global init_led
init_led:
li t0, GPIO_BASE # li: load the constant GPIO_BASE into t0
li t1, GPIO_RED # Load the constant GPIO_RED into t1
sw t1, 0x08(t0) # To enable GPIO_RED we write a 32bit word with
# the 22bit set to offset 0x08 (output_en)
sw t1, 0x40(t0) # We make the GPIO "active high", by writing
# to offset 0x40 (out_xor)
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment