Skip to content

Commit 6eb33e5

Browse files
authored
Merge pull request #3251 from LMESTM/dev_stm32l0_cube_v1.7.0
Dev stm32l0 cube v1.7.0
2 parents 8eaeb86 + fa9d147 commit 6eb33e5

File tree

123 files changed

+31040
-16497
lines changed

Some content is hidden

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

123 files changed

+31040
-16497
lines changed

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/stm32l053xx.h

Lines changed: 5530 additions & 2483 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/stm32l0xx.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
******************************************************************************
33
* @file stm32l0xx.h
44
* @author MCD Application Team
5-
* @version V1.4.0
6-
* @date 01-October-2015
5+
* @version V1.7.0
6+
* @date 31-May-2016
77
* @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File.
88
* This file contains all the peripheral register's definitions, bits
99
* definitions and memory mapping for STM32L0xx devices.
@@ -12,8 +12,8 @@
1212
* is using in the C source code, usually in main.c. This file contains:
1313
* - Configuration section that allows to select:
1414
* - The device used in the target application
15-
* - To use or not the peripherals drivers in application code(i.e.
16-
* code will be based on direct access to peripherals registers
15+
* - To use or not the peripheral's drivers in application code(i.e.
16+
* code will be based on direct access to peripheral's registers
1717
* rather than drivers API), this option is controlled by
1818
* "#define USE_HAL_DRIVER"
1919
*
@@ -89,7 +89,7 @@
8989
/* #define STM32L041xx */ /*!< STM32L041C6, STM32L041E6, STM32L041F6, STM32L041G6, STM32L041K6 Devices */
9090
/* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */
9191
/* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */
92-
#define STM32L053xx /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */
92+
#define STM32L053xx /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */
9393
/* #define STM32L061xx */ /*!< */
9494
/* #define STM32L062xx */ /*!< STM32L062K8 */
9595
/* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */
@@ -114,16 +114,16 @@
114114
#endif /* USE_HAL_DRIVER */
115115

116116
/**
117-
* @brief CMSIS Device version number V1.2.0RC1
117+
* @brief CMSIS Device version number V1.7.0
118118
*/
119-
#define __STM32L0xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */
120-
#define __STM32L0xx_CMSIS_DEVICE_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
121-
#define __STM32L0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
122-
#define __STM32L0xx_CMSIS_DEVICE_VERSION_RC (0x01) /*!< [7:0] release candidate */
123-
#define __STM32L0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
124-
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
125-
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
126-
|(__CMSIS_DEVICE_HAL_VERSION_RC))
119+
#define __STM32L0xx_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
120+
#define __STM32L0xx_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
121+
#define __STM32L0xx_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
122+
#define __STM32L0xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
123+
#define __STM32L0xx_CMSIS_VERSION ((__STM32L0xx_CMSIS_VERSION_MAIN << 24)\
124+
|(__STM32L0xx_CMSIS_VERSION_SUB1 << 16)\
125+
|(__STM32L0xx_CMSIS_VERSION_SUB2 << 8 )\
126+
|(__STM32L0xx_CMSIS_VERSION_RC))
127127

128128
/**
129129
* @}
@@ -216,8 +216,6 @@ typedef enum
216216

217217
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
218218

219-
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
220-
221219
/**
222220
* @}
223221
*/

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/stm32l0xx_hal_conf.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
******************************************************************************
33
* @file stm32l0xx_hal_conf.h
44
* @author MCD Application Team
5-
* @version V1.5.0
6-
* @date 8-January-2016
5+
* @version V1.7.0
6+
* @date 31-May-2016
77
* @brief HAL configuration template file.
88
* This file should be copied to the application folder and renamed
99
* to stm32l0xx_hal_conf.h.
@@ -90,7 +90,7 @@
9090
* (when HSE is used as system clock source, directly or through the PLL).
9191
*/
9292
#if !defined (HSE_VALUE)
93-
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
93+
#define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
9494
#endif /* HSE_VALUE */
9595

9696
#if !defined (HSE_STARTUP_TIMEOUT)
@@ -102,22 +102,22 @@
102102
* This value is the default MSI range value after Reset.
103103
*/
104104
#if !defined (MSI_VALUE)
105-
#define MSI_VALUE ((uint32_t)2000000) /*!< Value of the Internal oscillator in Hz*/
105+
#define MSI_VALUE ((uint32_t)2000000U) /*!< Value of the Internal oscillator in Hz*/
106106
#endif /* MSI_VALUE */
107107
/**
108108
* @brief Internal High Speed oscillator (HSI) value.
109109
* This value is used by the RCC HAL module to compute the system frequency
110110
* (when HSI is used as system clock source, directly or through the PLL).
111111
*/
112112
#if !defined (HSI_VALUE)
113-
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
113+
#define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
114114
#endif /* HSI_VALUE */
115115

116116
/**
117117
* @brief Internal High Speed oscillator for USB (HSI48) value.
118118
*/
119119
#if !defined (HSI48_VALUE)
120-
#define HSI48_VALUE ((uint32_t)48000000) /*!< Value of the Internal High Speed oscillator for USB in Hz.
120+
#define HSI48_VALUE ((uint32_t)48000000U) /*!< Value of the Internal High Speed oscillator for USB in Hz.
121121
The real value may vary depending on the variations
122122
in voltage and temperature. */
123123
#endif /* HSI48_VALUE */
@@ -126,7 +126,7 @@
126126
* @brief Internal Low Speed oscillator (LSI) value.
127127
*/
128128
#if !defined (LSI_VALUE)
129-
#define LSI_VALUE ((uint32_t)37000) /*!< LSI Typical Value in Hz*/
129+
#define LSI_VALUE ((uint32_t)37000U) /*!< LSI Typical Value in Hz*/
130130
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
131131
The real value may vary depending on the variations
132132
in voltage and temperature.*/
@@ -135,12 +135,12 @@
135135
* This value is used by the UART, RTC HAL module to compute the system frequency
136136
*/
137137
#if !defined (LSE_VALUE)
138-
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
138+
#define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/
139139
#endif /* LSE_VALUE */
140140

141141

142142
#if !defined (LSE_STARTUP_TIMEOUT)
143-
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */
143+
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
144144
#endif /* HSE_STARTUP_TIMEOUT */
145145

146146

@@ -151,12 +151,12 @@
151151
/**
152152
* @brief This is the HAL system configuration section
153153
*/
154-
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
155-
#define TICK_INT_PRIORITY (((uint32_t)1<<__NVIC_PRIO_BITS) - 1) /*!< tick interrupt priority */
156-
#define USE_RTOS 0
157-
#define PREFETCH_ENABLE 1
158-
#define PREREAD_ENABLE 0
159-
#define BUFFER_CACHE_DISABLE 0
154+
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
155+
#define TICK_INT_PRIORITY (((uint32_t)1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority */
156+
#define USE_RTOS 0U
157+
#define PREFETCH_ENABLE 1U
158+
#define PREREAD_ENABLE 0U
159+
#define BUFFER_CACHE_DISABLE 0U
160160

161161
/* ########################## Assert Selection ############################## */
162162
/**
@@ -296,11 +296,11 @@
296296
* If expr is true, it returns no value.
297297
* @retval None
298298
*/
299-
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
299+
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
300300
/* Exported functions ------------------------------------------------------- */
301301
void assert_failed(uint8_t* file, uint32_t line);
302302
#else
303-
#define assert_param(expr) ((void)0)
303+
#define assert_param(expr) ((void)0U)
304304
#endif /* USE_FULL_ASSERT */
305305

306306
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/system_stm32l0xx.c

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
******************************************************************************
33
* @file system_stm32l0xx.c
44
* @author MCD Application Team
5-
* @version V1.5.0
6-
* @date 8-January-2016
5+
* @version V1.7.0
6+
* @date 31-May-2016
77
* @brief CMSIS Cortex-M0+ Device Peripheral Access Layer System Source File.
88
*
99
* This file provides two functions and one global variable to be called from
@@ -40,7 +40,7 @@
4040
******************************************************************************
4141
* @attention
4242
*
43-
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
43+
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
4444
*
4545
* Redistribution and use in source and binary forms, with or without modification,
4646
* are permitted provided that the following conditions are met:
@@ -83,15 +83,15 @@
8383
#include "hal_tick.h"
8484

8585
#if !defined (HSE_VALUE)
86-
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
86+
#define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
8787
#endif /* HSE_VALUE */
8888

8989
#if !defined (MSI_VALUE)
90-
#define MSI_VALUE ((uint32_t)2000000) /*!< Value of the Internal oscillator in Hz*/
90+
#define MSI_VALUE ((uint32_t)2000000U) /*!< Value of the Internal oscillator in Hz*/
9191
#endif /* MSI_VALUE */
9292

9393
#if !defined (HSI_VALUE)
94-
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
94+
#define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
9595
#endif /* HSI_VALUE */
9696

9797

@@ -115,8 +115,8 @@
115115
/*!< Uncomment the following line if you need to relocate your vector Table in
116116
Internal SRAM. */
117117
/* #define VECT_TAB_SRAM */
118-
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
119-
This value must be a multiple of 0x200. */
118+
#define VECT_TAB_OFFSET 0x00U /*!< Vector Table base offset field.
119+
This value must be a multiple of 0x100. */
120120
/******************************************************************************/
121121
/**
122122
* @}
@@ -146,8 +146,9 @@
146146
variable is updated automatically.
147147
*/
148148
uint32_t SystemCoreClock = 32000000;
149-
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
150-
const uint8_t PLLMulTable[9] = {3, 4, 6, 8, 12, 16, 24, 32, 48};
149+
const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
150+
const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
151+
const uint8_t PLLMulTable[9] = {3U, 4U, 6U, 8U, 12U, 16U, 24U, 32U, 48U};
151152

152153
/**
153154
* @}
@@ -179,25 +180,25 @@ uint8_t SetSysClock_PLL_HSI(void);
179180
void SystemInit (void)
180181
{
181182
/*!< Set MSION bit */
182-
RCC->CR |= (uint32_t)0x00000100;
183+
RCC->CR |= (uint32_t)0x00000100U;
183184

184185
/*!< Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], MCOSEL[2:0] and MCOPRE[2:0] bits */
185-
RCC->CFGR &= (uint32_t) 0x88FF400C;
186+
RCC->CFGR &= (uint32_t) 0x88FF400CU;
186187

187188
/*!< Reset HSION, HSIDIVEN, HSEON, CSSON and PLLON bits */
188-
RCC->CR &= (uint32_t)0xFEF6FFF6;
189+
RCC->CR &= (uint32_t)0xFEF6FFF6U;
189190

190191
/*!< Reset HSI48ON bit */
191-
RCC->CRRCR &= (uint32_t)0xFFFFFFFE;
192+
RCC->CRRCR &= (uint32_t)0xFFFFFFFEU;
192193

193194
/*!< Reset HSEBYP bit */
194-
RCC->CR &= (uint32_t)0xFFFBFFFF;
195+
RCC->CR &= (uint32_t)0xFFFBFFFFU;
195196

196197
/*!< Reset PLLSRC, PLLMUL[3:0] and PLLDIV[1:0] bits */
197-
RCC->CFGR &= (uint32_t)0xFF02FFFF;
198+
RCC->CFGR &= (uint32_t)0xFF02FFFFU;
198199

199200
/*!< Disable all interrupts */
200-
RCC->CIER = 0x00000000;
201+
RCC->CIER = 0x00000000U;
201202

202203
/* Configure the Vector Table location add offset address ------------------*/
203204
#ifdef VECT_TAB_SRAM
@@ -259,33 +260,33 @@ void SystemInit (void)
259260
*/
260261
void SystemCoreClockUpdate (void)
261262
{
262-
uint32_t tmp = 0, pllmul = 0, plldiv = 0, pllsource = 0, msirange = 0;
263+
uint32_t tmp = 0U, pllmul = 0U, plldiv = 0U, pllsource = 0U, msirange = 0U;
263264

264265
/* Get SYSCLK source -------------------------------------------------------*/
265266
tmp = RCC->CFGR & RCC_CFGR_SWS;
266267

267268
switch (tmp)
268269
{
269-
case 0x00: /* MSI used as system clock */
270-
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13;
271-
SystemCoreClock = (32768 * (1 << (msirange + 1)));
270+
case 0x00U: /* MSI used as system clock */
271+
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13U;
272+
SystemCoreClock = (32768U * (1U << (msirange + 1U)));
272273
break;
273-
case 0x04: /* HSI used as system clock */
274+
case 0x04U: /* HSI used as system clock */
274275
SystemCoreClock = HSI_VALUE;
275276
break;
276-
case 0x08: /* HSE used as system clock */
277+
case 0x08U: /* HSE used as system clock */
277278
SystemCoreClock = HSE_VALUE;
278279
break;
279-
case 0x0C: /* PLL used as system clock */
280+
case 0x0CU: /* PLL used as system clock */
280281
/* Get PLL clock source and multiplication factor ----------------------*/
281282
pllmul = RCC->CFGR & RCC_CFGR_PLLMUL;
282283
plldiv = RCC->CFGR & RCC_CFGR_PLLDIV;
283-
pllmul = PLLMulTable[(pllmul >> 18)];
284-
plldiv = (plldiv >> 22) + 1;
284+
pllmul = PLLMulTable[(pllmul >> 18U)];
285+
plldiv = (plldiv >> 22U) + 1U;
285286

286287
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
287288

288-
if (pllsource == 0x00)
289+
if (pllsource == 0x00U)
289290
{
290291
/* HSI oscillator clock selected as PLL clock entry */
291292
SystemCoreClock = (((HSI_VALUE) * pllmul) / plldiv);
@@ -297,13 +298,13 @@ void SystemCoreClockUpdate (void)
297298
}
298299
break;
299300
default: /* MSI used as system clock */
300-
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13;
301-
SystemCoreClock = (32768 * (1 << (msirange + 1)));
301+
msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> 13U;
302+
SystemCoreClock = (32768U * (1U << (msirange + 1U)));
302303
break;
303304
}
304305
/* Compute HCLK clock frequency --------------------------------------------*/
305306
/* Get HCLK prescaler */
306-
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
307+
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4U)];
307308
/* HCLK clock frequency */
308309
SystemCoreClock >>= tmp;
309310
}

targets/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/device/system_stm32l0xx.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
******************************************************************************
33
* @file system_stm32l0xx.h
44
* @author MCD Application Team
5-
* @version V1.5.0
6-
* @date 8-January-2016
5+
* @version V1.7.0
6+
* @date 31-May-2016
77
* @brief CMSIS Cortex-M0+ Device Peripheral Access Layer System Header File.
88
******************************************************************************
99
* @attention
1010
*
11-
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11+
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
1212
*
1313
* Redistribution and use in source and binary forms, with or without modification,
1414
* are permitted provided that the following conditions are met:
@@ -74,6 +74,11 @@
7474
variable is updated automatically.
7575
*/
7676
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
77+
/*
78+
*/
79+
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
80+
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
81+
extern const uint8_t PLLMulTable[9]; /*!< PLL multipiers table values */
7782

7883
/**
7984
* @}

0 commit comments

Comments
 (0)