From 07e102ec11918237d9d682f094d527d7627f0a50 Mon Sep 17 00:00:00 2001 From: Wind <501422650@qq.com> Date: Sun, 2 Nov 2025 17:17:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=83=A7=E5=BD=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Src/main.c | 7 ++++++- stm32f4discovery.cfg | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 stm32f4discovery.cfg diff --git a/Core/Src/main.c b/Core/Src/main.c index 7c9d785..450c9bf 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -114,7 +114,12 @@ void SystemClock_Config(void) */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI; + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) + { + Error_Handler(); + } /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ diff --git a/stm32f4discovery.cfg b/stm32f4discovery.cfg new file mode 100644 index 0000000..1174370 --- /dev/null +++ b/stm32f4discovery.cfg @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +# This is an STM32F4 discovery board with a single STM32F407VGT6 chip. +# http://www.st.com/internet/evalboard/product/252419.jsp + + +# 去OpenOCD的路径下去找这个文件 +source [find interface/stlink.cfg] +#如果用DAP调试器就取消 下面的注释,并注释掉上方代码 +#source [find interface/cmsis-dap.cfg] + +transport select hla_swd + +source [find target/stm32f4x.cfg]