Skip to main content

spiflash.size()

Returns the total number of bytes in the SPI flash that are available to Squirrel

Availability

Device (from impOS™ 30)

Returns

Integer — the number of bytes of storage in the SPI flash available for user code use

Description

This method returns the size in bytes of the SPI flash storage area available to Squirrel. This is not the actual capacity of the attached SPI flash device as some capacity is reserved for impOS™ usage. How much storage is reserved for the operating system depends on the type of imp being used.

The imp003 requires 512KB of flash storage so it must be connected to a flash chip of at least 4Mbit in size. Only if a chip with a higher capacity than that is installed will any of the flash be left over for Squirrel to use.

The imp005 requires 3448KB of flash storage so it must be hooked up to a flash chip of at least 32Mbit in size. This means Squirrel will always have 648KB of flash storage available to it when running on an imp005 and possibly more if a larger chip is used.

Any SPI flash storage accessible to Squirrel is accessed via hardware.spiflash.