EEPROM Restore added in Bootloader
This commit is contained in:
@@ -145,8 +145,8 @@ void delay_01us(uint16_t nb);
|
||||
#define FLASH_PAGESIZE 256
|
||||
void unlockFlash();
|
||||
void writeFlash(uint32_t * address, uint32_t * buffer);
|
||||
uint32_t isFirmwareStart(uint32_t *block);
|
||||
uint32_t isBootloaderStart(uint32_t *block);
|
||||
uint32_t isFirmwareStart(const uint32_t *block);
|
||||
uint32_t isBootloaderStart(const uint32_t *block);
|
||||
|
||||
// Pulses driver
|
||||
void init_no_pulses(uint32_t port);
|
||||
|
||||
@@ -98,7 +98,7 @@ void writeFlash(uint32_t *address, uint32_t *buffer) // page size is 256 bytes
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t isFirmwareStart(uint32_t *block)
|
||||
uint32_t isFirmwareStart(const uint32_t *block)
|
||||
{
|
||||
if ((block[0] & 0xFFFC0000) != 0x20000000) {
|
||||
return 0;
|
||||
@@ -112,7 +112,7 @@ uint32_t isFirmwareStart(uint32_t *block)
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t isBootloaderStart(uint32_t *block)
|
||||
uint32_t isBootloaderStart(const uint32_t *block)
|
||||
{
|
||||
for (int i=0; i<256; i++) {
|
||||
if (block[i] == 0x544F4F42/*BOOT*/) {
|
||||
|
||||
@@ -724,8 +724,7 @@ int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count )
|
||||
}
|
||||
else if (sector < 3 + (EESIZE/BLOCKSIZE)) {
|
||||
while (count) {
|
||||
const EeFs * test = (const EeFs *)buffer;
|
||||
if (offset == 0 && test->version==EEFS_VERS && test->mySize==sizeof(eeFs) && test->bs==BS) {
|
||||
if (offset == 0 && isEepromStart(buffer)) {
|
||||
TRACE("EEPROM start found in sector %d", sector);
|
||||
offset = sector;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user