On 11 January 2017 at 02:40, Manu via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On 10 January 2017 at 19:04, Iain Buclaw via Digitalmars-d > <digitalmars-d@puremagic.com> wrote: >> >> On 10 January 2017 at 09:22, Manu via Digitalmars-d >> <digitalmars-d@puremagic.com> wrote: >> > Can any of the GDC guys comment on how difficult it would be to get this >> > toolchain build script to include building GDC? >> > >> > https://github.com/SaturnSDK/Saturn-SDK-GCC-SH2 >> > >> > I have a mate who's hacking on the Saturn and wants to build one of my >> > projects. >> > It'd be a really great test for embedded D; fairly small realtime >> > target. I >> > expect binary size to be a problem ;) >> >> Debian already has builds for SH4, there's just no druntime support. > > > Cool. Obviously, this is an SH2 toolchain, and it's baremetal, not linux. > Not sure what c-runtime it uses, but probably not glibc. > >> https://goo.gl/dznZIF >> >> But getting druntime working on it should be trivial enough. > > > I'm looking for just the BetterC experience, but druntime still seems > somewhat necessary... what parts need to be implemented for BetterC to work > well? > >> - Fix core.stdc.* to handle the arch-specific bits for SH (just copy >> from C headers). >> - There's threadasm.S if you want to implement native fiber support, >> otherwise you can fall back to ucontext_t. > > > I expect existing SH4 code should be mostly compatible, and a good > headstart. > Doesn't sound too bad. I'm not using fibers though. > >> Does double == float on this platform? That might be interesting... > > > I think SH2 supports double, but it would be terminally slow... Is there a > way to force double == float? What would that do to D?
Looking at the -march configurations, compile with the -m2a-single-only flag. I don't think it would affect the compiler in any way, but I can't test that on compiler explorer because the sh4 compiler was built only to support sh4 and sh4-no-fpu. You can play around with -m4-no-fpu here: https://goo.gl/0vmt9v I expect there to be no surprises unless you try to import anything.