ARM Cortex-M Microcontroller startup files

Timo Sintonen via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 29 23:43:17 PDT 2015


On Thursday, 30 April 2015 at 00:14:18 UTC, Martin Nowak wrote:

> Wonder if it makes more sense to start from zero and add as few 
> files as
> possible.

When I started I did not know D enough to understand what 
druntime does. Just picked the easy way. The amount of required 
changes has got smaller in every release. It is easy to maintain: 
I get mainstream updates and bug fixes just by patching.
Mike has done some work with an empty runtime and Adam has a 
chapter in his book. I do not know any real programs made from 
this base


> Druntime doesn't do much useful stuff for a µC anyhow.
>
> - GC and rt.lifetime (new, arrays)
> - Moduleinfo
> - EH unwind support
> - AA implementation
> - vectorized array ops
> - core.time/sync/thread/demangle

UC programs mostly use static resources but I think 'new' is 
useful to initialize class objects at runtime. I got exceptions 
to work but I do not know how much use they have. There should be 
some time routines.

>
> What might be interesting is this.
>
> - core.bitop
> - maybe core.atomic
> - some gcc simd module
> - libc bindings for core.stdc.math and core.stdc.stdio for 
> printf


Printf is a little tricky. It is actually a file operation to 
stdout and that is actually a syscall to kernel. In a controller 
board we may have several devices where we can send data like 
uart and oled display. (I even have a video output where video 
signal is generated with just one spi and one timer)
I think java style would be better here like
console = new Formatter (new uartWriter (uart2) )
console.printf("",...)
This way the formatter can be reused and is not bound to any 
hardware.


I think it is possible to make a minimum bare metal runtime fom 
scratch. However, there are some requirements:
- A team. One man project may never get ready and it will not 
receive enough attention. It is also often tailored to personal 
needs which makes it difficult for others to use.
- An insider. A project from unknown people will just be ignored. 
(I think we may have one now)
- A project coordinator. I think we will find one.
- Some people who want to work. We may have a couple.

If people thik we should start, I am with.


More information about the Digitalmars-d mailing list