summaryrefslogtreecommitdiff
path: root/components/rust/examples/application
diff options
context:
space:
mode:
authoryan hu <[email protected]>2026-08-07 18:05:09 +0800
committerRbb666 <[email protected]>2026-08-21 11:17:57 +0800
commit30af7388a4077354f6083082fee040595978bbac (patch)
treedfa0440a884847ff7d803bb3113dd3f9f916f74b /components/rust/examples/application
parent339bffb702b911b55b0e6d54fa5ad9116295f048 (diff)
[rust][tools] Fix Rust build example configuration handling
Improve the Rust build integration across core, applications, components, and module examples. Fix build failure propagation, target and feature handling, linker flags, example configuration semantics, and add STM32 CI attach coverage.
Diffstat (limited to 'components/rust/examples/application')
-rw-r--r--components/rust/examples/application/SConscript22
-rw-r--r--components/rust/examples/application/fs/Cargo.toml4
-rw-r--r--components/rust/examples/application/loadlib/Cargo.toml4
3 files changed, 17 insertions, 13 deletions
diff --git a/components/rust/examples/application/SConscript b/components/rust/examples/application/SConscript
index c6c4de3db8..fc50bc2825 100644
--- a/components/rust/examples/application/SConscript
+++ b/components/rust/examples/application/SConscript
@@ -6,7 +6,7 @@ cwd = GetCurrentDir()
# Import usrapp build module and build support
sys.path.append(os.path.join(cwd, '../../tools'))
-from build_usrapp import build_example_usrapp
+from build_usrapp import UserAppBuildError, build_example_usrapp
from build_support import clean_rust_build
@@ -31,7 +31,7 @@ def load_extended_feature_configs():
group = []
-if not _has('RT_RUST_BUILD_APPLICATIONS'):
+if not (_has('RT_RUST_BUILD_APPLICATIONS') or _has('RT_RUST_BUILD_ALL_EXAMPLES')) and not GetOption('clean'):
Return('group')
# Load extended feature configurations
@@ -51,12 +51,16 @@ if GetOption('clean'):
print('No example_usrapp build artifacts to clean')
else:
import rtconfig
- LIBS, LIBPATH, LINKFLAGS = build_example_usrapp(
- cwd=cwd,
- has_func=_has,
- rtconfig=rtconfig,
- build_root=os.path.join(Dir('#').abspath, "build", "example_usrapp")
- )
+ try:
+ LIBS, LIBPATH, LINKFLAGS = build_example_usrapp(
+ cwd=cwd,
+ has_func=_has,
+ rtconfig=rtconfig,
+ build_root=os.path.join(Dir('#').abspath, "build", "example_usrapp")
+ )
+ except UserAppBuildError as e:
+ print(f'Error: {e}')
+ sys.exit(1)
group = DefineGroup(
'example_usrapp',
@@ -67,4 +71,4 @@ group = DefineGroup(
LINKFLAGS=LINKFLAGS
)
-Return('group') \ No newline at end of file
+Return('group')
diff --git a/components/rust/examples/application/fs/Cargo.toml b/components/rust/examples/application/fs/Cargo.toml
index 2556b5f0a4..40c2e01ffa 100644
--- a/components/rust/examples/application/fs/Cargo.toml
+++ b/components/rust/examples/application/fs/Cargo.toml
@@ -12,6 +12,6 @@ default = []
enable-log = ["em_component_log/enable-log"]
[dependencies]
-rt-rust = { path = "../../../core" }
+rt-rust = { path = "../../../core", features = ["fs"] }
rt_macros = { path = "../../../rt_macros" }
-em_component_log = { path = "../../component/log"} \ No newline at end of file
+em_component_log = { path = "../../component/log"}
diff --git a/components/rust/examples/application/loadlib/Cargo.toml b/components/rust/examples/application/loadlib/Cargo.toml
index 1e1065f91a..66c7abfb91 100644
--- a/components/rust/examples/application/loadlib/Cargo.toml
+++ b/components/rust/examples/application/loadlib/Cargo.toml
@@ -8,5 +8,5 @@ name = "em_loadlib"
crate-type = ["staticlib"]
[dependencies]
-rt-rust = { path = "../../../core" }
-rt_macros = { path = "../../../rt_macros" } \ No newline at end of file
+rt-rust = { path = "../../../core", features = ["libdl"] }
+rt_macros = { path = "../../../rt_macros" }