Need help making minimal bare metal ARM Cortex-M D program
Mike
none at none.com
Sun Nov 24 17:04:39 PST 2013
On Sunday, 24 November 2013 at 20:00:56 UTC, Timo Sintonen wrote:
> A full working example for gdc and cortex-m4 (stm32f4) is in my
> repo at
> https://bitbucket.org/timosi/minlibd
>
> I have used startup file from st and have no need to put
> interrupt vectors in d code.
Thanks Timo, your minlibd is awesome, and will be my next object
of study.
I already know how do do what you did with assembly and C, but my
goal is not just to get something working, but to learn what can
and can't be done with D.
minlibd uses an assembly startup file and calls into C functions
to set up the clock, flash, etc... That works, and may be the
only (best?) way to go. But I'd like to explore and learn what
limitations exist in the D language and the D tools.
If the LDC folks add a section-attribute-like feature, then I
believe it should be possible to do away with the assembly
startup file, and put the vectors, data section relocation, and
bss initialization all in D, and that appeals to me.
I'm wondering, though, if the vector table's simple name could be
added to the text section. Then the attribute syntax would be
unnecessary. Something like this:
void (* const table_interrupt_vector[])(void) =
{
(void *) &_stack_end,
handler_reset
};
.text :
{
. = ALIGN(4);
*(.text.table_interrupt_vector)
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)
. = ALIGN(4);
} > flash
...but maybe the symbol will be added twice. Unfortunately I
won't be home for a few more days to try it out.
According to LDs docs, execution should default to the start of
text, and if I could just figure out how to make sure
table_interrrupt_vector is there, that would basically be it.
More information about the Digitalmars-d
mailing list