Keil Logo

Converting FlashDev.c

Device description files provided for ULINK adapters can be converted to be used by RL-FlashFS. Two macros which must be specified in this file:

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


The following example shows the conversion steps for the Am29x800BT Flash Device:

  1. Copy the file FlashDev.c from the folder \Keil\ARM\Flash\AM29F160DB to a subfolder of \Keil\ARM\RL\FlashFS\Flash.
  2. Rename the file to FS_FlashDev.h
  3. Delete the 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 the lines at the bottom:
      SECTOR_END
    };
    
  4. Expand and convert the sector description 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 the 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 this step for each line in the file.
  6. Add a macro FL_NSECT defining the number of sectors.

If everything has been done correctly, the file FS_FlashDev.h should look like this.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.