Adding a new target
Add a new target to FlashAlgo
DAPlink requires FlashAlgo to program a target. You need to either write FlashAlgo source code yourself, or use the one provided with your MCU.
This step requires a Windows PC.
Repo: https://github.com/mbedmicro/flashalgo
-
To add the Flash programming source code to the FlashAlgo repository:
- Add a record to
projects.yaml
. - Create a
<target>.yaml
file in therecords/projects
directory. - Create a
FlashDev.c
file describing the attributes of the new flash device. - Create a
FlashPrg.c
file containing all the necessary functions, including Init, UnInit, EraseChip, EraseSector and ProgramPage.
You can use this PR as an example: https://github.com/mbedmicro/FlashAlgo/pull/46/files.
- Add a record to
-
To generate uVision project files, follow the instructions in Develop Setup and Develop in the FlashAlgo documentation.
-
In Keil MDK, open the project file for your target in
\projectfiles\uvision<target>
, and build it. The build directory of a successful build will have the filesc_blob.c
andc_blob_mbed.c
; save both files. You will use them in the next step (c_blob.c
inflash_blob.c
, andc_blob_mbed.c
in Flash API).
Add your new target to DAPLink
This step requires a Windows PC.
The new target needs a unique board ID. To get one, please contact your technical account manager or email our support team.
Repo: https://github.com/armmbed/daplink.
- Port a target to DAPLink.
- Copy the content of
c_blob.c
intoflash_blob.c
. - Verify your port by running DAPLink tests.
- When all DAPlink tests pass create two PRs:
- One PR against the DAPLink repository.
- One PR against the FlashAlgo repository.
Add your new target to pyOCD
To be able to debug your port:
- Set up a development environment.
- Add a new target to pyOCD.
- Test your new target.
Wait for your target support to be merged into pyOCD's master branch and released in PyPi. You can then use pip install pyOCD
to enable debug.