What is the state of Microcontroller support in d?
Dan Walmsley via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 20 04:50:56 PDT 2017
On Tuesday, 20 June 2017 at 11:47:49 UTC, Dan Walmsley wrote:
> On Tuesday, 20 June 2017 at 10:41:10 UTC, Mike wrote:
>> On Tuesday, 20 June 2017 at 10:39:47 UTC, Mike wrote:
>>
>>> I had to use code from my minimal runtime experiment here
>>
>> Sorry, I forgot to add the link for my minimal runtime
>> experiment:
>> https://github.com/JinShil/minimal_druntime_experiment
>>
>> Mike
>
> Mike,
>
> I think good news:
>
> I built a slightly different example, because I don't have
> access to the linker you have, I just had the arm-none-eabi one
> and I used ldc 1.3.0-beta2.
>
> I compiled using these flags:
> -march=thumb -mcpu=cortex-m4 -mtriple=thumb-none-linux-eabi -g
> -defaultlib= -conf= -oftest -better
>
> and I got 0 rodata no rtti (I did do -gc-sections) if I don't
> gc-sections it complains about loads of missing runtime stuff.
>
> I tried then to instantiate a class, but it just crashes in
> hardfault:
>
> final abstract class TestClass1 { }
> final abstract class TestClass2 { }
> final abstract class TestClass3 { }
> final abstract class TestClass4 { }
> final abstract class TestClass5 { }
> final abstract class TestClass6 { }
> final abstract class TestClass7 { }
> final abstract class TestClass8 { }
> final abstract class TestClass9 { }
>
> extern (C) void _d_callfinalizer (void *p)
> {
> }
>
> class Point
> {
> this (int x, int y)
> {
> X = x;
> Y = y;
> }
>
> int X;
> int Y;
> }
>
> void Main()
> {
> scope p = new Point(2,2);
>
> p.X = 1;
> p.Y = 1;
>
> int x = 0;
>
> x++;
> }
>
> Perhaps D needs to be aware of my stack? I will take a look at
> your linker script. But at least there is 0 type info data
> after -gc-sections has run.
Actually about the stack was a red herring the code did actually
work!
my only issue is now when I add a method I get:
C:\dev\repos\STM32DBlinky\Blinky\build\obj\main.o: In function
`_D4main5Point3SumMFZi':
C:\dev\repos\STM32DBlinky\Blinky/main.d:26: undefined reference
to `_D9invariant12_d_invariantFC6ObjectZv'
C:\dev\repos\STM32DBlinky\Blinky/main.d:26: undefined reference
to `_d_assert_msg'
C:\dev\repos\STM32DBlinky\Blinky\build\obj\main.o: In function
`_D4main4MainFZv':
C:\dev\repos\STM32DBlinky\Blinky/main.d:44: undefined reference
to `_d_eh_resume_unwind'
Whats the invariant object thing?
More information about the Digitalmars-d
mailing list