aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-12-31 08:27:39 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-12-31 08:27:39 +0000
commitcab5dcae560231dab06bf93d46e119ae31c6aed5 (patch)
treef66cc85440404b3ff49f41e29123362ee977d1d1
parenteb3eac8fea79a78fc595c9bc13da99fedfa1bc20 (diff)
downloadChibiOS-cab5dcae560231dab06bf93d46e119ae31c6aed5.tar.gz
ChibiOS-cab5dcae560231dab06bf93d46e119ae31c6aed5.tar.bz2
ChibiOS-cab5dcae560231dab06bf93d46e119ae31c6aed5.zip
Fixed bug bug #994.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12500 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c36
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h42
-rw-r--r--readme.txt2
-rw-r--r--testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Just Run).launch2
4 files changed, 39 insertions, 43 deletions
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c
index 2cf7d7ed2..71b2251ec 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c
@@ -43,12 +43,6 @@
#error "TIM2 is not a 32bits timer"
#endif
-#if defined(STM32_TIM2_IS_USED)
-#error "ST requires TIM2 but the timer is already used"
-#else
-#define STM32_TIM2_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM2_HANDLER
#define ST_NUMBER STM32_TIM2_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@@ -68,12 +62,6 @@
#error "TIM3 is not a 32bits timer"
#endif
-#if defined(STM32_TIM3_IS_USED)
-#error "ST requires TIM3 but the timer is already used"
-#else
-#define STM32_TIM3_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM3_HANDLER
#define ST_NUMBER STM32_TIM3_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@@ -93,12 +81,6 @@
#error "TIM4 is not a 32bits timer"
#endif
-#if defined(STM32_TIM4_IS_USED)
-#error "ST requires TIM4 but the timer is already used"
-#else
-#define STM32_TIM4_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM4_HANDLER
#define ST_NUMBER STM32_TIM4_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@@ -118,12 +100,6 @@
#error "TIM5 is not a 32bits timer"
#endif
-#if defined(STM32_TIM5_IS_USED)
-#error "ST requires TIM5 but the timer is already used"
-#else
-#define STM32_TIM5_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM5_HANDLER
#define ST_NUMBER STM32_TIM5_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK1
@@ -143,12 +119,6 @@
#error "TIM21 is not a 32bits timer"
#endif
-#if defined(STM32_TIM21_IS_USED)
-#error "ST requires TIM21 but the timer is already used"
-#else
-#define STM32_TIM21_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM21_HANDLER
#define ST_NUMBER STM32_TIM21_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
@@ -160,12 +130,6 @@
#error "TIM21 is not a 32bits timer"
#endif
-#if defined(STM32_TIM22_IS_USED)
-#error "ST requires TIM22 but the timer is already used"
-#else
-#define STM32_TIM22_IS_USED
-#endif
-
#define ST_HANDLER STM32_TIM22_HANDLER
#define ST_NUMBER STM32_TIM22_NUMBER
#define ST_CLOCK_SRC STM32_TIMCLK2
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h b/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h
index e9e1a83c8..f1564c47d 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h
@@ -91,37 +91,67 @@
#if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
-#error "TIM2 not present"
+#error "TIM2 not present in the selected device"
+#endif
+#if defined(STM32_TIM2_IS_USED)
+#error "ST requires TIM2 but the timer is already used"
+#else
+#define STM32_TIM2_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM2
#elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
-#error "TIM3 not present"
+#error "TIM3 not present in the selected device"
+#endif
+#if defined(STM32_TIM3_IS_USED)
+#error "ST requires TIM3 but the timer is already used"
+#else
+#define STM32_TIM3_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM3
#elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
-#error "TIM4 not present"
+#error "TIM4 not present in the selected device"
+#endif
+#if defined(STM32_TIM4_IS_USED)
+#error "ST requires TIM4 but the timer is already used"
+#else
+#define STM32_TIM4_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM4
#elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
-#error "TIM5 not present"
+#error "TIM5 not present in the selected device"
+#endif
+#if defined(STM32_TIM5_IS_USED)
+#error "ST requires TIM5 but the timer is already used"
+#else
+#define STM32_TIM5_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM5
#elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21
-#error "TIM21 not present"
+#error "TIM21 not present in the selected device"
+#endif
+#if defined(STM32_TIM21_IS_USED)
+#error "ST requires TIM21 but the timer is already used"
+#else
+#define STM32_TIM21_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM21
#elif STM32_ST_USE_TIMER == 22
#if !STM32_HAS_TIM22
-#error "TIM22 not present"
+#error "TIM22 not present in the selected device"
+#endif
+#if defined(STM32_TIM22_IS_USED)
+#error "ST requires TIM22 but the timer is already used"
+#else
+#define STM32_TIM22_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM22
diff --git a/readme.txt b/readme.txt
index 362089019..278c35072 100644
--- a/readme.txt
+++ b/readme.txt
@@ -184,6 +184,8 @@
- EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
+- HAL: Fixed misplaced check in STM32 ST driver (bug #994)
+ (backported to 18.2.2 and 17.6.5).
- OTH: Fixed ARM CMx vectors table without thumb bit set for unused vectors
(bug #993)(backported to 18.2.2).
- HAL: Fixed STM32F7xx I2SPLL not fully initialized (bug #992)
diff --git a/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Just Run).launch b/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Just Run).launch
index d2789a8e9..1a9bdb0f6 100644
--- a/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Just Run).launch
+++ b/testhal/STM32/multi/ADC/debug/STM32-ADC (Select ELF file)(OpenOCD, Just Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;CR-dac-params-dacp-dac_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;xPSR-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;CR-dac-params-dacp-dac_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList&gt;&#10;&lt;memoryBlockExpressionItem&gt;&#10;&lt;expression text=&quot;0x40021004&quot;/&gt;&#10;&lt;/memoryBlockExpressionItem&gt;&#10;&lt;/memoryBlockExpressionList&gt;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${selected_resource_loc}"/>