December 16, 2020
Hi again guys!

I have been trying to develop a small-sized DRuntime for microcontrollers during SAoC2020. My last update is here[1]. At the moment, I have managed to build a DRuntime that can be linked with a simple application (not using classes or anything), for TockOS[2], and using the D userland I developed this spring[3].

But, in the linking process, I get the following warnings, that I believe are the cause of the faults on the microcontroller when I actually run the application:

/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D4core9exception6_storeG128v lma 0x8002dd28 adjusted to 0x8002dd30
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D4core6thread10threadbase10ThreadBase7sm_thisCQBtQBrQBnQBe lma 0x8002dd28 adjusted to 0x8002ddb0
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2gc4impl12conservativeQw14bytesAllocatedm lma 0x8002dd28 adjusted to 0x8002ddb4
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2gc4impl12conservativeQw14ConservativeGC12_inFinalizerb lma 0x8002dd28 adjusted to 0x8002ddbc
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2rt7dwarfeh15ExceptionHeader5stackPSQBkQBkQBf lma 0x8002dd28 adjusted to 0x8002ddbd
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2rt7dwarfeh15ExceptionHeader9ehstorageSQBnQBnQBi lma 0x8002dd28 adjusted to 0x8002ddc1
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2rt8lifetime18__blkcache_storagePS4core6memory8BlkInfo_ lma 0x8002dd28 adjusted to 0x8002de31
/home/tock/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: build/cortex-m4/cortex-m4.elf: section .tbss._D2rt8lifetime12__nextBlkIdxi lma 0x8002dd28 adjusted to 0x8002de35

All the addresses are from the flash memory of the microcontroller, but I believe there are some problems with the memory alignment. The microcontroller I am using in running in Thumb mode (16-bit architecture).

Does anyone have any ideea what the cause might be? Or what compilation flag/option should I use to not get these warnings? I have build the DRuntime using the ldc-build-runtime tool and modifying the CMakeLists.txt file to compile and link only the modules I need (for now).

Thank you!

[1] : https://forum.dlang.org/post/xqiaphttdtbohfmwwppm@forum.dlang.org
[2] : https://www.tockos.org
[3] : https://github.com/DLang-IoT/libtock-d
December 16, 2020
On Wednesday, 16 December 2020 at 11:51:52 UTC, Severin Teona wrote:
> Hi again guys!
>
> I have been trying to develop a small-sized DRuntime for microcontrollers during SAoC2020. My last update is here[1]. At the moment, I have managed to build a DRuntime that can be linked with a simple application (not using classes or anything), for TockOS[2], and using the D userland I developed this spring[3].
>
> [...]

Have you looked at my work in https://bitbucket.org/timosi/minlibd/src/master/
There is my libdruntime port and working sample program for stm32.

Tdata and tbss are handled special way in linker. They seem to be there but actually they are not. Look at https://bitbucket.org/timosi/minlibd/src/master/tools/stm32f4/ldscript for my workaround.

I have not updated this project for a while although I have half ready version for gcc 11. There are issues with exceptions that I have not been able to fix.

There is documentation in the directories and also in the wiki. Feel free to contact me if you want to ask something.