13.2 Flash programming configuration

Each target platform supported by DS-5 has an entry in the DS-5 configuration database. To add support for flash programming, a target's platform entry in the database must define both the flash programming method and any required parameters.

Configuration files

The target's platform entry information is stored across two files in the configuration database:
  • project_types.xml - This file describes the debug operations supported for the platform and may contain a reference to a flash configuration file. This is indicated by a tag such as <flash_config>CDB://flash.xml</flash_config>.
    The CDB:// tag indicates a path relative to the target's platform directory which is usually the one that contains the project_types.xml file. You can define a relative path above the target platform directory using ../. For example, a typical entry would be similar to <flash_config>CDB://../../../Flash/STM32/flash.xml</flash_config>.
    Using relative paths allows the flash configuration file to be shared between a number of targets with the same chip and same flash configuration.
  • The FDB:// tag indicates a path relative to where the Jython flash files (such as the stm32_setup.py and keil_flash.py used in the examples) are located. For DS-5 installations, this is usually <DS-5 Install folder>\sw\debugger\configdb\Flash.
  • A flash configuration .xml file. For example, flash.xml. This .xml file describes flash devices on a target, including which memory regions they are mapped to and what parameters need to be passed to the flash programming method.
A flash configuration must always specify the flash programming method to use, but can also optionally specify a setup script and a teardown script. Setup and teardown scripts are used to prepare the target platform for flash programming and to re-initialize it when flash programming is complete. These scripts might be very specific to the target platform, whereas the flash programming method might be generic.

Configuration file example

This example flash.xml is taken from the Keil MCBSTM32E platform. It defines two flash devices even though there is only one built-in flash device in the MCBSTM32E. This is because the two flash sections, the main flash for program code and the option flash for device configuration, are viewed as separate devices when programming.
Note how the flash method is set to the keil_flash.py script and how the parameters for that method are subsequently defined.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--Copyright (C) 2012 ARM Limited. All rights reserved.-->
<flash_config
     xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://www.arm.com/flash_config"
     xsi:schemaLocation="http://www.arm.com/flash_config flash_config.xsd">
	<devices>
		<!-- STM32F1xx has 2 flash sections: main flash for program code and option
		flash for device configuration.  These are viewed as separate devices
		when programming -->
		<!-- The main flash device -->
		<device name="MainFlash">
			<programming_type type="FILE">
				<!-- Use the standard method for running Keil algorithms -->
				<method language="JYTHON" script="FDB://keil_flash.py" class="KeilFlash" method_config="Main"/>
				<!-- Target specific script to get target in a suitable state for programming -->
				<setup script="FDB://stm32_setup.py" method="setup"/>
			</programming_type>
		</device>
		<!-- The option flash device -->
		<device name="OptionFlash">
			<programming_type type="FILE">
				<method language="JYTHON" script="FDB://keil_flash.py" class="KeilFlash" method_config="Option"/>
				<setup script="FDB://stm32_setup.py" method="setup"/>
			</programming_type>
		</device>
	</devices>
	<method_configs>
		<!-- Parameters for programming the main flash -->
		<method_config id="Main">
			<params>
				<!-- Programming algorithm binary to load to target -->
				<param name="algorithm" type="string" value="FDB://algorithms/STM32F10x_512.FLM"/>
				<!-- The core in the target to run the algorithm -->
				<param name="coreName" type="string" value="Cortex-M3"/>
				<!-- RAM location & size for algorithm code and write buffers -->
				<param name="ramAddress" type="integer" value="0x20000000"/>
				<param name="ramSize" type="integer" value="0x10000"/>
				<!-- Allow timeouts to be disabled -->
				<param name="disableTimeouts" type="string" value="false"/>
				<!-- Set to false to skip the verification stage -->
				<param name="verify" type="string" value="true"/>
			</params>
		</method_config>
		<!-- Parameters for programming the option flash -->
		<method_config id="Option">
			<params>
				<!-- Programming algorithm binary to load to target -->
				<param name="algorithm" type="string" value="FDB://algorithms/STM32F10x_OPT.FLM"/>
				<!-- The core in the target to run the algorithm -->
				<param name="coreName" type="string" value="Cortex-M3"/>
				<!-- RAM location & size for algorithm code and write buffers -->
				<param name="ramAddress" type="integer" value="0x20000000"/>
				<param name="ramSize" type="integer" value="0x10000"/>
				<!-- Allow timeouts to be disabled -->
				<param name="disableTimeouts" type="string" value="false"/>
				<!-- Set to false to skip the verification stage -->
				<param name="verify" type="string" value="true"/>
			</params>
		</method_config>
	</method_configs>
</flash_config> 
Related tasks
13.3 Creating an extension database for flash programming
Non-ConfidentialPDF file icon PDF versionARM DUI0446W
Copyright © 2010-2015 ARM. All rights reserved.