Skip to content

Support SDCC as compiler #7146

Open
Open

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 compilerPath of the .vscode/c_cpp_properties.json file, it is not being recongized correctly with the message "Unable to resolve configuration with compilerPath [..]/sdcc.exe. Using cl.exe instead."

Steps to reproduce

  1. (Note: I'm using PlatformIO to generate a project, auto-download SDCC and auto-generate the c_cpp_properties.json that is causing issues)
  2. Install the PlatformIO extension
  3. Create a new project for the STM8Blue board and SPL as framework
  4. Switch to the newly created project
  5. Change the platformio.ini of the project to
[env:stm8sblue]
platform = ststm8
board = stm8sblue
  1. Press Ctrl+Shift+P -> Rebuild IntelliSense
  2. Observe generated .vscode/c_cpp_properties.json containing SDCC in the compilerPath, 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.

  1. Logs from the command C/C++: Log Diagnostics: None relevant -- see below
  2. 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

Activity

  1. sean-mcmanus commented on Mar 10, 2021

    @sean-mcmanus
    Contributor

    Related to #6677 .

  2. added this to the Triage milestone on Mar 11, 2021
  3. github-actions commented on May 9, 2021

    @github-actions

    This feature request has received enough votes to be added to our backlog.

  4. modified the milestones: Triage, Backlog on May 9, 2021
  5. 45gfg9 commented on Feb 12, 2022

    @45gfg9

    What's going on here? People still use SDCC and VSCode, I really want to see VSCode add support for SDCC.

  6. ArvoGuo commented on Feb 14, 2023

    @ArvoGuo

    any update?

  7. sean-mcmanus commented on Feb 14, 2023

    @sean-mcmanus
    Contributor
  8. jmjoy commented on Dec 10, 2023

    @jmjoy

    +1

  9. syx-413 commented on Dec 30, 2023

    @syx-413

    +1

  10. abobija commented on Jun 2, 2024

    @abobija

    +1

    Any update?

  11. rushairer commented on Jul 4, 2024

    @rushairer

    +1

    Any update?

  12. mrx23dot commented on Jul 11, 2024

    @mrx23dot

    There is already an addon for that
    https://marketplace.visualstudio.com/items?itemName=CL.eide

    please close.

  13. Tentou-Reikie commented on Sep 24, 2024

    @Tentou-Reikie

    +1

    Any update?

  14. davemoore22 commented on May 16, 2025

    @davemoore22

    I would +1 this.

  15. rjstone commented on Jun 3, 2025

    @rjstone

    +1
    Hard to believe this still isn't done. Aren't there any other compilers that would benefit from some simple customization for the C/C++ extension syntax? This seems pretty easy to do.

  16. levshx commented on Jun 27, 2025

    @levshx

    +1
    no changes for 5 years already

  17. maxgerhardt commented on Jun 27, 2025

    @maxgerhardt
    Author

    Sad to see, that 4 years and 3 months later for this issue, or rather 7 years later for #2499, the best we have for SDCC coding in VSCode is #define'ing the missing syntax to an empty expression. The fundamental backlog issue #6677 (comment) hasn't been woked on?

  18. rjstone commented on Jun 28, 2025

    @rjstone

    Maximilian Gerhardt (@maxgerhardt) I think the main feature request that covers all these specifics is probably #6931

  19. chenzhiguo commented on Jul 11, 2025

    @chenzhiguo

    I have the same problem on vscode and CLion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions