D for embedded system

Jacob Carlborg doob at me.com
Sat Oct 20 05:31:21 PDT 2012


On 2012-10-19 20:08, Johannes Pfau wrote:

> Druntime might not need file access/etc as long as version(Posix) isn't
> defined for your target.
>
> Nobody has used GDC/D/druntime on a system without OS afaik. So you
> have to pioneer ;-) I see two solutions:

There are developers who have used D1 to create an operating system, or 
kernel.

http://wiki.xomb.org/index.php?title=Main_Page

https://github.com/xomboverlord/xomb

Last update, 4 months ago, I thought it was completely dead.

> * Create your own, simple runtime library. There's no real
>    documentation on the minimum interface a runtime must implement (the
>    compiler calls back into the runtime), so this would be a little
>    tricky.
>
> * Adjust druntime. You can probably throw out 90% of the druntime code
>    (core.sys.*). Make sure the basic code work with ansi C. Forget
>    about things like threading (core.thread, core.sync), those require
>    system specific code and can be implemented later on. Your biggest
>    problem is probably the GC and TLS. If your target libc supports
>    TLS, things should work just fine. If not, there's some additional
>    work waiting. You need to reimplement some functions for the GC (get
>    stack top/bottom...) which shouldn't be too difficult, but getting
>    the TLS range might be tricky, depending on your system.
>    You could also try to remove the GC completely, but the language
>    currently assumes that a GC is available (things like dynamic array
>    appending, ...). A proper -nogc switch which disables GC features
>    like array appending would be a solution, but nothing like this is
>    implemented yet, IIRC. (But I think there was some kind of --betterc
>    switch which could be a start?)
>

There are a lot of other features in D that depend on the runtime, which 
one needs to be aware of.

-- 
/Jacob Carlborg


More information about the D.gnu mailing list