Skip to content

Commit c6db0c9

Browse files
committed
rust: Add assertions, overflow checks and debug
With a previous cmake change, Rust builds are now done in `release` mode by default. Add profile directives to all of the samples and tests to ensure overflow checks, and debug assertions are enabled, as well as to still emit debugging symbols. This more closely matches the default configuration of the Zephyr code. General advice would be to keep the overflow checks, but disabling the debug checks might be useful after sufficient testing. Because debug symbols are not included in the target image, there is little reason to not always include them. The structure of cargo requires these flags to be set in each application, with the defaults being builtin. Signed-off-by: David Brown <[email protected]>
1 parent 4068531 commit c6db0c9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

samples/hello_world/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ crate-type = ["staticlib"]
1414

1515
[dependencies]
1616
zephyr = "3.7.0"
17+
18+
[profile.release]
19+
debug-assertions = true
20+
overflow-checks = true
21+
debug = true

samples/philosophers/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ crate-type = ["staticlib"]
1414

1515
[dependencies]
1616
zephyr = "3.7.0"
17+
18+
[profile.release]
19+
debug-assertions = true
20+
overflow-checks = true
21+
debug = true

tests/time/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ crate-type = ["staticlib"]
1414

1515
[dependencies]
1616
zephyr = "3.7.0"
17+
18+
[profile.release]
19+
debug-assertions = true
20+
overflow-checks = true
21+
debug = true

0 commit comments

Comments
 (0)