2011-01-11 12:51:36     saveenv not working for M25P80 SPI flash memory

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

2011-01-11 12:51:36     saveenv not working for M25P80 SPI flash memory

Matt Prewett (UNITED STATES)

Message: 97348   

 

I am running U-boot on my BF524-based board but having some issues with the saveenv command.  Here's my output:

 

****************************************************************

 

U-Boot 2010.06 (ADI-2010R1-RC2) (Jan 07 2011 - 15:22:29)

 

CPU:   ADSP bf524-0.2 (Detected Rev: 0.2) (spi flash boot)

Board: ADI BF526 EZ-Board board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 300 MHz, Core: 300 MHz, System: 100 MHz

RAM:   32 MiB

SF: Detected M25P80 with page size 256, total 1 MiB

*** Warning - bad CRC, using default environment

 

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Hit any key to stop autoboot:  0

## Error: "ramboot" not defined

bfin> saveenv

Saving Environment to SPI Flash...

Erasing SPI flash...bfin>

 

****************************************************************

 

Looking at the code around the "Erasing SPI flash..." print statement in ./u-boot-2010.06-2010R1-RC2/common/env_sf.c, I suspect that the CONFIG_ENV_OFFSET or CONFIG_ENV_SECT_SIZE is not configured correctly for my SPI device (M25P80).  Do you happen to know what these should be?

 

BTW: I am currently using the following settings based on the BF526 EZBRD:

 

#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)

#define CONFIG_ENV_IS_IN_SPI_FLASH

#define CONFIG_ENV_SPI_MAX_HZ 1000000

#define CONFIG_ENV_SPI_MODE SPI_MODE_3

#define CONFIG_ENV_SPI_BUS 0

#define CONFIG_ENV_SPI_CS 1

#define CONFIG_ENV_OFFSET    0x4000

#define CONFIG_ENV_SIZE        0x2000

#define CONFIG_ENV_SECT_SIZE    0x2000

 

 

 

Thanks,

 

Matt

QuoteReplyEditDelete

 

 

2011-01-11 12:56:53     Re: saveenv not working for M25P80 SPI flash memory

Mike Frysinger (UNITED STATES)

Message: 97349   

 

look at the flash geometry to determine what sector offset/size makes sense.  the top level README explains how the defines work.

QuoteReplyEditDelete

 

 

2011-01-11 14:49:43     Re: saveenv not working for M25P80 SPI flash memory

Matt Prewett (UNITED STATES)

Message: 97353   

 

Thanks. Yes - I see my M25P80 sector size is 0x10000 (65536 bytes) whereas SST25WF040 sector size is 0x1000 (4096 bytes) but I still have some questions.

 

When I program u-boot into the M25P80, I use only sectors 0-2.  If I leave sector 3 reserved, and configure as follows:

 

#define CONFIG_ENV_OFFSET 0x40000

#define CONFIG_ENV_SIZE 0x10000

#define CONFIG_ENV_SECT_SIZE 0x10000

 

do I then need to undefine CONFIG_ENV_IS_EMBEDDED_IN_LDR (since the ENV is now outside of the u-boot image)?

QuoteReplyEditDelete

 

 

2011-01-11 15:32:52     Re: saveenv not working for M25P80 SPI flash memory

Mike Frysinger (UNITED STATES)

Message: 97354   

 

CONFIG_ENV_IS_EMBEDDED_IN_LDR is opt-in only.  it is not necessary to undefine it.

QuoteReplyEditDelete

 

 

2011-01-12 14:34:34     Re: saveenv not working for M25P80 SPI flash memory

Matt Prewett (UNITED STATES)

Message: 97409   

 

That worked.  Thanks!

Attachments

    Outcomes