ARM Cortex-M D Runtime Port

Mike none at none.com
Sun Jan 5 17:32:07 PST 2014


On Sunday, 5 January 2014 at 17:07:10 UTC, Joakim wrote:
> What new platform are you porting druntime to?  I'm guessing 
> linux/ARM Cortex-M based on your previous posts.  Hopefully, I 
> can reuse some of your work when I try ARM out.

I'm porting to an STM32F4 
(http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577) MCU, 
simply because that's the only hardware I have, and I'm familiar 
with it, but I hope it will be portable to any ARM Cortex-M MCU 
with little or no modification.  I'm doing a bare-metal port (no 
OS) so Linux way out of scope for me.

My goal to make something like the Arduino.  So the end product 
would be end up with the following:
* The hardware (I/O board).  Think Arduino DUE 
(http://store.arduino.cc/index.php?main_page=product_info&cPath=11&products_id=243)
* A compiler specific to the hardware (LCD with ARM Thumb 
backend, or GDC cross-compiled for arm-none-eabi
* A port of the D runtime.  Definitely not a complete port. Just 
enough to work the I/O and make use D programming constructs 
(classes, structs, exceptions, thread local storage, etc...)
* A library, or set of libraries, to make programming the IO 
convenient.  See the Arduino reference to get a an idea 
(http://arduino.cc/en/Reference/HomePage)
* Possibly an IDE specific to microcontroller development.

I'd like to eventually create a very tiny real-time OS like 
FreeRTOS(http://www.freertos.org/) and the like, but that is a 
very long-term goal.

Other goals are:
* Assist the LDC and GDC folks with supporting this platform, as 
this adventure truly stands on their shoulders and we're not 
going to get anywhere without them.
* Show that the D language can replace C/C++ in the 32-bit MCU 
realm.

Timo Sintonen is also well on his way to an ARM Cortex-M port 
(https://bitbucket.org/timosi/minlibd), but he's taking quite a 
different approach than I.  I'm taking more of a bottom up 
approach and hope to discard the peripheral library, the C 
library, and anything else C/C++ and do everything in D.

I've created a simple "hello world" tutorial here 
(http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22) 
so people interested in this or similar endeavors can have a 
convenient place to start.

At the moment, I don't have any source code to publish, as 
everything I've built so far is simply for academic purposes (I 
have a lot to learn).  But, I'd be happy to share what I have and 
what I've learned, and I hope in the coming months I'll have a 
repository with something useful.

Mike


More information about the Digitalmars-d mailing list