Using VSCode for Arduboy - Tips & Tricks

Like Filmote, I just use the Arduino plugin (though I actually use VSCodium rather than VSCode - same thing but with the MS telemetry removed).

I used to have PlatformIO installed for dealing with Pokitto and it was mostly alright, but I eventually uninstalled it.

Build speed doesn’t bother me (it’s a good time to pause for a drink), but being able to disable the -fpermissive flag is tempting.

As tempting as being able to get rid of .ino files is, ideally games should still be compilable via the Arduino IDE to make it easier for other people to compile them.

I changed my keybind to F8 (and F7 to upload) because I use it so often.

I believe there’s a way to make it so that keybinds change depending on the environment, meaning it should be possible to make F6 act as the ‘build’ button (and F5 for ‘build and run’) for all environments, but the VSCode documentation is difficult to comb through so I have no idea how.

I also used vscode with arduino plugin and having arduino ide installed. But i actually almost never uploaded my project to the arduboy, i added a launch action to launch the emulator with my build hex file. Basically you just press the verify button on the ino file so it builds your hex file and then the play button in vscode to launch the emulator. Only if i needed to test specific things (like sound / music) or needed a test on real device i uploaded to arduboy.

Here is an example entry i used for launch.json to launch the emulator, it’s just as simple as launching projectabe with the hex file as commandline parameter

"configurations": [
            "name": "Arduboy emulator",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "C:/projectABE/ProjectABE.exe",
            "args": ["${workspaceFolder}/build/waternet.ino.hex"],
            "stopAtEntry": false,
            "cwd": "C:/projectABE/",
            "environment": [],
1 Like

Thanks for sharing … that is really neat. I have been launching the emulator manually but those days are history now!

Edit: is there any way to pick up the waternet.ino.hex portion from the config somehow? Likewise the build directory? The build directory is in the Arduino.json file as the ‘output’ attribute.


Personally I always upload to the device and don’t have the emulator installed, but it’s interesting to see what a working action actually looks like. I knew there was likely to be a way to do it, but could never find the relevant part of the documentation that would explain how.

The best I’ve managed to work out so far (from here) is that ${fileBasename} will give you file.ext for the currently open file, so if you had waternet.ino open and ran the command then "${workspaceFolder}/build/${fileBasename}.hex" would theoretically work. (You still need to add "output": "build" to your arduino.json though.)

While looking that up, I found out (from here) that it’s possible to add flags by adding a buildPreferences entry to arduino.json:

    "buildPreferences": [
        ["build.extra_flags", "-DMY_DEFINE=666 -DANOTHER_DEFINE=3.14 -Wall"],
        ["compiler.cpp.extra_flags", "-DYET_ANOTER=\"hello\""]

I have no clue if it’s possible to use that to remove a flag though. (I’d love to disable -fpermissive if there’s a way.)

From what i saw with gamebuino where i needed to change -Os to -O2 i think you need to change platform.txt of the board / platform and change the Compiler / linker flags there, vscode arduino ide plugin upon “verifying” step (which it always does before a build) always seem to rewrite c_cpp_properties.json based on that file so more specifically removing -fpermissive from compilerArgs in that file will get reverted just before a build but i think if you change it in platform.txt of that board you can go around that issue be aware though it will do it for all projects then not just the project you are working on as you change the compile flags globally for that specific board

you might also have to change it on more lines that what i showed in my screenshot and the path might differ with you

Also what does -Fpermissive do ? also i read somewhere that starting from GCC 4.8 -FPermissive can no longer be turned off 81787 – [5/6/7/8 Regression] `#pragma GCC diagnostic warning "-fpermissive"` no longer works since gcc 4.8 but not sure if it it applies to the command line parameter or that pragma quirck they used there

1 Like

I’ve forked the conversation to a new thread since we started talking about VSCode more than PlatformIO.

Horrible, horrible things.

-fpermissive downgrades certain errors to warnings, thus alllowing certain non-standard code to compile by relaxing various rules.

Oddly enough, downgrading errors to mere warnings to allow normally error-producing code to compile is a terrible idea…

  • int is allowed to implicitly cast to a pointer type, thus making void func(type *); func(42); valid
  • const char * is allowed to implicitly cast to a char, thus making const char tst = "Testing all"; valid
  • Pointers to functions can be implicitly cast to int, thus making int time = millis; // Note: no () valid

(These are all real examples taken from this GitHub issue.)

I would be very happy to disable it on every Arduino build. It’s a menace.

(I’d also probably change my -std from gnu++11 to c++11 because I care a lot about producing standard code, but I doubt many other people would do that.)

Oddly, my c_cpp_properties.json never contains compilerArgs. Some of the other parts seem misconfigured too (I don’t appear to have an “Arduino” configuration), but everything still builds properly. I have no idea why.

-fpermissive downgrades certain errors to warnings.
The #pragma is for disabling the downgraded warnings (i.e. to ignore them completely).

I think it’s a good thing that they don’t let people ignore those warnings. Those warnings are almost certainly bugs that should be fixed.

I can’t remember exactly how i setted up things myself but i installed arduino vs code plugin. Then selected my board port etc from within that plugin (that normally sets up arduino.json) then i pressed verify button to let it generate c_cpp_properties.json while having the ino file open (only then the 2 extra buttons for verify and upload appear in my vs code related to arduino vs code plugin) I think thats all i did.

In case of my waternet game it contains this:

if you can’t find the command / option to select your board etc you can configure it also by clicking these on the bottom when an ino file is open (make sure your arduboy is connected to your pc when trying to select the com port, it will only show available ports so only when arduboy is connected)

Be aware though when setting up the board / platform in arduino vs code plugin, somehow you can select the board in a neat seperate window that pops up but the port you need to select from the “edit/combobox” at the top in the middle.

I don’t think i did anything else (except having had arduino ide installed first and the board presetup)

Forgot to mention i also only used the 2 buttons added by arduino vs code plugin when an ino file is selected / open to build my hex file (using verify button) and to upload to my arduboy (it does verify before upload)

That’s the same as everything I do, and have been doing for a few years.
(Except that I usually use a keyboard shortcut instead of the buttons. It does the same thing though.)

Perhaps I’m just on an older version of the Arduino environment or something. Or perhaps it’s a Windows 10/Windows 8.1 difference.

I simply don’t have an “Arduino” configuration, only a “Win32” configuration, and the tool doesn’t automatically generate one for me. I tried making an “Arduino” configuration based on your settings, but even then the plugin doesn’t modify it at all.

It’s a mystery, but I’m not bothered too much by it.

On the bright side, I have proof that removing -fpermissive worked.
(Changing -std=gnu++11 to -std=c++11 on the other hand doesn’t seem to work quite right.)

Thats very weird, i can even erase my cpp properties file and as soon as i press verify it gets regenerated based on that platform.txt i talked about earlier.

the only thing i can think of is we are using a different version of the plugin or a different plugin all together … i use this plugin:

ah that’s good, but maybe using -std=c++11 does not work because gcc / g++ is actually used or shouldn’t that matter ?

I can do that, but what it generates is:

    "configurations": [
            "name": "Win32",
            "includePath": [
            "forcedInclude": [],
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
    "version": 4

Which is obviously wildly different to what it’s generating for you.

If I build as Leonardo instead of Arduboy I get:

    "configurations": [
            "name": "Win32",
            "includePath": [
            "forcedInclude": [
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
    "version": 4

Ah, this is probably the answer.

I did check this, but my editor thinks version 0.3.2 is up to date for some reason. If I look at it through the extension browser, even the changelog doesn’t list versions higher than 0.3.2.

Maybe later versions require a more recent version of the Arduino IDE than I have installed or something.

Either way I’m not particularly concerned. It’s not really going to affect much.

That shouldn’t matter. GCC’s C++ compiler handles both.
It’s more likely that something’s overriding it somewhere.

yes i think so also, this is what i found in the change log (for some previous versions) and is probably the change your missing

I wasn’t intending to, but I have actually figured out the root issue.

I use VSCodium rather than VSCode because I like to avoid telemetry whenever possible, and apparently it doesn’t retrieve its plugins/updates from the VSCode Marketplace because the authors aren’t sure if it’s legal. (VSCodium uses open-vsx instead.)

There is however a way to force it to use the marketplace.

ah yeah that explains it, but it does mean the plugin never got updated any more on open-vsx ? while it did on the VSCode markertplace ? i did notice microsoft is also listed as created of that plugin, maybe that explains why it never got updated anymore on open-vsx or so ?

I don’t think it was ever on open-vsx. Or if it was, it was removed.
I did have VSCode installed before I found out about VSCodium,
so it would have been installed back when I was using VSCode.