
I have a board that comes in three flash confirurations: - 32MB - 64MB - 128MB
The cfi code can safely detect the flash sizes, banks and widths at boot time. I have however the problem that the flash chips are "top" type and the small sectors are at the end of the address space. So I want to make the last sector (a small sector) to contain the environment. The last sector though is in a different address (and has a different size) depending on the flash configuration.
Currently the defines for the environment expect raw numerical values. Is there an infrastructure somewhere to define the flash size at runtime? I tried to print the flash sizes in the board specific codes, for instance:
extern flash_info_t flash_info[];
printf("flash 0 : %d %x\n", flash_info[0].size, flash_info[0].start[flash_info[0].sector_count-1]); ...
prints:
Flash: 64 MB In: serial Out: serial Err: serial flash 0 : 67108864 3ff0000
(the second number is the address of the last sector)
And all sizes are detected correctly. I want to use these values to calculate the location of the environment dynamically at runtime. This way I can have a single u-boot image for all flash configurations!
-- Angelos Manousaridis