Lichee Pi Zero run program without operating system

How do I run a program on Lichee Pi Zero without an operating system(Linux).
I want to light RGB LED by control the GPIOs(PG0-2)for testing,but I do not know how to write assemble program and Makefile.
what should I do ? Help me please
this is my code, but it doesn’t work

.global _start
LDR R0,=0x01C208D8 PG control register
MOV R1,#0x00000110 Set GPIOG1,GPIO2 output mode
STR R1,[R0]
LDR R0,=0x01C208E8 PG data register
MOV R1,#0x00000000 Set low level
STR R1,[R0]

B loop

arm-linux-gnueabihf-gcc -c -o led.o led.S
arm-linux-gnueabihf-ld -Ttext 0x00 -o led.bin
(arm-linux-gnueabihf-ld -Ttext 0x2000 -o led.bin)

rm -f *.o *.bin

make TF Card command
$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
$ sudo dd if=led.bin of=/dev/sdb bs=1024 seek=8

1 Like