Loading page…
Pitch
Description
Comments
D Apps for Apache NuttX RTOS and QEMU RISC-V
Inspired in Rust Apps for Apache NuttX RTOS and QEMU RISC-V by Lup Yuen Lee.
Read https://lupyuen.github.io/articles/rust3
git clone --depth=1 --recursive https://github.com/apache/nuttx -b nuttx-12.5.1
git clone --depth=1 --recursive https://github.com/apache/nuttx-apps -b nuttx-12.5.1 apps
git clone --depth=1 https://bitbucket.org/nuttx/tools.git
qemu-system-riscv32 \
-semihosting \
-M virt,aclint=on \
-cpu rv32 -smp 8 \
-bios none \
-kernel nuttx -nographic
nsh> hello_d
Hello World, [generic-rv32]!
hello_d_main: Saying hello from the dynamically constructed instance
DHelloWorld.HelloWorld: CONSTRUCTION FAILED!
hello_d_main: Saying hello from the instance constructed on the stack
DHelloWorld.HelloWorld: Hello, World!!
During some tests you may discover druntime (if used) and the compiler builtin require libunwind. There are some common errors to work around (not just in rv32/64).
static keyword (TLS) - use --emulated-tls.#ifdef/ifndef FOO (-DFOO=1) to Version(Foo) (--d-version=Foo)-vgc: list all gc allocations including hidden ones (if use DRT/GC alloc)-vtls: list all variables going into TLS (thread local storage)-verrors=context: show error messages with the context of the erroring source line (show LoC error)--- a/examples/hello_d/Makefile
+++ b/examples/hello_d/Makefile
@@ -26,7 +26,10 @@ MAINSRC = hello_d_main.d
# hello_d built-in application info
-DFLAGS += -oq -betterC
+DFLAGS += -oq -betterC -vtls --emulated-tls
+DFLAGS += -verrors=context -O
+DFLAGS += --d-version=NuttX_D_Initialize
Official DRT(D runtime) isn't ideal for embedded (particularly microcontrollers). However, it's possible make your own mini/tiny DRT, like:
No comments yet.
Sign in to be the first to comment.