Tiny4412-LED小灯裸机程序

来源:互联网 发布:json数据接口 编辑:程序博客网 时间:2024/05/01 02:14
#define GPM4CON (*(volatile unsigned long*)0x110002e0)
#define GPM4DAT (*(volatile unsigned long*)0x110002e4)

void led_init(void);
void led_status(char status);

void _start()
{
    led_init();
    led_status(0x01);
}

void led_init(void)
{
    GPM4CON = (GPM4CON & ~0xffff) | 0x1111;
}

void led_status(char status)
{
    GPM4DAT = (GPM4DAT & ~0xf) | status;

}


Makefile文件:

all:
    arm-linux-gcc -c test.c
    arm-linux-ld test.o
    arm-linux-objcopy -O binary a.out boot.bin
    
clean:
    rm -v a.out boot.bin *.o

0 0