mini2440裸机程序LED
text
.global _start
_start:
ldr r0,=0x56000010
mov r1,#0x15400
str r1,[r0]
ldr r0,=0x56000014
mov r1,#0x00
str r1,[r0]
halt:
b halt
******************************************
led_on.bin:led_on.S
arm-linux-gcc -c -o led_on.o led_on.S
arm-linux-ld -Ttext 0x00000000 led_on.o -o led_on_elf
arm-linux-objcopy -O binary -S led_on_elf led_on.bin
clean:
rm -f *.bin *.bin *elf
******************************************
@***************************
@*
@*
@****************************
.text
.global _start
_start:
ldr r0,=0x53000000
mov r1,#0x00
str r1,[r0]
ldr sp,=1024*4
bl main
halt:
b halt
**********************************************
#define GPBCON (*(unsigned long *)0x56000010)
#define GPBDAT (*(unsigned long *)0x56000014)
int main()
{
GPBCON=0x15400;
GPBDAT=0x180;
}
**************************************************
led_on_c.bin:init.S led_on.c
arm-linux-gcc -c -o init.o init.S
arm-linux-gcc -c -o led_on.o led_on.c
arm-linux-ld -Ttext 0x00000000 init.o led_on.o -o led_on_elf
arm-linux-objcopy -O binary -S led_on_elf led_on_c.bin
clean:
rm -f *.o *.bin *elf
*****************************************************
.text
.global _start
_start:
ldr r0,=0x53000000
mov r1,#0x00
str r1,[r0]
ldr sp,=1024*4
bl main
halt:
b halt
*************************************************
SECTIONS {
. = 0x00;
.text : { *(.text) }
.rodata ALIGN(4) : {*(.rodata)}
.data ALIGN(4) : { *(.data) }
.bss ALIGN(4) : { *(.bss) *(COMMON) }
}
`
*****************************
#define GPBCON (*(volatile unsigned long *)0x56000010)
#define GPBDAT (*(volatile unsigned long *)0x56000014)
#define GPB5_OUT (1<<(5*2))
#define GPB6_OUT (1<<(6*2))
#define GPB7_OUT (1<<(7*2))
#define GPB8_OUT (1<<(8*2))
delay(volatile unsigned long time)
{
volatile unsigned long k=100000;
for(;k>0;k--)
for(;time>0;time--);
}
/*
int main()
{
int i=0;
GPBCON=GPB5_OUT|GPB6_OUT|GPB7_OUT|GPB8_OUT;
// GPBDAT=0x180;
// delay(500000);
// GPBDAT=0x060;
while(1)
{
delay(50000);
GPBDAT=(~(i<<5));
if(++i==16)
i=0;
}
return 0;
}
*/
int main()
{
GPBCON=GPB5_OUT|GPB6_OUT|GPB7_OUT|GPB8_OUT;
//GPBDAT=0x7ff;
while(1)
{
int i;
for(i=0;i<4;i++)
{
GPBDAT =~(1<<(i+5));
delay(5000);
GPBDAT =0x7ff;
delay(5000);
}
}
return 0;
}
*************************************
CFLAGS := -Wall -O2
led_liushui.bin : init.S led_liushui.c
arm-linux-gcc $(CFLAGS) -c -o init.o init.S
arm-linux-gcc $(CFLAGS) -c -o led_liushui.o led_liushui.c
arm-linux-ld -Tled_liushui.lds init.o led_liushui.o -o led_liushui_elf
arm-linux-objcopy -O binary -S led_liushui_elf led_liushui.bin
arm-linux-objdump -D -m arm led_liushui_elf > led_liushui.dis
clean:
rm -rf *.o *elf *bin *dis *bak
补充:综合编程 , 其他综合 ,