Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement for Rust build #3020

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/nuttx_add_rust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ function(nuttx_add_rust)
add_custom_command(
OUTPUT ${RUST_LIB_PATH}
COMMAND
${CMAKE_COMMAND} -E env
NUTTX_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/include:${CMAKE_BINARY_DIR}/include:${CMAKE_BINARY_DIR}/include/arch
cargo build --${RUST_PROFILE} -Zbuild-std=std,panic_abort
${RUST_DEBUG_FLAGS} --manifest-path ${CRATE_PATH}/Cargo.toml --target
${RUST_TARGET} --target-dir ${RUST_BUILD_DIR}
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/slint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ opt-level = 'z'
[dependencies]
libc = "0.2"
slint = { version = "1.9", default-features = false, features = ["compat-1-2", "renderer-software", "libm", "unsafe-single-threaded"] }
nuttx = { git = "https://github.com/no1wudi/nuttx-rs.git", branch = "master" }
nuttx = { git = "https://github.com/no1wudi/nuttx-rs.git", branch = "main" }

[build-dependencies]
slint-build = { version = "1.9" }
2 changes: 1 addition & 1 deletion examples/rust/slint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub extern "C" fn slint_main() {
println!("{:?}", planeinfo);
println!("{:?}", videoinfo);

if videoinfo.fmt != Format::RGB565 as u8 {
if videoinfo.fmt != FB_FMT_RGB16_565 as u8 {
println!("Unsupported pixel format, only RGB565 is supported for now");
return;
}
Expand Down
6 changes: 4 additions & 2 deletions tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ endef

ifeq ($(CONFIG_DEBUG_FULLOPT),y)
define RUST_CARGO_BUILD
cargo build --release -Zbuild-std=std,panic_abort \
NUTTX_INCLUDE_DIR=$(TOPDIR)/include:$(TOPDIR)/include/arch \
cargo build --release -Zbuild-std=std,panic_abort \
-Zbuild-std-features=panic_immediate_abort \
--manifest-path $(2)/$(1)/Cargo.toml \
--target $(call RUST_TARGET_TRIPLE)
endef
else
define RUST_CARGO_BUILD
@echo "Building Rust code with cargo..."
cargo build -Zbuild-std=std,panic_abort \
NUTTX_INCLUDE_DIR=$(TOPDIR)/include:$(TOPDIR)/include/arch \
cargo build -Zbuild-std=std,panic_abort \
--manifest-path $(2)/$(1)/Cargo.toml \
--target $(call RUST_TARGET_TRIPLE)
endef
Expand Down
Loading