CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Visual Studio Code and the CCS compiler
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
allenhuffman



Joined: 17 Jun 2019
Posts: 552
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

Visual Studio Code and the CCS compiler
PostPosted: Tue Apr 20, 2021 11:31 am     Reply with quote

Has anyone experimented with using Visual Studio Code to do builds with the CCS compiler? A coworker of mine got his set up where it can build and then load to the board all from within VS Code. The only thing he needs the IDE for is setting project settings and using the debugger.

I wondered if anyone had made an extension to handle all of this.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Tue Apr 20, 2021 5:59 pm     Reply with quote

I haven't used VS code for this, but I've only ever used MPLAB X. Since CCS compiler has a plug-in for MPLAB X, setup is quite easy.

But from what I know, VS code is quite flexible. You just have to wait for somebody to write a plug-in... Or do it yourself
vasiliok



Joined: 17 May 2011
Posts: 19
Location: Kaunas, Lithuania

View user's profile Send private message

PostPosted: Fri May 21, 2021 4:41 am     Reply with quote

Visual Studio Code doesn't have a plugin for PICC CCS.

There should be the way to make VSC run pcwhd compiler (aka build project) with args to compile exact file but I can't find how to do this Confused

Anyone could help?
Ttelmah



Joined: 11 Mar 2010
Posts: 19531

View user's profile Send private message

PostPosted: Fri May 21, 2021 6:58 am     Reply with quote

There have been a number of threads about using VS in the past. This one
seems to describe how to do it:

[url]
http://www.ccsinfo.com/forum/viewtopic.php?t=29216&highlight=visual+studio[/url]
jeremiah



Joined: 20 Jul 2010
Posts: 1353

View user's profile Send private message

PostPosted: Fri May 21, 2021 3:24 pm     Reply with quote

Ttelmah wrote:
There have been a number of threads about using VS in the past. This one
seems to describe how to do it:

[url]
http://www.ccsinfo.com/forum/viewtopic.php?t=29216&highlight=visual+studio[/url]


Just as a note, VS Code is not the same as Visual Studio. VS Code is more of a flexible extendable text editor/IDE for any language/platform that people can write plugins for, where as Visual Studio is an IDE targetted specifically for coding for Windows based platforms using languages that Microsoft supports.

I'm sure you already know this, but highlighting it for others who may get them confused.
Ttelmah



Joined: 11 Mar 2010
Posts: 19531

View user's profile Send private message

PostPosted: Sat May 22, 2021 12:46 am     Reply with quote

I must admit I can't think how you could use MS Visual studio with CCS, or
even think that it would be useful, since it's syntax rules are not changeable.
I assumed that the poster would be asking about a development IDE that
could be used with a compiler like CCS, which VS can. You can integrate
third party compilers with Visual Studio by editing the vcproj file, but it
won't change the syntax rules.
He says 'code' as the last part of the question, so I assumed he was talking
about VS Code, rather that Visual Studio....
vasiliok



Joined: 17 May 2011
Posts: 19
Location: Kaunas, Lithuania

View user's profile Send private message

PostPosted: Tue May 25, 2021 7:14 am     Reply with quote

jeremiah, Ttelmah, thanks!

Yes, about VS Code!
Ttelmah



Joined: 11 Mar 2010
Posts: 19531

View user's profile Send private message

PostPosted: Tue May 25, 2021 8:19 am     Reply with quote

Phew!... Very Happy
pgvt



Joined: 17 Aug 2024
Posts: 6

View user's profile Send private message

Yes, it works very good w/ latest (Nov. 2024) vscode
PostPosted: Mon Nov 11, 2024 8:06 am     Reply with quote

Please reply if anyone is still interested.

I managed to use vscode with command line compilers that come with PCWHD suite and see nicely the references, do auto-compete as you type - provided by C/C+ language pack' IntelliSense - well, it needed some disabling of "too smart things" ... Also I made an error parser ("problemMatcher") to display and jump to warning / error / info.
Everything is done by 3 files in a sub-folder named .vscode placed in your project folder root.

SCREENSHOT

There is also a convenient way to make a shortcut on Desktop etc. for vscode to open directly this project folder and load your code.[/img]


Last edited by pgvt on Mon Nov 11, 2024 8:34 am; edited 1 time in total
allenhuffman



Joined: 17 Jun 2019
Posts: 552
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

Re: Yes, it works very good w/ latest (Nov. 2024) vscode
PostPosted: Mon Nov 11, 2024 8:23 am     Reply with quote

pgvt wrote:
Please reply if anyone is still interested.

I managed to use vscode with command line compilers that come with PCWHD suite and see nicely the references, do auto-compete as you type - provided by C/C+ language pack' IntelliSense - well, it needed some disabling of "too smart things" ... Also I made an error parser ("problemMatcher") to display and jump to warning / error / info.
Everything is done by 3 files in a sub-folder named .vscode placed in your project folder root.


I would certainly like to see what you came up with. Is this something that could be published as a VS Code Extension, allowing others to download it from that MS VS Code directory?
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
pgvt



Joined: 17 Aug 2024
Posts: 6

View user's profile Send private message

Here you go:
PostPosted: Mon Nov 11, 2024 8:45 am     Reply with quote

1. Create a sub-folder ./vscode and place inside:
2. A new file named tasks.json with contents:
Code:

{
  "version": "2.0.0",
  "inputs": [
    {
      "id": "picFlavor",
      "type": "pickString",
      "description": "Select: +FH(PIC18), +FB(PIC12), +FM(PIC16) or +FD(PIC24)",
      "options": ["+FH", "+FB", "+FM", "+FD"],
      "default": "+FH"
    }
  ],
  "tasks": [
    {
      "label": "Build Project by PICC",
      "type": "shell",
      "command": "C:\\Program Files (x86)\\PICC\\ccscon.exe",
      "args": [
        "-M", "-T", "-A", "-Z",
        "${input:picFlavor}",
        "+EA", "+P02", "+J", "+STDOUT", "+O8hex",
        "${file}"
      ],
      "presentation": {
        "echo": true,
        "revealProblems": "onProblem",
        "reveal": "always",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": false,
        "clear": true
      },
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": {
        "owner": "custom",
        "fileLocation": ["absolute"],
        "pattern": {
          "regexp": "^(.*):(\\d+):(\\d+):\\s+(Info|Error|Warning)#(\\d+)\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "code": 5,
          "message": 6
        }
      }
    }
  ]
}

3. Also a new file named settings.json with contents:
Code:
{
    "C_Cpp.errorSquiggles": "disabled",
    "C_Cpp.codeAnalysis.clangTidy.checks.disabled": [
        "clang-diagnostic-error"
    ]
}

4. Also a new file named c_cpp_properties.json with contents:
Code:

{
    "configurations": [
        {
            "name": "PICC",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Program Files (x86)\\PICC\\Devices",
                "C:\\Program Files (x86)\\PICC\\Drivers"
            ],
            "defines": [
               
            ]
        }
    ],
    "version": 4
}
//https://code.visualstudio.com/docs/editor/variables-reference


5. Download latest vscode and ... patience to load everything ...

6. Optional: For fast access you can create a shortcut to vscode with modifying the Target: field this way:
Code:
"C:\Users\<yourusername>\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\your project absolute path"
pgvt



Joined: 17 Aug 2024
Posts: 6

View user's profile Send private message

More
PostPosted: Mon Nov 11, 2024 8:56 am     Reply with quote

A quick (maybe old Smile ) vscode editor keys legend and variable references

vscode keys

variables reference

Not sure about "extension" probably it's possible

For me this way is ok, I simply copy-past the same .vscode to all my projects.
BTW, the git stuff works as well.

Now, I see the references instead of scratch my head every time.

The PCW IDE is still great as the main one to be used, but it is good to have more advanced editor. Hope the command-line and visual compiler work exactly same way and no worries about any difference in compiling.

For now, the ccload and extra tools I use as external .bat files and don't mess-up with vscode integrating ...

Yeah. I believe instead of ccscon ccsc can be used - i did this in NPP in the past. But here the +STDOUT somewhat didn't want to pass the output.
pgvt



Joined: 17 Aug 2024
Posts: 6

View user's profile Send private message

More
PostPosted: Mon Nov 11, 2024 9:31 am     Reply with quote

To call the compiler, vscode needs to be focused at your <project-main>.c file, then select "Run Task" from the upper side middle (general search) of vscode and then "Build by PICC Compiler"
pgvt



Joined: 17 Aug 2024
Posts: 6

View user's profile Send private message

Extension
PostPosted: Mon Nov 11, 2024 10:11 pm     Reply with quote

Here it is as a vscode extension ... whatever:

Extension: vscode-picc-ccs-support-0.0.1.vsix with screenshots

Once installed as extension, navigate to your project folder and activate.
See the 2 png files in the zip how to install the extension and how to use it.

Enjoy.
kieranjefferies



Joined: 22 Dec 2016
Posts: 6
Location: Ireland

View user's profile Send private message

re>Extension: vscode-picc-ccs-support-0.0.1.vsix
PostPosted: Tue Nov 12, 2024 1:18 am     Reply with quote

Thank you pgvt
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group