Skip to content

Commit 775ed88

Browse files
authored
Check that flash/ram is power of two (#97)
Check that flash/ram is power of two
1 parent 708ac61 commit 775ed88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

xtask/src/dist.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,14 @@ fn make_descriptors(
593593
// The remaining regions are allocated to tasks on a first-come first-serve
594594
// basis.
595595
for (i, (name, task)) in tasks.iter().enumerate() {
596+
if power_of_two_required && !task.requires["flash"].is_power_of_two() {
597+
panic!("Flash for task '{}' is required to be a power of two, but has size {}", task.name, task.requires["flash"]);
598+
}
599+
600+
if power_of_two_required && !task.requires["ram"].is_power_of_two() {
601+
panic!("Ram for task '{}' is required to be a power of two, but has size {}", task.name, task.requires["flash"]);
602+
}
603+
596604
// Regions are referenced by index into the table we just generated.
597605
// Each task has up to 8, chosen from its 'requires' and 'uses' keys.
598606
let mut task_regions = [0; 8];

0 commit comments

Comments
 (0)