Giter Club home page Giter Club logo

cortex-debug's Introduction

Cortex Debug

Visual Studio Code with Cortex-Debug Installed

Debugging support for ARM Cortex-M Microcontrollers with the following features:

  • Highly configurable. See https://github.com/Marus/cortex-debug/blob/master/debug_attributes.md
  • Support J-Link, OpenOCD GDB Server, STMicroelectronic's ST-LINK GDB server (no SWO support yet), pyOCD
  • Initial support for the Black Magic Probe (This has not been as heavily tested; SWO can only be captured via a serial port)
  • Partial support textane/stlink (st-util) GDB Servers (SWO can only be captured via a serial port)
  • Multi-core and multi-session debugging. See https://github.com/Marus/cortex-debug/wiki/Multi-core-debugging
  • Disassembly of source code available along with instruction level breakpoints and stepping. The actual disassembly window is provided and managed by VSCode. See https://github.com/Marus/cortex-debug/wiki/Disassembly-Debugging
  • Cortex Core Register Viewer (integrated into Variables window since V1.2)
    • In some cases the st-util GDB server can report incomplete/incorrect registers, so there may be some issues here.
  • SWO Decoding - "console" text output and binary data (signed and unsigned 32-bit integers, Q16.16 fixed point integers, single precision floating point values)
    • The registers that are part of the DWT, TPIU, and ITM debug components will automatically be configured and do not need to be set in firmware.
    • Firmware may still need to enable the SWO output pin - as this part of the setup is microcontroller dependant.
    • Decoding ETM data over the SWO pin is not currently supported.
  • Live graphing of decoded ITM data.
  • Support for Custom ITM Data Decoders:
    • Ability to define JavaScript modules to decode complex data formats streamed over one or more ITM ports. Data can be printed to a output window, or sent to the graphing system. If you are using TCP/IP instead, you can use a variety of tools to connect to the that port.
  • Semi-hosting Support. In the TERMINAL tab, there will be a sub-window called gdb-server. That terminal is bidirectional and is intended for semi-hosting. This applies to those gdb-servers that do their semi-hosting on their stdio.
  • Support for SEGGER Real Time Trace (RTT) using OpenOCD and J-Link gdb-servers. All the features supported for SWO (text, binary, graphing) are also supported with RTT. See image above for console style output. SWO output also creates another section.
  • Globals and Static scopes in the variables view
  • Initial support for Rust code (most functionality is working; report any issues
  • RTOS Thread Support in CALL STACK window (J-Link, OpenOCD, pyOCD - RTOS supported depend on GDB server)
    • As a general rule do not try to use stepping instructions before the scheduler of your RTOS has started - in many cases this tends to crash the GDB servers or leave it in an inconsistent state.
  • Live Watch with supported GDB servers (tested with OpenOCD, J-Link, STLink so far - since V1.6)
  • We have a set of extensions that this extension relies on for various frontend services (since V1.6)

Release Versioning

Cortex-Debug uses a versioning system specified by Microsoft that allows distribution of pre-releases via the marketplace. You can enable (or disable) pre-releases within VSCode for this extension and you will automatically get new pre-releases. By default, pre-releases are disabled. We use pre-releases as allow testing of bug fixes and new features. They allow you participate during the formation of a feature of how an issue gets addressed. More info about pre-releases. To summarize, extensions use semantic versioning (SemVer) system which in simple terms is major.minor.patch. With MS convention, if the minor version is odd, then it is a pre-release.

Planned Features

Installation

Requirements:

  • ARM GCC Toolchain (https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads) - provides arm-none-eabi-gdb and related tools
  • At least one of:
    • J-Link Software Tools - provides the J-Link GDB Server for J-Link based debuggers (https://www.segger.com/downloads/jlink)
    • OpenOCD - provides a GDB Server that can be used with a number of debuggers (http://openocd.org)
      • NOTE: If a chip vendor ships it's own OpenOCD version, for sure use NOTHING but that
      • NOTE: On macOS do not use the default version of OpenOCD provided by homebrew, this is not compatible with releases V0.2.4 and newer.
      • NOTE: Some linux versions and Windows may also need a more up-to-date version of OpenOCD from the xPack releases.
    • Texane's st-util GDB server - Only supports ST-Link Debug Probes (https://github.com/texane/stlink)
    • ST-LINK GDB server - This server is packaged with the STM32CubeIDE which must be installed. The location of the STM32CubeIDE and related tools is automatically resolved but also can be overridden using configuration settings (armToolchainPath, stm32cubeprogrammer and serverpath).
    • pyOCD GDB Server - GDB server that supports the CMSIS-DAP debugger on a number of mbed boards (https://github.com/mbedmicro/pyOCD)
    • Black Magic Probe

Usage

See https://github.com/Marus/cortex-debug/wiki for usage information. This needs some help from the community. See https://github.com/Marus/cortex-debug/blob/master/debug_attributes.md for a summary of all properties that are available in your launch.json

How to Build from sources

  • git clone https://github.com/Marus/cortex-debug.git
  • cd cortex-debug
  • Optionally switch to a branch: git checkout <existing-branch-name>
  • npm install
  • Optional npm run compile
  • Open VSCode in the top folder and run the task npm watch. This will compile the code and watch for any changes and auto compile. The first time, it may take a minute or so for it to watch the entire folder. You can see the output of npm watch in the Terminal tab.

How to debug

The extension is split into two main parts.

  1. The front-end which is what you interact with mostly
  2. The backend called debug adapter which interfaces between gdb, vscode/front-end, and the gdb-server. We just start the server and from then on the debug adapter only interacts with gdb. All requests go to gdb and the results are read back from gdb using gdb's MI (machine interface)

If you want to debug both parts, in launch.json use the Extension + Debug Server configuration. It will launch a new window -- the debuggee. In the debuggee VSCode window, load a FW folder/workspace (VSCode remembers the last one) and add the following to debuggee's launch.json.

            "debugServer": 4711

Now, launch a debug session and you wil be able to use the primary VSCode window to observe the Cortex-Debug extension

Acknowledgments

Parts of this extension are based upon Jan Jurzitza's (WebFreak) code-debug extension (https://github.com/WebFreak001/code-debug).
His project provided an excellent base for GDB MI parsing and interaction.

cortex-debug's People

Contributors

alexclewontin avatar andrej-mk avatar ashish-gawali-adi avatar bbenoist avatar benmcmorran avatar dependabot[bot] avatar depthdeluxe avatar diegoherranz avatar gentoo90 avatar haneefdm avatar hwmaier avatar john5f35 avatar kadw avatar kohada-t2 avatar manuargue avatar markushx avatar marsrock4 avatar marus avatar montaguk avatar mrmaxmeier avatar mryndzionek avatar ndk4 avatar pearson avatar philipphaefele avatar rookwood101 avatar ryanplusplus avatar sebastian-bartkowiak avatar tangcheng avatar trond-snekvik avatar webfreak001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cortex-debug's Issues

Timeout issue with Openocd

Hi,
I've recently been trying this out with Visual Studio Code
I'm currently using a LPC1769 test board

However I've been experiencing timeout errors when starting the debug session using openocd

Failed to launch OpenOCD GDB server: Timeout

So far I've tried

  • JLink / Segger - attached to the SWD port of the board - works okay
  • OpenOCD - attached to the CMSIS-DAP adapter on the board via USB - generates timeout error

So far I've managed to get this working with a JLink Segger okay, using the following config
This seems to work fine:

        {
            "name": "Debug (JLink Segger)",
            "type": "cortex-debug",
            "request": "attach",
            "servertype": "jlink",
            "cwd": "${workspaceRoot}",
            "executable": "./BUILD/LPC1768/GCC_ARM/GBD.Dlang.MbedBlinkyTest.elf",
            "device": "LPC1769",
            "interface": "swd",
        }

However using the inbuilt CMSIS-DAP / USB adapter that's built into the board, results in the timeout error

        {
            "name": "Debug (OpenOCD USB)",
            "type": "cortex-debug",
            "request": "launch",
            "device": "LPC1769",
            "servertype": "openocd",
            "cwd": "${workspaceRoot}",
            "executable": "./BUILD/LPC1768/GCC_ARM/GBD.Dlang.MbedBlinkyTest.elf",
            "configFiles": [
                "./scripts/openocd_configs/usb_boardconf.cfg"
            ]
        },

usb_boardconf.cfg

source [find interface/cmsis-dap.cfg]
source [find target/lpc17xx.cfg]
adapter_khz 500

# Make the initial connection and halt the board
init
targets
reset halt

I have managed to connect via openocd / gdb using the command line fine
which suggests a problem with the plugin

openocd -f scripts\openocd_configs\usb_boardconf.cfg
arm-none-eabi-gdb.exe --eval-command="target remote localhost:3333"

It would be nice if you could just specify a gdb instance running on a specific port to connect to
since I think the attach mode, still launches it's own gdb instance

Feature Request: Addtional Scopes in Variable display

While looking at LLDB debug extension by Vadim, I found its Variable display very powerful. It includes not only Local variables, but also static and global variables, and various registers in categories. I find this quite good. The Cortex register views and Peripherals can become part of this. What do you think, @Marus?

Below is a screenshot of using the LLDB extension, and examining the variables and registers.

screen shot 2018-01-22 at 16 23 35

More error output from server

At the moment the output from server (st-util etc.) as been piped, and is pretty silent. It can be difficult to see what happened if there was an error (e.g. Timeout). It may be a good idea to direct the output to the OUTPUT tab.

GDB port conflict

We have found a few cases where the default port 50000 is being used by other software. This port conflict causes GDB unable to launch.

Would you be able to add an option in the debug config that can manually select the port which the server should listen and GDB should connect to?

svdFile not loading

Hello, really enjoying your plugin. For whatever reason, the SVD file I have is not loading. I have a link in the configuration to the svd file as shown below. The SVD file is for the nrf52832_xxAA board from Nordic Semiconductors. Their SDK with the SVD file can be found at http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v14.x.x/

"svdFile": "C:/projects/svd/nrf52.svd",

Thoughts?

No SVD file loaded issue

Debugger works fine except loading SVD file.

My config is:

{
    "version": "0.2.0",
    "configurations": [
        {
            "cwd": "${workspaceRoot}",
            "executable": "./build/firmware_flash.elf",
            "name": "Debug",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "configFiles": [
                "/usr/share/openocd/scripts/board/atmel_saml21_xplained_pro.cfg"
            ],
            "svdFile": "${workspaceRoot}/doc/saml21b/svd/ATSAML21J18B.svd"
        }
    ]
}

The official SVD file comes form http://packs.download.atmel.com/ website.

I use Ubuntu 14.04, Visual Studio Code 1.22.2 and OpenOCD 0.10.0

Random breakpoint after startup with FreeRTOS enabled

Before I enabled FreeRTOS as the RTOS in the cortex debug configuration my application would always halt on the Reset_Handler in my startup asm after uploading and starting to debug (is there a way to disable this break on start?)

Now with it enabled (I also have the OpenOCD support file) upon starting it instead picks another thread:

image

I believe this might be related to the second issue described in #31 where the wrong thread is focused, but I don't quite understand how these other threads already appear to be created when this should be right after a reset.

Feature to view variables as different types

Would it be possible to add the ability to view the variables as different types? Working with hardware means viewing the variables as hex and even binary can be really useful. Pointers are converted to hex and ASCII is shown next to bytes, so I guess it's possible?

Also array pointers only show up as a single value, again it would be very useful if you can choose to display these as an array. Usually you are asked to enter the size of the array, then it just displays that area of memory as the variable.

Set path to arm-none-eabi-gdb

Is there an option to set the path to arm-none-eabi-gdb? I can have different versions on my system and would like to able to select per project.

RTOS Support

I'm not sure I understand this comment in the marketplace overview:

RTOS Support (J-Link and OpenOCD - RTOS supported depends on GDB server support)

To me RTOS support is the ability to see a list of tasks or the state of a mailbox etc. In particular it is nice to be able to see the call stack of any task and jump to it to examine its state. So not really a GDB thing but knowing how to find and decode the state of things on the target.

Website documentaion for other debuggers

The website currently only mentions the Jlink and OpenOCD server.

I'd like to see the configuration required for the STLink and black magic probe.

Could you please try to update this?

Thanks

Feature request: run openocd from a remote pc

I have been using the extension and found it to be very nice and valuable tool. Now, I wanted to run openocd from another computer in the same network. I was able to achieve this by modifying the source-code and changing the ip address and port numbers while at the same time disabling the local openocd. This is working fine but I was wondering if this is something you can consider for future releases. This can be in the form of providing optional arguments to disable the local openocd and provide the remote address and port numbers. The remote openocd can be started manually.

Thanks

Error: spawn arm-none-eabi-gdb ENOENT

Hallo.
Thanks for your plugin. I'm trying to use it.

launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Microcontroller",
"request": "launch",
"type": "cortex-debug",
"executable": "${workspaceRoot}/_debug/sdw_d.elf",
"cwd": "${workspaceRoot}",
"servertype": "jlink",
"device": "STM32F446RE",
}
]
}

vscode debug console:

Could not start debugger process, does the program exist in filesystem?
Error: spawn arm-none-eabi-gdb ENOENT

Terminal:

Andreys-Mac-Pro:Dev andrey$ arm-none-eabi-gdb
GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-git
Copyright (C) 2017 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=x86_64-apple-darwin10 --target=arm-none-eabi".
Type "show configuration" for configuration details.
---Type to continue, or q to quit---
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) Quit
Andreys-Mac-Pro:Dev andrey$

What am I doing wrong?

Breakpoint at main

I'm not sure if it's common to all projects (this is the first I have tried), but on starting the debug session, the program counter is set to my reset handler, which runs the init functions before main.

On other debuggers (Ozone / Eclipse) it would set a break point at main as this is normally where you want to start debugging. Obviously you can set a break point there, but I thought it was a good feature to have.

Failed to launch undefined GDB Server: Timeout

Hi,
I have no success starting a JLINK debug session on Windows. I am using the following launch configuration:

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Debug (J-Link)",
            "type": "cortex-debug",
            "request": "launch",
            "servertype": "jlink",
            "cwd": "${workspaceRoot}",
            "executable": "./build/temp-control-f4.elf",
            "device": "STM32F407VG",
            "interface": "swd",
        }
    ]
}

The JLinkGDBServer launches successfully and waits for a connection:
jlinkgdbserver

But after several seconds, I get an error message which says: Failed to launch undefined GDB Server: Timeout.

I am assuming, somethin with the path to the actual arm-none-eabi-gdb executable is not right? I have these lines in my workspace settings:

"cortex-debug.armToolchainPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\6 2017-q2-update\\bin",
"cortex-debug.JLinkGDBServerPath": "C:\\Program Files (x86)\\SEGGER\\JLink_V620f\\JLinkGDBServer.exe"

armToolchainPath is the one with the arm-none-eabi-* executables.

Is there anything else I forgot to configure?

Thanks!

Feature Request: JLinkRTTClient

Seggers RTT is an excellent debug print out and also trace tool:
https://www.segger.com/products/debug-probes/j-link/technology/real-time-transfer/about-real-time-transfer/

In particular I use JLinkRTTClient : "J-Link RTT Client acts as a Telnet client, but automatically tries to reconnect to a J-Link connection when a debug session is closed. The J-Link RTT Client is part of the J-Link Software and Documentation Pack for Windows, Linux and macOS and can be used for simple RTT use cases."

I manually start and stop this for each debug session.

A minimal feature request would be to start and stop this, similar to a semihosting session but better.

See here for a side by side comparison:
https://blog.segger.com/getting-printf-output-from-target-to-debugger/

Rust Support

This is an issue to discuss things related to support for Rust.

Debugger does not pause on breakpoint when FreeRTOS is enabled

I tried the newly added RTOS support but it does not seem to work for me as intended.

Steps to reproduce:

  1. Enable cortex-debug's new FreeRTOS support by adding "rtos": "FreeRTOS" to launch.json
  2. Set a breakpoint shortly after the call to vTaskStartScheduler.
  3. Plug in the STLink into USB and power on the target board
  4. Press the "Go" symbol to start debugging
  5. The debugger will break immediately after reset as usual
  6. Press continue
  7. The actions of the target board indicate that the breakpoint is indeed hit, but everything in VSCode appears as if the target is still running. Clicking on the pause button has no effect.

Debug console output:

adapter speed: 2000 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08008e20 msp: 0x20020000
Note: automatically using hardware breakpoints for read-only addresses.
[Switching to Thread 1]

I'm using:
STM32F405RG
STLink V2
OpenOCD 0.10.0
VSCode 1.19.0 on Linux

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            // For the Cortex-Debug extension
            "type": "cortex-debug",
            "servertype": "openocd",
            "request": "launch",
            "name": "Debug ODrive",
            "executable": "${workspaceRoot}/build/ODriveFirmware.elf",
            "rtos": "FreeRTOS",
            "device": "STM32F405RG",
            "configFiles": [
                "interface/stlink-v2.cfg",
                "target/stm32f4x_stlink.cfg",
            ],
            "cwd": "${workspaceRoot}"
        },
    ]
}

Move cortex-debug.armToolchainPath to launch.json

I have several different versions of toolchains installed, so having a single setting in settings.json is slightly awkward to use.

It would be a big help if I could set the path in launch.json

"configurations": [
        {
            "armToolchainPath": "/path/to/toolchain/",

would this be a possible?

ST-Link support and other contributions

Hi, this is some great work that you are doing!

I'm wondering if you will be supporting ST-Link tools? I'm an assistant at a university and we will be using VSCode as an IDE for ARM development. We will be using PlatformIO community version for the project management, but would like to use this debugger plugin as opposed to a paid and less featured one from PlatformIO.

For simplicity of setting up, we'd like to use ST-Link tools which comes with PlatformIO tool chain as opposed to OpenOCD.
So we are wondering if you will be interested in adding support or taking in merge request for this feature, and possibly some other features that we might need in the future.

Cheers again for the work!

VARIABLES view missing types?

Hi!
I cannot find a way to see the type of the variables in the VARIABLES view.
I'm not sure if I'm missing how to turn it on? Knowing the type helps a lot when debugging code to know if it's a pointer, or reference, etc.

I can see it when hovering, but I'd like it to always be visible, like an extra column or in parentheses or similar.

BR Emil

Access to bitpacked struct does not show up in debugger view

I dont know if this is cortex debug problem, or general vscode debugger problem, but here goes.

I have a bitpacked struct that has a lot of flags in it. Basically so that i can access it like struct.flag1 to see if it is set.

struct flags
{
      bool flag1 : 1;
      bool flag2 : 1;
      ...
      bool flag32: 1;
} __attribute__((packed));

However this will not show up nicely in the variable window. I only see: p:{...} and it is not extendable so that I can click it and see every flag as true/false

It works if I manually go into the gdb terminal and type "print p", then i get a nice list like

$3 = { flag1 = true, flag2 = false, ... flag32 = true }

Setting break point while target running

I am not sure if this is a limitation of VS Code (I haven't really used it for debugging before). But setting break points while the target is running brings up a circle outline that says "unverified breakpoint" and this then does not trigger. It also doesn't become a proper break point when the target is paused either.

The hardware is capable of setting break points on a running target and I am used to setting them in other debuggers.

Support for various number formats

Sometimes it's helpful to be able to view the register values in decimal or well formatted binary. This could be useful for our teaching purpose.

One possibility is adding options in the right-click drop down menu to change the numeric format of a particular register.

Would you be considering adding such support? And would you like a pull request for it?

Support J-Link target interface selection/incorrect default executable for J-Link on Windows.

It's very excited to found this extension, I'am a Chinese developer , and I'am using VSCode to develop STM32 program everyday , edit and debug(use cpp extension +J-Link GDB server ).

I tried cortex-debug , but the first problem is , I use SWD interface , not JTAG , to connect to STM32 . And cortex-debug do not work for this. Can you add a configuration for interface chosen?

The command introduction at the 83 page of <UM08001_JLink>.

Anyway , it's very appreciate , and I will study your source code , to figure out how this work .

bmp enhancements; Run to start

It would be useful in the startup commands if you could add start which would place a temporary breakpoint at main and run to it, rather than at the instructions after reset...of course you might on occasion want to run right from reset (refer to my previous note about configurable startup options :-) ).

DAVE

JLink and SVD files

I started to use this plugin with JLink.
From configuration point of view device setting is overriding svdFile.
The problem is, that I'm using Silicon Laboratories microcontrollers and some of symbols in device type are XXX for JLink device setting. SVD files are available for exact model of chip.

Would it be possible to change behavior of device and svdFile dependence?
Or might it be feasible to supply SVD files for other vendors?
On the other hand many SVD files will increase size of plugin...

Restart not updating code location in editor

When I click on restart (or pause then restart), the debugging session does not jump to the init functions. The Debug console outputs "Resetting target", but the code stays in the old location and the call stack window doesn't change.

If I then click the step over button, it jumps to the correct location, so I'm convinced the reset is actually taking place, it's just the editor / call stack that isn't updated.

How to Support or Donate?

Hi, I saw this project over on Reddit. I really like the initiative and I want to support your work. Is there a way to send a monetary contribution?

Add to watch fills in wrong variable name

When right clicking on a local variable, and selecting "Add to watch", it adds "var_variable" to the watch window when it should be "variable".
When adding an array element it adds "var_array.0" for element 0. It should be "array[0]".

You can manually edit this to work, but it would be nicer if it filled it in correctly to being with.

P.S. I hope you don't mind all the issues I'm creating, I just really like the tool and want to help make it better.

Adding more tag on description.

Hello,
Firstly thank you very much for this awesome extension. It does exactly what I need. I would like to share my experience and simeple suggestions here.

When tried searching extensions for embbeded system on VS code for the first time, I could not find this extension. This is because I my search words was "openocd" and "jlink" and this extension did not appear on the search result. I missed this extension for months.

So why not make this extension more searchable, e.g. adding openocd, jlink, stlink, and etc tags in the extension description?

Thank you.

Strange behaviour of this extension in my side

Hello,
I try since several times to run my project with your extension, it does not run as it should but I do not know where to start to debug:

I am able to run my project using a classic cppdbg configuration (here after):
/*{
"name": "(gdb) Proj",
"logging": { "trace": true, "traceResponse": true, "engineLogging": true },
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/Proj",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/opt/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:2331",
"debugServerPath": "/opt/SEGGER/JLink_V614f/JLinkGDBServer",
"debugServerArgs": "-device STM32F429ZI -if SWD -speed 10000",
"serverStarted": "connection...",
"preLaunchTask": "flash",

        "setupCommands": [
            {
                "description": "Exec file and symbols",
                "text": "-file-exec-and-symbols ${workspaceRoot}/Proj",
                "ignoreFailures": true
            }
        ]
    }*/

I just had to make a flash target in my makefile that directly uses Jlink to flash

ANd with the cortex M debug configuration as this:
{
"name": "Debug Microcontroller",
"type": "cortex-debug",
"request": "launch",
"servertype": "jlink",
"executable": "${workspaceRoot}/Proj",
"cwd": "${workspaceFolder}",
"device": "STM32F429ZI",
"interface":"swd",
"showDevDebugOutput": true,
"debugServer": 2331,
}

I get the first time "connection refused": I assume this was because the Jlink gdb server path was not correct, I found in another issue these parameters in my preferences settings:
"cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V614f/JLinkGDBServer",
"cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi-5_4-2016q3/bin", (I tried too with a terminating "/")

But I still have the "connect ECONNREFUSED 127.0.0.1:2331" message

If I start manually the JlinkGDBServer, I do not have this message, but the debug does not start, event if I get in the JlinkGDBServer side a connection (Waiting for GDB connection...Connected to 127.0.0.1
)

Would you have some tricks top enable debug verbosity so I can understand what happens ?

Thanks

Parsing of SVD Files

Hi,
I recently tried using an svd file
I managed to pick up one from here https://github.com/posborne/cmsis-svd
since I'm using a LPC1769 I tried using this one https://github.com/posborne/cmsis-svd/blob/master/data/NXP/LPC176x5x_v0.2.svd

However it doesn't look like this works
in the debugger it just says "No SVD File Loaded"

In order to narrow things down a bit, I tried forcing the use of one of the svd files that comes with the extension
copy paste STM32F0xx.svd into the root directory then tried

"svdFile": "${workspaceFolder}/STM32F0xx.svd",

This actually works / is parsed, although it's the incorrect mapping for the MCU it does show entries within the debug window
This suggests there's something within LPC176x5x_v0.2.svd that the parser doesn't like

I might try removing bits of the file to see if that gets it to work

Native debug configuration

How is difficult to add native debug configurations which we had in the original extension?

See our existing configuration for native-debug. Os, having this configuration we could switch to your extension. We don't need to specify paths to openOCD, J-LInk, or etc, because we handle this work on our virtual GDB side.

Thanks!

Debug arguments not recognized

Hi!
Really like your extension so far! However, I am having problems adding my own debug arguments.
Specifically, I am trying to enable monitor mode debugging on the nrf52 platform, and therefore need to set the "mon exec SetMonModeDebug = 1" and "mon exec SetMonModeVTableAddr = 0x23000" arguments. I get some error stating "No such file or directory". Can also mention that these arguments are recognized perfectly fine by the code-debug/Native debug extension.

bmp enhancements; swo support

Would it be possible for you to add swo support for the bmp? The code to do this is relatively straightforward (See https://github.com/mubes/orbuculum/blob/master/Src/orbuculum.c around line 1202 ... there may be other stuff in Orbuculum you can make use of too) but does need to be enabled via a suitable monitor command (monitor traceswo for 'standard' bmp monitor traceswo <speed> for bluepill or bmp with async swo support). When parallel trace support is in place this will probably be enabled by a similar mechanism.

[Windows] Unable to capture stderr output from spawned st-util process

There seems to be a issue on Windows that the stderr output from spawned st-util.exe is not captured. Thus the promise returned byGDBServer.init() never gets resolved. This eventually leads the st-util.exe process being sent a SIGTERM signal due to timeout, and the debugging on Windows using st-util fails to launch.

I'm looking into this problem at the moment. This issue tracker will track my findings and relevant discussions.

Some core Cortex registers missing?

Hi! I was testing the debug plugin, great work!

After testing some I realized that the following registers are missing in the register view, is there a way to add them or am I doing something wrong?
Thanks!

PRIMASK
FAULTMASK
BASEPRI
CONTROL

ITM debugging doesn't work under Windows

When I try to set swoConfig.enabled to true in my launch.json configuration entry, I get an exception:

Failed to launch OpenOCD GDB Server: Timeout.

In the adapter output, it starts almost normally, but then it logs

Error: Can't open trace destination file

which appears to come from here, bitching about the tpio config internal command being called with an invalid path - here in the extenion, I gather. I also can see that ChildProcess.spawnSync('mkfifo', [this.swoPath]) is only called on non-windows platforms, so this is probably the culprit - the file really doesn't exist.

What do you think can I do about this? Do you want to support this at all?


This SO thread suggests using sockets instead. I have no idea what openocd expects to work with.
I also have mkfifo tools installed from Mingw64 and Cygwin64, could they work if I just remove the OS check?

fails to find the source code

Debug session fails to find the corresponding source code. The underlying environment (gdb and OpenOCD) seems to be working good. I am able to download the code to the target, start a debug session, and halt the target. However, on halt, I always get disassembly rather then the source code. Addition to this, breakpoints set on source code lines are also not working.

The target binary is compiled with dwarf debugging symbols. The gdb running in the debug console itself is seeing the symbols like below. Breakpoints set manually through the console also works as expected.

target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x08001b5c msp: 0x20001800
Note: automatically using hardware breakpoints for read-only addresses.
Temporary breakpoint 1, main () at Src/main.c:83
83	  HAL_Init();

I could not figure out how to make the VS Code be aware of the source code. Is there a way to forcibly tell the existence of the source tree?

VS Code in question is running under Windows 10. I am using gnu-mcu-eclipse-openocd-0.10.0-7-20180123-1217-win64 and gcc-arm-none-eabi-7-2017-q4-major-win32-sha2 for debugging.

Unable to restart a running debug session

If the debugger is running (not paused) and I press the "restart" button, I get the following error:

Could not restart: Cannot execute this command while the target is running. Use the "interrupt" command to stop the target and then try again. (from interpreter-exec console "monitor halt")

I started digging through the code, and it looks like the interrupt command is sent before monitor halt so I'm not sure why the error message is saying this. Maybe because there is set target async on and the device hasn't stopped running yet?

This is my launch.json.

{
    "name": "Launch app",
     "type": "cortex-debug",
     "request": "launch",
     "servertype": "jlink",
     "device": "MK22FN512VLH12",
     "executable": "${workspaceRoot}/build/app/Firmware.elf",
      "svdFile": "${workspaceRoot}/jlink/MK22F51212.svd"
}

bmp enhancements; configurable command lines

First of all - thanks for this, exactly what we need, a competent debug tool on a reasonably lightweight platform. I will file a number of issues separately so they can be addressed/reconciled/rejected independently as appropriate.

The first issue is that the command lines available to the bmp configuration (and perhaps to others, I don't know) appear to be set in program code (in bmp.ts as far as I can see). That means that some assumptions and behaviours are hard-coded into the program. In my case, the use of SWD with the monitor swdp_scan is not appropriate, but I can also see things like multi-drop configuration, initial run-to and ITM configuration all being different depending on specific use-cases.

Would it be possible/is it appropriate for you to add the option to override these via the launch.json configuration?

Failed to launch OpenOCD GDB Server

Hi Marcel,
I installed Cortex-Debug 0.1.11 in the VS Code on Win7(64 bit), and here is my settings:

{
    "cwd": "${workspaceRoot}",
    "executable": "./obj/main/main.elf",
    "name": "cortex-debug",
    "request": "launch",
    "type": "cortex-debug",
    "servertype": "openocd",
    "configFiles": [
        "C:\\openocd\\share\\openocd\\scripts\\target\\stm32f4x.cfg"
    ]
}

But when start debugging, it failed and i find the following logs from "Adapter Output":

Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Error: Debug adapter does not support any transports? Check config file order.
Error: unable to select a session transport. Can't continue.
shutdown command invoked

and a messages Failed to launch OpenOCD GDB Server: Timeout..

Is that means there is something missing for transports? But I cant find any parameter to set this.
Thanks.

Failed to launch undefined GDB Server

Error: spawn EACCES
"configurations": [
{
"name": "Cortex Debug",
"cwd": "${workspaceRoot}",
"executable": ".......elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "jlink",
"device": "STM32F722ZE",
"interface": "swd",
}
]

$ which JLinkGDBServer
/opt/local/bin/JLinkGDBServer

Hi, I attempted to us cortex-debug on OSX. I can not figure out how to debug this issue as there is no verbose output available. I also added /opt/local/bin to the JLink path in user settings. Both approaches didn't work. My setup is working in eclipse. Thanks.

How to set a breakpoint at main

Hi, I am trying to use your plugin, it works but I want more...

launch.json:

{
"version": "0.2.0",
"configurations": [
{
"name": "Something Launch",
"type": "cortex-debug",
"request": "launch",
"servertype": "jlink",
"device": "STM32L433CC",
"cwd": "${workspaceRoot}",
"executable": "build/something.elf",
"interface": "swd",
"debuggerArgs": [
],
"svdFile": "/Users/path to/Keil/STM32L4xx_DFP/2.0.0/CMSIS/SVD/STM32L4x3.svd"
}
]
}

When press F5 the debug console shows:
/Users/someone/.gdbinit:1: Error in sourced command file:
No symbol table is loaded. Use the "file" command.
Reading symbols from /Users/path to/project/build/LoRa_eTag.elf...
done.
0x08000df2 in main () at Core/Src/main.c:101
101 MX_RTC_Init();
Not implemented stop reason (assuming exception): undefined
Resetting target
Resetting target

The program halts at:

ldr sp, =_estack

I want to set a breakpoint at main ant halt at main when we launch debug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.