嵌入式软件工程师&&太极拳
全部博文(548)
分类:
2011-02-20 19:45:34
【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] 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 #define GPFCON 0x56000050 #define GPFDAT 0x56000054 .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, =GPFCON ldr r0, [r1] bic r0, r0, #(0xf) str r0, [r1] eloop: ldr r1, =GPFDAT ldr r0, [r1] and r0, r0, #0x3 ldr r2, =GPEDAT ldr r3, [r2] bic r3, r3, #( 0x3 << 12 ) orr r3, r3, r0, LSL #12 str r3, [r2] 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/