microsoft / microsoft/vscode-cpptools

Support SDCC as compiler

Aperta
#7,146 17 commenti 73 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

embedded Feature Request Language Service
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre il problema con il progetto PlatformIO STM8 fornito e il file .vscode/c_cpp_properties.json generato, concentrandosi sulla gestione di compilerPath per sdcc.exe. Tracciare il modo in cui l'estensione C/C++ identifica i compilatori e applica gli includes e la sintassi specifici del compilatore. Il lavoro è completato quando SDCC viene riconosciuto senza ricorrere a cl.exe e gli header e la sintassi SDCC segnalati vengono gestiti correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.