Keil™, An ARM® Company

RL-ARM User's Guide

Converting FlashDev.c

Here are instructions to convert existing device description files for various Flash Devices, which are used by ULINK flash programming with RL-FlashFS. There are two macros which must be specified in this file:

  • the FLASH_DEVICE macro defines sector layout,
  • the FL_NSECT macro defines the number of flash sectors.


The following example describes conversion for the Am29x800BT Flash Device:

  1. Copy the FlashDev.c file from \Keil\ARM\Flash to a subfolder under \Keil\ARM\RL\FlashFS\Flash with the same subfolder name. This is a device name.
  2. Rename this file to FS_FlashDev.h
  3. Delete following lines:
    #include "..\FlashOS.H"       // FlashOS Structures
    
    struct FlashDevice const FlashDevice  =  {
      FLASH_DRV_VERS,             // Driver Version, do not modify!
      "AM29x800BT Flash",         // Device Name
      EXT16BIT,                   // Device Type
      0x000000,                   // Device Start Address
      0x100000,                   // Device Size in Bytes (1MB)
      1024,                       // Programming Page Size
      0,                          // Reserved, must be 0
      0xFF,                       // Initial Content of Erased Memory
      100,                        // Program Page Timeout 100 mSec
      3000,                       // Erase Sector Timeout 3000 mSec
    
    // Specify Size and Address of Sectors
    
    and lines at the bottom:
      SECTOR_END
    };
    
  4. Expand and Convert the Sector description and convert it to a macro FLASH_DEVICE.
      0x10000, 0x000000,          // Sector Size 64kB (14 Sectors)
    
    This line needs to be expanded to 14 lines for 14 sectors using a DFB macro. Do not forget a macro continuation sign \.
      DFB(0x10000, 0x000000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x010000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x020000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x030000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x040000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x050000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x060000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x070000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x080000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x090000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x0A0000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x0B0000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x0C0000),   /* Sector Size 64kB */    \ 
      DFB(0x10000, 0x0D0000),   /* Sector Size 64kB */    \ 
    
  5. Repeat the expansion for each line from the file.
  6. Add an FL_NSECT macro with defined number of sectors.

If you have done everything correctly, your FS_FlashDev.h file should look like this.