Skip to content

Commit 71d1ae6

Browse files
author
mean
committed
Set STM32 MCU speed through the MCU_SPEED setting
1 parent 23449e7 commit 71d1ae6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Platform/Core/BoardFlags/CompilerFlagsSetterStm32.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ ELSE(TRY_CPU_FLAGS)
88
_get_board_property(${BOARD_ID} build.cpu_flags CPU_FLAGS)
99
ENDIF(TRY_CPU_FLAGS)
1010

11-
set(COMPILE_FLAGS "-DF_CPU=${FCPU} ${CPU_FLAGS} -DARDUINO=${NORMALIZED_SDK_VERSION} ")
11+
# dont set the mcu speed, it is done elsewhere
12+
# set(COMPILE_FLAGS "-DF_CPU=${FCPU} ${CPU_FLAGS} -DARDUINO=${NORMALIZED_SDK_VERSION} ")
13+
set(COMPILE_FLAGS " ${CPU_FLAGS} -DARDUINO=${NORMALIZED_SDK_VERSION} ")
1214
# This should be derived from the arduino config files
1315
# hardcode them for the moment
1416

Platform/Initialization/DefaultCFlagsStm32.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ ENDIF(NOT DEFINED ARDUINO_UPLOAD_METHOD)
77

88
IF(NOT DEFINED ARDUINO_CFLAGS_SET)
99
SET(DEFINED ARDUINO_CFLAGS_SET 1)
10+
IF(NOT DEFINED MCU_SPEED )
11+
SET(MCU_SPEED 72000000L)
12+
ENDIF(NOT DEFINED MCU_SPEED )
13+
1014
SET(ARDUINO_DEFAULT_CFLAGS " -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -w -mcpu=cortex-m3 -mthumb -g ")
11-
SET(ARDUINO_DEFAULT_CFLAGS " ${ARDUINO_DEFAULT_CFLAGS} -DGENERIC_BOOTLOADER -DF_CPU=72000000L -DARDUINO_ARCH_STM32F1 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG ")
15+
SET(ARDUINO_DEFAULT_CFLAGS " ${ARDUINO_DEFAULT_CFLAGS} -DGENERIC_BOOTLOADER -DF_CPU=${MCU_SPEED}L -DARDUINO_ARCH_STM32F1 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG ")
1216
#SET(ARDUINO_DEFAULT_CFLAGS " ${ARDUINO_DEFAULT_CFLAGS} -DF_CPU=72000000L -DARDUINO_ARCH_STM32F1 ")
1317

1418
SET(ARDUINO_DEFAULT_CXXFLAGS "${ARDUINO_DEFAULT_CFLAGS} -fno-rtti -fno-exceptions -std=gnu++11 -Werror=return-type")

0 commit comments

Comments
 (0)