各位大佬好,我最近也在研究H616这款Soc,我是刚开始学习汇编的,想在板子上用汇编跑LED裸机程序,尝试了很多遍led都没反应。大佬帮忙看一下,谢谢
这是LED点灯的代码:myStart.S
.global _start
_start :
b reset
reset :
bl gpio_init
bl led_on
loop :
b loop
gpio_init :
ldr x15,=0x0300B04C
ldr w16,=0x77177777
str w16,[x15]
ldr x15,=0x0300B064 //pull up
ldr w16,=0x01000000
str w16,[x15]
ret
led_on :
ldr x15,=0x0300B058 //set 1
ldr w16,=0x00002000
str w16,[x15]
ret
链接脚本 mystart.lds
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
. = 0x00020060;
. = ALIGN(8);
.text :
{
myStart.o(.text*)
*(.text*)
}
. = ALIGN(8);
.data : {
*(.data*)
}
. = ALIGN(8);
.bss :
{
*(.bss*)
}
}
Makefile
AS = aarch64-linux-gnu-as
CC = aarch64-linux-gnu-gcc
LD = aarch64-linux-gnu-ld
OBJCOPY = aarch64-linux-gnu-objcopy
all : myStart.o
$(LD) -Tmystart.lds -o myStart.elf $^
$(OBJCOPY) -O binary myStart.elf myStart.bin
./mksunxiboot myStart.bin myStart_sunxi.bin
%.o : %.S
$(CC) -g -c $^
%.o : %.c
$(CC) -g -c $^
clean :
@rm -rf *.bin *.o *.elf
@echo clean OK