Is modern D ready for "embedded first" paradigm?

Dukc ajieskola at gmail.com
Mon Dec 11 07:59:43 UTC 2023


On Friday, 8 December 2023 at 19:01:16 UTC, Denis Feklushkin 
wrote:
> On Thursday, 12 October 2023 at 07:06:15 UTC, Dukc wrote:
>
>> If we're talking about a a bare-metal real-time application in 
>> a microcontroller, honestly no. D can do this sort of thing 
>> but it's not currently it's strong area. You're almost without 
>> library support in those platforms. Phobos does work with 
>> `-betterC` (or generally without a full-featured DRuntime) but 
>> it means continuously dealing with all sorts of 
>> incompatibilities and corner cases.
>
> First (and most importand) step to achieve support of 
> bare-metal platforms is druntime implementation.

It doesn't necessarily need to be full support and probably won't 
be for a simple and small microchip project.

>
> Before, I successfully implemented druntime hacks for checking 
> possibility of work D (not betterC!) on STM32 platform ("Hello, 
> world!" and druntime unittests are passed): 
> https://github.com/denizzzka/d_c_arm_test
>
> Unfortunately, without changes to the existing druntime code 
> organization it seems to impossible to support different 
> non-mainstream architectures. And, at first, this applies to 
> embedded ones.

Reorganisation of the sort you and Iain are pushing for certainly 
could help. However I think even more important is support for 
only a partially implemented DRuntime - if you don't use a 
runtime feature, D shouldn't require it being implemented. With 
the mainstream DRuntime this currently work badly because of the 
`version (...) else static assert(0, "unsupported platform")` 
paradigm, meaning one has to manually stub all of those. There 
should be a way to do this without manual work.

Dylan Grahams Lightweight DRuntime seems perfect for these use 
cases for me but haven't tried so far.

>
> Therefore, please support (or give constructive criticism 
> feedback) this initiative:
> https://forum.dlang.org/post/jdfwovvqdcusjphehwzx@forum.dlang.org - this link explains everything in more detail
> https://github.com/dlang/dmd/pull/15822 - here is PR with 
> additional info

Not promising but I'll try to remember next time I'm hacking my 
own projects.



More information about the Digitalmars-d mailing list