Page 1 of 1

VSCode in linux - Arduino extension

Posted: Thu Jan 02, 2020 6:05 pm
by ag123
i tried VSCode with Arduino extension in Linux
vscode
vscode
vscode.jpg (75.95 KiB) Viewed 6278 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

Re: VSCode in linux - Arduino extension

Posted: Thu Jan 02, 2020 6:24 pm
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

Re: VSCode in linux - Arduino extension

Posted: Mon Jan 06, 2020 7:56 am
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.

Re: VSCode in linux - Arduino extension

Posted: Mon Jan 06, 2020 8:16 am
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

Re: VSCode in linux - Arduino extension

Posted: Wed Feb 19, 2020 4:45 am
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