Skip to content

Instantly share code, notes, and snippets.

@stevej
Created June 11, 2010 04:01
Show Gist options
  • Save stevej/434027 to your computer and use it in GitHub Desktop.
Save stevej/434027 to your computer and use it in GitHub Desktop.
A simple example of doing memory-mapped IO on an ARM7 (this turns on a Red LED for a UberBoard v2)
.equiv GPIO_BASE_ADDR, 0x0E0028000
.equiv IOCLR0, GPIO_BASE_ADDR + 0x0C
.equiv IODIR0, GPIO_BASE_ADDR + 0x08
.equiv RED_LED, 1 << 18
.globl _start
_start:
ldr r1, =IODIR0
ldr r2, =RED_LED
str r2, [r1]
ldr r1, =IOCLR0
ldr r2, =RED_LED
add r2, r2, r1
str r2, [r1]
_loop:
b _loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment