logoalt Hacker News

finaardyesterday at 7:50 AM2 repliesview on HN

> People also do not like the arduino ide because the days of easy setup and run are gone and a real way of debug is needed in most projects.

A surprising amount of embedded SoCs target the Arduino IDE either as the main IDE, or one of the main ones. And for those the setup is still pretty easy for non technical users - "Download IDE, paste this into the boardmanager, compile the sketch, upload". That's the main reason I'm still using the Arduino IDE for stuff I publish and expect less technical people to use.

The problem with the IDE is that it doesn't offer a gradual path to more advanced usage. You're pretty much stuck with a single file main project. You can split off functionality into libraries, but the way library resolving works is way worse compared to "proper" build systems. There are projects to provide makefiles for Arduino projects, but it's a bit of a pain to set up - I use that for CI on some of my stuff, but it clearly is on the other end of difficulty scale.

And of course the editor is horrible - but thanks to file watching and automatic reloads that isn't much of an issue nowadasy.


Replies

1718627440yesterday at 9:40 AM

But targeting the Arduino IDE only means to have a GCC version to compile and some upload program and then set a bunch of variables in platform.txt . It doesn't actually make it any harder to not use the Arduino IDE.

> The problem with the IDE is that it doesn't offer a gradual path to more advanced usage. You're pretty much stuck with a single file main project. You can split off functionality into libraries, but the way library resolving works is way worse compared to "proper" build systems. There are projects to provide makefiles for Arduino projects, but it's a bit of a pain to set up - I use that for CI on some of my stuff, but it clearly is on the other end of difficulty scale.

It actually isn't all that hard. I recently did exactly that and it took like a week, most of which was spent on understanding what the Arduino IDE does with strace. Initially I assumed the Arduino IDE does way more stuff then it actually does. The makefile projects are too complicated, because they try to abstract over the installation and project. Instead I used Autotools which is way easier and simpler. It also breaks less, because these makefile projects tend to hardcode paths.

To save others the work: All you need to do is populate CPPFLAGS, CFLAGS, LDFLAGS, ... with the information from platform.txt and boards.txt . Then tell your build system to use the cross-compiler toolchain from your OS. Take care to only use the exact uploader program version that the Arduino IDE also uses, I have been burned by using the latest version, which bricked my board (i.e. you can't upload anything to fix it and need to use a second board to reflash the bootloader). This information is in the package_index.json file. Granted this is annoying to work with using fulltext search, you would have a much saner experience actually using the JSON format, but it still works and I am lazy.

> You're pretty much stuck with a single file main project.

You can have multiple files just fine, this is actually the reason why the Arduino IDE defaults to having this project directory. The Arduino IDE just assumes all files below that are things to compile. You need to remember to not name the other files with *.ino, but *.cpp, *.c and *.h, otherwise you end up with multiple main functions. An *.ino file is just a *.cpp file that gets preprocessed with a main function template.

> And of course the editor is horrible

You can tell the Arduino IDE to use another editor, which is what I did when I used it.

seg_lolyesterday at 9:22 AM

So basically, Arduino IDE acts as the client side of the tether to compile and flash firmware to the target device.

This seems like an ideal component for the OSS community to handle and rally around. Then anyone can use the IDE of their choice, the compile-flash manager handles the rest.