RL-ARM User's Guide

Flash Driver

Flash driver describes the flash programming functions for an embedded parallel Flash. The functions are located in the file FS_FlashPrg.c of the folder \ARM\RL\FlashFS\Flash\device_family.

The driver control block structure is defined in File_Config.h as follows:

/* Embedded Flash Device driver */
typedef struct {
  BOOL (*Init)        (U32 adr, U32 clk);
  BOOL (*UnInit)      (void);
  BOOL (*ReadData)    (U32 adr, U32 sz, U8 *buf);   /* Optional, NULL for memory-mapped Flash */
  BOOL (*ProgramPage) (U32 adr, U32 sz, U8 *buf);
  BOOL (*EraseSector) (U32 adr);
  BOOL (*EraseChip)   (void);                       /* Optional, NULL if not existing    */
} const EFS_DRV;

Developers can adapt the code of the following functions:

  • Init()
    This function is called when the RL-FlashFS is initialized by the finit function.
  • UnInit()
    This function is called to uninitialize the embedded flash drive by the funinit function.
  • ReadData()
    This function is used to read data from a Flash Device.
    Not provided (NULL) for parallel memory-mapped flash device.
  • ProgramPage()
    This function is used to program data into a Flash Device.
  • EraseSector()
    This function is called by the RL-FlashFS to erase a flash sector and from the fformat function to format the device.
  • EraseChip()
    This function is used to global erase a flash device. It is called from the fformat function.

Note

An alternative to writing a new Flash Driver is to convert an exiting ULINK Flash programming algorithm. Refer to Converting FlashPrg.c for detailed instructions.