What is the state of Microcontroller support in d?

Mike via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 20 17:08:24 PDT 2017


On Tuesday, 20 June 2017 at 22:31:15 UTC, Dan Walmsley wrote:

> Mike, I was thinking if you had used memory mapped structs 
> instead of classes you probably wouldn't have come up across 
> the rtti bloat so hard and it although be annoying wouldn't 
> have been a show stopper, was there a particular reason to use 
> classes to represent the registers?

I was able to work around the problem without having to 
compromise on my programming by compiling to assembly, modifying 
the assembly with this sed hack [1], and compiling the assembly 
to object code.  This masked the problem from me and my users, 
and I didn't have to change any of  my code.

It's always possible to find something that will work, especially 
in a comprehensive language like D and a rich tools like ld, 
binutils, and Linux-in-general.  But I can't go to my employer, 
colleagues, and customers with an object-oriented language, 
telling them they should avoid using classes or implement sed 
hacks in their build script, and expect to be taken seriously.  
It's fine to do such things for oneself, but my goal was to build 
a product line like Arduino around D, and I can't expect that to 
succeed with such blatant flaws in the language implementation.  
The problem should be fixed.

GDC may have fixed the problem recently with [2], but I haven't 
tested it.  Lucia Cojocaru is (was?) also working on addressing 
the problem by lowering TypeInfo calls in the compiler to 
templates [3].

I've been meaning to test the GDC changes, but I still have a bad 
taste in my mouth from my last experience with D, and have 
trouble getting excited about it like I once was.

You seem quite determined to get this to work.  With such 
determination I'm sure you'll find a way.  I hope you succeed and 
find the support you need.  Who knows?  I may have a change of 
heart later and join you.

Mike

[1] - 
https://github.com/JinShil/stm32f42_discovery_demo/blob/master/build.d#L69
[2] - https://github.com/D-Programming-GDC/GDC/pull/456
[3] - http://dconf.org/2017/talks/cojocaru.html


More information about the Digitalmars-d mailing list