|
Home / RL-ARM User's Guide (MDK v4)
 
Converting FlashDev.c
Home » RL-FlashFS » Using RL-FlashFS » Using Flash Devices » 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:
-
Copy the file FlashDev.c from the folder
\Keil\ARM\Flash\AM29F160DB to a subfolder of
\Keil\ARM\RL\FlashFS\Flash.
- Rename the file to FS_FlashDev.h
-
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
};
-
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 */ \
- Repeat this step for each line in the file.
-
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.
|