aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Poussin <fabien.poussin@gmail.com>2019-10-08 18:48:33 +0200
committerFabien Poussin <fabien.poussin@gmail.com>2019-10-08 18:48:33 +0200
commit4a70bf56c86c8716d9615bfb4a83c2df58f67b95 (patch)
tree0048c4a89cf5a25bc0692293f7d952ef2cc978a6
parent8fa75239baf24fde1fea73449335ab533d2354d5 (diff)
downloadChibiOS-Contrib-4a70bf56c86c8716d9615bfb4a83c2df58f67b95.tar.gz
ChibiOS-Contrib-4a70bf56c86c8716d9615bfb4a83c2df58f67b95.tar.bz2
ChibiOS-Contrib-4a70bf56c86c8716d9615bfb4a83c2df58f67b95.zip
mx2conf arguments
-rwxr-xr-xtools/mx2conf.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/mx2conf.py b/tools/mx2conf.py
index 59247d5..771ecbf 100755
--- a/tools/mx2conf.py
+++ b/tools/mx2conf.py
@@ -7,10 +7,9 @@ from os.path import expanduser, sep, dirname, abspath
from argparse import ArgumentParser
import re
-parser = ArgumentParser(description='Generate ChibiOS GPIO header file from STM32CubeMX project files.')
-parser.add_argument('--mx', required=True, type=str, help='STM32CubeMX project file path')
-parser.add_argument('--mcu', default='mcuconf.h', type=str, help='mcuconf.h path')
-parser.add_argument('--hal', default='halconf.h', type=str, help='halconf.h path')
+parser = ArgumentParser(description='Update ChibiOS halconf and mcuconf from STM32CubeMX project files.')
+parser.add_argument('cube', type=str, help='STM32CubeMX project file')
+parser.add_argument('cfg', type=str, help='Chibios config files folder')
# Always enable
ALWAYS = ('PAL', 'EXTI')
@@ -146,13 +145,16 @@ if __name__ == '__main__':
args = parser.parse_args()
cur_path = dirname(abspath(__file__))
- with open(args.mx, 'r') as f:
+ halconf_path = args.cfg + '/halconf.h'
+ mcuconf_path = args.cfg + '/mcuconf.h'
+
+ with open(args.cube, 'r') as f:
project = f.readlines()
- with open(args.hal, 'r') as f:
+ with open(halconf_path, 'r') as f:
halconf = f.readlines()
- with open(args.mcu, 'r') as f:
+ with open(mcuconf_path, 'r') as f:
mcuconf = f.readlines()
hal_devices = get_hal_devices(halconf)
@@ -164,11 +166,11 @@ if __name__ == '__main__':
# Update and save halconf
halconf = update_hal(halconf, enabled_drivers)
- with open(args.hal, 'w') as f:
+ with open(halconf_path, 'w') as f:
f.write("".join(halconf))
# Update and save mcuconf drivers
mcuconf = update_drivers(mcuconf, enabled_drivers)
mcuconf = update_rcc(mcuconf, rcc)
- with open(args.mcu, 'w') as f:
+ with open(mcuconf_path, 'w') as f:
f.write("".join(mcuconf))