On Friday, 9 July 2021 at 14:30:07 UTC, lili wrote:
Great Work!

Thanks!

Why standard D Runtime can not run on MCU?

The standard D Runtime is reliant on a fully-fledged OS, which don't fit onto small embedded devices and [they're incompatible with them](https://electronics.stackexchange.com/a/19243) For example, Linux requires a memory management unit (MMU), yet the Cortex-M series lack that feature.

The runtime itself is quite heavy due to the enormity of the features it supports. For example, the functions in DRuntime's [`lifetime.d`](https://github.com/dlang/druntime/blob/15b49cc725df280a72508f729ec4495ffbac66c3/src/rt/lifetime.d#L86) are dependent on GC code, which adds memory overhead to store those instructions and stack space. In LWDR, [`lifetime`](https://github.com/hmmdyl/LWDR/tree/master/source/lifetime) functions just point to your own implementation, yielding a leaner memory footprint. It's a very pedantic example, but it adds up after a while on a resource-constrained platform.

Will you plan that LWDR support other arch like RISC-v ?

Yes :)

Asides from some ARM EABI specific stuff in [`rt/sections.d`](https://github.com/hmmdyl/LWDR/blob/d55a39d028942f0eb1582d473317f89030995703/source/rt/sections.d#L38), I don't think it'd difficult getting LWDR running on another MCU platform (as of v0.3.0).

Reply via email to