Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active May 3, 2024 22:52
Show Gist options
  • Save lupyuen/4970e1a36b3aac8a0ae10ca522adca79 to your computer and use it in GitHub Desktop.
Save lupyuen/4970e1a36b3aac8a0ae10ca522adca79 to your computer and use it in GitHub Desktop.
Rust Apps for Apache NuttX RTOS: Build NuttX for Ox64 SBC. See https://github.com/lupyuen/nuttx-rust-app
$ mkdir nuttx
$ cd nuttx
$ git clone https://github.com/apache/nuttx nuttx
$ git clone https://github.com/apache/nuttx-apps apps
$ cd nuttx
$ tools/configure.sh ox64:nsh
$ make menuconfig
## TODO: Enable "Hello Rust" Example App
## https://github.com/lupyuen2/wip-nuttx/blob/rust/boards/risc-v/bl808/ox64/configs/nsh/defconfig
$ make
## Build NuttX with Tracing Enabled
$ make --trace export
$ pushd ../apps
## Build NuttX with Tracing Enabled
$ make --trace import
riscv64-unknown-elf-gcc \
-march=rv64imafdc \
-mabi=lp64d \
-c \
-fno-common \
-Wall \
-Wstrict-prototypes \
-Wshadow \
-Wundef \
-Wno-attributes \
-Wno-unknown-pragmas \
-Wno-psabi \
-fno-common \
-pipe \
-Os \
-fno-strict-aliasing \
-fomit-frame-pointer \
-ffunction-sections \
-fdata-sections \
-g \
-mcmodel=medany \
-isystem /Users/Luppy/ox64/apps/import/include \
-isystem /Users/Luppy/ox64/apps/import/include \
-D__NuttX__ \
-I "/Users/Luppy/ox64/apps/include" \
hello_main.c \
-o hello_main.c.Users.Luppy.ox64.apps.examples.hello.o
Makefile:52: target '/Users/Luppy/ox64/apps/examples/hello_rust_install' does not exist
make -C /Users/Luppy/ox64/apps/examples/hello_rust install APPDIR="/Users/Luppy/ox64/apps"
make[3]: Entering directory '/Users/Luppy/ox64/apps/examples/hello_rust'
make[3]: *** No rule to make target 'hello_rust_main.rs.Users.Luppy.ox64.apps.examples.hello_rust.o', needed by '/Users/Luppy/ox64/apps/bin/hello_rust'. Stop.
make[3]: Leaving directory '/Users/Luppy/ox64/apps/examples/hello_rust'
make[2]: *** [Makefile:52: /Users/Luppy/ox64/apps/examples/hello_rust_install] Error 2
make[2]: Leaving directory '/Users/Luppy/ox64/apps'
make[1]: *** [Makefile:78: .import] Error 2
make[1]: Leaving directory '/Users/Luppy/ox64/apps'
make: *** [Makefile:84: import] Error 2
$ rustup target add riscv64gc-unknown-none-elf
$ pushd ../apps/examples/hello_rust
$ rustc \
--target riscv64gc-unknown-none-elf \
--edition 2021 \
--emit obj \
-g \
-C panic=abort \
-O \
hello_rust_main.rs \
-o hello_rust_main.rs.Users.Luppy.ox64.apps.examples.hello_rust.o
$ popd
$ make import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment