[#6499] saveenv only works one time after boot with M25P128
Submitted By: Timur Aydin
Commands Fixed In Release:
Found In Release:
Is the bug repeatable?:
Summary: saveenv only works one time after boot with M25P128
I am booting u-boot from a 128Mbit SPI EEPROM. The sector size on this part is 256KBytes. The first sector holds u-boot itself and the second sector holds the environment variables. I didn't embed the environment into u-boot.
Here are the environment related defines:
#define CONFIG_ENV_OFFSET 0x40000
#define CONFIG_ENV_SIZE 0x10000
#define CONFIG_ENV_SECT_SIZE 0x40000
Now after u-boot completes the boot, the environment sector is blank. I do a saveenv and it works. But if I do a second saveenv, that second one doesn't work. I have added debug logs into the code and have determined that the failure occurs in the the saveenv() function in env_sf.c That function tries to allocate memory for 0x40000 - 0x10000 = 0x30000 bytes. This succeeds for the first saveenv invocation, but fails for the second one. I have confirmed that the memory is free'd after the first invocation. So there seems to be an issue with either malloc/free or the heap related settings.
No Messages Were Found
File Name File Type File Size Posted By
No Files Were Found