The CFG_ENV_SIZE is not suitable used for SPI flash erase
sector size if CFG_ENV_SIZE is less than CFG_ENV_SECT_SIZE.
Add condition check if CFG_ENV_SIZE is larger than
CFG_ENV_SECT_SIZE, calculate the right number of sectors for
erasing.
Signed-off-by: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
This is pretty incomplete...it doesn't handle reading the environment
before relocation, it doesn't support redundant environment, and it
doesn't support embedded environment. But apart from that, it does
seem to work.
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>