Embedded Linux really needs Dlang for the IOT market

Joakim dlang at joakim.fea.st
Fri Mar 9 05:56:50 UTC 2018


On Friday, 9 March 2018 at 03:09:16 UTC, dangbinghoo wrote:
> hi all,
>
> I think the D community should make more effort to make Dlang 
> more easier to use on embedded Linux(mostly are arm and mips, 
> powerpc).
>
> currently, LDC seems to be more complete, but we can only see a 
> hundred words on the wiki about the cross-compiling for arm.

A wiki search shows me dozens of pages that mention ARM:

https://wiki.dlang.org/?search=arm

Maybe you're talking about the ARM section in the main LDC page, 
but that links to those other pages.

> I'm working in a company now for IOT market. We have a lot of 
> things like embedded linux systems: has a basic linux kernel, 
> uclibc/eglibc system, built using buildroot or yocto.
>
> for such a device, we need to write lost of code for dealing 
> networking, web interface, database storage and sometimes data 
> algorithm.
>
> And, For most of the devices on the market, like routers, 
> fiber-port routers, ethernet switches, and most of the 
> termination system made by Cisco, Broadcom, Huawei and others 
> running at least millions of lines of C code on the embedded 
> linux system.
>
> So, We have very big chance for spreading to these market. D is 
> really syntax-clean and provides more productive.

You will be interested in the uClibc port that's being finished 
up upstream and will likely be in the upconing ldc 1.9 then, 
along with the betterC version of D that is supported by ldc 
(assuming you can't use the D runtime and garbage-collector):

https://github.com/dlang/druntime/pull/2134
https://dlang.org/spec/betterc.html

> We need tutorial for cross-compiling a whole d project for the 
> ARM, MIPS linux systems, and we need the cross-compile 
> toolchain ready to download.
>
> so, any ideas?

You should talk to Mike and Radu, they have both expressed 
interest in this and are working towards taking D there:

https://github.com/jinshil
https://github.com/rracariu

As for the cross-compile toolchain, we can make ldc work for 
these platforms, but you will likely always need to download the 
existing C cross-compilation toolchain for these embedded 
platforms separately, as we rely on the existing linker for these 
platforms to link D executables.  Also, there are a few C and 
assembly source files in the D runtime that require a C 
cross-compiler to build, so we cannot just do everything in the D 
compiler.

See these wiki pages about the ldc-build-runtime tool that comes 
with ldc and Android cross-compilation, which uses the C 
cross-compiler and linker from the Android NDK, for examples of 
what I'm talking about:

https://wiki.dlang.org/Building_LDC_runtime_libraries
https://wiki.dlang.org/Build_D_for_Android

And given how many embedded toolchains are out there, I doubt we 
can ever cover many of them beforehand.  We could probably put 
out a tutorial for some popular toolchain, but first we need to 
get it completely working, which AFAIK is still being worked on.  
If you'd like to chip in with that, as Rikki says, please talk to 
the ldc devs or Mike and Radu.


More information about the Digitalmars-d mailing list