June 21, 2017
On Tuesday, 20 June 2017 at 22:31:15 UTC, Dan Walmsley wrote:

> Mike, I was thinking if you had used memory mapped structs instead of classes you probably wouldn't have come up across the rtti bloat so hard and it although be annoying wouldn't have been a show stopper, was there a particular reason to use classes to represent the registers?

I was able to work around the problem without having to compromise on my programming by compiling to assembly, modifying the assembly with this sed hack [1], and compiling the assembly to object code.  This masked the problem from me and my users, and I didn't have to change any of  my code.

It's always possible to find something that will work, especially in a comprehensive language like D and a rich tools like ld, binutils, and Linux-in-general.  But I can't go to my employer, colleagues, and customers with an object-oriented language, telling them they should avoid using classes or implement sed hacks in their build script, and expect to be taken seriously.  It's fine to do such things for oneself, but my goal was to build a product line like Arduino around D, and I can't expect that to succeed with such blatant flaws in the language implementation.  The problem should be fixed.

GDC may have fixed the problem recently with [2], but I haven't tested it.  Lucia Cojocaru is (was?) also working on addressing the problem by lowering TypeInfo calls in the compiler to templates [3].

I've been meaning to test the GDC changes, but I still have a bad taste in my mouth from my last experience with D, and have trouble getting excited about it like I once was.

You seem quite determined to get this to work.  With such determination I'm sure you'll find a way.  I hope you succeed and find the support you need.  Who knows?  I may have a change of heart later and join you.

Mike

[1] - https://github.com/JinShil/stm32f42_discovery_demo/blob/master/build.d#L69
[2] - https://github.com/D-Programming-GDC/GDC/pull/456
[3] - http://dconf.org/2017/talks/cojocaru.html
June 21, 2017
On Tuesday, 20 June 2017 at 13:45:31 UTC, Mike wrote:

> IMO, to make D a pleasant experience on the ARM Cortex-M platform, we'll need to implement the entire druntime including threading, GC, exceptions, dynamic arrays, etc... even if those features are not used.  This is because D just hasn't been designed and implemented in a modular fashion to allow one to pay-as-they-go, and as you experienced in one of your other posts today, you just get too many undefined references and other odd errors that have nothing to do with your code.  The only way to make those errors go away is to ensure everything in druntime is there.

The more I think about this, the more it seems like the best approach.  All this time I've been trying to find a way to build just enough runtime code to support the features I'm using, and I've only encountered frustration.  It's a shame that we have to build such a massive amount of infrastructure just to get a build, only to have the linker strip it all away, but apparently that's just the way things are.

Forget -betterC and -no-rtti; embrace it all!  We might just be be able to turn this lemon into lemonade afterall.

I'm having a bit of a change of heart (or maybe there's something in my coffee).  I'll be traveling overseas for the next month, so when I return I'll revisit this and see if it still appeals to me.

Mike
June 21, 2017
On Wednesday, 21 June 2017 at 00:50:35 UTC, Mike wrote:
> On Tuesday, 20 June 2017 at 13:45:31 UTC, Mike wrote:
>
>> [...]
>
> The more I think about this, the more it seems like the best approach.  All this time I've been trying to find a way to build just enough runtime code to support the features I'm using, and I've only encountered frustration.  It's a shame that we have to build such a massive amount of infrastructure just to get a build, only to have the linker strip it all away, but apparently that's just the way things are.
>
> Forget -betterC and -no-rtti; embrace it all!  We might just be be able to turn this lemon into lemonade afterall.
>
> I'm having a bit of a change of heart (or maybe there's something in my coffee).  I'll be traveling overseas for the next month, so when I return I'll revisit this and see if it still appeals to me.
>
> Mike

When iv been using c++ on stm32 I have had to rely on gcsections to produce a workable binary.

Have a good holiday, ill try as much as I can to improve things in the mean time 😀
June 21, 2017
On Wednesday, 21 June 2017 at 00:08:24 UTC, Mike wrote:
>
> GDC may have fixed the problem recently with [2], but I haven't tested it.  Lucia Cojocaru is (was?) also working on addressing the problem by lowering TypeInfo calls in the compiler to templates [3].
>

I've decoupled the code generating compiler (gdc) from runtime (druntime), and will generate pseudo typeinfo if any are missing - this is in contrast to dmd which would complain about missing TypeInfo/corrupt object.d.

This should mean that object.d can be distilled down to just:

  module object;
  class Object { }

From a minilibd perspective, and the compiler will just fill in the blanks and continue without complaint.  However you'll still get linker errors if you don't define TypeInfo anywhere.  (If there are any other compile-time errors, it's likely the dmd front-end complaining because it can't generate some artificial helper function).

Pay-as-you-go TypeInfo generation could be done stemming from this.  Currently, the strategy is to always generate TypeInfo in the module that "owns" the type, on premise that although it may not be used itself, some external module may want it.

Really though, this is probably about as far as I can push it without making changes to the dmd frontend or druntime library itself.  IMO the right thing to do is to not push the compiler, but to push the D runtime library into improving it's runtime interface.

i.e: https://github.com/dlang/druntime/pull/1792

Replacing the old legacy functions with templates that don't require typeinfo is the direction that people should be pushing in.  Without this, I can't see -fno-rtti being possible without severely restricting users to a slim subset.

Regards,
Iain.
June 21, 2017
On Wednesday, 21 June 2017 at 00:50:35 UTC, Mike wrote:
> On Tuesday, 20 June 2017 at 13:45:31 UTC, Mike wrote:
>
>> [...]
>
> The more I think about this, the more it seems like the best approach.  All this time I've been trying to find a way to build just enough runtime code to support the features I'm using, and I've only encountered frustration.  It's a shame that we have to build such a massive amount of infrastructure just to get a build, only to have the linker strip it all away, but apparently that's just the way things are.
>
> [...]

Mike, is there an email address I can contact you outside the forum?
June 21, 2017
On Tuesday, 20 June 2017 at 14:12:36 UTC, Dan Walmsley wrote:
> Firstly who do we need to talk to about the bloat in LDC?

I'll be happy to help with the LDC stuff once I hand in my Honours thesis on the 3rd of July, just ask on https://gitter.im/ldc-developers/main or send me a message on gitter.

June 21, 2017
On Wednesday, 21 June 2017 at 08:25:35 UTC, Dan Walmsley wrote:
> Mike, is there an email address I can contact you outside the forum?

"slavo"~"5150"~AT_SYMBOL~"yahoo"~PERIOD~"com";
June 21, 2017
On Wednesday, 21 June 2017 at 08:38:21 UTC, Nicholas Wilson wrote:
> On Tuesday, 20 June 2017 at 14:12:36 UTC, Dan Walmsley wrote:
>> Firstly who do we need to talk to about the bloat in LDC?
>
> I'll be happy to help with the LDC stuff once I hand in my Honours thesis on the 3rd of July, just ask on https://gitter.im/ldc-developers/main or send me a message on gitter.

whats your gitter handle?
June 21, 2017
On Wednesday, 21 June 2017 at 09:12:56 UTC, Dan Walmsley wrote:
> On Wednesday, 21 June 2017 at 08:38:21 UTC, Nicholas Wilson wrote:
>> On Tuesday, 20 June 2017 at 14:12:36 UTC, Dan Walmsley wrote:
>>> Firstly who do we need to talk to about the bloat in LDC?
>>
>> I'll be happy to help with the LDC stuff once I hand in my Honours thesis on the 3rd of July, just ask on https://gitter.im/ldc-developers/main or send me a message on gitter.
>
> whats your gitter handle?

thewilsonator
October 25, 2017
On Monday, 19 June 2017 at 20:01:01 UTC, Dan Walmsley wrote:
> On Friday, 8 April 2016 at 03:38:01 UTC, Taylor Hillegeist wrote:
>> So, for me one of the greatest things about d is that it is compiled to machine language. But It makes me sad that this strength doesn't seem to be available in one of the most obvious places.
>>
>> [...]
> Hi you still around, I'm starting to investigate these issues and see if I can start using D in some of my embedded projects at my company. I've got stuck at the hurdle of trying to use minilibd with Ldc compiler, did you make progress since this post?,

I'm still around I just haven't been working with D for a while. I see you were trying to put an effort together. That's really great, if there is anything I can do to keep the momentum let me know.