本帖最后由 WindLand 于 2013-4-18 11:39 编辑
虽说硬件不同,但是原理一样
I.本文转自:http://blog.csdn.net/wfq0624/article/details/8605164
1 Cortex A8 LED点亮程序分析
1.1 环境搭建准备工作软件环境: 1.下载eclipse软件(绿色软件) 2.安装“yagarto-bu-2.22_gcc-4.7.1-c-c++_nl-1.20.0_gdb-7.4.1_eabi_20120616.exe” 3. tftpd32.exe 硬件平台: FS_S5PC100
搭建硬件环境: 1.PC UART-->开发板串口COM1(通过串口线) 2.电脑网卡-->开发板网卡(通过网线)
1.2 启动Eclipse软件,导入已有LED project
1.3 Makefile文件分析红色字体必须根据实际安装路径和项目路径细微修改
# CORTEX-A8 PERI DRIVER CODE
# VERSION 1.0
# ATHUOR lapset (klapset@gmail.com)
# MODIFY DATE
# 2012.2.22 by lapset ,to change the format of Makefile
#NOTE :please fix the following info to adpat to your environment
CROSS_COMPILE=arm-none-eabi-
LDPATH="C:\Program Files\yagarto\lib\gcc\arm-none-eabi\4.7.1\include"
OUTPATH="G:\tftp"
NAME=led
COMMONPATH = "G:\ARM\example modify\led_FS_S5PC100\common\include"
#=============================================================================#
#DO NOT TO CHANG THE CODE AFTER THIS !!!
export CFLAGS LD CC STRIP OBJCOPY OBJDUMP COMMONPATH
CFLAGS += -g -O0 -fno-strict-aliasing -mabi=apcs-gnu -mfpu=vfpv3 -mfloat-abi=softfp -fno-builtin -nostdinc -isystem$(LDPATH) -I$(COMMONPATH)
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
OBJS := start/start.o common/src/printf.o common/src/uart.o common/src/_udivsi3.o common/src/_umodsi3.o$(NAME).o
SUBDIRS := common/src/ start/
all:$(SUBDIRS)$(OBJS)
$(LD) $(OBJS) -Tmap.lds -o$(NAME).elf
$(OBJCOPY) -O binary $(NAME).elf$(NAME).bin
$(OBJDUMP) -D$(NAME).elf >$(NAME).dis
cp ./$(NAME).bin$(OUTPATH)
$(SUBDIRS):
$(MAKE) -C $@
%.o: %.S
$(CC)$(CFLAGS) -c -o $@ $<
%.o: %.c
$(CC)$(CFLAGS) -c -o $@ $<
clean:
rm -rf $(OBJS) *.elf *.bin *.dis$(OUTPATH)/$(NAME).bin
1.4 Build project生成led.bin文件1. 鼠标右击project name,选择“Build Project”
2. 成功后,会在该目录下【OUTPATH="G:\tftp"】生成led.bin文件,
如下所示,将tftpd32.exe和led.bin放在同一个目录下
1.5 配置ip地址1. 让开发板上电,进入uboot
2. 输入pri 打印环境变量,使用setenv命令来修改参数,让ip和PC ip地址保持一致
3. Ping ip地址,显示alive字样,表示网络连接OK
4. 打开PC上的tftpd32.exe软件,设置好对应的ip地址
5.执行tftp下载led.bin到内存0x20008000地址处,然后运行该程序”go 20008000”
|