aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFabien Poussin <fabien.poussin@gmail.com>2018-03-14 20:15:13 +0100
committerFabien Poussin <fabien.poussin@gmail.com>2018-03-14 20:15:13 +0100
commit424c7a2717fb6b2a847cec5c0060e3236f25e97f (patch)
treeb41f66639a1bcafa9d8ddbf8feb800d8cd7ffbbd /tools
parent1bfe2ef9f7f39d93174b1f62ac4b079aac2dea59 (diff)
downloadChibiOS-Contrib-424c7a2717fb6b2a847cec5c0060e3236f25e97f.tar.gz
ChibiOS-Contrib-424c7a2717fb6b2a847cec5c0060e3236f25e97f.tar.bz2
ChibiOS-Contrib-424c7a2717fb6b2a847cec5c0060e3236f25e97f.zip
Fixed most testhal examples for STM32, updated configs using script. Fixed deprecated MS2ST calls.
Diffstat (limited to 'tools')
-rw-r--r--tools/templates/halconf_community.h43
-rw-r--r--tools/templates/mcuconf_community.h76
-rw-r--r--tools/update_configs.py68
3 files changed, 140 insertions, 47 deletions
diff --git a/tools/templates/halconf_community.h b/tools/templates/halconf_community.h
index bed1ac8..631bb9f 100644
--- a/tools/templates/halconf_community.h
+++ b/tools/templates/halconf_community.h
@@ -84,7 +84,28 @@
* @brief Enables the TIMCAP subsystem.
*/
#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
-#define HAL_USE_COMP FALSE
+#define HAL_USE_COMP FALSE
+#endif
+
+/**
+ * @brief Enables the QEI subsystem.
+ */
+#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
+#define HAL_USE_QEI FALSE
+#endif
+
+/**
+ * @brief Enables the USBH subsystem.
+ */
+#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
+#define HAL_USE_USBH FALSE
+#endif
+
+/**
+ * @brief Enables the USB_MSD subsystem.
+ */
+#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__)
+#define HAL_USE_USB_MSD FALSE
#endif
/*===========================================================================*/
@@ -112,7 +133,25 @@
* @brief Enables search ROM feature.
* @note Disabling this option saves both code and data space.
*/
-#define ONEWIRE_USE_SEARCH_ROM FALSE
+#define ONEWIRE_USE_SEARCH_ROM TRUE
+
+/*===========================================================================*/
+/* QEI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables discard of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_DISCARD FALSE
+#endif
+
+/**
+ * @brief Enables min max of overlow
+ */
+#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__)
+#define QEI_USE_OVERFLOW_MINMAX FALSE
+#endif
/*===========================================================================*/
/* EEProm driver related settings. */
diff --git a/tools/templates/mcuconf_community.h b/tools/templates/mcuconf_community.h
index 6530c12..cf6a1ce 100644
--- a/tools/templates/mcuconf_community.h
+++ b/tools/templates/mcuconf_community.h
@@ -47,13 +47,13 @@
/*
* TIMCAP driver system settings.
*/
-#define STM32_TIMCAP_USE_TIM1 FALSE
+#define STM32_TIMCAP_USE_TIM1 TRUE
#define STM32_TIMCAP_USE_TIM2 FALSE
-#define STM32_TIMCAP_USE_TIM3 FALSE
-#define STM32_TIMCAP_USE_TIM4 FALSE
-#define STM32_TIMCAP_USE_TIM5 FALSE
-#define STM32_TIMCAP_USE_TIM8 FALSE
-#define STM32_TIMCAP_USE_TIM9 FALSE
+#define STM32_TIMCAP_USE_TIM3 TRUE
+#define STM32_TIMCAP_USE_TIM4 TRUE
+#define STM32_TIMCAP_USE_TIM5 TRUE
+#define STM32_TIMCAP_USE_TIM8 TRUE
+#define STM32_TIMCAP_USE_TIM9 TRUE
#define STM32_TIMCAP_TIM1_IRQ_PRIORITY 3
#define STM32_TIMCAP_TIM2_IRQ_PRIORITY 3
#define STM32_TIMCAP_TIM3_IRQ_PRIORITY 3
@@ -65,13 +65,13 @@
/*
* COMP driver system settings.
*/
-#define STM32_COMP_USE_COMP1 FALSE
-#define STM32_COMP_USE_COMP2 FALSE
-#define STM32_COMP_USE_COMP3 FALSE
-#define STM32_COMP_USE_COMP4 FALSE
-#define STM32_COMP_USE_COMP5 FALSE
-#define STM32_COMP_USE_COMP6 FALSE
-#define STM32_COMP_USE_COMP7 FALSE
+#define STM32_COMP_USE_COMP1 TRUE
+#define STM32_COMP_USE_COMP2 TRUE
+#define STM32_COMP_USE_COMP3 TRUE
+#define STM32_COMP_USE_COMP4 TRUE
+#define STM32_COMP_USE_COMP5 TRUE
+#define STM32_COMP_USE_COMP6 TRUE
+#define STM32_COMP_USE_COMP7 TRUE
#define STM32_COMP_USE_INTERRUPTS TRUE
#define STM32_COMP_1_2_3_IRQ_PRIORITY 5
@@ -103,3 +103,53 @@
#define STM32_USBH_MIN_QSPACE 4
#define STM32_USBH_CHANNELS_NP 4
+/*
+ * CRC driver system settings.
+ */
+#define STM32_CRC_USE_CRC1 TRUE
+#define STM32_CRC_CRC1_DMA_IRQ_PRIORITY 1
+#define STM32_CRC_CRC1_DMA_PRIORITY 2
+#define STM32_CRC_CRC1_DMA_STREAM STM32_DMA1_STREAM2
+
+#define CRCSW_USE_CRC1 FALSE
+#define CRCSW_CRC32_TABLE TRUE
+#define CRCSW_CRC16_TABLE TRUE
+#define CRCSW_PROGRAMMABLE TRUE
+
+/*
+ * EICU driver system settings.
+ */
+#define STM32_EICU_USE_TIM1 TRUE
+#define STM32_EICU_USE_TIM2 FALSE
+#define STM32_EICU_USE_TIM3 TRUE
+#define STM32_EICU_USE_TIM4 TRUE
+#define STM32_EICU_USE_TIM5 TRUE
+#define STM32_EICU_USE_TIM8 TRUE
+#define STM32_EICU_USE_TIM9 TRUE
+#define STM32_EICU_USE_TIM10 TRUE
+#define STM32_EICU_USE_TIM11 TRUE
+#define STM32_EICU_USE_TIM12 TRUE
+#define STM32_EICU_USE_TIM13 TRUE
+#define STM32_EICU_USE_TIM14 TRUE
+#define STM32_EICU_TIM1_IRQ_PRIORITY 7
+#define STM32_EICU_TIM2_IRQ_PRIORITY 7
+#define STM32_EICU_TIM3_IRQ_PRIORITY 7
+#define STM32_EICU_TIM4_IRQ_PRIORITY 7
+#define STM32_EICU_TIM5_IRQ_PRIORITY 7
+#define STM32_EICU_TIM8_IRQ_PRIORITY 7
+#define STM32_EICU_TIM9_IRQ_PRIORITY 7
+#define STM32_EICU_TIM10_IRQ_PRIORITY 7
+#define STM32_EICU_TIM11_IRQ_PRIORITY 7
+#define STM32_EICU_TIM12_IRQ_PRIORITY 7
+#define STM32_EICU_TIM13_IRQ_PRIORITY 7
+#define STM32_EICU_TIM14_IRQ_PRIORITY 7
+
+/*
+ * QEI driver system settings.
+ */
+#define STM32_QEI_USE_TIM1 TRUE
+#define STM32_QEI_USE_TIM2 FALSE
+#define STM32_QEI_USE_TIM3 TRUE
+#define STM32_QEI_TIM1_IRQ_PRIORITY 3
+#define STM32_QEI_TIM2_IRQ_PRIORITY 3
+#define STM32_QEI_TIM3_IRQ_PRIORITY 3
diff --git a/tools/update_configs.py b/tools/update_configs.py
index 637429e..6bc69b9 100644
--- a/tools/update_configs.py
+++ b/tools/update_configs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = 'Fabien Poussin'
__version__ = '0.1'
@@ -16,7 +16,6 @@ parser.add_argument('-d', '--dst', default='..', type=str, help='ChibiOS-Contrib
def makefile(lines):
-
for l in range(len(lines)):
if 'CHIBIOS =' in lines[l]:
@@ -56,45 +55,50 @@ if __name__ == '__main__':
args = parser.parse_args()
sources = {}
- for family in os.scandir(args.src + '/testhal/STM32/'):
- if not family.name[0].isupper() or not family.is_dir():
- continue
+ for folder in ['testhal']:
- for test in os.scandir(family.path):
- try:
- sources[family.name] = {'makefile': None, 'halconf': None, 'mcuconf': None}
+ for family in os.scandir(args.src + '/{}/STM32/'.format(folder)):
+ if not family.name[0].isupper() or not family.is_dir():
+ continue
- with open(test.path + '/Makefile', 'r') as file:
- sources[family.name]['makefile'] = makefile(file.readlines())
+ for test in os.scandir(family.path):
+ try:
+ sources[family.name] = {'makefile': None, 'halconf': None, 'mcuconf': None}
- with open(test.path + '/halconf.h', 'r') as file:
- sources[family.name]['halconf'] = halconf(file.readlines())
+ with open(test.path + '/Makefile', 'r') as file:
+ sources[family.name]['makefile'] = makefile(file.readlines())
- with open(test.path + '/mcuconf.h', 'r') as file:
- sources[family.name]['mcuconf'] = mcuconf(file.readlines())
+ with open(test.path + '/halconf.h', 'r') as file:
+ sources[family.name]['halconf'] = halconf(file.readlines())
- except Exception as e:
- print(test.path, e)
- del sources[family.name]
- continue
+ with open(test.path + '/mcuconf.h', 'r') as file:
+ sources[family.name]['mcuconf'] = mcuconf(file.readlines())
- break
+ except Exception as e:
+ print(test.path, e)
+ del sources[family.name]
+ continue
- print(sources.keys())
+ break
+
+ for family in os.scandir(args.dst + '/{}/STM32/'.format(folder)):
+ if not family.name[0].isupper() or not family.is_dir():
+ continue
- for family in os.scandir(args.dst + '/testhal/STM32/'):
- 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)
- 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 + '/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 + '/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'])
- 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)