| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| allenhuffman 
 
 
 Joined: 17 Jun 2019
 Posts: 643
 Location: Des Moines, Iowa, USA
 
 
			      
 
 | 
			
				| Visual Studio Code and the CCS compiler |  
				|  Posted: Tue Apr 20, 2021 11:31 am |   |  
				| 
 |  
				| 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 ?
 
 Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
 |  |  
		|  |  
		| dluu13 
 
 
 Joined: 28 Sep 2018
 Posts: 395
 Location: Toronto, ON
 
 
			      
 
 | 
			
				|  |  
				|  Posted: Tue Apr 20, 2021 5:59 pm |   |  
				| 
 |  
				| 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
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri May 21, 2021 4:41 am |   |  
				| 
 |  
				| 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
   
 Anyone could help?
 |  |  
		|  |  
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 |  |  
		|  |  
		| jeremiah 
 
 
 Joined: 20 Jul 2010
 Posts: 1401
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Fri May 21, 2021 3:24 pm |   |  
				| 
 |  
				| 
 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: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Sat May 22, 2021 12:46 am |   |  
				| 
 |  
				| 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
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue May 25, 2021 7:14 am |   |  
				| 
 |  
				| jeremiah, Ttelmah, thanks! 
 Yes, about VS Code!
 |  |  
		|  |  
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Tue May 25, 2021 8:19 am |   |  
				| 
 |  
				| Phew!...  |  |  
		|  |  
		| pgvt 
 
 
 Joined: 17 Aug 2024
 Posts: 12
 
 
 
			    
 
 | 
			
				| Yes, it works very good w/ latest (Nov. 2024) vscode |  
				|  Posted: Mon Nov 11, 2024 8:06 am |   |  
				| 
 |  
				| 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: 643
 Location: Des Moines, Iowa, USA
 
 
			      
 
 | 
			
				| Re: Yes, it works very good w/ latest (Nov. 2024) vscode |  
				|  Posted: Mon Nov 11, 2024 8:23 am |   |  
				| 
 |  
				|  	  | 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 ?
 
 Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
 |  |  
		|  |  
		| pgvt 
 
 
 Joined: 17 Aug 2024
 Posts: 12
 
 
 
			    
 
 | 
			
				| Here you go: |  
				|  Posted: Mon Nov 11, 2024 8:45 am |   |  
				| 
 |  
				| 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: 12
 
 
 
			    
 
 | 
			
				| More |  
				|  Posted: Mon Nov 11, 2024 8:56 am |   |  
				| 
 |  
				| A quick (maybe old  ) 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: 12
 
 
 
			    
 
 | 
			
				| More |  
				|  Posted: Mon Nov 11, 2024 9:31 am |   |  
				| 
 |  
				| 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: 12
 
 
 
			    
 
 | 
			
				| Extension |  
				|  Posted: Mon Nov 11, 2024 10:11 pm |   |  
				| 
 |  
				| 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
 
 
			    
 
 | 
			
				| re>Extension: vscode-picc-ccs-support-0.0.1.vsix |  
				|  Posted: Tue Nov 12, 2024 1:18 am |   |  
				| 
 |  
				| Thank you pgvt |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |