嵌入式软件工程师&&太极拳
全部博文(548)
分类:
2011-02-20 19:41:06
【led1.S】
#define GPECON 0x56000040 #define GPEDAT 0x56000044 .text .align 2 .global _start _start: ldr r1, =GPECON ldr r0, [r1] bic r0, r0, #(0xf << 24) orr r0, r0, #(0x5 << 24) str r0, [r1] ldr r1, =GPEDAT ldr r0, [r1] bic r0, r0, #( 0x3 << 12 ) str r0, [r1] die_loop: b die_loop
【led.S】
#define GPECON 0x56000040 #define GPEDAT 0x56000044 .text .align 2 .global _start _start: ldr r1, =GPECON ldr r0, [r1] bic r0, r0, #(0xf << 24) orr r0, r0, #(0x5 << 24) str r0, [r1] eloop: ldr r1, =GPEDAT ldr r0, [r1] bic r0, r0, #( 0x3 << 12 ) str r0, [r1] mov r0, #0x10000 bl delay ldr r1, =GPEDAT ldr r0, [r1] orr r0, r0, #( 0x3 << 12 ) str r0, [r1] mov r0, #0x10000 bl delay b eloop delay: sub r0, r0, #1 cmp r0, #0 bne delay mov pc, lr 【Makefile】
all: arm-linux-gcc led.S -c -o led.o arm-linux-ld led.o -o led arm-linux-objcopy -O binary led led.bin cp led.bin /exe/