Skip to main content


Erases a 4KB sector of the SPI flash


Device (from impOS™ 30)


Name Type Description
sectorAddress Integer The address of the 4KB sector to be erased




This method causes the erasure of an entire sector of the SPI flash storage, setting each bit in the sector to 1.

Every sector is 4KB long and arranged on 4KB boundaries, ie. beginning at addresses 0x0000, 0x1000, 0x2000 and so on. Calling this method with an address that is not on a 4KB boundary will cause a Squirrel error to be raised. With the imp003, imp004m and imp005, you must fit a SPI flash chip which supports 4KB erases; the imp005 SPI flash must also support 64KB erases.

If for any reason a sector has been hardware protected — set to read-only mode — in the manufacturing process, this call will fail.

Example Code

Erase the first 12KB of the SPI flash storage.