Menu

Frustrations. Or: why the Arduino IDE is a mess

It's official, I hate the Arduino IDE. There's just so much wrong with it that I hardly know where to begin...

First and foremost: the build pipeline. Who came up with this anyway? I know Arduino is aimed at beginners, but that's no excuse to make a mess of things. What happens when you hit the 'Verify' button (compile) is the following:

  1. Create a temporary folder somewhere in your user directory, in my case (WinXP) Documents And Settings\User\Local Settings\Temp\build-somerandomnumber. All compiled files end up here, I guess that reduces clutter in your project folder, but what's the problem in having an obj, lib or bin folder in there anyway?
  2. Do some pre-processing on the PDE file, i.e.: add an include for the Arduino header, and create forward declarations for each function in the file. Now I understand why they do this: to keep things simple for beginning programmers; no need to include a platform header and no need to have functions declared before calling them. But in my opinion educating new programmers is a much better idea, and will make life a lot easier for those of us who already know what we're doing.
    • Oh yeah, one tiny little detail: generated function declarations are placed above typedefs. So typedef struct { blah } Sometype; and then using Sometype* as a parameter in a function signature will give you some nice unexplainable compiler errors, since the function declaration will be placed above the typedef. But of course, none of this process is shown to you, you just end up with the errors.
  3. Compile the pre-processed file. There's some magic involved here as well. The pre-processor also scans for includes and tries to figure out which libraries are used. It will add all the necessary include paths to the compiler arguments. I'll explain why this is a problem later on. In Arduino 0.22, compiler warnings are turned off, that's right, no warnings. Seriously? Turns out I was missing a return in one of my functions, great..
  4. Compile all library files that are used.
  5. Link
  6. Upload

If you're like me and like to have your source tree reflect the namespaces you use then you're out of luck. I for one like to have to use #include <rc PPMOut.h=""> for my rc::PPMOut class, but that's not going to work for multiple reasons.
First of all, using that include won't tell the pipeline you're using the rc library, it doesn't look beyond the library's root folder for files, so the library won't be added to the include path and you'll be presented with a nice compiler error. This can be fixed by including a file that is placed in the root of the library folder, like rc.h. So you'll have to add another (useless) include to your source, yuck.
Now you've solved the include problem and fixed the compiler error, but get linker errors for unresolved references! Great, the pipeline doesn't see the CPP file unless it's in the root of the library, so it doesn't compile it.

And finally, none of this is configurable in any way through the IDE, can't set compiler flags, change warning levels, optimization levels or anything. A lot of these frustrations wouldn't exist if there was some form of project file with compiler settings, include paths, etc. None of it would have to be very complicated.

And don't get me started on the actual editing of code using the Arduino IDE, I've selected the "use external editor" option a long time ago; a few minutes after installing the IDE to be precise.

So, next challenge: rigging up a build pipeline in visual studio...

Posted by dvdouden 2012-02-21
  • Jelle Tigchelaar

    Daniel,

    you do know about Visual Micro yet don't you?
    I've been using it for a couple of weeks now, and i have to say it's doing what it should.
    It's nice te be working in VS instead of the Arduino IDE.

    http://www.visualmicro.com/

     
    • dvdouden

      dvdouden - 2012-12-06

      Thanks for the link, that's cool! I'm currently using Notepad++ as an editor and the Arduino IDE for building, my poor 10 year old laptop is too slow to run any real IDE. Also, I'd like to keep ArduinoRCLib fully compatible with the Arduino IDE and build system. Even though it's starting to become a royal pain.

      Something to add to my original rant: I noticed that Arduino libraries cannot depend on other libraries. The build system does not detect these dependencies and will not add the dependencies to the include path unless the sketch itself uses all the needed libs. In other words, if I want to use the SPI library or Wire library in ArduinoRCLib, any sketch using ArduinoRCLib will have to include SPI.h or Wire.h, otherwise ArduinoRCLib will not compile...

       
  • Jelle Tigchelaar

    The same is still true when using Visual Micro...
    It adds the files you create (.h) automatically to the pde/ino.
    That's why i didn't notice it at first.
    Still it's not a real problem for me, i'm trying to steer away from using any advanced libs, the first menu attempt used vectors (which required the standardcplusplus lib) but i've done away with that and i'm now using simple arrays which uses a LOT less memory.

    Microprocessor coding is new to me :)

     
    • dvdouden

      dvdouden - 2012-12-07

      Hehe, just stay away from anything that uses dynamic memory allocation or you'll run out of the 2KB RAM before you know it. I've recently started using stdio functions (printf, puts) on the Arduino, but you'll want to put as much static data in PROGMEM as you can. By default, all variables (even static const and string literals) are placed in RAM, which sucks when you're using FILE macros for debugging messages...

      I'm used to these devices, I learned programming on a 4MHz Z80 in assembler and programmed Nintendo GBA and DS for a few years professionally :)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.