summaryrefslogtreecommitdiff
path: root/prototype/fw/tools/patch_system_init.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2020-11-24 19:00:18 +0100
committerjaseg <git@jaseg.de>2020-11-24 19:00:18 +0100
commit0bfd7efaf4256e4c2821f8796781f0d81ad08251 (patch)
treeb9c1e08032ff7b31a70cddc35ed59137db43cc9e /prototype/fw/tools/patch_system_init.py
parent7ab2d94564fdb723eefca576f8043a770f22e1f7 (diff)
downloadihsm-0bfd7efaf4256e4c2821f8796781f0d81ad08251.tar.gz
ihsm-0bfd7efaf4256e4c2821f8796781f0d81ad08251.tar.bz2
ihsm-0bfd7efaf4256e4c2821f8796781f0d81ad08251.zip
Add prototype rotor firmware skeleton
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)