I'm trying to run some bare-metal code on my raspi 3. This is my first time doing any sort of bare-metal programming, so first things first I want to turn on my ACT led as a kind of hello-world type program but I can't for the life of me get it to turn on.
From what I've gathered:
- the act led is on gpio pin 47
- I need to set this pin to an output using gpio function select
- this pin is active low so to turn it on I need to clear it
My sd card is a raspbian image but I replaced the kernel.img with my own. Also the config.txt is completely empty at the moment.Below is the assembly code I'm running, my linker sets .init to be 0x8000
.section .init
.global _start
GPIO_BASE = 0x3F200000
GPFSEL4 = 0x10
GPSET1 = 0x20
GPCLR1 = 0x2C
_start:
ldr r0,=GPIO_BASE
//set ACT led to output
mov r1,#1
lsl r1,#21 //gpio 47 = 21-23
str r1,[r0,#GPFSEL4]
//turn on ACT led
mov r1,#1
lsl r1,#16
str r1,[r0,#GPCLR1]
loop:
b loop