summaryrefslogtreecommitdiff
path: root/prototype/fw/tools/patch_system_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'prototype/fw/tools/patch_system_init.py')
-rw-r--r--prototype/fw/tools/patch_system_init.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/prototype/fw/tools/patch_system_init.py b/prototype/fw/tools/patch_system_init.py
new file mode 100644
index 0000000..1c83f5e
--- /dev/null
+++ b/prototype/fw/tools/patch_system_init.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+if __name__ == '__main__':
+ import argparse
+ parser = argparse.ArgumentParser()
+ parser.add_argument('input', type=argparse.FileType('r'), help='Input stm32****_system.c file')
+ args = parser.parse_args()
+
+ print('/* AUTOGENERATED FILE! Do not edit! */')
+ print('/* This file was automatically patched by tools/patch_system_init.py */')
+ print()
+ print('extern unsigned int g_pfnVectors;')
+ print()
+
+ for line in args.input:
+ if line.strip().startswith('SCB->VTOR'):
+ print(' SCB->VTOR = (uint32_t)&g_pfnVectors;')
+ else:
+ print(line)