GNU汇编程序框架

汇编的作用:1.对芯片进行初始化

                      2. 和C混合编程提升C的运行效率

.section .data

         < 初始化的数据>

.section .bss

       <未初始化的数据>

.section .text

.globl  _start

_start:

     <汇编代码>

 

建立汇编代码:

例子:

.text

.global  _start

_start:

          mov r1,#1

          mov r2,#2

          mov r3,#3

 

Makefile:

all: start.o

  arm-linux-ld  -Ttext  0x30000000 -o start.elf $^

%.o : %.S

       arm-linux-gcc -g -o  $@ $^  -c

clean:

   rm  *.o  *.elf

如果使用连接器脚本: 替换  arm-linux-ld -Txxx.lds   start.elf $^

posted @ 2018-12-25 15:03  小飞Python  阅读(169)  评论(0编辑  收藏  举报