Difference between revisions of "Read-Modify-Write Flash"

From SEGGER Wiki
Jump to: navigation, search
Line 1: Line 1:
 
__TOC__
 
__TOC__
   
This article describes how to use the '''Read-Modify-Write (RMW)''' function of J-Link. This article assumes that there is already a basic knowledge about flash programming in general. The following example project will be shown for a Infineon XMC4500 MCU but can be applied to any other MCU which gives the option to split up physical memory sectors into smaller logical ones.
+
This article describes how to use the '''Read-Modify-Write (RMW)''' function in the J-Link software. This article assumes that there is already a basic knowledge about flash programming in general.
   
  +
The following example project will be shown for a Infineon XMC4500 MCU but can be applied to any other MCU. This can for example be used to split physical memory sectors into smaller logical ones.
By default the Read-Modify-Write threshold is set to 1 kB.
 
   
  +
By default the Read-Modify-Write threshold is set to 1 kB in order to allow read-modify-write of single bytes in flash (e.g. when editing bytes in memory windows of IDEs).
To increase the threshold J-Link offers the following command string: ''SetFlashDLNoRMWThreshold = <value>''
 
   
  +
To increase the threshold J-Link offers the following command string: ''SetFlashDLNoRMWThreshold = <value>''
A more detailed description is available in the J-Link users manual(UM8001).
 
   
  +
A more detailed description is available in the J-Link User Manual (UM08001).
= Minimum requirements =
 
In order to use the example project the following minimum requirements have to be met:
 
* J-Link software version V6.14a or later
 
* J-Link Plus HW version V10.1 or later
 
* Windows PC to execute the .bat file in the example project
 
   
 
= Sample project =
 
= Sample project =
The sample project is designed to be used with J-Link Plus and a Infineon XMC4500 MCU. It will we automatically executed when starting the .bat file.
+
The sample project is designed to be used with J-Link and a Infineon XMC4500 MCU. It will we automatically executed when starting the .bat file.
   
 
The .bat and .jlink file can be used as a reference for your own RMW flash projects.
 
The .bat and .jlink file can be used as a reference for your own RMW flash projects.
Line 22: Line 18:
 
= How to =
 
= How to =
   
For the example project the ''SetFlashDLNoRMWThreshold'' value was set to ''0xC00FFFF'' (device specific). Make sure you adjust this value depending on the device and sector you are trying to modify.
+
For the example project the ''SetFlashDLNoRMWThreshold'' value is set to ''0xFFFF'' (64 kB RMW threshold). This means that the J-Link DLL will perform a read-modify-write of flash memory regions <= 64 kB. Make sure you adjust this value depending on the device and sector you are trying to modify.
   
 
To use the example project follow these steps:
 
To use the example project follow these steps:

Revision as of 11:56, 14 March 2017

This article describes how to use the Read-Modify-Write (RMW) function in the J-Link software. This article assumes that there is already a basic knowledge about flash programming in general.

The following example project will be shown for a Infineon XMC4500 MCU but can be applied to any other MCU. This can for example be used to split physical memory sectors into smaller logical ones.

By default the Read-Modify-Write threshold is set to 1 kB in order to allow read-modify-write of single bytes in flash (e.g. when editing bytes in memory windows of IDEs).

To increase the threshold J-Link offers the following command string: SetFlashDLNoRMWThreshold = <value>

A more detailed description is available in the J-Link User Manual (UM08001).

Sample project

The sample project is designed to be used with J-Link and a Infineon XMC4500 MCU. It will we automatically executed when starting the .bat file.

The .bat and .jlink file can be used as a reference for your own RMW flash projects.

How to

For the example project the SetFlashDLNoRMWThreshold value is set to 0xFFFF (64 kB RMW threshold). This means that the J-Link DLL will perform a read-modify-write of flash memory regions <= 64 kB. Make sure you adjust this value depending on the device and sector you are trying to modify.

To use the example project follow these steps:

  • Unzip the contents of the Wiki_RMW.zip to a example folder
  • execute StartTest.bat
  • The J-Link commander will open and you should see the following output
Flash Success.PNG
  • If your output matches the screenshot, the RMW was successful (this applies only to the example project, the output on your own project might vary)