Skip to content

EFR32BG22: Memory regions must have a non-zero length #1847

@drt1245

Description

@drt1245

I am trying to use PyOCD with an EFR32BG22C224F512GM32 Bluetooth microcontroller. To install the pack, I ran the command pyocd pack install EFR32BG22C224F512GM32, which installed SiliconLabs.GeckoPlatform_EFR32BG22_DFP.2025.6.2

Running PyOCD with this target gives a memory region error:

$ pyocd gdbserver --verbose --target=EFR32BG22C224F512GM32
0000337 D [Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=0424 PID=2740). This can probably be remedied with a udev rule. See <https://github.com/pyocd/pyOCD/tree/master/udev> for help. [pyusb_backend]
0000352 D [Errno 13] Access denied (insufficient permissions) while trying to interrogate a USB device (VID=0424 PID=2740). This can probably be remedied with a udev rule. See <https://github.com/pyocd/pyOCD/tree/master/udev> for help. [pyusb_v2_backend]
0000352 D Project directory: /home/dtarry [session]
0000353 D Project directory: /home/dtarry [session]
0000367 D CMSIS-DAP v2 probe E66138528353692B: protocol version 2.0.0 [dap_access_cmsis_dap]
0000600 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000600 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000600 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000601 D GeckoPlatform_EFR32BG22_DFP DFP: skipping non-Keil flash algorithm [cmsis_pack]
0000623 C Error: Memory regions must have a non-zero length. [__main__]
Traceback (most recent call last):
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/__main__.py", line 161, in run
    status = cmd.invoke()
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/subcommands/gdbserver_cmd.py", line 182, in invoke
    session = Session(probe_proxy,
        project_dir=self._args.project_dir,
    ...<10 lines>...
        option_defaults=self._modified_option_defaults(),
    )
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/core/session.py", line 231, in __init__
    self._board = probe.create_associated_board() or Board(self)
                                                     ~~~~~^^^^^^
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/board/board.py", line 125, in __init__
    self.target = TARGET[self._target_type](session)
                  ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/target/pack/pack_target.py", line 383, in _pack_target__init__
    super(self.__class__, self).__init__(session, self._pack_device.memory_map)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/target/pack/cmsis_pack.py", line 1010, in memory_map
    self._build_memory_regions()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/target/pack/cmsis_pack.py", line 769, in _build_memory_regions
    region = MEMORY_TYPE_CLASS_MAP[type](**attrs)
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/core/memory_map.py", line 496, in __init__
    super().__init__(start=start, end=end, length=length, **attrs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dtarry/pyocd/lib/python3.13/site-packages/pyocd/core/memory_map.py", line 289, in __init__
    assert self.length > 0, "Memory regions must have a non-zero length."
           ^^^^^^^^^^^^^^^
AssertionError: Memory regions must have a non-zero length.

Running without the target specified (for generic Cortex-M) works (I can read from memory), but I can't program that way.

$ pyocd gdbserver
0000377 W Generic 'cortex_m' target type is selected by default; is this intentional? You will be able to debug most devices, but not program flash. To set the target type use the '--target' argument or 'target_override' option. Use 'pyocd list --targets' to see available targets types. [board]
0000377 I Target type is cortex_m [board]
0000394 I DP IDR = 0x6ba02477 (v2 rev6) [dap]
0000400 I AHB-AP#0 IDR = 0x84770001 (AHB-AP var0 rev8) [discovery]
0000403 I APB-AP#1 IDR = 0x54770002 (APB-AP var0 rev5) [discovery]
0000405 I AHB-AP#3 IDR = 0x84770001 (AHB-AP var0 rev8) [discovery]
0000409 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00fe000 (designer=673 part=d41) [rom_table]
0000411 I [0]<e00ff000:ROM class=1 designer=43b:Arm part=4c9> [rom_table]
0000411 I   AHB-AP#0 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b:Arm part=4c9) [rom_table]
0000414 I   [0]<e000e000:SCS M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=2a04 devid=0:0:0> [rom_table]
0000416 I   [1]<e0001000:DWT M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=1a02 devid=0:0:0> [rom_table]
0000418 I   [2]<e0002000:BPU M33 class=9 designer=43b:Arm part=d21 devtype=00 archid=1a03 devid=0:0:0> [rom_table]
0000420 I   [3]<e0000000:ITM M33 class=9 designer=43b:Arm part=d21 devtype=43 archid=1a01 devid=0:0:0> [rom_table]
0000422 I   [5]<e0041000:ETM M33 class=9 designer=43b:Arm part=d21 devtype=13 archid=4a13 devid=0:0:0> [rom_table]
0000423 I   [6]<e0042000:CTI M33 class=9 designer=43b:Arm part=d21 devtype=14 archid=1a14 devid=40800:0:0> [rom_table]
0000425 I [1]<e0040000:TPIU M33 class=9 designer=43b:Arm part=d21 devtype=11 archid=0000 devid=ca1:0:0> [rom_table]
0000427 I [2]<e00fd000:TSGEN class=15 designer=43b:Arm part=101> [rom_table]
0000429 I APB-AP#1 Class 0x1 ROM table #0 @ 0x000000 (designer=673 part=db6) [rom_table]
0000431 I [0]<00001000:??? class=15 designer=673 part=051> [rom_table]
0000434 I AHB-AP#3 Class 0x1 ROM table #0 @ 0xf0000000 (designer=673 part=52d) [rom_table]
0000437 I [0]<e00ff000:ROM class=1 designer=43b:Arm part=4c0> [rom_table]
0000437 I   AHB-AP#3 Class 0x1 ROM table #1 @ 0xe00ff000 (designer=43b:Arm part=4c0) [rom_table]
0000439 I   [0]<e000e000:SCS v6-M class=14 designer=43b:Arm part=008> [rom_table]
0000440 I   [1]<e0001000:DWT v6-M class=14 designer=43b:Arm part=00a> [rom_table]
0000442 I   [2]<e0002000:BPU v6-M class=14 designer=43b:Arm part=00b> [rom_table]
0000444 I [1]<f0001000:CTI M0+ class=9 designer=43b:Arm part=9a6 devtype=14 archid=1a14 devid=1040800:0:0> [rom_table]
0000450 I CPU core #0: Cortex-M33 r0p4, v8.0-M architecture [cortex_m]
0000450 I   Extensions: [DSP, FPU, FPU_V5, MPU, SEC] [cortex_m]
0000450 I   FPU present: FPv5-SP-D16-M [cortex_m]
0000453 I CPU core #1: Cortex-M0+ r0p1, v6.0-M architecture [cortex_m]
0000455 I 4 hardware watchpoints [dwt]
0000457 I 8 hardware breakpoints, 1 literal comparators [fpb]
0000461 I 2 hardware watchpoints [dwt]
0000462 I 4 hardware breakpoints, 0 literal comparators [fpb]
0000467 I Semihost server started on port 4444 (core 0) [server]
0000510 I GDB server listening on port 3333 (core 0) [gdbserver]
0000512 I Semihost server started on port 4445 (core 1) [server]
0000513 I GDB server listening on port 3334 (core 1) [gdbserver]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions