2011-02-13 04:07:25     Question : how u-boot and environment varible is arranged in flash?

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2011-02-13 04:07:25     Question : how u-boot and environment varible is arranged in flash?

david zheng (CHINA)

Message: 98121   

 

I am reading u-boot code now.

 

While reading bf533-stamp.h, I am confused by u-boot and environment varible's  arrangment in flash

 

The address of environment varible is controlled by CFG_ENV_OFFSET, as following

 

#if (BFIN_BOOT_MODE == BF533_BYPASS_BOOT)

#define CFG_ENV_IS_IN_FLASH  1

#define CFG_ENV_ADDR   0x20004000

#define CFG_ENV_OFFSET   (CFG_ENV_ADDR - CFG_FLASH_BASE)

#elif (BFIN_BOOT_MODE == BF533_SPI_BOOT)

#define CFG_ENV_IS_IN_EEPROM  1

#define CFG_ENV_OFFSET   0x4000

#define CFG_ENV_HEADER   (CFG_ENV_OFFSET + 0x12A) /* 0x12A is the length of LDR file header */

#endif

 

If my board is booted from spi flash, the boot rom of bf533 would  copy u-boot from 0x0 addresss of spi flash to sdram after resetting. That is the u-boot.ldr must be put in 0x0 address of spi flash. But the size of u-boot is more than 0x4000, so

the u-boot will cover environment varible's  ,I think CFG_ENV_OFFSET should be defined in the address more than size of u-boot, but why is it defined in 0x4000?

 

 

 

 

 

By the way, my board is BFIN_BOOT_MODE == BF533_BYPASS_BOOT, the u-boot.bin should be put in 0x0 address of flash , but CFG_ENV_ADDR is defined in 0x20004000 in bf533-stamp.h, obviously  environment varible will be covered, why?

QuoteReplyEditDelete

 

 

2011-02-13 05:04:42     Re: Question : how u-boot and environment varible is arranged in flash?

Mike Frysinger (UNITED STATES)

Message: 98122   

 

you're using a very old version of u-boot.  time to upgrade.

 

the env may be in the middle of the LDR image.  there is no requirement that it be after.  for the bf533-stamp, we simply chose to embed it.

Attachments

    Outcomes