From 21bdc4ad135b6e6187ce85af0035c69358a78688 Mon Sep 17 00:00:00 2001 From: victorpv Date: Thu, 5 Apr 2018 21:54:05 -0500 Subject: [PATCH] Update to fix FSMC inclusion in Rx devices The FSMC is only available in high density and XL density devices with more than 4 ports. Basically excluded in the RC/D/E/F/G models, since they dont have enough pins. Page 11 in the Datasheet references this. The table shows what is present, and shows the FSMC is NOT present in Rx MCUs: http://www.st.com/content/ccc/resource/technical/document/datasheet/59/f6/fa/84/20/4e/4c/59/CD00191185.pdf/files/CD00191185.pdf/jcr:content/translations/en.CD00191185.pdf Recent changes to other files highlight this issue during compilation time. The issue was already there, but GPIO E and GPIO F were declared and defined, while they don't actually exist in Rx MCUs, so FSMC was being included for those MCU even though they don't actually have an FSMC device, or at least no external ports to use it. With the recent changes GPIO E and F and correctly excluded from the build, but since FSMC was still included and needs GPIO E and F, it was failing to compile. I.e.: C:/Users/Victor/Documents/Arduino/Hardware/Arduino_STM32/STM32F1/cores/maple/libmaple/fsmc_f1.c:51:19: error: 'GPIOE' undeclared (first use in this function) Since the FSMC is not available (I suspect the silicon is there, but there is no IO pins to use it), the correct solution is to include FSMC only when using an MCU with more than 4 GPIO ports, which is what matches the datasheet. --- STM32F1/system/libmaple/stm32f1/include/series/stm32.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/STM32F1/system/libmaple/stm32f1/include/series/stm32.h b/STM32F1/system/libmaple/stm32f1/include/series/stm32.h index 9386dc3..467d308 100644 --- a/STM32F1/system/libmaple/stm32f1/include/series/stm32.h +++ b/STM32F1/system/libmaple/stm32f1/include/series/stm32.h @@ -185,12 +185,16 @@ extern "C" { # elif defined(STM32_HIGH_DENSITY) # define STM32_NR_INTERRUPTS 60 # define STM32_TIMER_MASK 0x1FE /* TIMER1--TIMER8 */ -# define STM32_HAVE_FSMC 1 +# if STM32_NR_GPIO_PORTS > 4 +# define STM32_HAVE_FSMC 1 +# endif # define STM32_HAVE_DAC 1 # elif defined(STM32_XL_DENSITY) # define STM32_NR_INTERRUPTS 60 # define STM32_TIMER_MASK 0x7FFE /* TIMER1--TIMER14 */ -# define STM32_HAVE_FSMC 1 +# if STM32_NR_GPIO_PORTS > 4 +# define STM32_HAVE_FSMC 1 +# endif # define STM32_HAVE_DAC 1 # endif