[ARM裸机程序][6]ARM GNU汇编程序示例

ARM GNU汇编程序框架

.section .data
    <初始化的数据>
.section .bss
    <未初始化的数据>
.section .text
.global _start
_start:
    <汇编代码><入口地址>

汇编程序的示例

//start.s
.bass
.text
.global _start
_start:
    mov r1,#1
    mov r2,#2
    add r3,r1,r2
_loop:
    b _loop
//Makefile
all:start.o
    arm-linux-ld -Ttext 0x30000000 -o start.elf start.o
start.o:start.s
    arm-linux-gcc -g -o start.o -c start.s
clean:
    rm -rf *.o *.elf

猜你喜欢

转载自blog.csdn.net/zimengyu2020/article/details/80346240