Compile the preparation of its first Linux environment program, download history

Wei Dongshan along with learning Linux:

Today the school system systematically compiled code download, records about:

First, the code: 001_led_on.S , put the following code is compiled after Bin file downloaded into 2440 processor.

/ *
* Lighting LEDl: GPF4
* /

.text
.global _start

_start:

/ *
Configured as an output pin GPF4

******************* /
Calendar r1 = 0x56000050
LDR r0, = 0x100
str r0, [r1]

/ *******
the output high GPF4
the write address 0x56000054 0

**************** /
Calendar r1 = 0x56000054
LDR r0, = 0
str r0, [r1]

/ ******
infinite loop
******** /
the HALT:
b the HALT
/ *********************** /

two. Compile:

Three instructions

arm-linux-gcc -c -o 001_led_on.o 001_led_on.S
arm-linux-ld -Ttext 0 001_led_on.o -o 001_led_on.elf
arm-linux-objcopy -O binary -S 001_led_on.elf 001_led_on.bin

three. The establishment of the makefile:

all:
arm-linux-gcc -c -o 001_led_on.o 001_led_on.S
arm-linux-ld -Ttext 0 001_led_on.o -o 001_led_on.elf
arm-linux-objcopy -O binary -S 001_led_on.elf 001_led_on.bin
clean:
rm *.bin *.o *.elf

four. Bin file generated using the command make.

Five use win7 dos window, oflash Bin download files nandflash.

six. It has been observed a bright light.

testing successfully!

 

Guess you like

Origin www.cnblogs.com/zhihui-3669/p/11482319.html