aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-11-16 10:17:06 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-11-16 10:17:06 +0000
commit94e6acd97233a4633aed56ec8e71f16654ba01c1 (patch)
tree419db3bf85bc0d02b4f96c3c2aed34e7599d7ce1 /os/hal/platforms
parentd06741a098e70be8e92006bf39680709ad3676e0 (diff)
downloadChibiOS-94e6acd97233a4633aed56ec8e71f16654ba01c1.tar.gz
ChibiOS-94e6acd97233a4633aed56ec8e71f16654ba01c1.tar.bz2
ChibiOS-94e6acd97233a4633aed56ec8e71f16654ba01c1.zip
Fixed bug 3586425.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4826 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms')
-rw-r--r--os/hal/platforms/STM32F4xx/hal_lld.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32F4xx/hal_lld.c b/os/hal/platforms/STM32F4xx/hal_lld.c
index e3cf144e1..521a1723a 100644
--- a/os/hal/platforms/STM32F4xx/hal_lld.c
+++ b/os/hal/platforms/STM32F4xx/hal_lld.c
@@ -208,9 +208,14 @@ void stm32_clock_init(void) {
RCC->CFGR |= STM32_MCO2PRE | STM32_MCO2SEL | STM32_MCO1PRE | STM32_MCO1SEL |
STM32_RTCPRE | STM32_PPRE2 | STM32_PPRE1 | STM32_HPRE;
- /* Flash setup.*/
- FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN | FLASH_ACR_DCEN |
- STM32_FLASHBITS;
+ /* Flash setup.
+ Some old revisions of F4x MCUs randomly crashes with compiler
+ optimizations enabled AND flash caches enabled. */
+ if ((DBGMCU->IDCODE == 0x20006411) && (SCB->CPUID == 0x410FC241))
+ FLASH->ACR = FLASH_ACR_PRFTEN | STM32_FLASHBITS;
+ else
+ FLASH->ACR = FLASH_ACR_PRFTEN | FLASH_ACR_ICEN |
+ FLASH_ACR_DCEN | STM32_FLASHBITS;
/* Switching to the configured clock source if it is different from MSI.*/
#if (STM32_SW != STM32_SW_HSI)