Pyocd errors when trying to flash at a specific address

In working with mcuboot bootloader, I’m not able to flash a signed image to slot1_partitition (address 0x73000 on a particle_xenon board that has mcuboot bootloader) using pyocd.

However, I have no issues when using Segger jflashlite utility. pyocd seems to prefer start flashing at address 0x00080000.

Has anyone else seen a similar behavior with pyocd? Thanks.

$pyocd flash -a 0x73000 -t nrf52 signed-new_blinky.bin


0001214:CRITICAL:__main__:no memory region defined for address 0x00080000
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyocd/", line 398, in run
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyocd/", line 572, in do_flash
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyocd/flash/", line 157, in program
    self._format_handlers[file_format](file_obj, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyocd/flash/", line 176, in _program_bin
    self._loader.add_data(address, data)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyocd/flash/", line 115, in add_data
    raise ValueError("no memory region defined for address 0x%08x" % address)
ValueError: no memory region defined for address 0x00080000

Does it work if you specify -t cortex_m instead? Or -t nrf52840?

Thank you for the quick response. Yes, indeed! -t nrf52840 worked, although the flashing is noticeably slower.

If I build the application in PlatformIO, using -DCONFIG_BOOTLOADER_MCUBOOT=y in the platform.ini file, the upload via jlink should be a lot faster.

I guess, I would need to use a custom upload script that first signs the application and then uses jlink to upload the image to a target with a mcuboot bootloader.

Would this be the best approach or is there another way that PlatformIO can assist with signing the built application image? Thanks.

I do remember at least two threads about MCUBoot here but they all seem to be using hacks to get it to working (or not at all). I think the best way would be to ask at e.g. Issues · platformio/platform-nordicnrf52 · GitHub for guidance or request for integration, since PlatformIO seems to be missing the steps for that bootloader.

Thanks. I’m reluctant to do a hack plus a proper integration and implementation would benefit our wider PlatformIO community.

Given the MCUboot enhancements that are occurring in Zephyr-RTOS, I think I’ll put together a short proposal on integrating mcuboot bootloader & bootloader applications into PlatformIO.

I’ll pitch the proposal to the PlatformIO-IDE team and offer assistance on its design & implementation.