Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code integration #21119

Open
andrewboie opened this issue Dec 3, 2019 · 73 comments
Open

VS Code integration #21119

andrewboie opened this issue Dec 3, 2019 · 73 comments
Assignees
Labels
area: Documentation Enhancement Changes/Updates/Additions to existing features

Comments

@andrewboie
Copy link
Contributor

Visual Studio Code is a really nice development environment, even someone such as myself who has stuck with vim for many years is considering switching over to it.

It would be cool if we could provide some documentation and/or VS Code extensions to make VS Code more zephyr-aware. This ticket can be a catch-all for integration tasks/ideas. So far I can think of:

  • Best way to get tab settings correct across different file types in Zephyr
  • Somehow populate header information to provide those definitions only provided by Kconfig, so we can correctly see what preprocessor directives are active, right now they are all greyed out for CONFIG_* variables. Probably need to be able to set what board/project configuration we are building for.
  • Integration for interacting with west
  • Integration for running CMake and doing builds for a particular project directory
  • Interactive debugging to connected hardware
  • Integration to run an emulator (and interactively debug it if desired) for QEMU or other emulation targets
  • Some kinds of lintian checks can be shown directly in the editor GUI - wonder if we could integrate checkpatch into this

Other ideas, please comment!

@andrewboie andrewboie added the Enhancement Changes/Updates/Additions to existing features label Dec 3, 2019
@ulfalizer
Copy link
Collaborator

ulfalizer commented Dec 3, 2019

For Kconfig, it's because autoconf.h is included automatically:

toolchain_cc_imacros(${AUTOCONF_H})

Would need to either include it manually where it's needed or tell VS Code about it somehow.

cmake/ide/eclipse_cdt4_generator_amendment.cmake seems to already have some stuff related to autoconf.h.

@andrewboie
Copy link
Contributor Author

andrewboie commented Dec 3, 2019

Would need to either include it manually where it's needed or tell VS Code about it somehow.

We'd need to generate it too, since it's a build artifact that depends on the selected board and defconfig.

Same deal with DTS #defines, syscalls, bunch of other stuff.

@nashif
Copy link
Member

nashif commented Dec 3, 2019

On Kconfig: https:/luveti/kconfig-vscode

@erwango
Copy link
Member

erwango commented Dec 3, 2019

Another nice improvement would be to enable search across modules, which I haven't been able to get working so far (while it is somewhat documented).

@nashif
Copy link
Member

nashif commented Dec 3, 2019

* Best way to get tab settings correct across different file types in Zephyr

This should already be supported using the .editorconfig file we have in the tree. That works for me. Alternativly, you could set this directly:

https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings

@markusr
Copy link

markusr commented Dec 3, 2019

There is a closed issue #17645 with some configs for vscode. Maybe it helps.

@sigvartmh
Copy link
Collaborator

I would also add that some default configuration for https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug would be helpful for the people developing with ARM architecture.

I'm pretty sure this is what platform.io uses with some improvements https://platformio.org/platformio-ide

So having some support for

  • OS level awareness for debugging in VS code is also an improvement.

@joerchan
Copy link
Contributor

joerchan commented Dec 9, 2019

CC: @trond-snekvik Maybe you have some input here?

@trond-snekvik
Copy link
Contributor

trond-snekvik commented Dec 9, 2019

I actually made a couple of extensions improve my workflow with Zephyr:

  • DeviceTree for the Zephyr project adds syntax highlighting, type checking, code completion, go to defintion and syntax checking to deviceTree files, written specifically for the Zephyr RTOS.
  • Kconfig for the Zephyr project adds highlighting, code go to definition and completion for Kconfig and .conf files, as well as type checking, basic linting and syntax validation for .conf files.
  • vscode-doxygen-generator is a generic Doxygen header API generator for C. It improves syntax highlighting for doxygen tags, and adds a snippet generator for doxygen comments (Place your cursor on a function definition, and press Ctrl+Q).
  • GNU Linker Map files adds syntax highlighting and symbol listing for GNU map files. Tested with Zephyr's map files, using GCC 9.3.1.

@carlescufi
Copy link
Member

One more potentially useful repo with info by @bus710:
https:/bus710/zephyr-rtos-development-in-linux

@brooksprumo
Copy link
Contributor

brooksprumo commented Jan 24, 2020

I've had some good luck using VS Code and its support for Language Server to do intellisense stuffs by having CMake generate a compilation database (that VS Code then consumes automatically, assuming the build directory is in the project).

The CMake parameter is CMAKE_EXPORT_COMPILE_COMMANDS, and here's examples of building an app:

west build -b <board> <app directory> -- -DCMAKE_EXPORT_COMPILE_COMMANDS=1

If you always want to generate the compilation database, you can also do:

west config build.cmake-args -- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

@sslupsky
Copy link
Contributor

Here is a helpful setting in my workspace c_cpp_properties.json:

"compileCommands": "~/Documents/source/blinky/build/compile_commands.json"

I also found some helpful information here:
https://gitlab.endian.se/simon/vscode-zephyr-intro

In particular, the forced includes and defines to get IntelliSense to work properly:

"forcedInclude": [
                "~/Documents/source/blinky/build/zephyr/include/generated/autoconf.h",
                "~/Documents/source/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h",
                "~/Documents/source/blinky/.vscode/c_cpp_undef.h"
],
"defines": [
                "BUILD_VERSION=v2.1.0-rc1-141-g3cc5bda2fa10",
                "KERNEL",
                "_FORTIFY_SOURCE=2",
                "__PROGRAM_START",
                "__ZEPHYR__=1"
],

@sslupsky
Copy link
Contributor

Also add this to your CMakeLists.txt for your project:

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

@sslupsky
Copy link
Contributor

CMake can be configured to generate a compile_commands.json. However, the file is for the application which leads to problems when you open a component of the Zephyr RTOS into vscode. For instance, if I open drivers/i2c/i2c_sam0.c I will see an error that there is no target for that file. This is true since the compilation of the OS is controlled by other CMake processes. Vscode opens the file and parses using the include paths and forced includes and defines specified in the config file.

What would be useful here is to be able to generate the compile_commands.json file for all the other Zephyr RTOS related files. That way, vscode would be able to open and parse any of the OS files (drivers, kernel, subsystems, modules, etc). At the moment, I have to rely on the Include paths and forced includes and defines in my config. These could be eliminated all together if I could get the compile_commands.json for all the components of Zephyr.

@sslupsky
Copy link
Contributor

Here is an example of a task I use to invoke west to do a build:

{
	"label": "west build auto",
	"type": "shell",
	"group": "build",
	"command": "west",
	"args": [
	    "build",
	    "-p",
	    "auto",
	    "-b",
	    "scanimetrics_witap_isb",
	    "${workspaceFolder}"
	],
	"options": {
	    "cwd": "${workspaceFolder}",
	    "env": {
		"ZEPHYR_BASE": "/Users/stevenslupsky/Documents/source/zephyrproject/zephyr",
		"ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
		"GNUARMEMB_TOOLCHAIN_PATH": "/usr/local/",
		"VS_CODE_BOARD_TO_BUILD": "scanimetrics_witap_isb",
		"VS_CODE_ZEPHYR_BIN_NAME": "zephyr.elf",
	    }
	},
	"dependsOn": [],
	"problemMatcher": [ "$gcc" ]
}

@sslupsky
Copy link
Contributor

sslupsky commented Mar 16, 2020

I found another way to integrate Zephyr with vscode using the CMake-tools extension. I had been playing around with this extension a while back but really did not understand how to use it. The key to use it for Zephyr is the "configurationProvider" property in c_cpp_properties.json.

Install the vector-of-bool (now microsoft) Cmake-tools extension. Then, edit your c_cpp_properties.json in your project's .vscode directory and add the following configuration:

{
	"name": "Cmake",
	"configurationProvider": "vector-of-bool.cmake-tools"
}

Select the "Cmake" configuration that was added by clicking the configuration button in the bottom right portion of the status bar beside the "Tweet Feedback" button (it is typically set to "Mac" or "Win"). When you select the "Cmake" configuration (or whatever name you gave it), this automatically finds compile_commands.json according to the CMake extension settings (you can change the default if you need to).

To get the Zephyr components to parse properly, edit the CMakeLists.txt files in each of the Zephyr directories that contains source files you want to be able to open with your project. Add the following line to each file:

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

In my case, I edited CMakeLists.txt in the following directories:
arch/arm
boards
drivers
kernel
soc
subsys

Build your project. Inspect the project compile_commands.json file and now you will see a number of additional entries for all the Zephyr components.

Now, when you open your Zephyr source files, they should be parsed properly by the c_cpp extension.

@sslupsky
Copy link
Contributor

Some other useful extensions:

ARM, Dan Underwood
CMake Tools, Microsoft
Cortex-Debug, marus25
DeviceTree, Pietro Lorefice
Doxygen Documentation Generator, Christoph Schlosser
Git Graph, mhutchie
Intel HEX format, keroc
kconfig, luveti

@sslupsky
Copy link
Contributor

sslupsky commented Mar 19, 2020

There is one problem with using the compile_commands.json workflow with VSCode. When you apply the CMAKE_EXPORT_COMPILE_COMMANDS setting, it doesn't seem to propagate to all the required files.

For instance, sam0_rtc_timer.c does not appear in my compile_commands.json. I have not determined why it is not being included.

Does anyone know how to force CMake to propagate a setting to all of the descendants of a CMakeList.txt?

@joerchan
Copy link
Contributor

@SebastianBoe Any idea why the compile commands would not be consistent with the ninja build file?

@SebastianBoe
Copy link
Collaborator

I couldn't say why, but it seems that setting the variable from CMakeLists.txt is unofficially not supported. I would try setting it from CLI to ensure it is always set as a cache variable.

https://gitlab.kitware.com/cmake/cmake/issues/16588

@joerchan
Copy link
Contributor

@sslupsky Given the answer from Sebastian, try setting the compile command as was explained here:
#21119 (comment)

@beriberikix
Copy link

Awesome discussion all around! I can't help but thinking that we can capture this with some automation via a new VS Code extension. If some of the scaffolding and configuration was implemented in west (like task generation) and the extension wrapped west, installed other extensions as deps - you could have a very nice developer experience out of the box. We did something similar when I was at Particle. Anyone with JS experience interested in collaborating? I know their APIs pretty well but I'm much more a Product guy than a good developer :)

@sslupsky
Copy link
Contributor

sslupsky commented Mar 20, 2020

@joerchan Thank you for the tip. I can confirm that setting the CMAKE_EXPORT_COMPILE_COMMANDS from the command line works better than using the setting in the CMakeLists.txt file. Now all the zephyr components are included in the compile_commands.json file. Hooray! :-)

One problem remains though. Some of the include paths do not resolve properly. For instance, #include <soc.h> comes up with a list of 76 definitions. This prevents anything that includes soc.h from linting properly with intellisense. Unfortunately, soc.h is quite a popular file to include ;-).

I have raised an issue with the VSCode CMake Tools team about this problem since it appears to be specific to VSCode at the moment:
microsoft/vscode-cmake-tools#1120

Has anyone here been able to resolve this?

@sslupsky
Copy link
Contributor

For clarification for anyone reading this, I am using the Multi-root workspace in VSCode. This allows me to configure VSCode to work with projects that have multiple "sub projects". In my use case, I have root folders for:
application (project)
custom board
zephyr tree (base)
zephyr modules

The multi root capability of VSCode is really quite helpful for Zephyr projects. Here is a copy of the .code-workspace file:

{
	"folders": [
		{
			"path": "isb",
			"name": "app"
		},
		{
			"path": "zephyrproject/zephyr/boards/arm/scanimetrics_witap_isb",
			"name": "board"
		},
		{
			"path": "zephyrproject/zephyr",
			"name": "zephyr"
		},
		{
			"path": "zephyrproject/modules",
			"name": "modules"
		}
	],
	"settings": {
		"C_Cpp.default.includePath": [
			"${workspaceFolder:zephyr}/include",
			"${workspaceFolder:zephyr}/include/drivers",
			"${workspaceFolder:zephyr}/soc/arm/atmel_sam0/samd21",
			"${workspaceFolder:zephyr}/soc/arm/atmel_sam0/common/.",
			"${workspaceFolder:zephyr}/drivers",
			"${workspaceFolder:zephyr}/ext/lib/fnmatch/.",
			"${workspaceFolder:zephyr}/ext/hal/cmsis/Core/Include",
			"${workspaceFolder:zephyr}/subsys/usb",
			"${workspaceFolder:modules}/hal/atmel/asf/sam0/include/samd21",
			"${workspaceFolder:modules}/fs/littlefs",
			"${workspaceFolder:modules}/fs/fatfs/include",
			"${workspaceFolder:modules}/fs/nffs/include/nfss",
			"${workspaceFolder:zephyr}/lib/libc/minimal/include",
			"/usr/local/Cellar/arm-none-eabi-gcc/8-2018-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
			"/usr/local/Cellar/arm-none-eabi-gcc/8-2018-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",
			"${workspaceFolder:app}/build/zephyr/include/generated"
		],
		"C_Cpp.default.forcedInclude": [
			"${workspaceFolder:app}/build/zephyr/include/generated/autoconf.h",
			"${workspaceFolder:zephyr}/include/toolchain/zephyr_stdint.h",
			"${workspaceFolder:app}/.vscode/c_cpp_undef.h"
		],
		"C_Cpp.default.defines": [
			"BUILD_VERSION=v2.1.0-rc1-141-g3cc5bda2fa10",
			"KERNEL",
			"_FORTIFY_SOURCE=2",
			"__PROGRAM_START",
			"__ZEPHYR__=1"
		],
		"C_Cpp.default.compilerPath": "/usr/local/bin/arm-none-eabi-gcc",
		"C_Cpp.default.cStandard": "c11",
		"C_Cpp.default.cppStandard": "c++17",
		"C_Cpp.default.intelliSenseMode": "gcc-x64",
		"C_Cpp.default.compileCommands": "${workspaceFolder:app}/build/compile_commands.json",
		"files.associations": {
			"zephyr.h": "c",
			"kernel.h": "c",
			"kernel_includes.h": "c",
			"log.h": "c",
			"printk.h": "c",
			"littlefs.h": "c",
			"i2c.h": "c",
			"usb_device.h": "c",
			"soc.h": "c",
			"samd21g18a.h": "c",
			"power.h": "c",
			"watchdog.h": "c",
			"i2c_ll_stm32.h": "c",
			"init.h": "c",
			"device.h": "c",
			"cpu.h": "c",
			"generated_dts_board.h": "c",
			"system_timer.h": "c",
			"clock_control.h": "c",
			"sys_clock.h": "c",
			"dma.h": "c",
			"hwinfo.h": "c",
			"gpio.h": "c",
			"errno.h": "c",
			"stdio.h": "c",
			"version.h": "c"
		},
		"terminal.integrated.env.osx": {
			"ZEPHYR_BASE": "${workspaceFolder:zephyr}/",
			"ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
			"GNUARMEMB_TOOLCHAIN_PATH": "/usr/local/",
			"PATH": "$ZEPHYR_BASE/scripts:${env:PATH}"
		},
		"editor.tabSize": 8,
		"editor.insertSpaces": false
	}
}

@sslupsky
Copy link
Contributor

@SebastianBoe Thank you, the command line option resolved my issue with the compile_commands.json file not including all the zephyr targets.

@sslupsky
Copy link
Contributor

@beriberikix That is a great idea ... that would simplify the setup process enormously by eliminating the need for someone to learn about the details of configuring VSCode. I have grown to admire VSCode tremendously and it keeps getting better. I have one nagging issue related to git that I haven't been able to figure out. Seems like VSCode will occasionally max out the CPU in one of its' threads. The problem seems related to staging selected code changes but I am not completely certain that is the cause; rather it is likely just a coincidence. VSCode has a helpful command when this happens, "Developer: reload window". This is a lifesaver. You loose your undo history but pretty much everything else comes back to where you were minus the laggy responsiveness due to the high cpu usage.

@trond-snekvik
Copy link
Contributor

I published the Kconfig extension on the marketplace last week. It provides full language support for all Kconfig and .conf files out of the box, including code completion, go to definition, syntax highlighting and linting. It should improve the VS Code experience for Kconfig quite a bit for both application developers and stack maintainers.

The extension depends on West v0.7.0 or newer. Older versions should work, but there may be some manual configuration required. Feel free to contact me on slack if you have any questions, issues or feature requests :)

@rosterloh
Copy link
Contributor

@trond-snekvik Thanks for this! I've been using it for the last few days and it's great. Hoping to see more zephyr support for VSCode in the future.

@wbober
Copy link
Member

wbober commented Sep 9, 2021

@hongshui3000 Yes, that was supposed to be a feature but turned out to be an issue that hit users hard. We already have a workaround: if you use a manual toolchain installation we won't override the terminal environment. For a more complete solution we would like to introduce a separate terminal profile for NCS and leave the default one unmodified.

Feel free to open issues on https://devzone.nordicsemi.com/

@carlescufi
Copy link
Member

https://www.rajeevpiyare.com/posts/nrfconnect-vs-code/

@hongshui3000
Copy link
Contributor

hongshui3000 commented Nov 12, 2021

espressif has an open source implementation, but it does not seem to be based on zephyr.The idea is similar to that of nordic
https:/espressif/vscode-esp-idf-extension

@marnold-b
Copy link
Contributor

Might be interesting for people who are using WSL2 with vscode:
https://devblogs.microsoft.com/commandline/connecting-usb-devices-to-wsl/

@ddavidebor
Copy link

Would the Nordic folks be so kind as to open-source their VSCode extensions?

@wbober
Copy link
Member

wbober commented Feb 5, 2022

@ddavidebor Does the closed source nature of the extensions limits your usage in any way?

@ddavidebor
Copy link

@wbober not for Nordic products, but of course the extensions could be expanded to encompass a larger number of toolchains over time - acting as the starting point for full VSCode integration

I totally understand if that's not viable for business reasons.

@hongshui3000
Copy link
Contributor

hongshui3000 commented Feb 6, 2022

I wish there was a zephyr community maintained vscode extension
Nordic's vscode extension is good, but not so good when multiple manufacturers' MCUs are used in the product

@wbober
Copy link
Member

wbober commented Feb 7, 2022

@ddavidebor There is no plan to open source the extension.

We are open to providing a limited support for development on other platforms. If you are able to provide more concrete examples of things that are missing or limiting then I will take that feedback to the team. Perhaps there are ways to support by opening APIs for extension with plugins or alike.

Can't make any promises but I'm open for a discussion.

@hongshui3000
Copy link
Contributor

hongshui3000 commented Feb 20, 2022

imports vsc
https:/smrtos/Zephyr2VSC
This tool imports Zephyr (https:/zephyrproject-rtos/zephyr ) source code into Visual Studio Code in the context of a build.

@mbrunnen
Copy link
Contributor

mbrunnen commented Feb 8, 2023

I still see this issue: microsoft/vscode-cpptools#9187

E.g. whenever I use LOG_INF("Hello World") with only one argument, I get:

too few arguments in invocation of macro "Z_FOR_LOOP_1"

@trond-snekvik
Copy link
Contributor

@mbrunnen you can get around this by adding __CDT_PARSER__ to your list of defines for CppTools. It's not a proper fix, but at least it makes the C++ extension usable.

@aunsbjerg
Copy link
Collaborator

@mbrunnen you can get around this by adding __CDT_PARSER__ to your list of defines for CppTools. It's not a proper fix, but at least it makes the C++ extension usable.

@trond-snekvik, I just tried that since I have the same issue, but I does not seem to have any effect, I still get the "too few arguments" warnings.

My configuration looks something like this:

{
    "name": "app",
    "cStandard": "c11",
    "cppStandard": "c++20",
    "intelliSenseMode": "linux-gcc-arm",
    "compilerPath": "${env:zephyrCompilerPath}",
    "compileCommands": "${workspaceFolder}/build/compile_commands.json",
    "defines": [
        "__CDT_PARSER__"
    ],
    "forcedInclude": [
        "${workspaceFolder}/build/autoconf.h"
    ]
},

@trond-snekvik
Copy link
Contributor

@aunsbjerg according to the cpptools reference, compileCommands replaces all defines and includes, unfortunately. The extension only uses your custom defines and includes when it can't find the file you're editing in the compileCommands. I'm not sure the same applies to the forcedInclude though, so you might be able to achieve the same thing by creating a dummy header with this define and force include it.

Without compileCommands, it works for me on the current main branch, because of this section:

#if defined(__CDT_PARSER__) || defined(__JETBRAINS_IDE__)
#undef LOG_ERR
#undef LOG_WRN
#undef LOG_INF
#undef LOG_DBG
#undef LOG_HEXDUMP_ERR
#undef LOG_HEXDUMP_WRN
#undef LOG_HEXDUMP_INF
#undef LOG_HEXDUMP_DBG
#define LOG_ERR(...) (void) 0
#define LOG_WRN(...) (void) 0
#define LOG_DBG(...) (void) 0
#define LOG_INF(...) (void) 0
#define LOG_HEXDUMP_ERR(...) (void) 0
#define LOG_HEXDUMP_WRN(...) (void) 0
#define LOG_HEXDUMP_DBG(...) (void) 0
#define LOG_HEXDUMP_INF(...) (void) 0
#endif

For what it's worth, clangd's configuration system is a lot more flexible, as it allows you to add or remove defines and includes in a yaml config file. The syntax is a little hard to work out, but their extension has come a long way, and often works better than Microsoft's in my experience.

@aunsbjerg
Copy link
Collaborator

@aunsbjerg according to the cpptools reference, compileCommands replaces all defines and includes, unfortunately. The extension only uses your custom defines and includes when it can't find the file you're editing in the compileCommands. I'm not sure the same applies to the forcedInclude though, so you might be able to achieve the same thing by creating a dummy header with this define and force include it.

Without compileCommands, it works for me on the current main branch, because of this section:

#if defined(__CDT_PARSER__) || defined(__JETBRAINS_IDE__)
#undef LOG_ERR
#undef LOG_WRN
#undef LOG_INF
#undef LOG_DBG
#undef LOG_HEXDUMP_ERR
#undef LOG_HEXDUMP_WRN
#undef LOG_HEXDUMP_INF
#undef LOG_HEXDUMP_DBG
#define LOG_ERR(...) (void) 0
#define LOG_WRN(...) (void) 0
#define LOG_DBG(...) (void) 0
#define LOG_INF(...) (void) 0
#define LOG_HEXDUMP_ERR(...) (void) 0
#define LOG_HEXDUMP_WRN(...) (void) 0
#define LOG_HEXDUMP_DBG(...) (void) 0
#define LOG_HEXDUMP_INF(...) (void) 0
#endif

For what it's worth, clangd's configuration system is a lot more flexible, as it allows you to add or remove defines and includes in a yaml config file. The syntax is a little hard to work out, but their extension has come a long way, and often works better than Microsoft's in my experience.

Forced includes are also ignored when using compile_command.json. I played around with it, but couldn't really find a working solution. I'll give clangd a shot - thanks for the heads up and for taking the time to respond :)

@mbrunnen
Copy link
Contributor

Hey @trond-snekvik and @aunsbjerg, thanks for the help. __CDT_PARSER__ does help, but not using compile_commands.json is not really an option for me. I will try it with clangd :)

@JPHutchins
Copy link
Contributor

JPHutchins commented Mar 1, 2023

I started working on turning https:/smrtos/Zephyr2VSC into a VSCode extension - "configurationProvider" - but oooooh boy things did not start smoothly!

Sanity check: I am getting IntelliSense with "ms-vscode.cpptools" alone and simply defining compileCommands in .vscode/c_cpp_properties.json:

{
    "version": 4,
    "configurations": [
        {
            "name": "zephyr-default",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ]
}

This is nice, because I find cmake-tools cumbersome and the Nordic stuff completely unusable 😝.

On the other hand, I'm sure that I haven't used this config enough to discover why it's insufficient! 😭

Looking forward to trying out the new offerings from Microsoft when I have time: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-embedded-tools

Then again, maybe we should all just calm tf down before we turn VSCode into Eclipse...

@beriberikix
Copy link

FYI @robotdad, who works on the Embedded Tools extension!

@hongshui3000
Copy link
Contributor

hongshui3000 commented Mar 2, 2023

@JPHutchins If you are interested in configurationProvider, you can also take a look at this extended method.Although it is not targeting zephyr https:/Mossop/vscode-mozillacpp https:/Mossop/vscode-mozillacpp/blob/main/src/provider.ts
image

@kartben
Copy link
Collaborator

kartben commented Mar 23, 2023

I still see this issue: microsoft/vscode-cpptools#9187

E.g. whenever I use LOG_INF("Hello World") with only one argument, I get:

too few arguments in invocation of macro "Z_FOR_LOOP_1"

interestingly (and sadly) this also fails when running CodeQL against a Zephyr application :(

@whati001
Copy link

Quite nice repository to get started with Zephyr debugging in vscode:
https:/beriberikix/zephyr-vscode-example/tree/main

@KozhinovAlexander
Copy link
Collaborator

KozhinovAlexander commented Dec 20, 2023

You can also try mine: https:/KozhinovAlexander/zephyr_vscode_workspace
One thing to think about: default openocd v0.11.0 for ubuntu does not work with Marus/cortex.debug - you need to build v0.12.0 or install separately.

I am also open to support and commits. Just create an issue - I will be able to answer ASAP or support you.

@carlescufi
Copy link
Member

Note that there is a discussion regarding the same topic:
#74005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Documentation Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests