Severin Teona - SAOC Milestone 1 Update 2 - Druntime for Microcontrollers

Severin Teona teona.severin9 at gmail.com
Wed Sep 30 16:35:05 UTC 2020


Hi all,

This post represents the second weekly update for the first 
milestone for #SAoC2020.

After the first week, my plan for this week was:
- to build the runtime for the target architecture (ARM Cortex-M4 
based MCUs), in order to have a working environment for the 
runtime.

First, I tried compiling the runtime using the 
‘ldc-build-runtime’ tool but I was using it wrong.
This week:
- thanks to kinke’s advice([1]) I managed to build the runtime 
for cortex-m4, but that came with a few questions.
1. During the installation, because I was using 
‘arm-none-eabi-gcc’, I got the following messages:

— The C compiler identification is GNU 9.3.1
— Detecting C compiler ABI info
— Detecting C compiler ABI info - failed
— Detecting C compile features
— Detecting C compile features - done
— The ASM compiler identification is GNU
— Found assembler: 
/home/teona/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc
— Looking for sys/types.h
— Looking for sys/types.h - not found
— Looking for stdint.h
— Looking for stdint.h - not found
— Looking for stddef.h
— Looking for stddef.h - not found
— Check size of void*
— Check size of void* - failed
— Looking for unistd.h
— Looking for unistd.h - not found
— Configuring done
— Generating done

Both the build and the linking parts were succesful, but I wanted 
to ask you if I should care about those messages, or if they 
appear because I wasn’t using ‘gcc’.

2. Also, I tried building the runtime without 
‘BUILD_SHARED_LIBS=OFF’ and it failed, as it was looking for some 
dynamic libraries (-lpthread, -ldl, -lrt, and so on). My question 
here is, does abynody here know if there exists a set of dynamic 
libraries, compiled for this architecture? With TockOS, I’ve been 
using newlib([2]) as C standard library, but newlib is a static 
library. Would it make a big difference if I used a dynamic 
library?

My plan for next week is:
- to try to emulate a Cortex-M4 device using qemu - the biggest 
issue I have here is that there are just 2 Cortex-M4 based 
devices that can be emulated, and the resources(64KB of RAM and 
256KB of flash) are way smaller than what I need (>2.5MB flash - 
the current size of the compiled runtime).
- to try to compile and run using qemu a basic `int main() { 
return 0;}` application in C, in D (using -betterC), in D (linked 
with the compiled druntime) and finally, a bigger application 
that uses GC from the compiled druntime (such as using a class or 
string concatenation)
- lastly, I will try to move and run all my work on a docker.

There is a strong possibility I won’t be able to test the 
druntime using qemu. Do you have any advice about what should I 
do next? (the board I am using has only 2MB of flash).

Thank you so much!

[1]: 
https://forum.dlang.org/post/vgnlauzerzezwfrgnrkv@forum.dlang.org
[2]: https://sourceware.org/newlib/



More information about the Digitalmars-d mailing list