debug_print("Reading from address %08x to buffer at %08x\n", sector << READ_BUFFER_SHIFT, rBuffer.buffer);
flashResult = spi_flash_read(sector << READ_BUFFER_SHIFT, (uint32 *) rBuffer.buffer, READ_BUFFER_SIZE); <- exception is here
debug_print("Reading finished, result: %d\n", flashResult);
This is my debug output:
...
fsOpen: www/wifi/esp8266.html
Reading from address 00020000 to buffer at 3fff56b0
Reading finished, result: 0
Reading from address 00020200 to buffer at 3fff56b0
Reading finished, result: 0
Reading from address 00020240 to buffer at 3fff56b0
Reading finished, result: 0
Reading from address 00020480 to buffer at 3fff56b0
Fatal exception 0(IllegalInstructionCause):
epc1=0x402467c0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x0
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
load 0x40100000, len 29120, room 16
tail 0
chksum 0x70
...
As I said, this happens randomly, so the problem is not related to specific flash address or buffer address.