This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Atmel DataFlash Driver and EB55


Andrew Lunn wrote:

On Thu, Oct 07, 2004 at 08:45:54AM +0200, Sebastian Block wrote:


Hi,

I've got a new problem, when building redboot. It compile all ok, but when building the redboot.elf it tells :

arm-elf-gcc -c -I/tmp/eb/install/include -I/tmp/ecos/packages/redboot/current -I/tmp/ecos/packages/redboot/current/src -I/tmp/ecos/packages/redboot/current/tests -I. -finline-limit=7000 -mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -o /tmp/eb/install/lib/version.o /tmp/ecos/packages/redboot/current/src/version.c
arm-elf-gcc -mcpu=arm7tdmi -mno-short-load-words -Wl,--gc-sections -Wl,-static -g -nostdlib -L/tmp/eb/install/lib -Ttarget.ld -o /tmp/eb/install/bin/redboot.elf /tmp/eb/install/lib/version.o
/tmp/eb/install/lib/extras.o: In function `do_load':
/tmp/ecos/packages/redboot/current/src/load.c:569: undefined reference to `flash_read_buf'
collect2: ld returned 1 exit status
make[1]: *** [/tmp/eb/install/bin/redboot.elf] Fehler 1
make[1]: Leaving directory `/tmp/eb/redboot/current'
make: *** [build] Fehler 2


Did I forget something to add to the target !?
I'm sorry that I've got no idea where the comes from.



I never tried building redboot on the eb55 with DataFlash before. I
can reproduce your problem and understand what is going on.


The DataFLASH driver does not allow reads of flash by doing a
memcpy. There is no memory mapping for a DataFlash device. It needs to
get the data from over the SPI buffer. With the old flash API you had
to define CYGSEM_IO_FLASH_READ_INDIRECT which told io/flash to call
flash_read_buf to read the flash rather than do a memcpy.

With the new API this is done differently. If the strucutre of
functions contains a NULL pointer for the read function, io/flash will
do a memcpy. If a read function has been provided it will use
it. CYGSEM_IO_FLASH_READ_INDIRECT is not used by version 2 flash
drivers. However the DataFlash cdl are incorrectly defined it. This is
causing problems with the legacy device interface code. The legacy
flash interface code allows an old device driver to be used with the
new io/flash API. It puts a wrapper around the old driver API which
makes it look like its a new driver. The legacy wrapper uses
CYGSEM_IO_FLASH_READ_INDIRECT to determine if it should call memcpy to
perform a read from flash or call the legacy function
flash_read_buf. The legacy device driver the eb55 uses,
CYGPKG_DEVS_FLASH_ATMEL_AT49XXXX, allows memcpy to access the flash
and so does not define the function flash_read_buf. Hence the linker
error.

So in summary:

V2 device drivers should set flash_read in the device structure is
reading is to be perfored by a function.

Legacy devices should define CYGSEM_IO_FLASH_READ_INDIRECT and provide
a function flash_read_buf.

Attached is a patch which fixes your problem and allows RedBoot to
link. I don't have the hardware so i have no idea if it actually runs.


Ouch,... it looks like the DataFlash driver in the CVS is the old one!
I'am very sorry, but being a bit busy I didn't follow its integration into CVS.
The new driver is on ecos-patches (http://ecos.sourceware.org/ml/ecos-patches/2004-10/msg00000.html),
the current driver in CVS is from ecos-devel (http://ecos.sourceware.org/ml/ecos-devel/2004-09/msg00006.html).


savin



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]