Building LDC runtime for a microcontroller

Dylan Graham dylan.graham2000 at gmail.com
Wed Sep 23 13:56:07 UTC 2020


On Wednesday, 23 September 2020 at 10:02:58 UTC, Dylan Graham 
wrote:
> On Friday, 18 September 2020 at 07:44:50 UTC, Dylan Graham 
> wrote:
>> On Monday, 7 September 2020 at 19:12:59 UTC, aberba wrote:
>>> On Monday, 7 September 2020 at 16:18:00 UTC, IGotD- wrote:
>>>> On Monday, 7 September 2020 at 15:23:28 UTC, Severin Teona 
>>>> wrote:
>>>>> [...]
>>>>
>>>> Use betterC, which is much better suited for 
>>>> microcontrollers than the full D. The disadvantage is that 
>>>> many great features are disabled in betterC.
>>>>
>>>> [...]
>>>
>>> How about an alternative runtime + standard library for 
>>> embedded systems...with a least bare minimum. I've seen a 
>>> number of efforts to get D to run in those environments but 
>>> almost none of them is packaged for others to consume.
>>
>> [...]
>>
>> A lot of embedded stuff is done with RTOSs now that provide 
>> memory management and threading support, so having a flexible 
>> lightweight runtime with a generic backend (mem allocation, 
>> threads) that I can hook to the RTOS' libraries would be great.
>
> I'm starting work on a small runtime according to this 
> specification. I can't promise a whole lot; it will be 
> barebones. I'm targeting the STM32 series (ARM Cortex M0-4).

So far I have been able to get a class and heap allocated struct 
to allocate and deallocate manually on an STM32F407 MCU. Array 
bounds checking works but so far just logs the error in my IDE 
and hangs. Abstract classes work too. Interfaces are giving me 
trouble for some reason - they crash LDC2 1.23.0.

Going to add some proper support for D's assert(...) and array 
bounds checking to make things a little easier.


More information about the Digitalmars-d-learn mailing list