VSCode in linux - Arduino extension

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

VSCode in linux - Arduino extension

Post by ag123 »

i tried VSCode with Arduino extension in Linux
vscode
vscode
vscode.jpg (75.95 KiB) Viewed 6202 times
the guide from fpiSTM is here
https://github.com/stm32duino/wiki/wiki ... -extension
https://code.visualstudio.com/
https://github.com/microsoft/vscode-arduino

interestingly the 'engine' of the vscode extension is a javascript dialect - typescript

the example script i ran on F401 black pill is here
viewtopic.php?f=14&t=9&p=350#p350

the value add in VScode as like Eclipse, is that symbol reference and jumps is easy, so drill down / reference jump into function codes or struct definitions is much easier with the IDE. i think it is possible to debug, but i've not explored that
Last edited by ag123 on Thu Jan 02, 2020 6:34 pm, edited 2 times in total.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: VSCode in linux - Arduino extension

Post by ag123 »

fpiSTM did a good job with it. though i hit some java issues and i actually installed the stm32duino official core
using the Arduino IDE
https://github.com/stm32duino/wiki/wiki/Getting-Started
did some tests, and then try to do get the blinky with whetstone benchmark to build and run in VSCode
the usage is less than straightforward in linux
one of those things is that unlike the arduino IDE, it deletes the temporary build folder so the built binary is inaccessible using 'verify'

it turns out there is an 'undocumented' work around
https://github.com/microsoft/vscode-arduino/issues/477
it turns out add the 'output' attribute in the hidden file
.vscode/.vscode/arduino.json

Code: Select all

{
    "port": "/dev/ttyACM0",
    "board": "STM32:stm32:GenF4",
    "configuration": "pnum=BLACKPILL_F401CC,upload_method=dfuMethod,xserial=none,usb=CDCgen,xusb=FS,opt=o3std,rtlib=nano",
    "sketch": "../Arduino/sketch_jun19a/sketch_jun19a.ino",
    "output": "/home/user/Arduino/build"
}
makes it output in the build directory i wanted and leaves the binary there

initially i hit another issue that it keep running the samples. it turns out i need to 'add folder into workspace' for the sketch folder in VSCode.
then it seem i'd be able to select the appropriate sketch to build
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: VSCode in linux - Arduino extension

Post by fpiSTM »

That's sound strange that you need to define the output, maybe related how you create your example.
If you used the Arduino example menu then it create properly the workspace and you don't need to specify output.
I specify the output when I use the Cortex Debug extension to get access to cortex and peripherals registers.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: VSCode in linux - Arduino extension

Post by ag123 »

defining the output is not really needed, in the default configuration, it writes to a temporary folder
but the temporary folder is deleted once verify is done, so i'm unable to access the binary that is built

setting the output here is so that the compiled objects and binaries are saved in my selected output folder
and i tend to install the binary separately myself
i keep binaries for the reason that i reuse my boards, it is a hassle to have to rebuild when i need the binary
luca_stm32
Posts: 19
Joined: Tue Feb 18, 2020 3:37 pm

Re: VSCode in linux - Arduino extension

Post by luca_stm32 »

Hi age123,
Have you tried to "install" Roger core under Vscode +Arduino plugin? Is there a guide how can I install It?

Thanks
Regards
Luca
Post Reply

Return to “IDE's”