Unable To Debug - tool-pyocd ModuleNotFoundError: No module named 'board'

Hi, i’ve spent days trying to get debugging working for my NXP mbed 11u24 board

It has a builtin CMSIS-DAP tool and the firmware has been updated to the latest version to support that. When ever i try debugging in VSC I get this error:

Processing lpc11u24 (platform: nxplpc; framework: mbed; board: lpc11u24)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc/lpc11u24.html
PLATFORM: NXP LPC (6.0.1) > NXP mbed LPC11U24
HARDWARE: LPC11U24 48MHz, 8KB RAM, 32KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-mbed 6.51504.200716 (5.15.4)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Linking .pio\build\lpc11u24\firmware.elf
Checking size .pio\build\lpc11u24\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.1% (used 825 bytes from 8192 bytes)
Flash: [====      ]  40.3% (used 13204 bytes from 32768 bytes)
========================= [SUCCESS] Took 3.78 seconds =========================
undefinedTraceback (most recent call last):
  File "pyocd-gdbserver.py", line 24, in <module>
    from pyOCD.tools.gdb_server import main
  File "site-packages\pyOCD\__init__.py", line 18, in <module>
    import board
**ModuleNotFoundError: No module named 'board'**
Reading symbols from c:\Users\<myusername>\Documents\PlatformIO\Projects\201228-005558-mbed-blink\.pio\build\lpc11u24\firmware.elf...
C:\Users\<myusername>\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> bit.ly/pio-debug
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:
:3333: No connection could be made because the target machine actively refused it.

I have 201228-005558-mbed-blink running on the board and this is my platformio.ini:

[env:lpc11u24]
platform = nxplpc
framework = mbed
board = lpc11u24
upload_port = E:

I have tried defining the debug_tool to CMSIS-DAP but it looks like that is the default setting anyways.

Doing some debugging I’ve found that board module does exist and in the latest pyocd on github the init uses “from . import board” but for some reason the tool-pyocd just does “import board”. I saw the bintray has version 0.801.0, i’ve never used bintray before but maybe that version is outdated? It doesn’t look like a valid version from github either.

I’ve tried running this is VSC, and CLion. I’ve tried the Core installer script and installing using pip. I’ve also tried the normal IDE install method through VSC. Nothing seems to work.

I’ve spent a lot of time just trying to get the debugger going. Any help would be greatly appreciated.

I’m receiving the same error.

According to

and

Invoking the debugger should be <python path> C:\Users\<user>\.platformio\packages\tool-pyocd\pyocd-gdbserver.py -t lpc11u24

Invocation of that also fails immediately

Can you please try the following:

I’m assuming you have a Python3 installation, which can be accessed in the terminal (Windows+R → cmd.exe) via python or python3 (check python --version to be 3.x).

Then install PyOCD normally by executing python -m pip install pyocd. Then follow the instructions at GitHub - pyocd/pyOCD: Open source Python library for programming and debugging Arm Cortex-M microcontrollers for correctly adding libusb support.

Then, execute pyocd --version to check whether it was installed correctly and is in the path. If not, you might need to add the Scripts folder of your Python installation to your PATH (e.g. C:\Users\<user>\AppData\Local\Programs\Python\Python38\Scripts, see tutorial) .

Connect the target board to your PC and execute pyocd gdbserver -t lpc11u24. Post the output. Can pyOCD connect to the board?

Output should look something like

>pyocd gdbserver -t lpc11u24
0000615:INFO:board:Target type is lpc11u24
0000631:INFO:dap:DP IDR = 0x1ba01477 (v1 rev1)
0000646:INFO:ap:AHB-AP#0 IDR = 0x14770011 (AHB-AP var1 rev1)
0000698:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=020 part=410)
0000698:INFO:rom_table:[0]<e000e000:SCS-M3 class=14 designer=43b part=000>
0000698:INFO:rom_table:[1]<e0001000:DWT class=14 designer=43b part=002>
0000698:INFO:rom_table:[2]<e0002000:FPB class=14 designer=43b part=003>
0000698:INFO:rom_table:[3]<e0000000:ITM class=14 designer=43b part=001>
0000698:INFO:rom_table:[4]<e0040000:TPIU-M3 class=9 designer=43b part=923 devtype=11 archid=0000 devid=ca0:0:0>
0000698:INFO:cortex_m:CPU core #0 is Cortex-M3 r1p1
0000713:INFO:dwt:4 hardware watchpoints
0000713:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0000729:INFO:server:Semihost server started on port 4444 (core 0)
0000729:INFO:gdbserver:GDB server started on port 3333 (core 0)

If that is all good, we can redefine the debugging command by adding

debug_tool = custom
debug_server =
  pyocd
  gdbserver 
  -t
  lpc11u24

to the platformio.ini, which should then use your global PyOCD installation.

Thanks for posting all those details. Looks lke external pyocd works fine apart from one issue, my simple blinky code toggles the LED without issues when running but when debugging, the LED doesn’t work. Is this a known issue?

Also should i raise this issue to github so the devs are aware?

Thanks again!

After posting above I’ve opened Every pyOCD invocation fails with ModuleNotFoundError: No module named ‘board’ · Issue #22 · platformio/platform-nxplpc · GitHub to track the error.

However that does not include the error that the debugged firmware does not work at all.

As a first test, can you add

build_type = debug

to the platformio.ini and the “Upload” normally (via copying it to the ‘E:’ drive of the CMSIS-DAP adapter, PIO does that as you’ve instructed)? Does the LED still blink?

If yes, there is some error when it is uploaded via the pyOCD adapter.

Can you also show the full code for reference?

Awesome thanks.

To clarify the blinky program i have works perfectly fine while i upload it to the board.either through VSC or by dropping it into E:. here is the full code:

#include <mbed.h>

DigitalOut led_1(LED1);

int main() {

  // put your setup code here, to run once:

  while(1) {

    // put your main code here, to run repeatedly:

    led_1 = 1;

    printf("LED1 should now be ON\n");

    wait_ms(1000);

    led_1 = 0;

    printf("LED1 shoud now be OFF\n");

    wait_ms(1000);

  }

}

The issue happens when i start the debugging, the LED stops working entirely but the printf’s work. Here is the log from starting the debugger:

Processing lpc11u24 (platform: nxplpc; framework: mbed; board: lpc11u24)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc/lpc11u24.html
PLATFORM: NXP LPC (6.0.1) > NXP mbed LPC11U24
HARDWARE: LPC11U24 48MHz, 8KB RAM, 32KB Flash
DEBUG: Current (custom) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-mbed 6.51504.200716 (5.15.4)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Linking .pio\build\lpc11u24\firmware.elf
Checking size .pio\build\lpc11u24\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.1% (used 825 bytes from 8192 bytes)
Flash: [====      ]  41.4% (used 13572 bytes from 32768 bytes)
========================= [SUCCESS] Took 4.30 seconds =========================
Reading symbols from c:\Users\<my_username>\Documents\PlatformIO\Projects\Embedded Playground\.pio\build\lpc11u24\firmware.elf...
undefinedC:\Users\<my_username>\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
0000771:INFO:board:Target type is lpc11u24
0000808:INFO:dap:DP IDR = 0x0bb11477 (v1 MINDP rev0)
0000868:INFO:ap:AHB-AP#0 IDR = 0x04770021 (AHB-AP var2 rev0)
0000901:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=43b part=471)
0000916:INFO:rom_table:[0]<e000e000:SCS-M0+ class=14 designer=43b part=008>
0000927:INFO:rom_table:[1]<e0001000:DWT-M0+ class=14 designer=43b part=00a>
0000936:INFO:rom_table:[2]<e0002000:BPU class=14 designer=43b part=00b>
0000940:INFO:cortex_m:CPU core #0 is Cortex-M0 r0p0
0000946:INFO:dwt:2 hardware watchpoints
0000952:INFO:fpb:4 hardware breakpoints, 0 literal comparators
0000970:INFO:server:Semihost server started on port 4444 (core 0)
0000975:INFO:gdbserver:GDB server started on port 3333 (core 0)
0002580:INFO:gdbserver:One client connected!
0002705:INFO:gdbserver:Attempting to load argon
0002705:INFO:gdbserver:Attempting to load freertos
0002706:INFO:gdbserver:Attempting to load rtx5
0002706:INFO:gdbserver:Attempting to load zephyr
0x00003026 in delay_loop_code ()
Error: unrecognized command 'init'
Loading section .text, size 0x3374 lma 0x0
Loading section .ARM.exidx, size 0x8 lma 0x3374
Loading section .data, size 0x188 lma 0x337c
Loading section .heap, size 0xc00 lma 0x36c0
[---|---|---|---|---|---|---|---|---|----]
[
=
==
=
===
=
==
=
==
=
========
=======
=====]
0005728:INFO:loader:Erased 4096 bytes (1 sector), programmed 4096 bytes (4 pages), skipped 16384 bytes (16 pages) at 6.68 kB/s
Start address 0xc0, load size 16644
Transfer rate: 5 KB/sec, 1513 bytes/write.
Resetting target with halt
Successfully halted device on reset
Temporary breakpoint 1 at 0x1694: file src\main.cpp, line 5.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

Temporary breakpoint 1, main () at src\main.cpp:5
5	int main() {

Breakpoint 2, main () at src\main.cpp:16
16	    wait_ms(1000);

Breakpoint 2, main () at src\main.cpp:16
16	    wait_ms(1000);

I think the issue has to do with how pyocd is being used. When I run the pyocd commander (separate from platformio), “reset halt” command followed by “continue” cause the same issue: the LED stops flashing but the serial text continues working. Doing a simple “reset” fixes this but I think “reset halt” is the main cause.

Is there a discord or IRC for PlatformIO? I would love to dig deeper into this platform and change what I need but i have no idea where “reset halt” is even being called from PlatformIO, getting live pointers would be great.

The initial GDB commands can be modified by debug_init_cmds = .. as per docs.

That is… interesting to say the least. What in the world is going on there under the hood… Some Cortex-M SysTick timer stopped internally / ignored? Hm.

When you manually press the reset button of the board after the debugging has started, does the firmware behave normally? After a debug firmware is flashed during the debugging process, and the board is disconnected and connected again, does it run the firmware as expected?

As far as I know, not a public one, maybe one for developers. Or I’ve overseen that for… 3 years. @ivankravets should know about that?

1 Like

There is no public chat for developers. This forum is the only place where the community shares its thoughts. It helps to avoid duplicated issues and make this forum a library with a ton of answers.

P.S: We will update PyOCD tool and back with news to this issue soon.

/cc @valeros

Hi guys! Would be great if someone could try to debug using the latest pyOCD package. Just specify a special branch in “platformio.ini”:

platform = https://github.com/platformio/platform-nxplpc.git#pyocd-update
framework = mbed
board = lpc11u24

Btter with only one platform = value, right?

[env:lpc11u24]
platform = https://github.com/platformio/platform-nxplpc.git#pyocd-update
framework = mbed
board = lpc11u24
upload_port = E:
1 Like

Reset button after debugging starts restores firmware functionality but the debugger stops working. Unplugging and plugging back in also restores the functionality but again the debugger stops working and has to be restarted.

Makes sense.

Maybe I’m doing something wrong but I made the change to my ini as shown above and I keep getting this:

Processing lpc11u24 (platform: https://github.com/platformio/platform-nxplpc.git#pyocd-update; board: lpc11u24; framework: mbed)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc/lpc11u24.html
PLATFORM: NXP LPC (6.0.1+sha.e03dbb5) > NXP mbed LPC11U24
HARDWARE: LPC11U24 48MHz, 8KB RAM, 32KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-mbed 6.51504.200716 (5.15.4)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio\build\lpc11u24\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.1% (used 825 bytes from 8192 bytes)
Flash: [====      ]  41.4% (used 13556 bytes from 32768 bytes)
========================= [SUCCESS] Took 4.74 seconds =========================
Reading symbols from c:\Users\<my_username>\Documents\PlatformIO\Projects\Hardware Test\.pio\build\lpc11u24\firmware.elf...
undefinedC:\Users\<my_username>\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote target...
Collecting pyocd
  Using cached pyocd-0.28.3-py2.py3-none-any.whl (9.4 MB)
Collecting cmsis-pack-manager>=0.2.7
  Using cached cmsis_pack_manager-0.2.10-py2.py3-none-win_amd64.whl (2.5 MB)
Collecting appdirs>=1.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting intelhex<3.0,>=2.0
  Using cached intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Collecting intervaltree<4.0,>=3.0.2
  Using cached intervaltree-3.1.0-py2.py3-none-any.whl
Collecting milksnake>=0.1.2
  Using cached milksnake-0.1.5-py2.py3-none-any.whl (9.6 kB)
Collecting cffi>=1.6.0
  Using cached cffi-1.14.4-cp37-cp37m-win_amd64.whl (178 kB)
Collecting naturalsort<2.0,>=1.5
  Using cached naturalsort-1.5.1-py3-none-any.whl
Collecting pyusb<2.0,>=1.0.0b2
  Using cached pyusb-1.1.0-py3-none-any.whl
Collecting pywinusb>=0.4.0
  Using cached pywinusb-0.4.2-py3-none-any.whl
Collecting pyyaml<6.0,>=5.1
  Using cached PyYAML-5.3.1-cp37-cp37m-win_amd64.whl (216 kB)
Collecting six<2.0,>=1.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting sortedcontainers<3.0,>=2.0
  Using cached sortedcontainers-2.3.0-py2.py3-none-any.whl (29 kB)
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting prettytable
  Using cached prettytable-2.0.0-py3-none-any.whl (22 kB)
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Collecting pyelftools
  Using cached pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Collecting pylink-square
  Using cached pylink_square-0.8.1-py2.py3-none-any.whl (75 kB)
Collecting psutil>=5.2.2
  Using cached psutil-5.8.0-cp37-cp37m-win_amd64.whl (244 kB)
Collecting future
  Using cached future-0.18.2-py3-none-any.whl
Collecting wcwidth
  Using cached wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting setuptools
  Using cached setuptools-51.1.1-py3-none-any.whl (2.0 MB)
Installing collected packages: pycparser, cffi, wcwidth, sortedcontainers, six, setuptools, pyyaml, psutil, milksnake, future, appdirs, pywinusb, pyusb, pylink-square, pyelftools, prettytable, naturalsort, intervaltree, intelhex, colorama, cmsis-pack-manager, pyocd
.pioinit:13: Error in sourced command file:
:3333: No connection could be made because the target machine actively refused it.

I tried this with a new project, running clean task, and “update all” from the quick access menu, still getting the same error. So far the only way to make it work has been with using external pyocd.

Can you retry debugging a second time? Maybe the first time is just an installation run and then it can be started. I’ll try this on my machine, too.

Looks like pyOCD cannot keep up with the PlatformIO debug client. It would be great if you could test the latest changes in platformio-core and the NXP platform:

  • Delete C:\Users\<my_username>\.platformio\platforms\nxplpc@hashsum
  • Run pio upgrade --dev in the IDE terminal (make sure the latest 5.0.5a1 is installed)
  • Start debug again

I don’t have that NXP LP11U24 board (just connected a Nucelo F103RB as substitute) but I do see that, after doing above and using the latest platform, debugging now starts pyOCD correctly.

Processing lpc11u24 (platform: https://github.com/platformio/platform-nxplpc.git#pyocd-update; framework: mbed; board: lpc11u24)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc/lpc11u24.html
PLATFORM: NXP LPC (6.0.1+sha.cf20a1d) > NXP mbed LPC11U24
HARDWARE: LPC11U24 48MHz, 8KB RAM, 32KB Flash
DEBUG: Current (cmsis-dap) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-mbed 6.51504.200716 (5.15.4)
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Checking size .pio\build\lpc11u24\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   9.8% (used 801 bytes from 8192 bytes)
Flash: [====      ]  37.7% (used 12344 bytes from 32768 bytes)
========================= [SUCCESS] Took 3.63 seconds =========================
Collecting pyocd
  Downloading pyocd-0.28.3-py2.py3-none-any.whl (9.4 MB)
Collecting cmsis-pack-manager>=0.2.7
  Using cached cmsis_pack_manager-0.2.10-py2.py3-none-win_amd64.whl (2.5 MB)
Collecting appdirs>=1.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting intelhex<3.0,>=2.0
  Using cached intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Collecting intervaltree<4.0,>=3.0.2
  Using cached intervaltree-3.1.0.tar.gz (32 kB)
Collecting milksnake>=0.1.2
  Using cached milksnake-0.1.5-py2.py3-none-any.whl (9.6 kB)
Collecting cffi>=1.6.0
  Using cached cffi-1.14.4-cp38-cp38-win_amd64.whl (179 kB)
Collecting naturalsort<2.0,>=1.5
  Using cached naturalsort-1.5.1.tar.gz (7.4 kB)
Collecting pyusb<2.0,>=1.0.0b2
  Using cached pyusb-1.1.0-py3-none-any.whl
Collecting pywinusb>=0.4.0
  Using cached pywinusb-0.4.2.zip (61 kB)
Collecting pyyaml<6.0,>=5.1
  Using cached PyYAML-5.3.1-cp38-cp38-win_amd64.whl (219 kB)
Collecting six<2.0,>=1.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting sortedcontainers<3.0,>=2.0
  Using cached sortedcontainers-2.3.0-py2.py3-none-any.whl (29 kB)
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting prettytable
  Using cached prettytable-2.0.0-py3-none-any.whl (22 kB)
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Collecting pyelftools
  Using cached pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Collecting pylink-square
  Using cached pylink_square-0.8.1-py2.py3-none-any.whl (75 kB)
Collecting psutil>=5.2.2
  Using cached psutil-5.8.0-cp38-cp38-win_amd64.whl (245 kB)
Collecting future
  Using cached future-0.18.2.tar.gz (829 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting setuptools
  Downloading setuptools-51.1.1-py3-none-any.whl (2.0 MB)
Using legacy 'setup.py install' for intervaltree, since package 'wheel' is not installed.
Using legacy 'setup.py install' for naturalsort, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pywinusb, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Installing collected packages: pycparser, cffi, wcwidth, sortedcontainers, six, setuptools, pyyaml, psutil, milksnake, future, appdirs, pywinusb, pyusb, pylink-square, pyelftools, prettytable, naturalsort, intervaltree, intelhex, colorama, cmsis-pack-manager, pyocd
    Running setup.py install for future: started
    Running setup.py install for future: finished with status 'done'
    Running setup.py install for pywinusb: started
    Running setup.py install for pywinusb: finished with status 'done'
    Running setup.py install for naturalsort: started
    Running setup.py install for naturalsort: finished with status 'done'
    Running setup.py install for intervaltree: started
    Running setup.py install for intervaltree: finished with status 'done'
Successfully installed appdirs-1.4.4 cffi-1.14.4 cmsis-pack-manager-0.2.10 colorama-0.4.4 future-0.18.2 intelhex-2.3.0 intervaltree-3.1.0 milksnake-0.1.5 naturalsort-1.5.1 prettytable-2.0.0 psutil-5.8.0 pycparser-2.20 pyelftools-0.27 pylink-square-0.8.1 pyocd-0.28.3 pyusb-1.1.0 pywinusb-0.4.2 pyyaml-5.3.1 setuptools-51.1.1 six-1.15.0 sortedcontainers-2.3.0 wcwidth-0.2.5
undefined0000625:WARNING:gdb_server:pyocd-gdbserver is deprecated; please use the new combined pyocd tool.
0000775:INFO:board:Target type is lpc11u24
0000801:INFO:dap:DP IDR = 0x1ba01477 (v1 rev1)
0000816:INFO:ap:AHB-AP#0 IDR = 0x14770011 (AHB-AP var1 rev1)
0000863:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=020 part=410)
0000865:INFO:rom_table:[0]<e000e000:SCS-M3 class=14 designer=43b part=000>
0000867:INFO:rom_table:[1]<e0001000:DWT class=14 designer=43b part=002>
0000870:INFO:rom_table:[2]<e0002000:FPB class=14 designer=43b part=003>
0000872:INFO:rom_table:[3]<e0000000:ITM class=14 designer=43b part=001>
0000873:INFO:rom_table:[4]<e0040000:TPIU-M3 class=9 designer=43b part=923 devtype=11 archid=0000 devid=ca0:0:0>
0000873:INFO:cortex_m:CPU core #0 is Cortex-M3 r1p1
0000878:INFO:dwt:4 hardware watchpoints
0000882:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0000899:INFO:server:Semihost server started on port 4444 (core 0)
0000909:INFO:gdbserver:GDB server started on port 3333 (core 0)
Reading symbols from C:\Users\Max\Documents\PlatformIO\Projects\nxp_mbed_test\.pio\build\lpc11u24\firmware.elf...
C:\Users\Max\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote target...
0003589:INFO:gdbserver:One client connected!
0003613:INFO:gdbserver:Attempting to load argon
0003613:INFO:gdbserver:Attempting to load freertos
0003613:INFO:gdbserver:Attempting to load rtx5
0003613:INFO:gdbserver:Attempting to load zephyr
..

Also invocation of tool-pyocd does not crash anymore instantly as before

C:\Users\Max\.platformio\packages\tool-pyocd>python pyocd-gdbserver.py -t lpc11u24
0000544:WARNING:gdb_server:pyocd-gdbserver is deprecated; please use the new combined pyocd tool.
0000652:INFO:board:Target type is lpc11u24
0000683:INFO:dap:DP IDR = 0x1ba01477 (v1 rev1)
0000698:INFO:ap:AHB-AP#0 IDR = 0x14770011 (AHB-AP var1 rev1)
0000745:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=020 part=410)
0000745:INFO:rom_table:[0]<e000e000:SCS-M3 class=14 designer=43b part=000>
0000745:INFO:rom_table:[1]<e0001000:DWT class=14 designer=43b part=002>
0000745:INFO:rom_table:[2]<e0002000:FPB class=14 designer=43b part=003>
0000745:INFO:rom_table:[3]<e0000000:ITM class=14 designer=43b part=001>
0000745:INFO:rom_table:[4]<e0040000:TPIU-M3 class=9 designer=43b part=923 devtype=11 archid=0000 devid=ca0:0:0>
0000745:INFO:cortex_m:CPU core #0 is Cortex-M3 r1p1
0000761:INFO:dwt:4 hardware watchpoints
0000761:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0000776:INFO:server:Semihost server started on port 4444 (core 0)
0000776:INFO:gdbserver:GDB server started on port 3333 (core 0)

If it really works all properly with debugging, only one with the real board can tell.

1 Like

Just tested this on my board and it works! Final ini looks like this:

[env:lpc11u24]
;platform = nxplpc
platform = https://github.com/platformio/platform-nxplpc.git#pyocd-update
framework = mbed
board = lpc11u24
upload_port = E:
debug_extra_cmds =
    monitor reset

One more thing on this topic, like i mentioned before “reset halt” seems to break the board somehow (i’m still debugging). It basically stops the LEDs from turning on/off but serial out seems to work just fine. I’ve found doing a “monitor reset” as an extra cmd works but is there any way to not run the initial commands? I’ve tried this but it still ran the default init cmds:

debug_tool = custom
debug_init_cmds = 
    monitor reset

Testing this in CLion leads to issues as well. Should i create a separate thread for that? I know that’s experimental but not sure how to get the issues to the devs.

Thanks again!

Hm I thought by modying debug_init_cmds from the doc link above you could completely take control of that.

Then maybe the PlatformIO core has to be adapted to respect that for any GDB+pyOCD combination in https://github.com/platformio/platformio-core/blob/develop/platformio/commands/debug/initcfgs.py?

Yes please, that might be a separate issue if it works in VSCode.

Well the two other people in this thread are the devs. By talking to @ivankravets you’re speaking to the CEO and PlatformIO-core developer personally :smiley: And @valeros develops a lot of platform integrations and other stuff.

The “canonical” way would be to open issues, in the repos where the offending code might be located, like Issues · platformio/platformio-core · GitHub for the core or Issues · platformio/platform-nxplpc · GitHub for the NXP integration.

1 Like