RAM Flash erase

Posts: 15
Joined: Tue Mar 15, 2016 6:30 pm

RAM Flash erase

Postby berkutta » Mon Jan 09, 2017 4:13 pm


I'm writing an OTA Application on which I first download the new application over a special protocoll, write the downloaded chunks to a seperate section of the flash and then copy them over to the main flash (0x10000...). But I have a problem on erasing the flash. After trying to erase Sector 16 (0x10000) the ESP stops working. The function which erases the flash is allocated in the RAM ( #define IRAM_ATTR __attribute__((section(".text"))) )

I'm using the NONOS V2.0

The code is the following:

Code: Select all

void IRAM_ATTR kiloota_move_flash(void) {
   unsigned char data_rewrite[4096];

   os_printf("Now flashing the SW\n");


   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);



Code: Select all

Now flashing the SW
Read data from FLASH
Erasing Sector on FLASH, Position 65536, Sector 16

Any idea?

Posts: 15
Joined: Tue Mar 15, 2016 6:30 pm

Re: RAM Flash erase

Postby berkutta » Wed Jan 11, 2017 4:24 pm

With Non-OS 1.5.4 it seems to work. With Non-OS 2 not. Any idea why? Espressif?

Who is online

Users browsing this forum: MSN [Bot] and 4 guests