What is the state of Microcontroller support in d?

Mike Franklin slavo5150 at yahoo.com
Thu Nov 29 11:00:45 UTC 2018


On Thursday, 29 November 2018 at 06:50:12 UTC, Russell Haley 
wrote:
> On Wednesday, 21 June 2017 at 00:50:35 UTC, Mike wrote:
>> On Tuesday, 20 June 2017 at 13:45:31 UTC, Mike wrote:
>>
>>> [...]
>>
>> The more I think about this, the more it seems like the best 
>> approach.  All this time I've been trying to find a way to 
>> build just enough runtime code to support the features I'm 
>> using, and I've only encountered frustration.  It's a shame 
>> that we have to build such a massive amount of infrastructure 
>> just to get a build, only to have the linker strip it all 
>> away, but apparently that's just the way things are.
>>
>> [...]
>
> Hi, I'm new to D. I'm looking at options on microcontrollers 
> and I wondered if anything ever came of this effort? I'm 
> currently using FreeRTOS on a TI CC3220 at work. I also have 
> access to an STM32 board and an NXP K220f (?).
>
> Thanks!

You can see the extent of my work at 
https://github.com/JinShil/stm32f42_discovery_demo  I'm afraid 
that proof of concept is all I've got; sorry.

You will likely also be interested in 
https://bitbucket.org/timosi/minlibd  I think it's a more 
complete port of the D runtime to the ARM Cortex-M platform, but 
the author of the project will have to give you the details.  I'm 
not sure if it is still being maintained.

There was a good push in the last year or so to decouple the 
runtime from the compiler so one can start bare-metal programming 
with a C-like subset of D features and incrementally implement 
features in the runtime.  See the changelog for 2.079 for a few 
details:  
https://dlang.org/changelog/2.079.0.html#minimal_runtime.

There was also work towards getting more features of D working in 
-betterC.  See https://dlang.org/spec/betterc.html

I've always hated -betterC though, and affectionately refer to it 
as -worseD.  IMO -betterC would not even be necessary if the 
compiler<->runtime interface would just get fixed.  The fix 
includes, but is not limited to, removing all of the dependencies 
on runtime type information (a.k.a. `TypeInfo`) for information 
the compiler already knows at compile-time.  This can be done by 
lowering expressions to templates instead of `extern "C"` runtime 
functions calls like these: https://wiki.dlang.org/Runtime_Hooks. 
  It's quite difficult and messy due to D's `@safe, @nogc, @throw` 
attribute hell (you'll understand as you get more familiar with 
D).  My last PR working towards that end can be found here:  
https://github.com/dlang/druntime/pull/2268

I'm no longer working with D, so I don't know if any of this has 
a future; sorry.

Mike


More information about the Digitalmars-d mailing list