Keil Logo

ARM: MDK5.x: How to modify FLASH algorithms

Information in this knowledgebase article applies to:

  • MDK 5 all versions


How can I modify an existing Flash algorithm in MDK5? The chapter Flash Algorithms in the µVision manual refers to the file/folder structure that was used for MDK version 4.


Since MDK version 5, the FLASH algorithms are located in the corresponding Device Family Pack (DFP) folder [MDK_Install_Path]\ARM\Pack\[Vendor]\[Device_Family_Pack]\[Version]\Flash. All files in the 'Pack' folder have the file attribute 'read only' set, because these files are not intended to be changed. Therefore Flash programming algorithms shall not be added/modified nor rebuild within the Pack folder.

Up to MDK version 4, all Flash algorithms were located in the folder [MDK_Install_Path]\ARM\Flash. In MDK version 5, this folder is dedicated to custom Flash algorithms and external Flash devices. Flash algorithms in this folder are shown in the dialog Add Flash Programming Algorithm (see below) with Origin = MDK Core. Therefore we recommend to copy an existing Flash algorithm from the DFP folder into this ARM\Flash folder and to modify and build it there.

  1.   Locate the Flash algorithm source code and project files:
    • Open a µVision project with a Cortex-M device selected.
    • Open the dialog Options for Target and select the tab Utilities. Then press the button Settings to open the dialog Cortex-M Target Driver Setup with the tab Flash Download selected.
    • Press the button Add to open the dialog to select a Flash algorithm. Then select the Flash Algorithm you want to modify. In the bottom of this dialog, you see the path and filename of this flash algorithm.

      Path to Flash algorithm
  2. Copy the Flash algorithm, modify it and build it:
    • The folder which contains the *.FLM file also contains a folder with the source code and a µVision project. Copy this folder to the folder [MDK_Install_Path]\ARM\Flash.
    • Now you have to remove the 'read only' file attributes. Therefore right-click the folder with the flash algorithm source code and select Properties. In this dialog, unselect the atribute Read-only and press the Apply button. Another dialog wants to have your confirmation that the read-only flag should be unset for this folder, subfolders and files. Press OK.

      File Attributes for Flash folder
    • Open the Flash algorithm project in this folder and modify it according to your needs. Make sure that you also modify the Device Name in the structure FlashDevice (second line) in the module FlashDev.c so that you are able to distinguish your modified Flash algorithm from the original one. Building this project automatically copies the *.FLM file into the Flash folder.
  3. Select the modified Flash algorithm for your project:
    • Open the dialog Add Flash Programming Algorithm in your µVision application project as described in paragraph 1 above. Now you should see your modified Flash algorithm:

      Select modified Flash algorithm




The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, May 9, 2017

Did this article provide the answer you needed?
Not Sure
  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.