Skip to content

Commit 1bc106e

Browse files
d3zd3zgustavonihei
authored andcommitted
sim: Homogenize max-align-32 feature check
This feature check was done statically instead of dynamically in the build.rs file. Change this to match the rest. Perhaps we might want to change all of them to be done at compile time, but that should be done with all of the features. Signed-off-by: David Brown <david.brown@linaro.org>
1 parent 41f123c commit 1bc106e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sim/mcuboot-sys/build.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn main() {
3333
let downgrade_prevention = env::var("CARGO_FEATURE_DOWNGRADE_PREVENTION").is_ok();
3434
let ram_load = env::var("CARGO_FEATURE_RAM_LOAD").is_ok();
3535
let direct_xip = env::var("CARGO_FEATURE_DIRECT_XIP").is_ok();
36+
let max_align_32 = env::var("CARGO_FEATURE_MAX_ALIGN_32").is_ok();
3637

3738
let mut conf = CachedBuild::new();
3839
conf.conf.define("__BOOTSIM__", None);
@@ -41,11 +42,11 @@ fn main() {
4142
conf.conf.define("MCUBOOT_HAVE_ASSERT_H", None);
4243
conf.conf.define("MCUBOOT_MAX_IMG_SECTORS", Some("128"));
4344

44-
#[cfg(not(feature = "max-align-32"))]
45-
conf.conf.define("MCUBOOT_BOOT_MAX_ALIGN", Some("8"));
46-
47-
#[cfg(feature = "max-align-32")]
48-
conf.conf.define("MCUBOOT_BOOT_MAX_ALIGN", Some("32"));
45+
if max_align_32 {
46+
conf.conf.define("MCUBOOT_BOOT_MAX_ALIGN", Some("32"));
47+
} else {
48+
conf.conf.define("MCUBOOT_BOOT_MAX_ALIGN", Some("8"));
49+
}
4950

5051
conf.conf.define("MCUBOOT_IMAGE_NUMBER", Some(if multiimage { "2" } else { "1" }));
5152

0 commit comments

Comments
 (0)