Skip to content
Merged
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
8 changes: 5 additions & 3 deletions cmake/nuttx_add_rust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ function(nuttx_add_rust)
# Determine build profile based on CONFIG_DEBUG_FULLOPT
if(CONFIG_DEBUG_FULLOPT)
set(RUST_PROFILE "release")
set(RUST_DEBUG_FLAGS "-Zbuild-std-features=panic_immediate_abort")
else()
set(RUST_PROFILE "debug")
set(RUST_DEBUG_FLAGS "")
endif()

# Get the Rust target triple
Expand All @@ -142,9 +144,9 @@ function(nuttx_add_rust)
add_custom_command(
OUTPUT ${RUST_LIB_PATH}
COMMAND
cargo build --${RUST_PROFILE} -Zbuild-std=std,panic_abort --manifest-path
${CRATE_PATH}/Cargo.toml --target ${RUST_TARGET} --target-dir
${RUST_BUILD_DIR}
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}
COMMENT "Building Rust crate ${CRATE_NAME}"
VERBATIM)

Expand Down
1 change: 1 addition & 0 deletions tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ endef
ifeq ($(CONFIG_DEBUG_FULLOPT),y)
define RUST_CARGO_BUILD
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
Expand Down
Loading