On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:
Dylan Graham writes about his experience using D in a
microcontroller project and why he chose it. Does anyone know
of any similar projects using D? I don't. This may well be the
first time it's been employed in this specific manner.
The blog:
https://dlang.org/blog/2021/06/01/driving-with-d/
Reddit:
https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/
FWIW, I tried D in a simple project using an atmega32a. It almost
worked (thanks to Webfreak and LDC people), but there were a
couple of issues:
1. No support for ISRs. I had to implement thunks in C calling D.
2. No slices, because 'length' is typed as 32-bit. Worked around
by accessing the array's elements via .ptr.
3. No foreach (as a consequence of 2, I guess)
4. Integer promotion errors/warnings are very annoying when the
primary integer type is byte.
5. A memory corruption bug (probably due to clobbered
registers/corrupted stack/a stupid mistake of mine), which made
me switch back to C++ for now.