Skip to content

Commit

Permalink
xtask: require kernel flash/RAM to be 0 mod 4
Browse files Browse the repository at this point in the history
Our linker scripts all assume that things are aligned to at least 32-bit
boundaries. Right now, if you configure an lpc55 target (at least) with
a kernel flash size that isn't a multiple of 4, you get an obscure error
from the linker late in the build process.

That's annoying because (1) it happens late, so iteration time is slow,
and (2) linker errors are designed by space aliens to confuse humanity,
or so I've inferred.

This adds an explicit check and early failure for the case.
  • Loading branch information
cbiffle committed Mar 22, 2024
1 parent b44e677 commit 4d268d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/xtask/src/config.rs
Expand Up @@ -124,6 +124,12 @@ impl Config {
bail!("'kernel' is reserved and cannot be used as a task name");
}

for (name, size) in &toml.kernel.requires {
if (size % 4) != 0 {
bail!("kernel region '{name}' not a multiple of 4: {size}");
}
}

// The app.toml must include a `chip` key, which defines the peripheral
// register map in a separate file. We load it then accumulate that
// file in the buildhash.
Expand Down

0 comments on commit 4d268d9

Please sign in to comment.