Hacker News new | ask | show | jobs
by adiabatichottub 211 days ago
> From an embedded developer's perspective, Arduino is awful.

Specific AVR Arduino annoyances I remember:

* Strings loaded to RAM instead of program memory, so you use up all your RAM if you have a lot of text. Easily fixed with a macro

* serial.println blocks, so your whole program has to stop and wait for the string to be transmitted. Easily fixed with a buffer and ISR

* Floating-point used everywhere, because fuck you

* No printf(). It's in avr-libc, and it's easy plumbed in, but the first C/C++ function that everybody ever learned to use was somehow too complicated or something.

* A hacked-together preprocessor that concatenated everything, which meant you could only have your includes in one place, thus breaking perfectly good, portable code.

I think they ultimately did a disservice to novice programmers by giving them something that was almost a standard C++ environment, but just not quite.

2 comments

> Strings loaded to RAM

Modern AVRs have program memory mapped into the RAM address space. The GCC linker scripts for the parts that support this put strings into .rodata within that memory region, obviating the need for special macros to retrieve them. However, you won't find this on most of the usual suspects in the Arduino AVR ecosystem.

> A hacked-together preprocessor that concatenated everything, which meant you could only have your includes in one place, thus breaking perfectly good, portable code.

While it does concatenate, does it break something regarding the include mechanism, assuming said files use include guards? You can include stuff wherever anyway (though doing it within a scope needs special considerations).