使SAMBA支持YAFFS镜像烧写

一,需下载工具

GNU编译工具链

下载地址:

http://www.codesourcery.com/sgpp/lite/arm/portal/package6496/public/arm-none-eabi/arm-2010q1-188-arm-none-eabi.exe

http://www.codesourcery.com/sgpp/lite/arm/portal/package4466/public/arm-none-eabi/arm-2009q1-161-arm-none-eabi.exe

 

make工具:

下载地址:

http://nchc.dl.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe

 

 

二,工具安装及使用

GNU编译工具

下载后直接安装即可。

(若有时间,将安装步骤补上)

 

Make工具安装

将下载好的GetGnuWin32-0.6.3.exe解压到某处,例如:D盘根目录。

解压完毕后,打开一个命令窗口,进入GetGnuWin32目录并运行download.bat。下载好的packages都放在D:/GetGnuWin32/packages目录中。

C:/Documents and Settings/Administrator> D

D:/> cd getgnuwin32

D:/GetGnuWin32> download

 

然后就是静静地等待它下载packages。

 

等所有的packages下载完后,开始安装了

D:/GetGnuWin32> install C:/gnuwin32

 

 

三,修改源码

1.  修改isp-project/nandflash/main.c文件

318行:

blockSize = NandFlashModel_GetBlockSizeInBytes(&skipBlockNf.ecc.raw.model)+0x1000;

337行:

static int blocknum = 0;

memoryOffset = 0x2a0000+((blocknum++)*0x20000);     

 

 

2.   修改at91lib/memories/nandflash/SkipBlockNandFlash.c

392行:       

data = (void *) ((unsigned char *) data + pageSize+64);

 

3.   修改at91lib/memories/nandflash/EccNandFlash.c

252行:

    error = RawNandFlash_WritePage(RAW(ecc), block, page, data, data+2048);

  

四,编译SAMBA

 请参阅SAM BA 的说明文档。

 

 五,更新SAMBABIN文件

将新生成的isp-nandflash-at91sam9g20.bin文件拷贝到C:/Program Files/ATMEL Corporation/AT91-ISP v1.13/sam-ba 2.9/applets/isp-project/tcl_lib/at91sam9g20-ek目录,覆盖原文件即可。

 

  

我所遇到问题:

一,提示

 

Checking for required programs: awk grep sed bzip2 gunzip

Preparing to install...

Extracting the JRE from the installer archive...

Unpacking the JRE...

Extracting the installation resources from the installer archive...

Configuring the installer for this system's environment...

 

Launching installer...

 

Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

 

Stack Trace:

java.awt.HeadlessException:

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

        at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)

        at java.awt.Window.<init>(Unknown Source)

        at java.awt.Frame.<init>(Unknown Source)

        at java.awt.Frame.<init>(Unknown Source)

        at javax.swing.JFrame.<init>(Unknown Source)

        at com.zerog.ia.installer.LifeCycleManager.g(DashoA10*..)

        at com.zerog.ia.installer.LifeCycleManager.h(DashoA10*..)

        at com.zerog.ia.installer.LifeCycleManager.a(DashoA10*..)

        at com.zerog.ia.installer.Main.main(DashoA10*..)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at com.zerog.lax.LAX.launch(DashoA10*..)

        at com.zerog.lax.LAX.main(DashoA10*..)

This Application has Unexpectedly Quit: Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

 

 

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

解决:

export DISPLAY=localhost:0

 

 

其它解决:

./arm-2010q1-188-arm-none-eabi.bin -i  console

 

 

 二,由于项目的原因,需要修改并定制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版本即可。

 

你可能感兴趣的:(使SAMBA支持YAFFS镜像烧写)