From 0bfd7efaf4256e4c2821f8796781f0d81ad08251 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 24 Nov 2020 19:00:18 +0100 Subject: Add prototype rotor firmware skeleton --- prototype/fw/tools/patch_system_init.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 prototype/fw/tools/patch_system_init.py (limited to 'prototype/fw/tools/patch_system_init.py') 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) -- cgit