关键词: SAM BA GNU MAKE ATMEL arm-none-eabi-gcc 抵岸科技
由于项目的原因,需要修改并定制SAM BA,但在定制SAM BA的时候,遇到一个问题:我用厂商提供的源代码进行编译时,竟然报错。报错信息如下:
D:/TDDOWNLOAD/isp_patch/AT91-ISP v1.13/sam-ba 2.9/applets/isp-project/nandflash>
make clean BOARD=at91sam9g20-ek CHIP=at91sam9g20 sdram
makefile:221: 警告:覆盖关于目标“debug”的命令
makefile:221: 警告:忽略关于目标“debug”的旧命令
makefile:221: 警告:覆盖关于目标“debug”的命令
makefile:221: 警告:忽略关于目标“debug”的旧命令
rm -f obj/*.o bin/*.bin bin/*.elf bin/*.map
arm-none-eabi-gcc -Wall -g -Os -I../../at91lib/boards/at91sam9g20-ek -I../../at
91lib/peripherals -I../../at91lib/memories -I../../at91lib -Dat91sam9g20 -D__ASS
EMBLY__ -Dsdram -c -o obj/sdram_isp_cstartup.o ../common/isp_cstartup.S
../common/isp_cstartup.S: Assembler messages:
../common/isp_cstartup.S:82: Error: cannot use register index with PC-relative a
ddressing -- `str r1,[pc,#-(8+.-isInitialized)]'
make: *** [obj/sdram_isp_cstartup.o] 错误 1
我试过将common/isp_cstartup.S 文件的82行代码屏蔽,
//str r1, [pc, #-(8+.-isInitialized)]
编译能通过并能生成isp-nandflash-at91sam9g20.bin文件。但是用新生成的isp-nandflash-at91sam9g20.bin文件替换掉ATMEL Corporation/AT91-ISP v1.13/sam-ba 2.9/applets/isp-project/tcl_lib/at91sam9g20-ek目录下同名文件后,烧写NANDFLASH出错。
SAM BA程序提示如下错误:
(AT91-ISP v1.13) 1 % NANDFLASH::Init
-I- NANDFLASH::Init (trace level : 4)
-I- Loading applet isp-nandflash-at91sam9g20.bin at address 0x20000000
-I- Memory Size : 0x8000000 bytes
-I- Buffer address : 0x20003B48
-I- Buffer size: 0x20000 bytes
-I- Applet initialization done
(AT91-ISP v1.13) 1 % send_file {NandFlash} "E:/WorkSpace/ARM9+Linux平台/downfiles/u-boot.bin" 0x020000 0
-I- Send File E:/WorkSpace/ARM9+Linux平台/downfiles/u-boot.bin at address 0x020000
GENERIC::SendFile E:/WorkSpace/ARM9+Linux平台/downfiles/u-boot.bin at address 0x20000
-I- File size : 0x26D9C byte(s)
-I- Writing: 0x20000 bytes at 0x20000 (buffer addr : 0x20003B48)
-E- Can't send data (0x0000000f)
(AT91-ISP v1.13) 1 %
通过DEBUG口打印信息如下:
RomBOOT
>-I- -- EXTRAM ISP Applet 2.9 --
-I- -- AT91SAM9G20-EK
-I- -- Compiled: Jun 22 2009 14:59:31 --
-I- INIT command:
-I- Communication link type : 0
-I- Data bus width : 32 bits
-I- External RAM type : SDRAM
-I- Init SDRAM...
-I- Init successful.
-I- End of applet (command : 0 --- status : 0)
-I- -- NandFlash ISP applet 2.9 --
-I- -- AT91SAM9G20-EK
-I- -- Compiled: Jul 9 2010 10:31:34 --
-I- INIT command
-I- Nandflash ID is 0x9500F1EC
-I- Nandflash driver initialized
-I- pageSize : 0x800 blockSize : 0x20000 blockNb : 0x400 bus width : 8
-I- bufferAddr : 0x20003b48
-I- End of applet (command : 0 --- status : 0)
-I- WRITE arguments : offset 0x20000, buffer at 0x20003b48, of 0x20000 Bytes
-I- End of applet (command : 2 --- status : f)
上述步骤我是在WINDOWS环境进行的。在UBUNTU环境下,我也试过,报一样的错。
GNU compiler toolchain 的版本信息:
D:/TDDOWNLOAD/isp_patch/AT91-ISP v1.13/sam-ba 2.9/applets/isp-project/nandflash>
arm-none-eabi-gcc -v
Using built-in specs.
Target: arm-none-eabi
Configured with: /scratch/julian/2010q1-release-eabi-lite/src/gcc-4.4-2010q1/con
figure --build=i686-pc-linux-gnu --host=i686-mingw32 --target=arm-none-eabi --en
able-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --ena
ble-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs='%{O2:%{!f
no-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-
remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --disa
ble-shared --disable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite 2010
q1-188' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-n
ls --prefix=/opt/codesourcery --with-headers=yes --with-sysroot=/opt/codesourcer
y/arm-none-eabi --with-build-sysroot=/scratch/julian/2010q1-release-eabi-lite/in
stall/host-i686-mingw32/arm-none-eabi --with-libiconv-prefix=/scratch/julian/201
0q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-mingw32/usr --
with-gmp=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-n
one-eabi-i686-mingw32/usr --with-mpfr=/scratch/julian/2010q1-release-eabi-lite/o
bj/host-libs-2010q1-188-arm-none-eabi-i686-mingw32/usr --with-ppl=/scratch/julia
n/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm-none-eabi-i686-mingw32/u
sr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --
with-cloog=/scratch/julian/2010q1-release-eabi-lite/obj/host-libs-2010q1-188-arm
-none-eabi-i686-mingw32/usr --disable-libgomp --enable-poison-system-directories
--with-build-time-tools=/scratch/julian/2010q1-release-eabi-lite/obj/tools-i686
-pc-linux-gnu-2010q1-188-arm-none-eabi-i686-mingw32/arm-none-eabi/bin --with-bui
ld-time-tools=/scratch/julian/2010q1-release-eabi-lite/obj/tools-i686-pc-linux-g
nu-2010q1-188-arm-none-eabi-i686-mingw32/arm-none-eabi/bin
Thread model: single
gcc version 4.4.1 (Sourcery G++ Lite 2010q1-188)
make utility 版本信息:
D:/TDDOWNLOAD/isp_patch/AT91-ISP v1.13/sam-ba 2.9/applets/isp-project/nandflash>
make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-pc-mingw32
解决方法:
arm-none-eabi-gcc工具的版本太高了。下载4.3.3版本即可。