mbedmicro/CMSIS-DAP — pull request #33 by embeddedartists (2014-03-18 16:20:35+00:00)
Title: Proposed changes to flash_algo_gen.py

The current version of the flash_algo_gen.py script is limited with regards to the ALGO_START constant which must be modified depending on target. When searching the code I have found three different possible values: 0x10000000, 0x20000000 and 0x02000000. Specifying the ALGO_START value has nothing to do with the actual code in the flash_algo.axf file so setting wrong value will not be noticed.

I have added a parser for the FlashDevice structure. It is extracted from the flash_algo.axf file and not the FlashDev.c file to make sure that it is the real data. The device name from that structure is then compared with a list of known algorithm start addresses (ALGO_START_ADDRESSES).

This way the ALGO_START is found without having to add command line arguments as the old comment suggested. It also prepares for future enhancements using the actual data of the FlashDevice structure to generate more of the target_flash.h file.