summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-26 14:26:28 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-02 13:30:55 -0700
commit8dc86e5ec58ec94f7ea8227ee008ded202c4204f (patch)
tree02ab6704d2ad5698c45981162cc2c192ebdee9db /build-aux
parent0110cae147d8b1749b4bd5763620ec73d5296a76 (diff)
libhw: Add rp2040_gpioirq, use it
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/lint-bin20
-rwxr-xr-xbuild-aux/stack.c.gen16
2 files changed, 23 insertions, 13 deletions
diff --git a/build-aux/lint-bin b/build-aux/lint-bin
index 0b955de..c487f36 100755
--- a/build-aux/lint-bin
+++ b/build-aux/lint-bin
@@ -25,7 +25,7 @@ RESET=$(tput sgr0)
err() {
printf "${RED}%s${RESET}: %s\n" "$1" "$2" >&2
- #r=1
+ r=1
}
# Input is `ld --print-map` format.
@@ -107,6 +107,21 @@ lint_stack() {
<(readelf_funcs "$in_elffile" | sed 's/\.part\.[0-9]*$//' | sort -u))
}
+lint_func_blocklist() {
+ local in_elffile
+ in_elffile=$1
+
+ local blocklist=(
+ gpio_default_irq_handler
+ )
+
+ while read -r func; do
+ err "$in_elffile" "Contains blocklisted function: ${func}"
+ done < <(readelf --syms --wide -- "$in_elffile" |
+ awk '$4 == "FUNC" { print $8 }' |
+ grep -Fx "${blocklist[@]/#/-e}")
+}
+
main() {
r=0
@@ -116,7 +131,8 @@ main() {
echo 'Global variables:'
lint_globals "${elf}.map" | sed 's/^/ /'
} > "${elf%.elf}.lint.globals"
- lint_stack "$elf" &> "${elf%.elf}.lint.stack"
+ (lint_stack "$elf") &> "${elf%.elf}.lint.stack"
+ lint_func_blocklist "$elf"
done
return $r
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index c73a8bb..66d837a 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -504,6 +504,7 @@ class LibHWPlugin:
"rp2040_hwtimer_intrhandler",
"hostclock_handle_sig_alarm",
"hostnet_handle_sig_io",
+ "gpioirq_handler",
]
def extra_nodes(self) -> typing.Collection[Node]:
@@ -522,6 +523,10 @@ class LibHWPlugin:
"w5500_udp_alarm_handler",
]
return ret, False
+ if "/rp2040_gpioirq.c:" in loc and "handler->fn" in line:
+ return [
+ "w5500_intrhandler",
+ ], False
return None
def skip_call(self, chain: list[str], call: str) -> bool:
@@ -711,17 +716,14 @@ class LibMiscPlugin:
class PicoSDKPlugin:
- app_gpio_handlers: typing.Collection[str]
app_init_array: typing.Collection[str]
app_preinit_array: typing.Collection[str]
def __init__(
self,
*,
- app_gpio_handlers: typing.Collection[str],
app_init_array: typing.Collection[str],
) -> None:
- self.app_gpio_handlers = app_gpio_handlers
self.app_init_array = app_init_array
# git grep '^PICO_RUNTIME_INIT_FUNC\S*('
@@ -754,7 +756,6 @@ class PicoSDKPlugin:
def is_intrhandler(self, name: str) -> bool:
return name in [
- "gpio_default_irq_handler",
"isr_invalid",
"isr_nmi",
"isr_hardfault",
@@ -783,8 +784,6 @@ class PicoSDKPlugin:
return ["rom_hword_as_ptr(BOOTROM_TABLE_LOOKUP_OFFSET)"], False
if "/flash.c:" in loc and "boot2_copyout" in line:
return ["_stage2_boot"], False
- if "/gpio.c:" in loc and call == "callback":
- return sorted(self.app_gpio_handlers), False
if "/printf.c:" in loc:
if call == "out":
return [
@@ -1137,10 +1136,6 @@ def main(
lib9p_plugin = Lib9PPlugin(arg_base_dir, arg_c_fnames)
- sbc_gpio_handlers = [
- "w5500_intrhandler",
- ]
-
def sbc_is_thread(name: str) -> int:
if name.endswith("_cr") and name != "lib9p_srv_read_cr":
if "9p" in name:
@@ -1165,7 +1160,6 @@ def main(
if arg_pico_platform == "rp2040":
plugins += [
PicoSDKPlugin(
- app_gpio_handlers=sbc_gpio_handlers,
app_init_array=["register_fini"],
),
TinyUSBDevicePlugin(arg_c_fnames),