[U-Boot-Users] How to support multiple flash sizes ?
Laurent Pinchart
laurent.pinchart at tbox.biz
Tue May 9 11:07:32 CEST 2006
Hi,
I'm trying to find a way for U-Boot to automatically detect the flash base
address.
Our custom board can be mounted with different flash options, from 16MB to
128MB. I would like to avoid programming the board with a different boot
loader for each flash size, so I was trying a way to create a
"one-fits-them-all" U-Boot version.
I thought defining CFG_FLASH_BASE to 0xF8000000 would be enough, as the flash
would repeat over the 128MB memory range. This indeed works fine for reading,
but U-Boot is clever enough to detect the flash size, which leads to problems
when erasing sectors. The environment, for instance, is stored at TEXT_BASE +
256kB (0xFFF40000). Saving the environment fails, as U-Boot is unable to
erase sector 0xFFF40000 which is outside the 16MB flash memory range
(0xF8000000 - 0xF8FFFFFF).
CFG_FLASH_BASE is used throughout the U-Boot code, so it would not be an easy
task to replacing it by a variable. Does someone know of a way to either
detect the flash base address, or read it from a fixed location in flash
(let's say in the first sector for instance, after the hard reset
configuration word) ? A possible approach would be to use the hardcoded
CFG_FLASH_BASE value at startup, and remap the flash at 0xFFFFFFFF -
flash_size later when the flash size is known. CFG_FLASH_BASE would have to
be replaced by a variable in several places.
Thanks in advance for all the help you can provide.
Best regards,
Laurent Pinchart
More information about the U-Boot
mailing list