Limit automatic read burst length to 64K

Reading of very large binaries (e.g. 32 MB) can cause stack overflow.
Put a reasonable limit on read burst length.
This commit is contained in:
Petr Nechaev 2022-10-16 15:44:33 +03:00
parent 7185bbd127
commit 1bbe448f3a
1 changed files with 4 additions and 1 deletions

View File

@ -382,8 +382,11 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
bool SPIFlash::verify(const int &base_addr, const uint8_t *data,
const int &len, int rd_burst)
{
if (rd_burst == 0)
if (rd_burst == 0) {
rd_burst = len;
if (rd_burst > 65536)
rd_burst = 65536;
}
printInfo("Verifying write (May take time)");