microsoft / microsoft/vscode-cpptools
Support SDCC as compiler
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Type: LanguageService
This issue is closely related to #2499 but more general. The linked issue talks requests that VSCode supports some of SDCC compiler's syntax for Intel 8051 projects. This issue requests that SDCC is generally a supported and recognized compiler in VSCode's C/C++ extension, since SDCC can do much more (compile code for STM8, Z80, PIC14, PIC16, etc.).
Describe the bug
- OS and Version: Windows 10 x64
- VS Code Version: 1.54.1
- C/C++ Extension Version: 1.2.2
- Other extensions you installed (and if the issue persists after disabling them): PlatformIO (2.3.0)
- Does this issue involve using SSH remote to run the extension on a remote machine?: No
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).:
- When using SDCC as the compiler in the
compilerPathof the.vscode/c_cpp_properties.jsonfile, it is not being recongized correctly with the message "Unable to resolve configuration with compilerPath [..]/sdcc.exe. Using cl.exe instead."
- When using SDCC as the compiler in the
Steps to reproduce
- (Note: I'm using PlatformIO to generate a project, auto-download SDCC and auto-generate the
c_cpp_properties.jsonthat is causing issues) - Install the PlatformIO extension
- Create a new project for the STM8Blue board and SPL as framework
- Switch to the newly created project
- Change the
platformio.iniof the project to
[env:stm8sblue]
platform = ststm8
board = stm8sblue
- Press Ctrl+Shift+P -> Rebuild IntelliSense
- Observe generated
.vscode/c_cpp_properties.jsoncontaining SDCC in thecompilerPath, example:
//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
"configurations": [
{
"name": "PlatformIO",
"includePath": [
"C:/Users/Max/Documents/PlatformIO/Projects/stm8_testing/include",
"C:/Users/Max/Documents/PlatformIO/Projects/stm8_testing/src",
"C:/Users/Max/.platformio/packages/tool-unity",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"C:/Users/Max/Documents/PlatformIO/Projects/stm8_testing/include",
"C:/Users/Max/Documents/PlatformIO/Projects/stm8_testing/src",
"C:/Users/Max/.platformio/packages/tool-unity",
""
]
},
"defines": [
"F_CPU=16000000L",
"PLATFORMIO=50101",
"STM8S_BLUE",
"STM8S103",
""
],
"compilerPath": "C:/Users/Max/.platformio/packages/toolchain-sdcc/bin/sdcc.exe",
"compilerArgs": [
"-mstm8",
""
]
}
],
"version": 4
}
Expected behavior
The SDCC compiler is recongized correctly in VSCode and compiler-specific includes like `#include "mcs51/8051.h" are recongized, and special SDCC syntax for e.g. special function registers (SFRs) and interrupt definitions are recongized.
- Logs from the command
C/C++: Log Diagnostics: None relevant -- see below - Logs from the language server: None relevant: see below
Actual behavior
Error message in the "C/C++ Configuration warnings" output tab:
[10.3.2021, 20:14:57] Die Konfiguration mit compilerPath "C:/Users/Max/.platformio/packages/toolchain-sdcc/bin/sdcc.exe" kann nicht aufgelöst werden. Stattdessen wird "cl.exe" verwendet.
Translates to
Unable to resolve configuration with compilerPath [..]/sdcc.exe. Using cl.exe instead."
Due to that of course, nothing SDCC specific like the compiler-specific includes or syntaxes are displayed correctly in VSCode.
Screenshots
None relevant
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided PlatformIO STM8 project and generated .vscode/c_cpp_properties.json, focusing on compilerPath handling for sdcc.exe. Trace how the C/C++ extension identifies compilers and applies compiler-specific includes and syntax. Done means SDCC is recognized without falling back to cl.exe and the reported SDCC headers and syntax are handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100