Keil Logo

Creating Flash Programming Algorithms

New Flash programming algorithms can be created with µVision. Programming algorithms are defined with functions to erase and program the Flash device. Special compiler and linker settings are required.

Arm Cortex-based devices

A detailed description on how to create Flash programming algorithms for Arm Cortex-based devices is available in the CMSIS documentation on GitHub: Creating a new algorithm. For older devices (Arm7 and Arm9, please follow the step mentioned below).

Arm7 and Arm9 based devices

Follow these steps to create and configure a new Flash programming algorithm:

  1. Create a new and empty sub-folder in \KEIL\ARM\FLASH\.
  2. Copy the content of an existing Flash algorithm to this new folder, for example copy \KEIL\ARM\FLASH\LPC_IAP_256.
  3. Rename the files LPC_IAP_256.uv2 and LPC_IAP_256.opt to 29F400.uv2 and 29F400.opt, to represent the new Flash ROM device name.
  4. Open the project with µVision and replace the target name using Project — Manage — Project Items.
  5. Select the device using Project — Options for Target — Device. Ensure to use the correct endianness.
    • Device ARM - ARM7 will fit for most ARM7 and ARM9 processor-based devices.
    • Device ARM - ARM9xxE-S will fit for most ARM9E-S processor-based devices.
  6. Replace all output names, here LPC_IAP_256, with the new device name. Use the Project — Options for Target — Output dialog.
  7. Adjust the names in the field Run #1 of the Project — Options for Target — User dialog. For ARM7 and ARM9 processor-based devices use the suffix FLX.
  8. Enable Read-Only Position Independent and Read-Write Position Independent in both dialogs Project — Options for Target — C/C++ and Project — Options for Target — Asm.
  9. Open Project — Options for Target — Linker and enter .\Target.lin in the Scatter File field.
  10. In Misc controls use --entry 0 for ARM7 and ARM9 processor-based devices.
  11. Edit the FlashPrg.c file and create the code for the mandatory functions EraseChip, EraseBlock, and ProgramBlock. Code the optional functions Init and UnInit according to the requirements of the device.
  12. Edit the FlashDev.c file and define the device parameters within the FlashDevice structure.
  13. Build the new Flash programming algorithm. The output file, which has the extension *.FLX, contains the programming algorithm. The file is copied to the appropriate folder automatically.

Note

  • This feature is not supported by the MDK-Lite (evaluation) Edition. Refer to Limitations for additional information.
  • Use the Add button in the Flash Download Setup dialog to add this programming algorithm to a µVision project.
  • The \KEIL\ARM\FLASH\LPC_IAP_256\TEST folder contains a project that shows how to test a new Flash Programming Algorithm.
  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.