FLASH Memory

Overview

FLASH memory and EEPROM are non-volatile memory solutions that are widely used in embedded systems applications. They are available both on-chip and as external, stand-alone memory. The Keil 8051, 251, and C16x/ST10 development tools allow you to write software for all FLASH-based chips and microcontrollers that are available.

Uses for FLASH Memory

  • Using FLASH Memory for Program Code
    Program code may be stored in FLASH using any of a number of schemes. Embedded applications that must be updated benefit from FLASH memory. These systems can easily be programmed externally by device programmers and many can be re-programmed in-system.
  • Using FLASH Memory for Data Storage
    FLASH can also be used for configuration data and mass storage. These systems are typically updated on-the-fly in-system. Since FLASH is non-volatile (unless it's broken) these systems can restore configuration parameters after a power failure or reset.

Accessing FLASH Memory

In either case, your application must include code that allows you to read (or execute) and write the FLASH memory.

Reading FLASH memory works just like reading any other type of memory. The only difference with FLASH is that you may have a special format for the data it holds. This can best be represented by a C struct.

Executing from FLASH memory also works just like executing from any other type of memory. Your FLASH device (and the code it contains) start at a specific address. When you create a program that is loaded into FLASH for execution you may be required to relocate that code when programming the device (for example, upload to XDATA/RAM then write into FLASH).

Writing FLASH memory involves some real work. You must have routines that erase the FLASH and write bytes or blocks. Because of the number of different devices, these routines must be customized for each different device.