Code:
void IRAM_ATTR kiloota_move_flash(void) {
unsigned char data_rewrite[4096];
os_printf("Now flashing the SW\n");
ets_wdt_disable();
uint32_t flashsize;
for(flashsize = 0; flashsize <= file_bytes; flashsize = flashsize+4096) {
os_printf("Read data from FLASH\n");
spi_flash_read(flash_start + flashsize, (uint32 *) data_rewrite, 4096);
os_printf("Erasing Sector on FLASH, Position %d, Sector %d\n", 0x10000 + flashsize, (0x10000 + flashsize)/4096);
spi_flash_erase_sector((0x10000 + flashsize)/4096);
os_printf("Writing data to FLASH\n");
spi_flash_write(0x10000 + flash_start, (uint32 *) data_rewrite, 4096);
}
ets_wdt_enable();
system_restart();
}
Code:
Now flashing the SW
Read data from FLASH
Erasing Sector on FLASH, Position 65536, Sector 16
Statistics: Posted by berkutta — Mon Jan 09, 2017 4:13 pm