summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 02:29:41 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 02:29:41 -0700
commit25930f0607fb8d16ad66203c919dd26133cd0702 (patch)
treef055bbc2dddbe13ddc0da9328f1e548fb61a0ce0
parent5af4f296b28c475569c30235ce660df01e773731 (diff)
Work on stack analysis
-rwxr-xr-xbuild-aux/stack.c.gen19
-rw-r--r--cmd/sbc_harness/CMakeLists.txt2
2 files changed, 17 insertions, 4 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index 5e7bd7e..80bea85 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -176,15 +176,24 @@ def main(ci_fnames: list[str]) -> None:
handle_elem(elem)
missing: set[str] = set()
+ cycles: set[str] = set()
print("/*")
- def nstatic(funcname: str) -> int:
+ def nstatic(funcname: str, chain: list[str] = []) -> int:
if funcname not in graph:
- missing.add(funcname)
- return 0
+ if f"__wrap_{funcname}" in graph:
+ funcname = f"__wrap_{funcname}"
+ else:
+ missing.add(funcname)
+ return 0
+ if funcname in chain:
+ cycles.add(f"{chain[chain.index(funcname):] + [funcname]}")
+ return 9999999
node = graph[funcname]
- return node.nstatic + max([0, *[nstatic(call) for call in node.calls]])
+ return node.nstatic + max(
+ [0, *[nstatic(call, chain + [funcname]) for call in node.calls]]
+ )
namelen = max(len(name) for name in graph if name.endswith("_cr"))
print(("=" * namelen) + " =======")
@@ -197,6 +206,8 @@ def main(ci_fnames: list[str]) -> None:
for funcname in sorted(missing):
print(f"{funcname}\tmissing")
+ for cycle in sorted(cycles):
+ print(f"cycle: {cycle}")
print("*/")
diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt
index 06444d2..ec28446 100644
--- a/cmd/sbc_harness/CMakeLists.txt
+++ b/cmd/sbc_harness/CMakeLists.txt
@@ -22,6 +22,8 @@ target_link_libraries(sbc_harness_objs
libdhcp
libhw
)
+set_target_properties(sbc_harness_objs PROPERTIES PICO_TARGET_FLOAT_IMPL "pico_float_none") # default (pico), compiler, pico, none
+set_target_properties(sbc_harness_objs PROPERTIES PICO_TARGET_DOUBLE_IMPL "pico_double_none") # default (pico), compiler, pico, none
pico_enable_stdio_usb(sbc_harness_objs 0)
pico_enable_stdio_uart(sbc_harness_objs 1)
pico_enable_stdio_semihosting(sbc_harness_objs 0)