Startup files for STM32F4xx

Jens Bauer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 24 22:07:02 PDT 2015


On Saturday, 25 April 2015 at 04:21:06 UTC, Martin Nowak wrote:
> The STM peripheral library really sux, verbose boilerplate for 
> the simplest stuff and no type safety for the enums (find the 
> difference of GPIO_PIN4 and GPIO_PinSource4 via debugging).

I couldn't agree more. I especially hate the fact that pointers 
have to be type-casted into uint32_t!

I know, I know.. It's always 32-bit on the Cortex-M 
microcontrollers, but ... it would make it easier to make a 
sandbox application or some test-suite running on a computer, if 
not having to type-cast everything.

> It's also really hard to setup all the startup files, linker 
> scripts and debugger configs.
>
> In constrast we could provide a really amazing D experience on 
> those platforms.

D is really suitable for microcontrollers; especially because 
classes no longer cost a payload of memory. This will allow us to 
make neat User-Interface objects easily, where a minimal UI 
library would be 5K in C++. I also hope that associative arrays 
and strings will fit most microcontrollers. I know that there 
might be problems, when we have little RAM available. I do not 
know how little memory is realistic at the moment; here I'm 
especially thinking about fragmentation and the use of the 'new' 
keyword.

I hope to find a good way to use import for microcontroller 
libraries, so it'll be easy for everyone. I'm thinking about 
something like ...

import mcu.stm32f439.all

... and I'm hoping to have this in a shared location instead of 
including the library in every source file like it's usually done 
in C and C++ based projects. But I will wait and see what the 
more experienced D)everlopers recommend. ;)

While I remember it ... I had to nullify a number of imports in 
stdint. They simply do not belong in there. :)
Eg. I do not want FILE* if I aks for stdint. But FILE* is forced 
upon me, because wchar_t includes it. What does a wchar_t need a 
file-system for ?
Things like these might need a slight cleanup at some point 
(because normally, you don't have a file system on a 
microcontroller; thus you will get errors, when trying to import 
a simple file like stdint).


More information about the Digitalmars-d-learn mailing list