diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-06 17:24:17 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-09 03:09:22 -0600 |
commit | 638317a18ce4562440fc3fba95c1cb9f33b5affa (patch) | |
tree | f22e61a460a4eb4b1887fbe0f3f75b61d25bae2e | |
parent | 86d4320a0a8c2987f3f5ec39079c293fb086d9da (diff) |
stack.c.gen: APP: Factor in stack guard size
-rwxr-xr-x | build-aux/stack.c.gen | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen index 576e446..11c5854 100755 --- a/build-aux/stack.c.gen +++ b/build-aux/stack.c.gen @@ -1470,10 +1470,11 @@ def main( print_group("Interrupt handlers") print("*/") overhead = max(v.nstatic for v in result.groups["Interrupt handlers"].rows.values()) + stack_guard_size = 16 * 2 rows: list[tuple[str, int, int]] = [] for funcname, val in result.groups["Threads"].rows.items(): base = val.nstatic - size = next_power_of_2(base + overhead) + size = next_power_of_2(base + overhead + stack_guard_size) - stack_guard_size rows.append((str(funcname.base()), base, size)) namelen = max(len(r[0]) for r in rows) baselen = max(len(str(r[1])) for r in rows) @@ -1484,7 +1485,9 @@ def main( print("const size_t CONFIG_COROUTINE_STACK_SIZE_", end="") print(f"{row[0].ljust(namelen)} =", end="") print(f" {str(row[2]).rjust(sizelen)};", end="") - print(f" /* LM_NEXT_POWER_OF_2({str(row[1]).rjust(baselen)}+{overhead}) */") + print( + f" /* LM_NEXT_POWER_OF_2({str(row[1]).rjust(baselen)}+{overhead}+{stack_guard_size})-{stack_guard_size} */" + ) print() print("/*") print_group("Misc") |