rust/hello: Optimize the build flags

Summary:
- Added `codegen-units = 1` and `opt-level = 'z'` to the release profile in `Cargo.toml`
- These changes optimize the build for minimal binary size

Impact:
- Reduces the final binary size by ~7% (244316 -> 228380 bytes)
- Improves resource utilization for embedded systems
- No functional changes to the application behavior

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2025-01-19 11:26:07 +08:00 committed by Xiang Xiao
parent 6669372415
commit 9b6de015bc

View file

@ -9,11 +9,11 @@ crate-type = ["staticlib"]
[profile.dev]
panic = "abort"
# Special hanlding for the panic! macro, can be removed once
# the libstd port for NuttX is complete.
[profile.release]
panic = "abort"
lto = true
codegen-units = 1
opt-level = 'z'
[dependencies]
serde = { version = "1.0", features = ["derive"] }