<p dir="ltr">On 19 Apr 2014 01:35, "Mike via D.gnu" <<a href="mailto:d.gnu@puremagic.com">d.gnu@puremagic.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> It is common practice in ARM Cortex-M bare metal C/C++ programs to define symbols in the linker so one can initialize the .data and .bss segments and know the boundaries of one's stack and heap. It looks something like this.<br>
><br>
> **** linkerscript ****<br>
> __text_end__ = .;<br>
><br>
> .data : AT(__text_end__)<br>
> {<br>
> __data_start__ = .;<br>
> *(.data)<br>
> *(.data.*)<br>
> __data_end__ = .;<br>
> } > SRAM<br>
><br>
> **** C++ file ****<br>
> extern "C" uint32_t __text_end__;<br>
> extern "C" uint32_t __data_start__;<br>
> extern "C" uint32_t __data_end__;<br>
><br>
> void startup()<br>
> {<br>
> // copy mutable state out of ROM into RAM<br>
> memcpy(&__data_start__, &__text_end__, (&__data_end__ - &__data_start__) * 4);<br>
> }<br>
><br>
> I tried to do something similar in D with...<br>
><br>
> extern(C) __gshared uint __text_end__;<br>
> extern(C) __gshared uint __data_start__;<br>
> extern(C) __gshared uint __data_end__;<br>
><br>
> ... but unfortunately this puts new variables in the .bss segment. I want the un-mangled name, so I can refer to it easily, but I also want it to be truly "extern" (defined elsewhere). Is that possible at this moment in D?<br>
><br>
> Thanks for the help,<br>
> Mike</p>
<p dir="ltr">I think you mean to 'extern (C) extern'</p>
<p dir="ltr">Iain </p>