Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ start = true
features = ["h743"]
priority = 3
name = "drv-stm32h7-rng"
stacksize = 256
stacksize = 512
start = true
task-slots = ["sys", "user_leds"]
uses = ["rng"]
Expand Down
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h753.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ start = true
features = ["h753"]
priority = 3
name = "drv-stm32h7-rng"
stacksize = 256
stacksize = 512
start = true
task-slots = ["sys", "user_leds"]
uses = ["rng"]
Expand Down
2 changes: 1 addition & 1 deletion app/gemini-bu/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ name = "drv-stm32h7-rng"
priority = 6
uses = ["rng"]
start = true
stacksize = 256
stacksize = 512
task-slots = ["sys", "user_leds"]

[tasks.update_server]
Expand Down
2 changes: 1 addition & 1 deletion app/gimletlet/base-gimletlet2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ name = "drv-stm32h7-rng"
priority = 6
uses = ["rng"]
start = true
stacksize = 256
stacksize = 512
task-slots = ["sys", "user_leds"]

[tasks.update_server]
Expand Down
2 changes: 1 addition & 1 deletion app/sidecar/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ name = "drv-stm32h7-rng"
priority = 6
uses = ["rng"]
start = true
stacksize = 256
stacksize = 512
task-slots = ["sys"]

[tasks.update_server]
Expand Down
11 changes: 9 additions & 2 deletions build/xtask/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,17 +1236,24 @@ pub fn get_max_stack(
}
chunks.extend(chunk); // don't forget the trailing chunk!

let frame_size = addr_to_frame_size.get(&base_addr).copied();
let mut calls = BTreeSet::new();
for (addr, chunk) in chunks {
let instrs = cs
.disasm_all(&chunk, addr.into())
.map_err(|e| anyhow!("disassembly failed: {e:?}"))?;
for instr in instrs.iter() {
for (i, instr) in instrs.iter().enumerate() {
let detail = cs.insn_detail(instr).map_err(|e| {
anyhow!("could not get instruction details: {e}")
})?;

// Detect tail calls, which are jumps at the final instruction
// when the function itself has no stack frame.
let can_tail = frame_size == Some(0) && i == instrs.len() - 1;
if detail.groups().iter().any(|g| {
g == &InsnGroupId(InsnGroupType::CS_GRP_CALL as u8)
|| (g == &InsnGroupId(InsnGroupType::CS_GRP_JUMP as u8)
&& can_tail)
}) {
let arch = detail.arch_detail();
let ops = arch.operands();
Expand Down Expand Up @@ -1290,7 +1297,7 @@ pub fn get_max_stack(
FunctionData {
name,
short_name,
frame_size: addr_to_frame_size.get(&base_addr).map(|i| *i),
frame_size,
calls,
},
);
Expand Down