diff options
author | Diego Ismirlian <dismirlian@gmail.com> | 2019-10-02 11:38:05 -0300 |
---|---|---|
committer | Diego Ismirlian <dismirlian@gmail.com> | 2019-10-02 11:38:05 -0300 |
commit | 6f817a029807c07668d41b33faa3512df129710a (patch) | |
tree | 9502da2e070e245b51af4ed51b8c681fe13df416 /tools | |
parent | d685cfd0c27252b77fe3cb5416d3921f37033e81 (diff) | |
parent | 51910c3551c2a4232ba3defcef063e2f745f925a (diff) | |
download | ChibiOS-Contrib-6f817a029807c07668d41b33faa3512df129710a.tar.gz ChibiOS-Contrib-6f817a029807c07668d41b33faa3512df129710a.tar.bz2 ChibiOS-Contrib-6f817a029807c07668d41b33faa3512df129710a.zip |
Merge branch 'master' of https://github.com/ChibiOS/ChibiOS-Contrib
Diffstat (limited to 'tools')
-rw-r--r-- | tools/templates/halconf_community.h | 9 | ||||
-rw-r--r-- | tools/templates/mcuconf_community.h | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | tools/update_configs.py | 213 |
3 files changed, 127 insertions, 105 deletions
diff --git a/tools/templates/halconf_community.h b/tools/templates/halconf_community.h index 631bb9f..0083cc9 100644 --- a/tools/templates/halconf_community.h +++ b/tools/templates/halconf_community.h @@ -81,13 +81,20 @@ #endif
/**
- * @brief Enables the TIMCAP subsystem.
+ * @brief Enables the COMP subsystem.
*/
#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
#define HAL_USE_COMP FALSE
#endif
/**
+ * @brief Enables the OPAMP subsystem.
+ */
+#if !defined(HAL_USE_OPAMP) || defined(__DOXYGEN__)
+#define HAL_USE_OPAMP FALSE
+#endif
+
+/**
* @brief Enables the QEI subsystem.
*/
#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
diff --git a/tools/templates/mcuconf_community.h b/tools/templates/mcuconf_community.h index 1ebe24c..b862d6e 100644 --- a/tools/templates/mcuconf_community.h +++ b/tools/templates/mcuconf_community.h @@ -87,6 +87,16 @@ #endif /* + * OPAMP driver system settings. + */ + +#define STM32_OPAMP_USE_OPAMP1 TRUE +#define STM32_OPAMP_USE_OPAMP2 TRUE +#define STM32_OPAMP_USE_OPAMP3 TRUE +#define STM32_OPAMP_USE_OPAMP4 TRUE +#define STM32_OPAMP_USER_TRIM_ENABLED TRUE + +/* * USBH driver system settings. */ #define STM32_OTG1_CHANNELS_NUMBER 8 diff --git a/tools/update_configs.py b/tools/update_configs.py index 6bc69b9..b12a24a 100644..100755 --- a/tools/update_configs.py +++ b/tools/update_configs.py @@ -1,104 +1,109 @@ -#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-__author__ = 'Fabien Poussin'
-__version__ = '0.1'
-
-import os
-import re
-from argparse import ArgumentParser
-from traceback import print_exc
-from shutil import copy
-
-parser = ArgumentParser(description='Generate ChibiOS-Contrib config and make files from ChibiOS')
-parser.add_argument('-s', '--src', default='../../ChibiOS-RT', type=str, help="ChibiOS folder")
-parser.add_argument('-d', '--dst', default='..', type=str, help='ChibiOS-Contrib folder')
-
-
-def makefile(lines):
-
- for l in range(len(lines)):
-
- if 'CHIBIOS =' in lines[l]:
- lines[l] = lines[l][:-1] + '/../ChibiOS-RT\n'
- lines.insert(l + 1, 'CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib\n')
-
- if '$(CHIBIOS)/os/hal/hal.mk' in lines[l] \
- or '$(CHIBIOS)/os/hal/ports/' in lines[l] \
- or '$(CHIBIOS)/os/various' in lines[l] :
- lines[l] = lines[l].replace('CHIBIOS', 'CHIBIOS_CONTRIB')
-
- return "".join(lines)
-
-
-def halconf(lines):
-
- idx_end = lines.index('#endif /* HALCONF_H */\n')
- lines.insert(idx_end - 1, '\n')
- lines.insert(idx_end - 1, '#include "halconf_community.h"')
- lines.insert(idx_end - 1, '\n')
-
- return "".join(lines)
-
-
-def mcuconf(lines):
-
- idx_end = lines.index('#endif /* MCUCONF_H */\n')
- lines.insert(idx_end - 1, '\n')
- lines.insert(idx_end - 1, '#include "mcuconf_community.h"')
- lines.insert(idx_end - 1, '\n')
-
- return "".join(lines)
-
-
-if __name__ == '__main__':
-
- args = parser.parse_args()
- sources = {}
-
- for folder in ['testhal']:
-
- for family in os.scandir(args.src + '/{}/STM32/'.format(folder)):
- if not family.name[0].isupper() or not family.is_dir():
- continue
-
- for test in os.scandir(family.path):
- try:
- sources[family.name] = {'makefile': None, 'halconf': None, 'mcuconf': None}
-
- with open(test.path + '/Makefile', 'r') as file:
- sources[family.name]['makefile'] = makefile(file.readlines())
-
- with open(test.path + '/halconf.h', 'r') as file:
- sources[family.name]['halconf'] = halconf(file.readlines())
-
- with open(test.path + '/mcuconf.h', 'r') as file:
- sources[family.name]['mcuconf'] = mcuconf(file.readlines())
-
- except Exception as e:
- print(test.path, e)
- del sources[family.name]
- continue
-
- break
-
- for family in os.scandir(args.dst + '/{}/STM32/'.format(folder)):
- if not family.name[0].isupper() or not family.is_dir():
- continue
-
- for test in os.scandir(family.path):
- copy('templates/halconf_community.h', test.path)
- copy('templates/mcuconf_community.h', test.path)
-
- try:
- with open(test.path + '/Makefile', 'w') as file:
- file.write(sources[family.name]['makefile'])
-
- with open(test.path + '/halconf.h', 'w') as file:
- file.write(sources[family.name]['halconf'])
-
- with open(test.path + '/mcuconf.h', 'w') as file:
- file.write(sources[family.name]['mcuconf'])
-
- print('updated', test.path)
- except KeyError as e:
- print('Missing family data', e)
+#!/usr/bin/python3 +# -*- coding: utf-8 -*- +__author__ = 'Fabien Poussin' +__version__ = '0.1' + +import os +import re +from argparse import ArgumentParser +from traceback import print_exc +from shutil import copy + +parser = ArgumentParser(description='Generate ChibiOS-Contrib config and Makefiles from ChibiOS') +parser.add_argument('-s', '--src', default='../../ChibiOS', type=str, help="ChibiOS folder") +parser.add_argument('-d', '--dst', default='..', type=str, help='ChibiOS-Contrib folder') + +FOLDERS = ['testhal'] + +def makefile(lines): + + for l in range(len(lines)): + + if 'CHIBIOS =' in lines[l]: + lines[l] = lines[l][:-1] + '/../ChibiOS\n' + lines.insert(l + 1, 'CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib\n') + + if '$(CHIBIOS)/os/hal/hal.mk' in lines[l] \ + or '$(CHIBIOS)/os/hal/ports/' in lines[l]: + lines[l] = lines[l].replace('CHIBIOS', 'CHIBIOS_CONTRIB') + + return "".join(lines) + + +def halconf(lines): + + idx_end = lines.index('#endif /* HALCONF_H */\n') + lines.insert(idx_end - 1, '\n') + lines.insert(idx_end - 1, '#include "halconf_community.h"') + lines.insert(idx_end - 1, '\n') + + return "".join(lines) + + +def mcuconf(lines): + + idx_end = lines.index('#endif /* MCUCONF_H */\n') + lines.insert(idx_end - 1, '\n') + lines.insert(idx_end - 1, '#include "mcuconf_community.h"') + lines.insert(idx_end - 1, '\n') + + return "".join(lines) + +if __name__ == '__main__': + + args = parser.parse_args() + sources = {} + + for folder in FOLDERS: + + for family in os.scandir(args.src + '/{}/STM32/'.format(folder)): + if not family.name[0].isupper() or not family.is_dir(): + continue + + for test in os.scandir(family.path): + try: + sources[family.name] = {'makefile': None, 'halconf': None, 'mcuconf': None, 'chconf': None} + + with open(test.path + '/Makefile', 'r') as file: + sources[family.name]['makefile'] = makefile(file.readlines()) + + with open(test.path + '/chconf.h', 'r') as file: + sources[family.name]['chconf'] = file.read() + + with open(test.path + '/halconf.h', 'r') as file: + sources[family.name]['halconf'] = halconf(file.readlines()) + + with open(test.path + '/mcuconf.h', 'r') as file: + sources[family.name]['mcuconf'] = mcuconf(file.readlines()) + + except Exception as e: + print(test.path, e) + del sources[family.name] + continue + + break + + for family in os.scandir(args.dst + '/{}/STM32/'.format(folder)): + if not family.name[0].isupper() or not family.is_dir(): + continue + + for test in os.scandir(family.path): + copy('templates/halconf_community.h', test.path) + copy('templates/mcuconf_community.h', test.path) + + try: + with open(test.path + '/Makefile', 'w') as file: + file.write(sources[family.name]['makefile']) + + with open(test.path + '/chconf.h', 'w') as file: + file.write(sources[family.name]['chconf']) + + with open(test.path + '/halconf.h', 'w') as file: + file.write(sources[family.name]['halconf']) + + with open(test.path + '/mcuconf.h', 'w') as file: + file.write(sources[family.name]['mcuconf']) + + print('updated', test.path) + except KeyError as e: + print('Missing family data', e) |