I am trying to st GPIO 17 as an output. I am using Pi 2 model B. By searching for the base address of peripherals, I found that it is 0x3F000000. I want to write a code in assembly language, Following is my code
.section .init
.globl _start
_start:
ldr r0,=0x3F000000
mov r1,#1
lsl r1,#21
str r1, [r0,#4]
loop$:
b loop$
I have saved the above code as gpio.s and then run the following commands to assemble it and linking it
as -o gpio.o gpio.s
ld -o gpio gpio.o
But by running it through
sudo ./gpio
The program does not set pin 17 as an output?
Any help will be useful.