Freeware - Yes. Open source, a variant of MIT licence. Distributed compiled version as freeware.
Windows 10 - Yes, that’s how I run it.
Easy setup - Yes to get started. Enabling debugging on the STM32L0 core was a little bit quirky for me.
To get started, just download and install VS Code. Install the Arduino extension from the Extensions tab. Requires Arduino to be already installed. You will need to run an initialization for arduino projects that creates a settings-json for each project/directory. That far it has been smooth sailing for me.
For debugging, hit ctrl+shift+d → create a launch.json file → C++ (GDB) → Add configuration (bottom right) → Arduino.
This creates a boilerplate debugging setup. I needed to set the path to openOCD and set config arguments, I’m sure there are more elegant ways to configure this:
“debugServerPath”: “C:/Program Files (x86)/openocd/bin-x64/openocd.exe”,
“debugServerArgs”: " -f interface/stlink-v2.cfg -f target/stm32l0.cfg",
The stlink-v2.cfg sets the debugging link, stm32l0.cfg sets the mcu type. Adjust as needed.
I needed to change the “sketch” name in the arduino.json file to BMA400.cpp, as the compiler picks the first cpp/ino file in the folder as the compiled .elf name. As far as I have seen, that does not affect anything else. Again, it is possible there are more elegant solutions.
That should be enough to start debugging. You can compile and upload from the interface via usb (to also power the board) while connected with the st-link and then hit F5 to start debugging and set/change breakpoints while the code is running.
There is some more info at the extension webpage:
Some variables are optimized out, and the optimizer also causes some unintuitive jumps while stepping. I have experimented with creating an -o0 option in the boards.txt file for the Arduino core. I needed to also add the flag -fomit-frame-pointer to make that compile, as well as changing the following lines in (…)\Arduino\hardware\TleraCorp\stm32l0\cores\arduino\HardwareSerial.h :
virtual void begin(unsigned long) = 0;
virtual void begin(unsigned long baudrate, uint32_t config) = 0;
virtual void end() = 0;
where I added the “= 0” at the end.
That seems to be working pretty well so far. Some libraries are distributed already compiled from source that is located in folders that don’t exist on my machine. I’m sure you could recompile them to sort that out, but I have just avoided following the code into these parts of the core so far.
I hope this write up saves someone a little bit of work setting it up.
For other platforms (AVR, ESP) I use the PlatformIO plugin in VS Code. Their library management setup is excellent, keeping a separate set of libraries for each project. I have not seen anyone using it for the STM32L0 core yet though, I think that requires a bit more setup.