| |||
| Home > Reading and writing to flash memory > Writing an image to flash memory | |||
You must define a suitable memory map for your algorithm before the debugger can carry out flash programming operations.
Before carrying out any flash programming operations you must register your flash algorithm with the debugger.
To use this feature you must have a valid Compiler license file.
To set up the memory map and write an image to flash memory:
Use the mem flash command to define
a region of flash memory and insert it into the memory map for the
target. For example:
memory flash 0x08000000 0x0801FFFF Keil.STM32F10x_128.FLX clockSpeed=8000000 # Defines a flash region for Keil.STM32F10x_128.FLX algorithm
Use the mem command to define a
region of RAM and insert it into the memory map for the target.
For example:
memory 0x20000000 0x20004FFF # specify RW region 0x20000000 0x20004FFF
Use the info mem command to verify
the memory map for the target.
Use the set flash-buffer command
to define a region of RAM memory for use as a buffer when programming
flash memory. The memory range is written to as part of flash programming,
and the original content is not restored afterwards. For example,
to define the buffer shown in the figure you can use the following:
set flash-buffer 0x20000100 0x20004EFF # set flash buffer
When all the regions are set up then you can use the same commands that you normally use when writing to RAM.
For example:
load myFlashImage.axf # Image that loads into flash # memory addresses restore myFile.bin binary 0x08000000 # Restore content of binary file # myFile.bin starting at 0x08000000
The following figure shows the memory map for this example.
ARM® DS-5™ Debugger Command Reference: