adds ISR check that is closer to productive code

This approach patches the existing trap handler to call the test routine
This commit is contained in:
2026-03-21 20:27:16 +01:00
parent 8bcbc9881e
commit 7307a86860
3 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
#!/bin/bash
set -eu
src="$1"
dst="$2"
extern_anchor='extern void _tx_timer_interrupt(void);'
call_anchor='_tx_timer_interrupt();'
line=$(grep -n -F "$extern_anchor" "$src" | head -n 1 | cut -d: -f1)
if [ -z "$line" ]; then
echo "failed to find _tx_timer_interrupt declaration anchor in trap source" >&2
exit 1
fi
sed "${line}a\\
extern void test_interrupt_dispatch(void);" "$src" > "$dst.tmp1"
line=$(grep -n -F "$call_anchor" "$dst.tmp1" | head -n 1 | cut -d: -f1)
if [ -z "$line" ]; then
echo "failed to find _tx_timer_interrupt call anchor in trap source" >&2
rm -f "$dst.tmp1"
exit 1
fi
mkdir -p "$(dirname "$dst")"
sed "${line}i\\
test_interrupt_dispatch();" "$dst.tmp1" > "$dst"
rm -f "$dst.tmp1"