Skip to content

Commit 5b510a3

Browse files
committed
F2 CUBE V1.6.0
This PR updates STM32 Cube SDK to - HAL V1.2.1 - LL V1.2.1 - CMSIS 2.2.0
1 parent 3122abe commit 5b510a3

File tree

138 files changed

+65622
-12490
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+65622
-12490
lines changed

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/stm32f207xx.h

Lines changed: 12491 additions & 5767 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/stm32f2xx.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
******************************************************************************
33
* @file stm32f2xx.h
44
* @author MCD Application Team
5-
* @version V2.1.2
6-
* @date 29-June-2016
5+
* @version V2.2.0
6+
* @date 17-March-2017
77
* @brief CMSIS STM32F2xx Device Peripheral Access Layer Header File.
88
*
99
* The file is the unique include file that the application programmer
@@ -18,7 +18,7 @@
1818
******************************************************************************
1919
* @attention
2020
*
21-
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
21+
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
2222
*
2323
* Redistribution and use in source and binary forms, with or without modification,
2424
* are permitted provided that the following conditions are met:
@@ -99,11 +99,11 @@ extern "C" {
9999
#endif /* USE_HAL_DRIVER */
100100

101101
/**
102-
* @brief CMSIS Device version number V2.1.2
102+
* @brief CMSIS Device version number V2.2.0
103103
*/
104104
#define __STM32F2xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
105-
#define __STM32F2xx_CMSIS_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */
106-
#define __STM32F2xx_CMSIS_VERSION_SUB2 (0x02U) /*!< [15:8] sub2 version */
105+
#define __STM32F2xx_CMSIS_VERSION_SUB1 (0x02U) /*!< [23:16] sub1 version */
106+
#define __STM32F2xx_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
107107
#define __STM32F2xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
108108
#define __STM32F2xx_CMSIS_VERSION ((__STM32F2xx_CMSIS_VERSION_MAIN << 24)\
109109
|(__STM32F2xx_CMSIS_VERSION_SUB1 << 16)\

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/system_stm32f2xx.c

Lines changed: 166 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
******************************************************************************
33
* @file system_stm32f2xx.c
44
* @author MCD Application Team
5-
* @version V2.1.2
6-
* @date 29-June-2016
5+
* @version V2.2.0
6+
* @date 17-March-2017
77
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File.
88
*
99
* This file provides two functions and one global variable to be called from
@@ -39,7 +39,7 @@
3939
******************************************************************************
4040
* @attention
4141
*
42-
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
42+
* <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
4343
*
4444
* Redistribution and use in source and binary forms, with or without modification,
4545
* are permitted provided that the following conditions are met:
@@ -127,18 +127,18 @@
127127
/** @addtogroup STM32F2xx_System_Private_Variables
128128
* @{
129129
*/
130-
131-
/* This variable can be updated in Three ways :
132-
1) by calling CMSIS function SystemCoreClockUpdate()
133-
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
134-
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
135-
Note: If you use this function to configure the system clock; then there
136-
is no need to call the 2 first functions listed above, since SystemCoreClock
137-
variable is updated automatically.
138-
*/
139-
uint32_t SystemCoreClock = 120000000;
140-
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
141-
130+
131+
/* This variable can be updated in Three ways :
132+
1) by calling CMSIS function SystemCoreClockUpdate()
133+
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
134+
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
135+
Note: If you use this function to configure the system clock; then there
136+
is no need to call the 2 first functions listed above, since SystemCoreClock
137+
variable is updated automatically.
138+
*/
139+
uint32_t SystemCoreClock = 16000000;
140+
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
141+
const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
142142
/**
143143
* @}
144144
*/
@@ -148,7 +148,7 @@ const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8,
148148
*/
149149

150150
#ifdef DATA_IN_ExtSRAM
151-
static void SystemInit_ExtMemCtl(void);
151+
static void SystemInit_ExtMemCtl(void);
152152
#endif /* DATA_IN_ExtSRAM */
153153

154154
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
@@ -166,41 +166,41 @@ uint8_t SetSysClock_PLL_HSI(void);
166166

167167
/**
168168
* @brief Setup the microcontroller system
169-
* Initialize the Embedded Flash Interface, the PLL and update the
169+
* Initialize the Embedded Flash Interface, the PLL and update the
170170
* SystemFrequency variable.
171171
* @param None
172172
* @retval None
173173
*/
174174
void SystemInit(void)
175175
{
176-
/* Reset the RCC clock configuration to the default reset state ------------*/
177-
/* Set HSION bit */
178-
RCC->CR |= (uint32_t)0x00000001;
176+
/* Reset the RCC clock configuration to the default reset state ------------*/
177+
/* Set HSION bit */
178+
RCC->CR |= (uint32_t)0x00000001;
179179

180-
/* Reset CFGR register */
181-
RCC->CFGR = 0x00000000;
180+
/* Reset CFGR register */
181+
RCC->CFGR = 0x00000000;
182182

183-
/* Reset HSEON, CSSON and PLLON bits */
184-
RCC->CR &= (uint32_t)0xFEF6FFFF;
183+
/* Reset HSEON, CSSON and PLLON bits */
184+
RCC->CR &= (uint32_t)0xFEF6FFFF;
185185

186-
/* Reset PLLCFGR register */
187-
RCC->PLLCFGR = 0x24003010;
186+
/* Reset PLLCFGR register */
187+
RCC->PLLCFGR = 0x24003010;
188188

189-
/* Reset HSEBYP bit */
190-
RCC->CR &= (uint32_t)0xFFFBFFFF;
189+
/* Reset HSEBYP bit */
190+
RCC->CR &= (uint32_t)0xFFFBFFFF;
191191

192-
/* Disable all interrupts */
193-
RCC->CIR = 0x00000000;
192+
/* Disable all interrupts */
193+
RCC->CIR = 0x00000000;
194194

195195
#ifdef DATA_IN_ExtSRAM
196-
SystemInit_ExtMemCtl();
196+
SystemInit_ExtMemCtl();
197197
#endif /* DATA_IN_ExtSRAM */
198198

199-
/* Configure the Vector Table location add offset address ------------------*/
199+
/* Configure the Vector Table location add offset address ------------------*/
200200
#ifdef VECT_TAB_SRAM
201-
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
201+
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
202202
#else
203-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
203+
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
204204
#endif
205205

206206
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
@@ -224,24 +224,83 @@ void SystemInit(void)
224224
* The SystemCoreClock variable contains the core clock (HCLK), it can
225225
* be used by the user application to setup the SysTick timer or configure
226226
* other parameters.
227-
*
227+
*
228228
* @note Each time the core clock (HCLK) changes, this function must be called
229229
* to update SystemCoreClock variable value. Otherwise, any configuration
230-
* based on this variable will be incorrect.
231-
*
232-
* @note - The system frequency computed by this function is not the real
233-
* frequency in the chip. It is calculated based on the predefined
230+
* based on this variable will be incorrect.
231+
*
232+
* @note - The system frequency computed by this function is not the real
233+
* frequency in the chip. It is calculated based on the predefined
234234
* constant and the selected clock source:
235-
*
235+
*
236+
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
237+
*
238+
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
239+
*
240+
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
241+
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
242+
*
243+
* (*) HSI_VALUE is a constant defined in stm32f2xx_hal_conf.h file (default value
244+
* 16 MHz) but the real value may vary depending on the variations
245+
* in voltage and temperature.
246+
*
247+
* (**) HSE_VALUE is a constant defined in stm32f2xx_hal_conf.h file (its value
248+
* depends on the application requirements), user has to ensure that HSE_VALUE
249+
* is same as the real frequency of the crystal used. Otherwise, this function
250+
* may have wrong result.
251+
*
236252
* - The result of this function could be not correct when using fractional
237253
* value for HSE crystal.
238-
*
254+
*
239255
* @param None
240256
* @retval None
241257
*/
242258
void SystemCoreClockUpdate(void)
243259
{
244-
SystemCoreClock = HAL_RCC_GetSysClockFreq();
260+
uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
261+
262+
/* Get SYSCLK source -------------------------------------------------------*/
263+
tmp = RCC->CFGR & RCC_CFGR_SWS;
264+
265+
switch (tmp)
266+
{
267+
case 0x00: /* HSI used as system clock source */
268+
SystemCoreClock = HSI_VALUE;
269+
break;
270+
case 0x04: /* HSE used as system clock source */
271+
SystemCoreClock = HSE_VALUE;
272+
break;
273+
case 0x08: /* PLL used as system clock source */
274+
275+
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
276+
SYSCLK = PLL_VCO / PLL_P
277+
*/
278+
pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
279+
pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
280+
281+
if (pllsource != 0)
282+
{
283+
/* HSE used as PLL clock source */
284+
pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
285+
}
286+
else
287+
{
288+
/* HSI used as PLL clock source */
289+
pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
290+
}
291+
292+
pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
293+
SystemCoreClock = pllvco/pllp;
294+
break;
295+
default:
296+
SystemCoreClock = HSI_VALUE;
297+
break;
298+
}
299+
/* Compute HCLK frequency --------------------------------------------------*/
300+
/* Get HCLK prescaler */
301+
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
302+
/* HCLK frequency */
303+
SystemCoreClock >>= tmp;
245304
}
246305

247306
#ifdef DATA_IN_ExtSRAM
@@ -255,71 +314,71 @@ void SystemCoreClockUpdate(void)
255314
*/
256315
void SystemInit_ExtMemCtl(void)
257316
{
258-
__IO uint32_t tmp = 0x00;
259-
260-
/*-- GPIOs Configuration -----------------------------------------------------*/
261-
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
262-
RCC->AHB1ENR |= 0x00000078;
263-
/* Delay after an RCC peripheral clock enabling */
264-
tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);
265-
(void)(tmp);
266-
267-
/* Connect PDx pins to FSMC Alternate function */
268-
GPIOD->AFR[0] = 0x00CCC0CC;
269-
GPIOD->AFR[1] = 0xCCCCCCCC;
270-
/* Configure PDx pins in Alternate function mode */
271-
GPIOD->MODER = 0xAAAA0A8A;
272-
/* Configure PDx pins speed to 100 MHz */
273-
GPIOD->OSPEEDR = 0xFFFF0FCF;
274-
/* Configure PDx pins Output type to push-pull */
275-
GPIOD->OTYPER = 0x00000000;
276-
/* No pull-up, pull-down for PDx pins */
277-
GPIOD->PUPDR = 0x00000000;
278-
279-
/* Connect PEx pins to FSMC Alternate function */
280-
GPIOE->AFR[0] = 0xC00CC0CC;
281-
GPIOE->AFR[1] = 0xCCCCCCCC;
282-
/* Configure PEx pins in Alternate function mode */
283-
GPIOE->MODER = 0xAAAA828A;
284-
/* Configure PEx pins speed to 100 MHz */
285-
GPIOE->OSPEEDR = 0xFFFFC3CF;
286-
/* Configure PEx pins Output type to push-pull */
287-
GPIOE->OTYPER = 0x00000000;
288-
/* No pull-up, pull-down for PEx pins */
289-
GPIOE->PUPDR = 0x00000000;
290-
291-
/* Connect PFx pins to FSMC Alternate function */
292-
GPIOF->AFR[0] = 0x00CCCCCC;
293-
GPIOF->AFR[1] = 0xCCCC0000;
294-
/* Configure PFx pins in Alternate function mode */
295-
GPIOF->MODER = 0xAA000AAA;
296-
/* Configure PFx pins speed to 100 MHz */
297-
GPIOF->OSPEEDR = 0xFF000FFF;
298-
/* Configure PFx pins Output type to push-pull */
299-
GPIOF->OTYPER = 0x00000000;
300-
/* No pull-up, pull-down for PFx pins */
301-
GPIOF->PUPDR = 0x00000000;
302-
303-
/* Connect PGx pins to FSMC Alternate function */
304-
GPIOG->AFR[0] = 0x00CCCCCC;
305-
GPIOG->AFR[1] = 0x000000C0;
306-
/* Configure PGx pins in Alternate function mode */
307-
GPIOG->MODER = 0x00085AAA;
308-
/* Configure PGx pins speed to 100 MHz */
309-
GPIOG->OSPEEDR = 0x000CAFFF;
310-
/* Configure PGx pins Output type to push-pull */
311-
GPIOG->OTYPER = 0x00000000;
312-
/* No pull-up, pull-down for PGx pins */
313-
GPIOG->PUPDR = 0x00000000;
314-
315-
/*--FSMC Configuration -------------------------------------------------------*/
316-
/* Enable the FSMC interface clock */
317-
RCC->AHB3ENR |= 0x00000001;
318-
319-
/* Configure and enable Bank1_SRAM2 */
320-
FSMC_Bank1->BTCR[2] = 0x00001011;
321-
FSMC_Bank1->BTCR[3] = 0x00000201;
322-
FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF;
317+
__IO uint32_t tmp = 0x00;
318+
319+
/*-- GPIOs Configuration -----------------------------------------------------*/
320+
/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
321+
RCC->AHB1ENR |= 0x00000078;
322+
/* Delay after an RCC peripheral clock enabling */
323+
tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);
324+
(void)(tmp);
325+
326+
/* Connect PDx pins to FSMC Alternate function */
327+
GPIOD->AFR[0] = 0x00CCC0CC;
328+
GPIOD->AFR[1] = 0xCCCCCCCC;
329+
/* Configure PDx pins in Alternate function mode */
330+
GPIOD->MODER = 0xAAAA0A8A;
331+
/* Configure PDx pins speed to 100 MHz */
332+
GPIOD->OSPEEDR = 0xFFFF0FCF;
333+
/* Configure PDx pins Output type to push-pull */
334+
GPIOD->OTYPER = 0x00000000;
335+
/* No pull-up, pull-down for PDx pins */
336+
GPIOD->PUPDR = 0x00000000;
337+
338+
/* Connect PEx pins to FSMC Alternate function */
339+
GPIOE->AFR[0] = 0xC00CC0CC;
340+
GPIOE->AFR[1] = 0xCCCCCCCC;
341+
/* Configure PEx pins in Alternate function mode */
342+
GPIOE->MODER = 0xAAAA828A;
343+
/* Configure PEx pins speed to 100 MHz */
344+
GPIOE->OSPEEDR = 0xFFFFC3CF;
345+
/* Configure PEx pins Output type to push-pull */
346+
GPIOE->OTYPER = 0x00000000;
347+
/* No pull-up, pull-down for PEx pins */
348+
GPIOE->PUPDR = 0x00000000;
349+
350+
/* Connect PFx pins to FSMC Alternate function */
351+
GPIOF->AFR[0] = 0x00CCCCCC;
352+
GPIOF->AFR[1] = 0xCCCC0000;
353+
/* Configure PFx pins in Alternate function mode */
354+
GPIOF->MODER = 0xAA000AAA;
355+
/* Configure PFx pins speed to 100 MHz */
356+
GPIOF->OSPEEDR = 0xFF000FFF;
357+
/* Configure PFx pins Output type to push-pull */
358+
GPIOF->OTYPER = 0x00000000;
359+
/* No pull-up, pull-down for PFx pins */
360+
GPIOF->PUPDR = 0x00000000;
361+
362+
/* Connect PGx pins to FSMC Alternate function */
363+
GPIOG->AFR[0] = 0x00CCCCCC;
364+
GPIOG->AFR[1] = 0x000000C0;
365+
/* Configure PGx pins in Alternate function mode */
366+
GPIOG->MODER = 0x00085AAA;
367+
/* Configure PGx pins speed to 100 MHz */
368+
GPIOG->OSPEEDR = 0x000CAFFF;
369+
/* Configure PGx pins Output type to push-pull */
370+
GPIOG->OTYPER = 0x00000000;
371+
/* No pull-up, pull-down for PGx pins */
372+
GPIOG->PUPDR = 0x00000000;
373+
374+
/*--FSMC Configuration -------------------------------------------------------*/
375+
/* Enable the FSMC interface clock */
376+
RCC->AHB3ENR |= 0x00000001;
377+
378+
/* Configure and enable Bank1_SRAM2 */
379+
FSMC_Bank1->BTCR[2] = 0x00001011;
380+
FSMC_Bank1->BTCR[3] = 0x00000201;
381+
FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF;
323382
}
324383
#endif /* DATA_IN_ExtSRAM */
325384

0 commit comments

Comments
 (0)