H1 2015 Priorities and Bare-Metal Programming

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 1 02:11:42 PST 2015


On 2/1/2015 1:38 AM, Timo Sintonen wrote:
> The one of major issues is: how to access hardware. We need a language feature
> to access hardware registers. This has been discussed twice. Both time you
> rejected anything but your own idea of library functions. You rejected anything
> anybody said. No serious programmer will write code that way. It worked in 80's
> when we had an uart with three registers 8 bit each. Now an usb or ethernet
> peripheral may have 100 registers 32 bit each.

core.bitop.volatileLoad() and volatileStore() are implemented, and do the job. 
They are compiler intrinsics that result in single instructions. They support 8, 
16, 32 and 64 bit loads and stores.


> There are workarounds:
> - disable optimization. the code works but is 3 times bigger and slower
> - GDC marks shared variables as volatile. This works mostly but is unstandard
> and unstable and may be removed at any time.
> - Have an separate templated data type which has its own operators. While this
> seems to work, it is a little complicated way to do things.

I don't see the need for any of these workarounds. The compiler intrinsics are 
volatile, i.e. they are not optimized away even when optimization is turned on.


> The runtime needs:
> - NoSystem should be a supported platform and not a build failure. The build
> system should leave out files and features that are not available.
> - Unrelated things should be split in separate files and unnecessary imports
> should be removed. Object.d is pulling in most of the library with its imports.
> Imports that are used only in unittests should be in unittest blocks. I know
> this is worked on.
> - Runtime library functions should not use gc and free all resources they use. I
> know this is also being worked on.
>
> The absolute minimum set of changes that I had to make can be seen here:
> https://bitbucket.org/timosi/minlib/src/8674af49718880021c2777d60ac2091bc99c0107/Changes?at=default

The link does not work.

I have added https://issues.dlang.org/show_bug.cgi?id=14100 and have also added 
the "bare-metal" keyword. Please enumerate the issues you're having, file them 
on bugzilla, and tag them with "bare-metal".



More information about the Digitalmars-d mailing list