Skip to content

Add PSOC Edge flashing support via OpenOCD - #125

Open
NikhitaR-IFX wants to merge 10 commits into
Josverl:mainfrom
NikhitaR-IFX:main
Open

NikhitaR-IFX wants to merge 10 commits into
Josverl:mainfrom
NikhitaR-IFX:main

Conversation

@NikhitaR-IFX

Copy link
Copy Markdown

Adds flashing support for Infineon PSOC Edge boards (psoc-edge port, tested on KIT_PSE84_AI).

  • Review the board database: KIT_PSE84_AI is already present for psoc-edge
  • Research how MicroPython flashes this port: Infineon OpenOCD with the .zip release package
    (.hex + PSE84_SMIF.FLM QSPI flash loader + qspi_config.cfg) from micropython.org
  • Add psoc-edge / .zip to PORT_FWTYPES and the worklist firmware ranking
  • Add a new openocd flash backend that plugs into the registry (--method openocd, auto-selected)
  • Find an Infineon OpenOCD (MPFLASH_OPENOCD, then PATH, >= 5.8.0); download the pinned release if missing
  • Use the board's KitProg3 USB serial number as the OpenOCD adapter serial (--probe overrides)
  • Support --erase, mpflash erase and mpflash format / flash --format for psoc-edge
  • Write unit tests (66 tests, all hardware/network/subprocess mocked)
  • Update README, CHANGELOG and docs
  • Verify on hardware (KIT_PSE84_AI): flash, mpflash format, mpflash erase

Implementation summary

  • Backend: mpflash/flash/builtins/openocd_backend.py. Ports and boards come from the table in
    openocd/targets.py, so the backend has no board names in it and another Infineon port is a data entry.
  • OpenOCD handling (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.
  • Flashing (openocd/flash.py): extracts .hex, .FLM and .cfg from the zip, then runs
    init; reset init; flash write_image erase; verify_image; reset run; shutdown over SWD/KitProg3.
  • Download (openocd/download.py): pinned Infineon release v5.16.1 with a SHA-256 check and
    path-traversal protection, installed into the user cache folder. Asks first when interactive;
    --yes/-y skips the question.
  • Erase: a PSOC Edge filesystem erase takes about 4 minutes (220 x 256 KB QSPI sectors, about 1 s each),
    so erase_filesystem got a per-port timeout (ERASE_TIMEOUTS, 600 s for psoc-edge; the 60 s default for
    other ports is unchanged).
  • Other: 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).
  • Full suite: 878 passed, 51 skipped (uv run pytest).
  • Hardware: run on a KIT_PSE84_AI with Infineon OpenOCD 5.16.1.4486 on Linux.

Notes for reviewers

  • The openocd method is limited to ports listed in targets.py (currently only psoc-edge) and has been
    tested only on Infineon PSOC Edge hardware (KIT_PSE84_AI).
  • Auto-download covers the platforms Infineon publishes packages for (Linux x64, Windows x64, macOS arm64).
    Other hosts get a clear error and can set MPFLASH_OPENOCD.
  • Locally built .hex files (--build) are not supported yet, because flashing needs the QSPI layout
    and flash loader from the release zip.
  • On Linux the KitProg3 probe needs the udev rules shipped in the Infineon OpenOCD package
    (mpflash does not install them).

@NikhitaR-IFX
NikhitaR-IFX requested a review from Josverl as a code owner October 29, 2026 11:25
@Josverl Josverl added the enhancement New feature or request label Oct 29, 2026
@Josverl

Josverl commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thank you for the PR,
Very happy to see additional backbends added.

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.
I'll ask if another contributor can help.

@NikhitaR-IFX

Copy link
Copy Markdown
Author

Thank you for the PR, Very happy to see additional backbends added.

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. I'll ask if another contributor can help.

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,
Nikhita

@Josverl

Josverl commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

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
I tested on this PR rebased on top of main.

P2 - missing udev rule

  • board connected to the program/debug USB connector ( J1 , righthand)
  • P2: error on flashing: 21:26:09 | ❌ Failed to flash KIT_PSE84_AI on /dev/ttyACM0: OpenOCD failed with exit code 1. Is the board connected?

I ran OpenOCD’s probe initialization without flashing. It reports:
could not open device 0x04b4:0xf155: Access denied (insufficient permissions)

Applied Fix

  • Install the rules from the downloaded OpenOCD package:
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
  • Unplug and reconnect the board

I think it would be good to install the udev rules right after installingInfineon OpenOCD,
and perhaps prompt the user the user to sudo ... --reload-rules and/or check access to the 0x04b4:0xf155: device ?

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.
It would be nice if the udev rules could be copied after a user confirms that. ( I think I should do that as well for some other backends)
I suggest the relevant udev rules to be addedd to : mpflash/udev_rules to simplify discovering (with relevant attribution / licensing)

P2 — Linux can lose the selected probe’s serial number. The new metadata assignment in mpremoteboard/__init__.py is skipped for absolute paths by the earlier Path.is_absolute() check at line 79.
Linux serial devices such as /dev/ttyACM0 are absolute paths.

You can reproduce this by specifying only --serial
With multiple probes connected, OpenOCD may select a different board from the one selected by serial port.
While using --probe <KitProg3 serial> can be used to correct this, it is a workaround; the code should preserve serial metadata for POSIX serial devices and test this path.

Error Details

(mpflash) jos@nucnuc:~/mypython/mpflash$ mpflash -VVV  flash --board KIT_PSE84_AI --serial /dev/ttyACM0
21:26:08 | 🐞 version: 1.29.3
21:26:08 | ✏️ Setting quiet mode to False
21:26:08 | ✏️ Setting interactive mode to True
21:26:08 | ✏️ ask_missing_params: FlashParams(ports=[], boards=['KIT_PSE84_AI'], variant=None, versions=['stable'], serial=['/dev/ttyACM0'], ignore=[], 
bluetooth=False, force=False, erase=False, format_fs=False, bootloader=\<BootloaderMethod.AUTO: 'auto'\>, cpu=None, flash_mode='keep', custom=False, 
volumes=[], retry_on_error=True, retry_baud=115200, retry_flash_mode='dio')
21:26:08 | ✏️ Using latest stable version: v1.29.0
21:26:08 | ✏️ filtered_portinfos: ignore=[], include=['/dev/ttyACM0'], bluetooth=False
21:26:08 | ✏️ include=['/dev/ttyACM0'], ignore=[], bluetooth=False
21:26:08 | ✏️ comports: ['/dev/ttyACM0']
21:26:08 | ✏️ explicit: ['/dev/ttyACM0']
21:26:08 | 🐞 filtered_comports: ['/dev/ttyACM0']
21:26:08 | 🐞 Creating manual worklist for 1 ports, board_id: KIT_PSE84_AI, version: v1.29.0
21:26:08 | ✏️ Manual updating /dev/ttyACM0 to KIT_PSE84_AI v1.29.0
21:26:08 | 🐞 Creating manual board task: /dev/ttyACM0 KIT_PSE84_AI v1.29.0
21:26:08 | 🐞 Looking for firmware for KIT_PSE84_AI v1.29.0 
21:26:08 | ℹ️ Found v1.29.0 firmware psoc-edge/KIT_PSE84_AI-v1.29.0.zip for KIT_PSE84_AI on /dev/ttyACM0.
21:26:08 | ℹ️ Updating KIT_PSE84_AI on /dev/ttyACM0 to v1.29.0
21:26:09 | 🐞 Using flash backend: openocd for KIT_PSE84_AI
21:26:09 | ℹ️ Flashing KIT_PSE84_AI-v1.29.0.zip to KIT_PSE84_AI on /dev/ttyACM0 using /home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/bin/openocd
21:26:09 | 🐞 Running OpenOCD: ['/home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/bin/openocd', '-s', 
'/home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/scripts', '-s', '/tmp/mpflash-openocd-88v1idf1', '-c', 'set QSPI_FLASHLOADER 
{/tmp/mpflash-openocd-88v1idf1/PSE84_SMIF.FLM}', '-c', 'source ', '-c', 'transport select swd', '-c', 'source ', '-c', 'init', '-c', 'reset init', '-c', 
'adapter speed 12000', '-c', 'flash write_image erase {/tmp/mpflash-openocd-88v1idf1/firmware.hex}', '-c', 'verify_image 
{/tmp/mpflash-openocd-88v1idf1/firmware.hex}', '-c', 'reset run', '-c', 'shutdown']
21:26:09 | ✏️ Open On-Chip Debugger 0.12.0+dev-5.16.1.4486 (2026-04-14-19:02)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
***************************************
** SERIES:   PSE84 (E81/E82/E83/E84)
** DEVICE:   PSE8xxGxS2
** BOARD:    Generic
***************************************
transport: swd
adapter name: kitprog3
adapter speed: 4000 kHz
adapter srst delay: 50
cortex_m reset_config sysresetreq
Info : Using CMSIS-flash algorithms 'PSE84_RRAM_NVM' for bank 'cat1d.cm33.main_ns' (footprint 5464 bytes)
Info : CMSIS-flash: ELF path: ../flm/infineon/pse8xxgp/PSE84_RRAM_NVM.FLM
Info : CMSIS-flash: Address range:     0x22000000-0x22069FFF
Info : CMSIS-flash: Program page size: 0x00000400 bytes
Info : CMSIS-flash: Erase sector size: 0x00000400 bytes, unified
Info : Using CMSIS-flash algorithms 'PSE84_SMIF' for bank 'cat1d.cm33.smif1_ns' (footprint 38304 bytes)
Info : CMSIS-flash: ELF path: /tmp/mpflash-openocd-88v1idf1/PSE84_SMIF.FLM
Info : CMSIS-flash: Address range:     0x60000000-0x67FFFFFF
Info : CMSIS-flash: Program page size: 0x00001000 bytes
Info : CMSIS-flash: Erase sector size: 0x00040000 bytes, unified
Error: unable to find a matching CMSIS-DAP device

21:26:09 | ❌ Failed to flash KIT_PSE84_AI on /dev/ttyACM0: OpenOCD failed with exit code 1. Is the board connected?
adapter name: kitprog3
adapter speed: 4000 kHz
adapter srst delay: 50
cortex_m reset_config sysresetreq
Info : Using CMSIS-flash algorithms 'PSE84_RRAM_NVM' for bank 'cat1d.cm33.main_ns' (footprint 5464 bytes)
Info : CMSIS-flash: ELF path: ../flm/infineon/pse8xxgp/PSE84_RRAM_NVM.FLM
Info : CMSIS-flash: Address range:     0x22000000-0x22069FFF
Info : CMSIS-flash: Program page size: 0x00000400 bytes
Info : CMSIS-flash: Erase sector size: 0x00000400 bytes, unified
Info : Using CMSIS-flash algorithms 'PSE84_SMIF' for bank 'cat1d.cm33.smif1_ns' (footprint 38304 bytes)
Info : CMSIS-flash: ELF path: /tmp/mpflash-openocd-88v1idf1/PSE84_SMIF.FLM
Info : CMSIS-flash: Address range:     0x60000000-0x67FFFFFF
Info : CMSIS-flash: Program page size: 0x00001000 bytes
Info : CMSIS-flash: Erase sector size: 0x00040000 bytes, unified
Error: unable to find a matching CMSIS-DAP device
21:26:09 | ❌ No boards were flashed

with udev rules

mpflash -VVV flash --board KIT_PSE84_AI --serial /dev/ttyACM0
21:43:50 | 🐞 version: 1.29.3
21:43:50 | ✏️ Setting quiet mode to False
21:43:50 | ✏️ Setting interactive mode to True
21:43:50 | ✏️ ask_missing_params: FlashParams(ports=[], boards=['KIT_PSE84_AI'], variant=None, versions=['stable'], serial=['/dev/ttyACM0'], ignore=[],
bluetooth=False, force=False, erase=False, format_fs=False, bootloader=<BootloaderMethod.AUTO: 'auto'>, cpu=None, flash_mode='keep', custom=False,
volumes=[], retry_on_error=True, retry_baud=115200, retry_flash_mode='dio')
21:43:50 | ✏️ Using latest stable version: v1.29.0
21:43:50 | ✏️ filtered_portinfos: ignore=[], include=['/dev/ttyACM0'], bluetooth=False
21:43:50 | ✏️ include=['/dev/ttyACM0'], ignore=[], bluetooth=False
21:43:50 | ✏️ comports: ['/dev/ttyACM0']
21:43:51 | ✏️ explicit: ['/dev/ttyACM0']
21:43:51 | 🐞 filtered_comports: ['/dev/ttyACM0']
21:43:51 | 🐞 Creating manual worklist for 1 ports, board_id: KIT_PSE84_AI, version: v1.29.0
21:43:51 | ✏️ Manual updating /dev/ttyACM0 to KIT_PSE84_AI v1.29.0
21:43:51 | 🐞 Creating manual board task: /dev/ttyACM0 KIT_PSE84_AI v1.29.0
21:43:51 | 🐞 Looking for firmware for KIT_PSE84_AI v1.29.0
21:43:51 | ℹ️ Found v1.29.0 firmware psoc-edge/KIT_PSE84_AI-v1.29.0.zip for KIT_PSE84_AI on /dev/ttyACM0.
21:43:51 | ℹ️ Updating KIT_PSE84_AI on /dev/ttyACM0 to v1.29.0
21:43:51 | 🐞 Using flash backend: openocd for KIT_PSE84_AI
21:43:51 | ℹ️ Flashing KIT_PSE84_AI-v1.29.0.zip to KIT_PSE84_AI on /dev/ttyACM0 using /home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/bin/openocd
21:43:51 | 🐞 Running OpenOCD: ['/home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/bin/openocd', '-s',
'/home/jos/.cache/mpflash/tools/openocd/5.16.1.4486/openocd/scripts', '-s', '/tmp/mpflash-openocd-o3e30lbv', '-c', 'set QSPI_FLASHLOADER
{/tmp/mpflash-openocd-o3e30lbv/PSE84_SMIF.FLM}', '-c', 'source ', '-c', 'transport select swd', '-c', 'source ', '-c', 'init', '-c', 'reset init', '-c',
'adapter speed 12000', '-c', 'flash write_image erase {/tmp/mpflash-openocd-o3e30lbv/firmware.hex}', '-c', 'verify_image
{/tmp/mpflash-openocd-o3e30lbv/firmware.hex}', '-c', 'reset run', '-c', 'shutdown']
21:43:58 | ✏️ Open On-Chip Debugger 0.12.0+dev-5.16.1.4486 (2026-04-14-19:02)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html


** SERIES: PSE84 (E81/E82/E83/E84)
** DEVICE: PSE8xxGxS2
** BOARD: Generic


transport: swd
adapter name: kitprog3
adapter speed: 4000 kHz
adapter srst delay: 50
cortex_m reset_config sysresetreq
Info : Using CMSIS-flash algorithms 'PSE84_RRAM_NVM' for bank 'cat1d.cm33.main_ns' (footprint 5464 bytes)
Info : CMSIS-flash: ELF path: ../flm/infineon/pse8xxgp/PSE84_RRAM_NVM.FLM
Info : CMSIS-flash: Address range: 0x22000000-0x22069FFF
Info : CMSIS-flash: Program page size: 0x00000400 bytes
Info : CMSIS-flash: Erase sector size: 0x00000400 bytes, unified
Info : Using CMSIS-flash algorithms 'PSE84_SMIF' for bank 'cat1d.cm33.smif1_ns' (footprint 38304 bytes)
Info : CMSIS-flash: ELF path: /tmp/mpflash-openocd-o3e30lbv/PSE84_SMIF.FLM
Info : CMSIS-flash: Address range: 0x60000000-0x67FFFFFF
Info : CMSIS-flash: Program page size: 0x00001000 bytes
Info : CMSIS-flash: Erase sector size: 0x00040000 bytes, unified
Info : Using CMSIS-DAPv2 interface with VID:PID=0x04b4:0xf155, serial=1D160D98012D2400
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : KitProg3: FW version: 2.80.1529
Info : KitProg3: Pipelined transfers enabled
Info : KitProg3: Asynchronous USB transfers enabled
Info : VTarget = 1.821 V
Info : kitprog3: acquiring device in Test Mode using custom target sequence...
Info : clock speed 4000 kHz
Info : SWD DPIDR 0x4c013477
** Target acquired in Test Mode
Info : Cortex-M33 r1p0 processor detected
Info : target has 8 breakpoints, 4 watchpoints


** Silicon: 0xED94, Family: 0x115, Rev.: 0x21 (B0)
** Detected Device: PSE846GPS2DBZC4A
** SROM Boot version: 2.0.0.6022
** RRAM Boot version: 2.0.0.7127
** SE RT Services Base version: 1.0.0.2361
** SE RT Services version: 0.0.0.0
** Extended Boot version: 1.1.0.1700
** Boot Status : CYBOOT_SUCCESS
** Life Cycle : DEVELOPMENT


Info : Examination succeed
Info : Examination succeed
Info : Examination succeed
Info : gdb port disabled
Info : gdb port disabled
Info : starting gdb server for cat1d.cm33 on 3333
Info : Listening on port 3333 for gdb connections
Info : kitprog3: acquiring device in Test Mode using custom target sequence...
** Target acquired in Test Mode
Info : external reset detected
Info : Current domain secure state: Secure
halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x120015d0 msp: 0x34005c88
adapter speed: 12000 kHz
auto erase enabled
Info : Section start address 0x60340400 breaks the required alignment of flash bank cat1d.cm33.smif1_ns
Info : Padding 1024 bytes from 0x60340000
Info : Padding image section 0 at 0x60380180 with 3712 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x60381000 .. 0x603bffff

[ 50%] [ Erasing ]
[100%] [ Erasing ]

[ 23%] [ Programming ]
[ 26%] [ Programming ]
[ 29%] [ Programming ]
[ 32%] [ Programming ]
[ 35%] [ Programming ]
[ 38%] [ Programming ]
[ 41%] [ Programming ]
[ 44%] [ Programming ]
[ 47%] [ Programming ]
[ 50%] [ Programming ]
[ 55%] [ Programming ]
[ 58%] [ Programming ]
[ 60%] [ Programming ]
[ 63%] [ Programming ]
[ 66%] [ Programming ]
[ 69%] [ Programming ]
[ 72%] [ Programming ]
[ 75%] [ Programming ]
[ 80%] [ Programming ]
[ 83%] [ Programming ]
[ 86%] [ Programming ]
[ 89%] [ Programming ]
[ 92%] [ Programming ]
[ 95%] [ Programming ]
[ 98%] [ Programming ]
[100%] [ Programming ]
Info : Padding image section 1 at 0x70106534 with 2764 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x70107000 .. 0x7013ffff

[100%] [ Erasing ]

[100%] [ Programming ]
wrote 294912 bytes from file /tmp/mpflash-openocd-o3e30lbv/firmware.hex in 4.997667s (57.627 KiB/s)
verified 287412 bytes in 1.281955s (218.944 KiB/s)
shutdown command invoked
Info : cat1d.dap: powering down debug domain...

21:43:58 | ℹ️ Done flashing, board has been reset ...
21:43:59 | ✏️ /home/jos/mypython/mpflash/.venv/bin/python -m mpremote connect /dev/ttyACM0 resume run
/home/jos/mypython/mpflash/mpflash/mpremoteboard/mpy_fw_info.py
21:44:01 | ✏️ mpy_fw_info output for /dev/ttyACM0:
21:44:01 | ✏️ {'description': 'KIT_PSE84_AI with PSOCE84', 'cpu': 'PSOCE84', 'port': 'psoc-edge', 'arch': 'armv7emsp', 'ver': '1.29.0', 'mpy': 'v6.3',
'board_id': 'KIT_PSE84_AI', 'version': '1.29.0', 'sys_platform': 'psoc-edge', 'build': '', 'variant': '', 'family': 'micropython', 'board': 'KIT_PSE84_AI'}
21:44:01 | ✏️ /home/jos/mypython/mpflash/.venv/bin/python -m mpremote connect /dev/ttyACM0 cat :board_info.toml
21:44:02 | ✏️ Did not find a board_info.toml: []
21:44:02 | ℹ️ Flashed 1 boards
Updating board info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--21:44:02 | ✏️ /home/jos/mypython/mpflash/.venv/bin/python -m mpremote connect /dev/ttyACM0 run /home/jos/mypython/mpflash/mpflash/mpremoteboard/mpy_fw_info.py
Updating board info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--21:44:04 | ✏️ mpy_fw_info output for /dev/ttyACM0:
21:44:04 | ✏️ {'description': 'KIT_PSE84_AI with PSOCE84', 'cpu': 'PSOCE84', 'port': 'psoc-edge', 'arch': 'armv7emsp', 'ver': '1.29.0', 'mpy': 'v6.3',
'board_id': 'KIT_PSE84_AI', 'version': '1.29.0', 'sys_platform': 'psoc-edge', 'build': '', 'variant': '', 'family': 'micropython', 'board': 'KIT_PSE84_AI'}
21:44:04 | ✏️ /home/jos/mypython/mpflash/.venv/bin/python -m mpremote connect /dev/ttyACM0 cat :board_info.toml
Updating board info ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--21:44:05 | ✏️ Did not find a board_info.toml: []
Updated boards after flashing
┏━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃Serial ┃Family ┃Port ┃Board ┃CPU ┃Version┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━┩
│/dev/ttyACM0│micropython│psoc-edge│KIT_PSE84_AI │PSOCE84│v1.29.0│
│ │ │ │KIT_PSE84_AI with PSOCE84│ │ │
└────────────┴───────────┴─────────┴─────────────────────────┴───────┴───────┘
(mpflash) jos@nucnuc:~/mypython/mpflash$

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.95028% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.23%. Comparing base (89f75ee) to head (33c98c1).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
mpflash/flash/builtins/openocd/download.py 79.82% 16 Missing and 7 partials ⚠️
mpflash/flash/builtins/openocd/runner.py 86.41% 8 Missing and 3 partials ⚠️
mpflash/flash/builtins/openocd/flash.py 92.68% 3 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

@NikhitaR-IFX

Copy link
Copy Markdown
Author

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.

@NikhitaR-IFX

Copy link
Copy Markdown
Author

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:

  1. 6296abc fix: keep USB serial metadata for POSIX serial device paths. On Linux, MPRemoteBoard treated ttyACM0 as a plain file, so the USB serial number was never read. Because of that, adapter serial was not passed to OpenOCD and it could pick the wrong probe when several boards were connected. It now reads the USB details for device paths, and UF2 volume directories are still skipped. I added two tests.

  2. 33c98c1 feat: explain missing KitProg3 USB permission and offer to install a udev rule.

  • Clearer error: when the KitProg3 (04b4:f155) is plugged in but the user can't open it, mpflash now says so and shows the commands to fix it. Before, it said "Is the board connected?". A probe that really isn't connected gets its own message.

  • New rule file: 65-mpflash-infineon-kitprog3.rules (plugdev + uaccess, not 0666). I wrote it following your 65-mpflash-stm32-dfu.rules. The IDs come from the KitProg3 entries in 50-cmsis-dap.rules. udevadm verify passes. I added it because the OpenOCD package's own 60-openocd.rules doesn't list f154, f155 or f166.

  • Install prompt: on an interactive Linux terminal, mpflash asks before installing the rule with sudo (default No, and --yes does not skip it), then retries once. Elsewhere it only prints the manual commands. I kept this in openocd/udev.py, so it is easy to move into the shared helper you mentioned.

  • Docs: psoc_edge_udev_rules.md, in the style of the STM32 one.

  1. 7c63ab9 fix: show square-bracket text verbatim in log output. Rich was treating [find …] in debug messages as markup, so it disappeared from the log. It is now escaped. This only affected the log, the real OpenOCD command was always correct.

Tested on a KIT_PSE84_AI.

Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants