fix(flasher_stub): Correct boundaries for SPIWrite4B and SPIRead4B

SPIWrite4B and SPIRead4B functions are required for flash sizes bigger
than 16MB. This fix corrects the boundaries so SPIWrite and SPIRead
would be used for the whole 16MB area.

The octal flash support for 32 MB chips
(https://github.com/espressif/esptool/issues/795) will be added in a
follow-up commit.

Closes https://github.com/espressif/esptool/issues/745
This commit is contained in:
Roland Dobai
2022-12-27 12:23:26 +01:00
parent 869740ad41
commit 21e59148e7
4 changed files with 9 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -119,7 +119,7 @@ void handle_flash_read(uint32_t addr, uint32_t len, uint32_t block_size,
uint32_t n = len - num_sent;
if (n > block_size) n = block_size;
#if defined(ESP32S3)
if (addr + len > 0x00ffffff)
if (addr + n > 0x01000000)
res = SPIRead4B(1, SPI_FLASH_FASTRD_MODE, addr, buf, n);
else
res = SPIRead(addr, (uint32_t *)buf, n);
@@ -158,7 +158,7 @@ int handle_flash_get_md5sum(uint32_t addr, uint32_t len) {
n = FLASH_SECTOR_SIZE;
}
#if defined(ESP32S3)
if (addr + len > 0x00ffffff)
if (addr + n > 0x01000000)
res = SPIRead4B(1, SPI_FLASH_FASTRD_MODE, addr, buf, n);
else
res = SPIRead(addr, (uint32_t *)buf, n);

View File

@@ -320,7 +320,7 @@ void handle_flash_data(void *data_buf, uint32_t length) {
/* do the actual write */
#if defined(ESP32S3)
if (fs.next_write + length > 0x00ffffff)
if (fs.next_write + length > 0x01000000)
res = SPIWrite4B(1, SPI_FLASH_FASTRD_MODE, fs.next_write, data_buf, length);
else
res = SPIWrite(fs.next_write, data_buf, length);