IntFLASH
 
Component IntFLASH
Internal FLASH
Component Level: High

This component provides access to the CPU internal FLASH memory. The entire FLASH memory must be mapped into the address space of the CPU. The flash memory consists of one or more blocks. Each block contains a number of sectors. Sector is usually smallest erasable unit. The size of the sector depends on the CPU type (the actual value of the sector size is available as a constant in the component header file, please see Types and constants page). The user can choose one the following ways of handling write operations (property Write Method):

  • Write - No erase options are available. Data are written into FLASH without any tests. Only erased bits are affected. Any of erase methods must be used (e.g EraseSector) before write or the user must be sure that the flash is already erased.
  • Destructive write (with erase) - The whole sector is erased (if necessary) without any data backup and then data is written into the FLASH.
  • Safe write (with save & erase) - If sector erase is necessary, data from sector are stored into a buffer in RAM, sector is erased and data are restored back, and then new data are written into erased area. This option could lead to compiler or runtime errors on derivatives where the RAM is not large enough for the buffer.

The component offers the following features (if they are supported by the hardware - please see the version specific notes in this document):

  • Simple access to individual items
    The component provides simple methods allowing to directly read/write individual bytes/words/longs (SetByteFlash, GetByteFlash etc.).

  • Virtual page
    The virtual page is an array located in RAM and the content of the whole array can be transferred between this virtual page and flash by using the methods SetPage and GetPage. Individual bytes of the virtual page can be accessed by using the methods GetBytePage, SetBytePage, GetWordPage, SetWordPage, GetWordPage, SetWordPage. See also event OnWritePageEnd.

  • Methods can wait for the end of the operation or exit immediately
    The write methods can wait until the writing is finished or exit immediately. This option can be controlled at runtime by the SetWait method and the Busy method can be used for the detection whether the flash memory is ready for the next operation or not.

  • Interrupt or polling based implementation
    If the interrupt support property is enabled, the OnWriteEnd and OnWritePageEnd (if the virtual page is enabled) events are available. These events are invoked when the write operation finishes.

  • Block access
    The component provides methods for reading/writing continuous data blocks: SetBlockFlash, GetBlockFlash.

Addressing

The component uses special type TAddress, which depends on the current CPU and its addressing mode (usually it is unsigned 16-bit or 32-bit integer). It is possible to use component methods DataPtr2Addr and FuncPtr2Addr to convert pointer to the correct TAddress value.

Version specific information for Freescale HCS08 and ColdFireV1 derivatives
Flash protection, security and other CPU-specific settings can be configured in CPU component properties: Internal peripherals - FLASH.
Version specific information for Freescale ColdFireV1 derivatives
For derivatives with two Flash modules and two Flash areas. The component supports only the default (after reset) position of Flash areas.