newman0708 发表于 2013-1-31 12:25:09

TQ2440_test测试程序(其实就是裸机程序)如何编译

TQ2440_test测试程序(其实就是裸机程序),在windows上可能用ADS1.2编译通过。
我用的是linux系统,所以想问一下如何用arm-linux-gcc来编译,
能不能给个Makefile(通用些的)。

我的文件
CFLAGS         := -Wall -Wstrict-prototypes -g -fomit-frame-pointer -ffreestanding

## Include Directories
INCLUDES = -I"../inc/"

PROJECT=Main
PROJECTBIN   = $(PROJECT).bin

CC=arm-linux-gcc $(INCLUDES)
COMPILE.C = $(CC) $(CFLAGS) -c
COMPILE.S = $(CC) -S -Wall -O2 -c
OBJ   = 2440init.o 2440slib.o $(PROJECT).o camif.o IrDA.o memtest.o RTC.o UDA1341.o 2440lib.o camproset.o keyscan.o mmu.o SD_MMC.o dma.o LCD_TFT.o nand.o Test_OV9650.o Adc.oeeprom.oMain.o Pic.o Touchpanel.o AudioDrv.o IIC.oprofile.o TQ_LOGO.o

all: $(PROJECT)

$(PROJECT) : $(OBJ)
        arm-linux-ld -T$(PROJECT).lds $(OBJ) -o $(PROJECT)_elf
        arm-linux-objcopy -O binary -S $(PROJECT)_elf $(PROJECT).bin
        arm-linux-objdump -D -m arm$(PROJECT)_elf > $(PROJECT).dis

%.o: %.s
        $(COMPILE.S) $< -o $@

%.o: %.c
        $(COMPILE.C) $< -o $@


clean:
        rm -f   $(PROJECT).dis $(PROJECT).bin $(PROJECT)_elf *.o





我在Makefile在src目录里
newman0708@debian:/work/eclipse_projects/TQ2440_Test/src$ ls
2440init.scamproset.cLCD_TFT.c   mmu.o      RTC.o          TQ_LOGO.o
2440lib.c   dma.c      Main.c      nand.c   SD_MMC.c       UDA1341.c
2440slib.sdma.o      Makefile      nand.o   SD_MMC.o       UDA1341.o
Adc.c       eeprom.c   Makefile.tgzPic.c      Test_OV9650.c
Adc.o       IIC.c      memtest.c   Pic.o      Test_OV9650.o
AudioDrv.cIrDA.c       memtest.o   profile.cTouchpanel.c
camif.c   keyscan.c    mmu.c         RTC.c      TQ_LOGO.c

newman0708@debian:/work/eclipse_projects/TQ2440_Test/src$ make
arm-linux-gcc -I"../inc/"-S -Wall -O2 -c 2440init.s -o 2440init.o
arm-linux-gcc -I"../inc/"-S -Wall -O2 -c 2440slib.s -o 2440slib.o
arm-linux-gcc -I"../inc/"-S -Wall -O2 -c Main.c -o Main.o
In file included from Main.c:11:
../inc/2440addr.h: In function `ClearPending':
../inc/2440addr.h:677: warning: type defaults to `int' in declaration of `i'
../inc/2440addr.h: In function `ClearSubPending':
../inc/2440addr.h:685: warning: type defaults to `int' in declaration of `i'
In file included from Main.c:12:
../inc/2440lib.h:27:1: warning: "NULL" redefined
In file included from /work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/sys-include/string.h:33,
               from Main.c:8:
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/include/stddef.h:402:1: warning: this is the location of the previous definition
Main.c: At top level:
Main.c:18: error: stray '$' in program
Main.c:18: error: stray '$' in program
Main.c:18: error: syntax error before "RO"
Main.c:18: error: stray '$' in program
Main.c:18: error: stray '$' in program
Main.c:18: warning: type defaults to `int' in declaration of `Limit'
Main.c:18: warning: data definition has no type or storage class
Main.c:19: error: stray '$' in program
Main.c:19: error: stray '$' in program
Main.c:19: error: syntax error before "RO"
Main.c:19: error: stray '$' in program
Main.c:19: error: stray '$' in program
Main.c:19: warning: type defaults to `int' in declaration of `Base'
Main.c:19: warning: data definition has no type or storage class
Main.c:20: error: stray '$' in program
Main.c:20: error: stray '$' in program
Main.c:20: error: syntax error before "RW"
Main.c:20: error: stray '$' in program
Main.c:20: error: stray '$' in program
Main.c:20: warning: type defaults to `int' in declaration of `Limit'
Main.c:20: warning: data definition has no type or storage class
Main.c:21: error: stray '$' in program
Main.c:21: error: stray '$' in program
Main.c:21: error: syntax error before "RW"
Main.c:21: error: stray '$' in program
Main.c:21: error: stray '$' in program
Main.c:21: warning: type defaults to `int' in declaration of `Base'
Main.c:21: warning: data definition has no type or storage class
Main.c:22: error: stray '$' in program
Main.c:22: error: stray '$' in program
Main.c:22: error: syntax error before "ZI"
Main.c:22: error: stray '$' in program
Main.c:22: error: stray '$' in program
Main.c:22: warning: type defaults to `int' in declaration of `Limit'
Main.c:22: warning: data definition has no type or storage class
Main.c:23: error: stray '$' in program
Main.c:23: error: stray '$' in program
Main.c:23: error: syntax error before "ZI"
Main.c:23: error: stray '$' in program
Main.c:23: error: stray '$' in program
Main.c:23: warning: type defaults to `int' in declaration of `Base'
Main.c:23: warning: data definition has no type or storage class
Main.c:67: error: stray '$' in program
Main.c:67: error: stray '$' in program
Main.c:67: error: syntax error before "RW"
Main.c:67: error: stray '$' in program
Main.c:67: error: stray '$' in program
Main.c:67: warning: type defaults to `int' in declaration of `Limit'
Main.c:67: warning: data definition has no type or storage class
Main.c:68: error: stray '$' in program
Main.c:68: error: stray '$' in program
Main.c:68: error: `Image' undeclared here (not in a function)
Main.c:68: error: syntax error before "RW"
Main.c:68: error: stray '$' in program
Main.c:68: error: stray '$' in program
Main.c: In function `Clk0_Enable':
Main.c:312: warning: suggest parentheses around arithmetic in operand of |
Main.c:313: warning: suggest parentheses around arithmetic in operand of |
Main.c: In function `Clk1_Enable':
Main.c:317: warning: suggest parentheses around arithmetic in operand of |
Main.c:318: warning: suggest parentheses around arithmetic in operand of |
Main.c: At top level:
Main.c:67: warning: array 'Limit' assumed to have one element
Main.c:23: warning: array 'Base' assumed to have one element
make: *** Error 1

报了很多错,不知道如何解决,请高手帮忙看一下。

embedsky_lhh 发表于 2013-1-31 14:47:15

这个你要改的东西多了,最好搞个LDS文件建立链接关系
页: [1]
查看完整版本: TQ2440_test测试程序(其实就是裸机程序)如何编译