2011-10-20 15:38:54     question about u-boot for BF518F -- sf erase wraps around to beginning

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

2011-10-20 15:38:54     question about u-boot for BF518F -- sf erase wraps around to beginning

Matt Prewett (UNITED STATES)

Message: 104048   

 

I have designed a board that is very similar to the BF518F-EZBRD and have been working to create a version of u-boot for the external SPI memory (1 MiB M25P16) and another version for the internal SPI memory (512 KiB SST25WF040).  I created two versions to ensure that the environment parameters were stored in the correct device. I had to copy the following statements from the BF526

 

Anyway, in the past I have always used the command "sf erase 0x60000 0xA0000" to prepare the external SPI memory for the application to be programmed.  When I did this on u-boot for the internal SPI memory, I found that it deleted u-boot. I'm guessing that since the offset (0x60000) + length (0xA0000) was past the end of the internal SPI memory (0x80000), it wrapped around and erase 0x0.

 

Shouldn't the sf erase command prevent this situation from happening?

 

-Matt

QuoteReplyEditDelete

 

 

2011-10-20 15:48:43     Re: question about u-boot for BF518F -- sf erase wraps around to beginning

Matt Prewett (UNITED STATES)

Message: 104049   

 

Sorry for the unfinished text above. Here is the information, not necessary for my question but perhaps useful to someone else.

 

For the external SPI memory, I modified ./include/configs/bf-518f-ezbrd as follows:

 

/*

* Env Storage Settings

*/

#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)

#define CONFIG_ENV_IS_IN_SPI_FLASH

#define CONFIG_ENV_SPI_MODE SPI_MODE_3

#define CONFIG_ENV_SPI_BUS 0

#define CONFIG_ENV_SPI_CS 2

#define CONFIG_ENV_OFFSET    0x10000

#define CONFIG_ENV_SIZE        0x2000

#define CONFIG_ENV_SECT_SIZE    0x10000

#else

#define CONFIG_ENV_IS_IN_FLASH

#define CONFIG_ENV_OFFSET    0x4000

#define CONFIG_ENV_ADDR        (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)

#define CONFIG_ENV_SIZE        0x2000

#define CONFIG_ENV_SECT_SIZE    0x2000

#endif

#define CONFIG_ENV_IS_EMBEDDED_IN_LDR

 

---

 

For the internal SPI memory, I modified ./include/configs/bf-518f-ezbrd as follows:

 

/*

* Env Storage Settings

*/

#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)

#define CONFIG_ENV_IS_IN_SPI_FLASH

#define CONFIG_ENV_SPI_MODE SPI_MODE_3

#define CONFIG_ENV_SPI_BUS 0

#define CONFIG_ENV_SPI_CS 4

#define CONFIG_ENV_OFFSET    0x10000

#define CONFIG_ENV_SIZE        0x2000

#define CONFIG_ENV_SECT_SIZE    0x10000

#else

#define CONFIG_ENV_IS_IN_FLASH

#define CONFIG_ENV_OFFSET    0x4000

#define CONFIG_ENV_ADDR        (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)

#define CONFIG_ENV_SIZE        0x2000

#define CONFIG_ENV_SECT_SIZE    0x2000

#endif

#define CONFIG_ENV_IS_EMBEDDED_IN_LDR

 

-Matt

QuoteReplyEditDelete

 

 

2011-10-20 23:11:11     Re: question about u-boot for BF518F -- sf erase wraps around to beginning

Aaron Wu (CHINA)

Message: 104051   

 

Could you check the passed in len and offset value for function call in spi_flash_erase  in cmd_sf.c and check what happens.

Attachments

    Outcomes