Skip to content

Commit 90e883a

Browse files
committed
[NUCLEO_F302R8] Move SetSysClock() in mbed_sdk_init() + minor modifications
1 parent 06434d9 commit 90e883a

File tree

10 files changed

+26
-14
lines changed

10 files changed

+26
-14
lines changed

libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F302R8/system_stm32f30x.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}
153153
* @{
154154
*/
155155

156-
void SetSysClock(void);
157-
158156
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
159157
uint8_t SetSysClock_PLL_HSE(uint8_t bypass);
160158
#endif
@@ -208,10 +206,6 @@ void SystemInit(void)
208206
/* Disable all interrupts */
209207
RCC->CIR = 0x00000000;
210208

211-
/* Configure the System clock source, PLL Multiplier and Divider factors,
212-
AHB/APBx prescalers and Flash settings */
213-
SetSysClock();
214-
215209
/* Configure the Vector Table location add offset address ------------------*/
216210
#ifdef VECT_TAB_SRAM
217211
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F302R8/system_stm32f30x.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Cloc
6565

6666
extern void SystemInit(void);
6767
extern void SystemCoreClockUpdate(void);
68+
extern void SetSysClock(void);
6869

6970
/**
7071
* @}

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
*/
2828
#include "analogin_api.h"
29-
#include "wait_api.h"
3029

3130
#if DEVICE_ANALOGIN
3231

32+
#include "wait_api.h"
3333
#include "cmsis.h"
3434
#include "pinmap.h"
3535
#include "error.h"

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_irq_api.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
*/
3030
#include <stddef.h>
3131
#include "cmsis.h"
32-
3332
#include "gpio_irq_api.h"
3433
#include "pinmap.h"
3534
#include "error.h"

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/i2c_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
100100
void i2c_frequency(i2c_t *obj, int hz) {
101101
I2C_TypeDef *i2c = (I2C_TypeDef *)(obj->i2c);
102102
I2C_InitTypeDef I2C_InitStructure;
103-
uint32_t tim;
103+
uint32_t tim = 0;
104104

105105
// Disable the Fast Mode Plus capability
106106
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Enable SYSCFG clock

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/mbed_overrides.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
*/
28-
29-
extern void SystemCoreClockUpdate(void);
28+
#include "cmsis.h"
3029

3130
// This function is called after RAM initialization and before main.
3231
void mbed_sdk_init() {
32+
/* Configure the System clock source, PLL Multiplier and Divider factors,
33+
AHB/APBx prescalers and Flash settings */
34+
SetSysClock();
35+
3336
// Update the SystemCoreClock variable.
3437
SystemCoreClockUpdate();
3538
}

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/pwmout_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030
#include "pwmout_api.h"
3131

32+
#if DEVICE_PWMOUT
33+
3234
#include "cmsis.h"
3335
#include "pinmap.h"
3436
#include "error.h"
@@ -275,3 +277,5 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
275277
float value = (float)us / (float)obj->period;
276278
pwmout_write(obj, value);
277279
}
280+
281+
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/rtc_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030
#include "rtc_api.h"
3131

32+
#if DEVICE_RTC
33+
3234
static int rtc_inited = 0;
3335

3436
void rtc_init(void) {
@@ -136,3 +138,5 @@ void rtc_write(time_t t) {
136138
RTC_SetTime(RTC_Format_BIN, &timeStruct);
137139
PWR_BackupAccessCmd(DISABLE); // Disable access to RTC
138140
}
141+
142+
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/serial_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*******************************************************************************
2929
*/
3030
#include "serial_api.h"
31+
32+
#if DEVICE_SERIAL
33+
3134
#include "cmsis.h"
3235
#include "pinmap.h"
3336
#include "error.h"
@@ -309,3 +312,5 @@ void serial_break_clear(serial_t *obj) {
309312
USART_RequestCmd(usart, USART_Request_SBKRQ, DISABLE);
310313
USART_ClearFlag(usart, USART_FLAG_SBK);
311314
}
315+
316+
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/sleep.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
*******************************************************************************
2929
*/
3030
#include "sleep_api.h"
31-
#include "cmsis.h"
3231

33-
// This function is in the system_stm32f30x.c file
34-
extern void SetSysClock(void);
32+
#if DEVICE_SLEEP
33+
34+
#include "cmsis.h"
3535

3636
// MCU SLEEP mode
3737
void sleep(void) {
@@ -53,3 +53,5 @@ void deepsleep(void) {
5353
// After wake-up from STOP reconfigure the PLL
5454
SetSysClock();
5555
}
56+
57+
#endif

0 commit comments

Comments
 (0)