13.5.1 About using the default implementation FlashMethodv1
Flash programming methods are written as Python classes that are required to implement the
com.arm.debug.flashprogrammer.IFlashMethod interface. This interface defines the methods the flash programming layer of DS-5 Debugger might invoke.
See the flash_method_v1.py file in the
folder>\sw\debugger\configdb\Flash\flashprogrammer for a default
com.arm.debug.flashprogrammer.FlashMethodv1. This has empty
implementations of all functions - this allows a Python class derived from this
object to only implement the required functions.
Running a flash programming method is split into three phases:
- Setup - the
setup() function prepares the target for performing
flash programming. This might involve:
- Reading and validating parameters passed from the configuration
- Opening a connection to the target.
- Preparing the target state, for example, to initialize the flash
- Loading any flash programming algorithms to the target.
- Programming - the
program() function is called for each section
of data to be written. Images might have multiple load regions, so the
program() function might be called several times. The data
to write is passed to this function and the method writes the data into flash at
- Teardown - the
teardown() function is called after all sections
have been programmed. At this stage, the target state can be restored (for
example, take the flash controller out of write mode or reset the target) and
any debug connection closed.
teardown() functions are not to be confused with the
target platform optional
teardown() scripts. The
teardown() functions defined in the flash method class
are for the method itself and not the board.