45

I use Visual Studio Code to develop for arduino which uses Arduino Studio installed files and needs the installation to work. This works very well.

Annoying is that when verifying a sketch it takes longer than in the Arduino IDE. I suspect the following warning to cause it:

[Warning] Output path is not specified. Unable to reuse previously compiled files. Verify could be slow. See README.

I would like to get rid of the warning and I searched through all README files in the arduino installation folder and I also searched google but haven't found out what its supposed to mean and how to fix it. No readme file mentions that or I overlooked it.

Is there a documentation on how to fix this anywhere?

3
  • Is there a README with whatever you installed into VS?
    – Majenko
    Commented Oct 6, 2017 at 12:02
  • @Majenko Thanks. After reading through 30-40 readme files in all sorts of folders and libraries I didn't think of that anymore :-).
    – Uwe Hafner
    Commented Oct 6, 2017 at 12:35
  • I installed Arduino from App Store, to fix the issue i uninstalled Arduino and reinstalled by downloading windows installer, after installation and basic configuration in VS Code, like path to Arduino exe error was gone and i was able to compile and Upload.
    – sairfan
    Commented Dec 8, 2020 at 2:24

2 Answers 2

48

Thanks to @Majenko I looked some place new:

documented in the arduino plugin of VS Code Arduino Extension there is an option to set an output directory.
Note though that according to this it should not be in the workspace or subfolders.

So in arduino.json settings file add:

"output": "../ArduinoOutput"
34

To clarify the answer, for those new in arduino world +StudioCode (source: https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino )

The following settings are as per sketch settings of the Arduino extension. You can find them in .vscode/arduino.json under the workspace.

{
    "sketch": "example.ino",
    "port": "COM5",
    "board": "adafruit:samd:adafruit_feather_m0",
    "output": "../build",
    "debugger": "jlink",
    "prebuild": "bash prebuild.sh"
}

sketch - The main sketch file name of Arduino.

port - Name of the serial port connected to the device. Can be set by the Arduino: Select Serial Port command.

board - Currently selected Arduino board alias. Can be set by the Arduino: Change Board Type command. Also, you can find the board list there.

output - Arduino build output path. If not set, Arduino will create a new temporary output folder each time, which means it cannot reuse the intermediate result of the previous build leading to long verify/upload time, so it is recommended to set the field. Arduino requires that the output path should not be the workspace itself or in a subfolder of the workspace, otherwise, it may not work correctly. By default, this option is not set.

debugger - The short name of the debugger that will be used when the board itself does not have a debugger and there is more than one debugger available. You can find the list of debuggers here. By default, this option is not set.

prebuild - External command before building the sketch file. You should only set one prebuild command. command1 && command2 does not work. If you need to run multiple commands before the build, then create a script.

When You add folder with sketch, you are creating "so called" project. VS code puts there some hidden folders with the project configuration files. To see them from windows file explorer you may enable show hidden files. than in your project folder You may find .vscode , and there is the arduino.json file.

More simple way is just click on the project navigation bar on the left, and open there the .vscode folder and using vscode as editor just add

"output": "../ArduinoOutput" or "output": "../build" or whatever you want to name that folder.

".." tells that it is one level above the "project folder" so it is "outside" as VScode wants.

And as far as i know this is not global setting, so You need to set it for every project if you want it.

Check the proper formatting in order to save file, use code hints to add options in file.

Hope that this is as clear as possible and help others to find that magic arduino.json file and understand where what and why.

Cheers. vscode arduino.json file location and editing

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.