Repository navigation
Add PSOC Edge flashing support via OpenOCD - #125
NikhitaR-IFX wants to merge 10 commits into
Conversation
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
|
Thank you for the PR, I'll need to review it in more detail, please allow some time for that. One challenge is that I do not have access to the hardware needed to validate independently. |
Thank you @Josverl for looking into this. We will be happy to support to push this PR ahead. Regarding the hardware, I understand Juan ( @jaenrig-ifx ) has already connected with you. Looking forward to hear from you! Best Regards, |
|
Thank you - received the kit today. I was able to flash the board after an initial snag with udev rules. Initial feedback from exploratory testing on a Ubuntu machine without any Infinion toolchain prior installed. Note I needed to push am update to mpflash due to an expired access key. that also caused several of the errors in CI P2 - missing udev rule
I ran OpenOCD’s probe initialization without flashing. It reports: Applied Fix
sudo cp -f ~/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/udev_rules/60-openocd.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
I think it would be good to install the udev rules right after installingInfineon OpenOCD, While the need for the udev rules is explicitly noted in the comments of this PR , I do not expect users to read these. They expect a tool to work, or at least to tell them what they should do to get things working. So I think at minimum the error message should be clearer / understandable. P2 — Linux can lose the selected probe’s serial number. The new metadata assignment in You can reproduce this by specifying only Error Details
with udev rules
mpflash -VVV flash --board KIT_PSE84_AI --serial /dev/ttyACM0 ** SERIES: PSE84 (E81/E82/E83/E84) transport: swd ** Silicon: 0xED94, Family: 0x115, Rev.: 0x21 (B0) Info : Examination succeed [ 50%] [ Erasing ] [ 23%] [ Programming ] [100%] [ Erasing ] [100%] [ Programming ] 21:43:58 | ℹ️ Done flashing, board has been reset ... |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
==========================================
+ Coverage 80.71% 81.23% +0.52%
==========================================
Files 80 86 +6
Lines 5160 5517 +357
Branches 777 825 +48
==========================================
+ Hits 4165 4482 +317
- Misses 765 792 +27
- Partials 230 243 +13 ☔ View full report in Codecov by Harness. |
|
Thanks for testing this on a clean machine, and for the detailed logs. Both points are right. I will fix the udev issue and the lost probe serial number on Linux and then push the changes to this PR. |
|
Hi @Josverl , I have pushed 3 commits to cover the points you mentioned and some minor gaps I found. Find the details per commit below:
Tested on a KIT_PSE84_AI. |
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
Adds flashing support for Infineon PSOC Edge boards (
psoc-edgeport, tested onKIT_PSE84_AI).KIT_PSE84_AIis already present forpsoc-edge.ziprelease package(
.hex+PSE84_SMIF.FLMQSPI flash loader +qspi_config.cfg) from micropython.orgpsoc-edge/.ziptoPORT_FWTYPESand the worklist firmware rankingopenocdflash backend that plugs into the registry (--method openocd, auto-selected)MPFLASH_OPENOCD, thenPATH, >= 5.8.0); download the pinned release if missingadapter serial(--probeoverrides)--erase,mpflash eraseandmpflash format/flash --formatforpsoc-edgeKIT_PSE84_AI): flash,mpflash format,mpflash eraseImplementation summary
mpflash/flash/builtins/openocd_backend.py. Ports and boards come from the table inopenocd/targets.py, so the backend has no board names in it and another Infineon port is a data entry.openocd/runner.py): accepts only the Infineon build (stock OpenOCD has no PSE84 target),runs it without a shell, and reports OpenOCD's own error output.
openocd/flash.py): extracts.hex,.FLMand.cfgfrom the zip, then runsinit; reset init; flash write_image erase; verify_image; reset run; shutdownover SWD/KitProg3.openocd/download.py): pinned Infineon release v5.16.1 with a SHA-256 check andpath-traversal protection, installed into the user cache folder. Asks first when interactive;
--yes/-yskips the question.so
erase_filesystemgot a per-port timeout (ERASE_TIMEOUTS, 600 s forpsoc-edge; the 60 s default forother ports is unchanged).
MPRemoteBoard.usb_serial_number(new attribute),FlashMethod.OPENOCD, CLI help text.Testing
tests/flash/test_openocd.py: OpenOCD discovery and version check, zip handling, command construction,serial validation, backend selection, erase ordering and timeout, download/checksum/path-traversal,
board-id lookup (including hyphenated names and variant suffixes).
uv run pytest).KIT_PSE84_AIwith Infineon OpenOCD 5.16.1.4486 on Linux.Notes for reviewers
openocdmethod is limited to ports listed intargets.py(currently onlypsoc-edge) and has beentested only on Infineon PSOC Edge hardware (
KIT_PSE84_AI).Other hosts get a clear error and can set
MPFLASH_OPENOCD..hexfiles (--build) are not supported yet, because flashing needs the QSPI layoutand flash loader from the release zip.
(mpflash does not install them).