Hacker News new | ask | show | jobs
by nobody3141 5345 days ago
To misquote Clinton - "It's the software stupid"

You can buy an MSP430 dev board form TI for $5 with more features but the thing about the Arduino is that somebody with NO knowledge of embedded programming can go from box to flashing LED in <5mins.

I have spent longer than that trying to work out which target configuration I have on some embedded systems (Yes Keil I'm talking about you!)

3 comments

Exactly.

It took me less time from opening the Arduino package to having the first blinky LED program running - than it took to even figure out which software I need to download for the MSP430, then actually download it, then install it, then rummage through all the useless options, etc. Ugh. :(

Now I'm programming naked AVRs, but there's no doubt - Arduino is still easier and more time-effective for most amateur projects. Maybe a naked-AVR board, 8 pin DIP, could beat it for extremely miniature applications. Otherwise, just use a Nano or Mini, and save your time for other things.

I wish I had an Arduino when I was a kid and was playing with Basic on a small computer - a programmable board like this would have opened the real world to the computer.

I don't know, but I'd love to hack on an Arduino in C. Or Python, if people want to be noob-friendly.
Arduino is C++. Plain and simple. Just like Processing is java.

the arduino GUI just adds some lines in front of your code, and passes it over to avr-g++ along with some flags.

It links the whole thing to what it calls "arduino cores" and of course the additional libraries. You can find all that stuff inside the Arduino folder (or on macosx inside the Arduino.app) in the Resources/Java/hardware/arduino/cores/arduino folder. After that, it just does:

int main(void) { init(); setup(); for (;;) loop(); return 0; }

The one thing that is slightly annoying with arduino is how terribly inefficient the libraries are. For example, digitalWrite is like half a gazillion cycles (I remember counting, it was well in the 3 digits), while it's one cycle if you use the normal approach (port |= _BV(bit)). Also, the initialization code snips one timer interrupt from you, which can be annoying as well. The way around that, because I actually like the fact that I can just reuse some library for whatever chip is around (something that is definitely not common in the embedded world) is to just remove the call to init() in the main.cpp file.

The rest is really just C++, with all the avr includes and co available. You also just need to dump whatever source you have available into your library folder as well.

A good guide for BSD users is here:

http://arduino.cc/playground/OpenBSD/CLI

Most of the non-IDE toolchains I've encountered were horrific monsters, including several TextMate bundles. I wonder how worthwhile it would be to create a simple wrapper a la dotcloud's deploy utility, or Rails' initial project build.

It's a well-obscured secret, but if you write C and feed it to Arduino, it will compile and run just fine. The Arduino language is just a nice C api and the IDE just calls avr-gcc in the background.
Well, there's nothing stopping you from using GCC to target the AVR chip directly. As for Python, what about this project: http://code.google.com/p/python-on-a-chip/
Though C++ is the "normal" language, typically you only use a C like subset. 1kB of RAM doesn't go too far in STL.

Likewise, Python isn't going to go far in 1kB of RAM.

But there is hope! The newer Arduinos have 2kB of RAM!

actually the STL can be quite useful sometimes, it definitely allows you tight control over the memory layout. I don't want to go too far into something I don't know that much about (the STL, which I actually avoid due to more mundane issues of often not being able to compile libstdc++ for my embedded targets :), but I found templating extremely useful when tackling embedded programming.
If you'd like something with more of an Electrical Engineering bent, nerdkits are pretty good, and they use the same chips. They still have a bootloader, but other than that it seems to be raw C, bitbanging, interrupts, all that sort of thing :)
gcc is used to program naked AVR chips directly. See avrdude.

But really, whatever language mutant they use for Arduino, it's very noob-friendly.

In Keil's defense, it's not targeted at confused new users, and once you are set up and moving it is a beautiful tool. Perhaps the best embedded IDE I've ever used.
Maybe, but why do they feel the need to reinvent the wheel. I have been using their IDE for a long time now and while it's a big improvement from other embedded tools, it's still a far cry from modern IDEs like Visual Studio, etc.
The last time I used a Keil IDE and compiler (~2007), their linker died if a filename had spaces in it, among many other issues. I was vastly more productive munging the Keil headers with a Perl script to work with SDCC than using the Keil suite designed for the SiLabs 8051.
I guess I can't comment on your experience; I was using their ARM toolchain in 2010.