For LDC with an ARM backend, you only need to compile with
-march= and/or -mcpu= if you wish to compile for bare-metal.
The version strings are listed here
(http://dlang.org/version.html). So if I understand your
objective, you would only need...
else version(ARM_Thumb) // or version(ARM) if targeting
Cortex-A and the like
{
...
}
And it may actually need to look more like...
version(X86)
{
version(Windows)
{ }
else version(Linux)
{ }
else
{ }
}
else version(ARM_Thumb)
{
...
}
of course the hard part is filling in the (...).
What CPU/MCU are you targeting? Are you building for
bare-metal?
Yes, for bare metal, no OS, nothing.
I think I have to specify my target architecture and CPU
otherwise the compiler cannot know that I'm cross compiling for
ARM. -march= -mcpu= will not work for me.
I'm trying to compile a simple stand alone object file.
class TestClass
{
ubyte member;
this(ubyte m) { member = m; }
ubyte Get() { return member; }
};
extern(C) void main()
{
// stack class
scope test = new TestClass(0);
// simple inline asm test
__asm("mov r0,#1;
mov r1,#2", "~{r0,r1}");
}
This test should be simple enough I thought but it turned out
that to compile and link this, D requires almost everything from
the runtime.
So the challenge is, compile and link the simple code above
targeting ARM using LDC, no OS allowed.