Bare metal D

Timo Sintonen t.sintonen at luukku.com
Sun May 5 11:00:44 PDT 2013


On Sunday, 5 May 2013 at 10:56:53 UTC, Iain Buclaw wrote:
> On May 4, 2013 6:40 PM, "teachop" <is-not at given.com> wrote:
>>
>> Looking for help / advice getting D running in an embedded 
>> system.  The
> compiler building for gdc and newlib went smoothly (mostly) 
> thanks to this
> web page:
>> http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG
>>
>> I have given the bitbucket-hosted timosi/minlibd a fair bit of 
>> time and
> not been able to link correctly and get an output.  The library 
> built
> wihtout error.  The example there isn't complete.  My targets 
> are AVR32 and
> ARM Cortex M3 but am first focusing only on the M3.
>>
>> Any advice on getting this going?  Thanks.
>
> Seek me out if there are any blockers preventing you from doing 
> this.
> Otherwise please document everything you do.  :)
>

I have been able to compile, link and run a test program in 
stm32f4 with the tools and libs in my repo.
The major thing that is missing is memory allocation. The one I 
used was heavily related to my hardware and I am now making a 
more general version.

Another file that is missing is a startup file. The file should 
have code that sets the state of the processor so that we can 
call main. This means usually setting the clock oscillator, 
interrupt controller and memory controller. This file is totally 
processor dependent and the processor vendor does provide this. 
The license of those files may prevent me to share them in my 
repo.

There has also been issues in linking. When an operating system 
loads an elf file, it can look the elf headers and find out the 
section locations. When the file is loaded into flash memory, 
this information is lost. Linker script variables are used to 
mark the locations but they may still be wrong.

I have been a  busy lately but I try to get a working example as 
soon as possible. It is possible and it has been done and it has 
worked.

Meanwhile, I am interested to hear what kind of processors you 
are using. I can answer stm32 related questions if that is your 
target.




More information about the D.gnu mailing list