Segmentation fault with mbed-os-example-blinky when debugging attempted in VSCode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
CoreyW_81
Employee
Employee
50 sign-ins 50 replies posted 25 replies posted

Following on from the discussion in:

Debugging Mbed application for CY8CKIT-062-WIFI-BT in VSCode

The suggestion of adding:

  "debugServerArgs": "-p 3333 -t cy8c6xx7",

did allow me to program the board.  But, when debugging gets started after the programming, I get:

pastedImage_0.png

Any thoughts on this?  It will trigger the exception regardless if I have a breakpoint set or not.

0 Likes
7 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

The VS Code exporter in Mbed OS is buggy and I attribute this error to that. Please use the mbed-vscode-generator to create a clean launch.json, task.json, and c_cpp_properties.json file.

If you face any problems, please attach your complete project. I will fix it and attach it back to you.

Regards,

Dheeraj

I went through the incredibly long and complicated process of installing "mbed-vscode-generator" and now I am having the following problem when kicking off a compile in VSCode.  It seems like it will compile a few files and then fails like this:

> Executing task: mbed.exe compile -m CY8CKIT_062_WIFI_BT --profile=debug <

[mbed] Working path "C:\VSCodeWork\mbed-os-example-blinky" (program)

[Warning] @,: Compiler version mismatch: Have 7.2.1; expected version >= 9.0.0 and < 10.0.0

Building project mbed-os-example-blinky (CY8CKIT_062_WIFI_BT, GCC_ARM)

Scan: mbed-os-example-blinky

Compile [ 10.9%]: cfg_stack.c

Compile [ 11.0%]: dm_adv.c

Compile [ 11.1%]: dm_adv_ae.c

[ERROR] [Errno 0] Error

[mbed] ERROR: "C:\Python27\python.exe" returned error.

      Code: 1

      Path: "C:\VSCodeWork\mbed-os-example-blinky"

      Command: "C:\Python27\python.exe -u C:\VSCodeWork\mbed-os-example-blinky\mbed-os\tools\make.py -t GCC_ARM -m CY8CKIT_062_WIFI_BT --profile debug --source . --build .\BUILD\CY8CKIT_062_WIFI_BT\GCC_ARM-DEBUG"

      Tip: You could retry the last command with "-v" flag for verbose output

---

The terminal process terminated with exit code: 1

When I go into the project in a command line and run "mbed compile" it runs to completion without issue.

0 Likes
AnKn_4627811
Level 1
Level 1

I have the same problem. The mbed-vscode-generator didn't fix it. I'm building the elf file in another environment (conda with mbed-cli and all the dependencies installed) and am attempting to use vscode purely for debugging. Debugging directly from gdb seems to run the firmware fine, but also doesn't stop at breakpoints (I'm sure I need a few more configuration options doing it that way).

$ arm-none-eabi-gdb

GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git

Copyright (C) 2018 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>.

Find the GDB manual and other documentation resources online at:

<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".

Type "apropos word" to search for commands related to "word".

(gdb) file BUILD/CY8CKIT_062_BLE/GCC_ARM-DEBUG/mbed-os-example-blinky.elf

Reading symbols from BUILD/CY8CKIT_062_BLE/GCC_ARM-DEBUG/mbed-os-example-blinky.elf...done.

(gdb) target remote localhost:3333

Remote debugging using localhost:3333

0x08000378 in ?? ()

(gdb) mon reset

(gdb) b main.cpp:15

Breakpoint 1 at 0x10002344: file .\main.cpp, line 15.

(gdb) continue

Continuing.

Note: automatically using hardware breakpoints for read-only addresses.

...

0 Likes

OK, let me know if you come up with a solution to get this working in VSCode...

0 Likes

I also tried it with OpenOCD instead of PyOCD today. Same problem. Tried it with openocd 0.10.0 installed via chocolatey on Windows

openocd -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\interface\cmsis-dap.cfg -f C:\ProgramData\chocolatey\lib\openocd\tools\OpenOCD-20190828-0.10.0\share\openocd\scripts\target\psoc6.cfg -c init -c "reset init"

with the interface MCU set to CMSIS-DAP mode

and also the most recent version on the devel branch from here

https://github.com/Cypress-OpenOCD/OpenOCD

built under Cygwin. Tried it both in CMSIS-DAP and DAPLink mode and with both config files

./openocd -f interface/cmsis-dap.cfg -f target/psoc6.cfg -c init -c "reset init" and

./openocd -f interface/kitprog3.cfg -f target/psoc6.cfg -c init -c "reset init"

The problem is always the same, that the program segfaults within .L_loop0_0

It would be nice if you could point me to a working debug configuration since I have been unable so far to debug code on the CY8CKIT_062_BLE.

Edit: I just tried it with the CY8CPROTO_063_BLE..ran into the same problem.

0 Likes

The exporters for VSCODE seems to be broken and I see multiple reports of this in the mbed community too. I'm tracking the tickets which are looking into this issue. Will keep you posted once this issue is fixed.

My attempts to fix the project you provided me haven't been fruitful.

Regards,

Dheeraj

0 Likes