当我尝试使用这些代码构建以下项目时,错误发生如下!
#include <stm32f10x.h>
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
void LED_GPIO_Config(void){
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_SetBits(GPIOB, GPIO_Pin_5);
}
//delay
void delay_nms(u16 time){
u16 i = 0;
while(time--){
i = 12000;
while(i--);
}
}
//main
int main(void){
SystemInit();
LED_GPIO_Config();
while(1){
GPIO_SetBits(GPIOB, GPIO_Pin_5);
delay_nms(1000);
GPIO_ResetBits(GPIOB, GPIO_Pin_5);
delay_nms(1000);
}
}
输出如下:
*** Using Compiler 'V5.06 update 2 (build 183)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'Target 1'
compiling ControllerFunctions.c...
compiling BayesFunctions.c...
compiling FastMathFunctions.c...
compiling DistanceFunctions.c...
compiling ComplexMathFunctions.c...
compiling BasicMathFunctions.c...
compiling main.c...
compiling LED_MCBSTM32E.c...
compiling MatrixFunctions.c...
assembling irq_cm3.s...
compiling cmsis_os1.c...
compiling SVMFunctions.c...
compiling StatisticsFunctions.c...
compiling SupportFunctions.c...
compiling rtx_lib.c...
compiling rtx_evr.c...
compiling rtx_delay.c...
compiling rtx_evflags.c...
compiling rtx_kernel.c...
compiling CommonTables.c...
compiling rtx_memory.c...
compiling rtx_mempool.c...
compiling rtx_mutex.c...
compiling rtx_semaphore.c...
compiling rtx_system.c...
compiling rtx_msgqueue.c...
compiling RTX_Config.c...
compiling RV_Framework.c...
D:\u_version projects\ZET6\LED_1\RTE\CMSIS_RTOS_Validation\RV_Config.h(10): error: #5: cannot open
source input file "ARMCM3.h": No such file or directory
#include "ARMCM3.h"
C:\Keil_v5\ARM\PACK\ARM\CMSIS-RTOS_Validation\1.1.0\Source\RV_Framework.c: 0 warnings, 1 error
compiling RV_Report.c...
D:\u_version projects\ZET6\LED_1\RTE\CMSIS_RTOS_Validation\RV_Config.h(10): error: #5: cannot open
source input file "ARMCM3.h": No such file or directory
#include "ARMCM3.h"
C:\Keil_v5\ARM\PACK\ARM\CMSIS-RTOS_Validation\1.1.0\Source\RV_Report.c: 0 warnings, 1 error
compiling RV_Timer.c...
D :\u_version projects\ZET6\LED_1\RTE\CMSIS_RTOS_Validation\RV_Config.h(10): error: #5: cannot open
source input file "ARMCM3.h": No such file or directory
#include "ARMCM3.h"
C:\Keil_v5\ARM\PACK\ARM\CMSIS-RTOS_Validation\1.1.0\Source\RV_Timer.c: 0 warnings, 1 error
compiling RV_WaitFunc.c...
D:\u_version projects\ZET6\LED_1\RTE\CMSIS_RTOS_Validation\RV_Config.h(10): error: #5: cannot open
source input file "ARMCM3.h": No such file or directory
#include "ARMCM3.h"
C:\Keil_v5\ARM\PACK\ARM\CMSIS-RTOS_Validation\1.1.0\Source\RV_WaitFunc.c: 0 warnings, 1 error
compiling cmsis_rv.c...
D:\u_version projects\ZET6\LED_1\RTE\CMSIS_RTOS_Validation\RV_Config.h(10): error: #5: cannot open
source input file "ARMCM3.h": No such file or directory
#include "ARMCM3.h"
C:\Keil_v5\ARM\PACK\ARM\CMSIS-RTOS_Validation\1.1.0\Source\cmsis_rv.c: 0 warnings, 1 error
compiling rtx_timer.c...
compiling rtx_thread.c...
compiling os_systick.c...
assembling startup_stm32f10x_hd.s...
compiling FilteringFunctions.c...
compiling TransformFunctions.c...
compiling misc.c...
compiling stm32f10x_gpio.c...
compiling DMA_STM32F10x.c...
compiling stm32f10x_rcc.c...
compiling GPIO_STM32F10x.c...
compiling system_stm32f10x.c...
".\Objects\LED.axf" - 5 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:05
Load "D:\\u_version projects\\ZET6\\LED_1\\Objects\\LED.axf"
_____^
*** error 56: cannot open file
Error: Flash Download failed - Could not load file 'D:\u_version
projects\ZET6\LED_1\Objects\LED.axf'
Flash Load finished at 11:00:32
此外,我正在使用带有 stm32f103zet6 的 st-link!我不知道为什么它找不到文件,我也没有找到文件!那是因为一些包裹被破坏了还是如何解决这个问题?谢谢!