ArduinoSTL and Valgrind / AddressSanitizer checks

submited by
Style Pass
2021-07-03 17:00:08

...make a Forth interpreter/compiler from scratch... ...then put it inside a 1.5$ Blue Pill microcontroller... ...then repeatedly squash it until it fits inside an Arduino UNO... ...i.e. inside 2K of RAM!

The rainy afternoon turned into a week-long hackfest (was looking forward every day to the post-work FORTH-tinkering in the afternoon...)

I meant it when I said "portable" - the source code compiles as-is for both native and Arduino builds. Part of why I did that, was to be able to use Valgrind and AddressSanitizer to detect any issues I have with my memory handling. Just as important, debugging with GDB in the native host is much easier/faster.

I first tried ArduinoSTL, but found that it was too wasteful memory-wise. It also made the build process significantly slower - from 2-second builds to something like 20-seconds' ones.

So I built my own memory pool, as well as list, tuple and string-like C++ templates. It was a nice challenge, re-inventing a tiny C++ STL...

Leave a Comment
Related Posts