关于Keil4 function "assert_param" declared implicitly;assert_param(IS_GPIO_);和宏定义问题

本文详细介绍了在使用STM32与RealView MDK进行项目开发时如何正确配置USE_STDPERIPH_DRIVER及STM32F10X系列宏定义,以确保编译顺利进行并避免警告或错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.关于STM32 MDK中USE_STDPERIPH_DRIVER问题

初学STM32,在RealView MDK 环境中使用STM32固件库建立工程时,初学者可能会遇到编译不通过的问题。出现如下警告或错误提示:

warning: #223-D: function "assert_param" declared implicitly;assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

这时候我们需要在“Target Options”中的“C/C++”选项卡中如图1所示红框中添加USE_STDPERIPH_DRIVER、STM32F10X_HD。这样才能使编顺利通过。

                                                                                                     图-1

  我们知道,程序的执行是从“main.c”文件开始的,其中必须包含有头文件“stm32f10x.h”。我们打开“stm32f10x.h”,按下“Ctrl+F”键,查找USE_STDPERIPH_DRIVER,在“Find What”栏中输入“USE_STDPERIPH_DRIVER”。如图2所示。点击“Find Next”,出现“USE_STDPERIPH_DRIVER”对应的代码行,重复上边操作三次,第三次的时候我们能在第8296-8298行找到如图3所示代码段。

                                                                                                图2

                                                                                                图3

  这段代码的意思是,只有用预编译指令预定义了“USE_STDPERIPH_DRIVER”,才会将"stm32f10x_conf.h"包含进“stm32f10x.h”中,从而被"main.c"用到。这就解释了,为什么我们没有在“main.c”中包含"stm32f10x_conf.h",而在编译之后却被包含进了"main.c"中,出现如图4所示的情况。"stm32f10x_conf.h"文件相当于一个开关文件,如果要用到STM32固件库驱动标准外设,则外设驱动头文件是必不可少的,如“stm32f10x_gpio.h”。在"stm32f10x_conf.h"中我们通过代码#include "stm32f10x_gpio.h"来实现这个操作。

实际上,在v3.5的stm32标准库,已经有了以下的补充代码:

#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL)
 #error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"
#endif

#if !defined  USE_STDPERIPH_DRIVER
/**
 * @brief Comment the line below if you will not use the peripherals drivers.
   In this case, these drivers will not be included and the application code will 
   be based on direct access to peripherals registers 
   */
#define USE_STDPERIPH_DRIVER  /*#define USE_STDPERIPH_DRIVER*/
#endif

这里我们就无需再宏定义了。

二. STM32F10X_LD,STM32F10X_MD,STM32F10X_HD,STM32F10X_CL宏定义的选择

 如果你使用stm32f10x_stdperiph_lib,会发现在stm32f10x.h文件会有一段关于宏选择的代码,如:

#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL) 
  /* #define STM32F10X_LD */     /*!< STM32F10X_LD: STM32 Low density devices */
  /* #define STM32F10X_LD_VL */  /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */  
#define STM32F10X_MD  /* #define STM32F10X_MD */     /*!< STM32F10X_MD: STM32 Medium density devices */
  /* #define STM32F10X_MD_VL */  /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */  
  /* #define STM32F10X_HD */     /*!< STM32F10X_HD: STM32 High density devices */
  /* #define STM32F10X_HD_VL */  /*!< STM32F10X_HD_VL: STM32 High density value line devices */  
  /* #define STM32F10X_XL */     /*!< STM32F10X_XL: STM32 XL-density devices */
  /* #define STM32F10X_CL */     /*!< STM32F10X_CL: STM32 Connectivity line devices */
#endif

这里我们就有一个问题,我们应该选择哪个宏定义?这要根据你所用的设备来选。参考手册中给了如下:

 

这里告诉我们flash容量在16~32kbytes的是ld,64~128的是md,256~512的是Hd。如下表:

 

 

 

 

 

 

Build target 'Target 1' compiling MAIN.c... main.h(4): error: #5: cannot open source input file "stm32f1xx_hal.h": No such file or directory #include "stm32f1xx_hal.h" MAIN.c: 0 warnings, 1 error compiling DHT11.c... dht11.h(4): error: #5: cannot open source input file "stm32f1xx_hal.h": No such file or directory #include "stm32f1xx_hal.h" DHT11.c: 0 warnings, 1 error compiling TFT_GFX.c... tft_gfx.h(4): error: #5: cannot open source input file "stm32f1xx_hal.h": No such file or directory #include "stm32f1xx_hal.h" TFT_GFX.c: 0 warnings, 1 error compiling BUZZER.c... buzzer.h(4): error: #5: cannot open source input file "stm32f1xx_hal.h": No such file or directory #include "stm32f1xx_hal.h" BUZZER.c: 0 warnings, 1 error compiling misc.c... C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(99): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(117): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(159): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_VECTTAB(NVIC_VectTab)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(178): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_LP(LowPowerMode)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(202): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c: 5 warnings, 0 errors compiling stm32f10x_gpio.c... C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(111): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(178): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(286): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(308): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(324): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(346): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(361): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(377): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(397): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(420): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(437): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(466): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(486): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(554): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_REMAP(GPIO_Remap)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(613): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(632): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ETH_MEDIA_INTERFACE(GPIO_ETH_MediaInterface)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c: 16 warnings, 0 errors compiling stm32f10x_rcc.c... C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(273): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_HSE(RCC_HSE)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(338): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_CALIBRATION_VALUE(HSICalibrationValue)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(357): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(383): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(404): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(568): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_SYSCLK_SOURCE(RCC_SYSCLKSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(612): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_HCLK(RCC_SYSCLK)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(638): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_PCLK(RCC_HCLK)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(664): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_PCLK(RCC_HCLK)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(703): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_IT(RCC_IT)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(731): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_USBCLK_SOURCE(RCC_USBCLKSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(770): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_ADCCLK(RCC_PCLK2)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(832): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_LSE(RCC_LSE)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(865): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(882): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(896): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1067): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1098): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1129): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1188): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1219): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1240): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1253): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1285): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_MCO(RCC_MCO)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1332): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_FLAG(RCC_FLAG)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1406): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_GET_IT(RCC_IT)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1451): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_CLEAR_IT(RCC_IT)); C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c: 27 warnings, 0 errors assembling startup_stm32f10x_hd.s... compiling system_stm32f10x.c... ".\Objects\01.axf" - 4 Error(s), 48 Warning(s). Target not created. Build Time Elapsed: 00:00:07
06-27
*** Using Compiler 'V5.06 update 3 (build 300)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Rebuild target 'takeatry' assembling startup_stm32f103xe.s... compiling main.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/main.c(4): error: #20: identifier "TASK_IDLE" is undefined TaskMode current_task = TASK_IDLE; ../Core/Src/main.c(27): warning: #223-D: function "Key_Scan" declared implicitly if (Key_Scan(KEY1_PIN, KEY1_PORT) && !task_running) { ../Core/Src/main.c(27): error: #20: identifier "KEY1_PIN" is undefined if (Key_Scan(KEY1_PIN, KEY1_PORT) && !task_running) { ../Core/Src/main.c(27): error: #20: identifier "KEY1_PORT" is undefined if (Key_Scan(KEY1_PIN, KEY1_PORT) && !task_running) { ../Core/Src/main.c(32): warning: #223-D: function "Key_Scan" declared implicitly if (Key_Scan(KEY2_PIN, KEY2_PORT) && !task_running) { ../Core/Src/main.c(32): error: #20: identifier "KEY2_PIN" is undefined if (Key_Scan(KEY2_PIN, KEY2_PORT) && !task_running) { ../Core/Src/main.c(32): error: #20: identifier "KEY2_PORT" is undefined if (Key_Scan(KEY2_PIN, KEY2_PORT) && !task_running) { ../Core/Src/main.c(37): warning: #223-D: function "Key_Scan" declared implicitly if (Key_Scan(KEY3_PIN, KEY3_PORT) && !task_running) { ../Core/Src/main.c(37): error: #20: identifier "KEY3_PIN" is undefined if (Key_Scan(KEY3_PIN, KEY3_PORT) && !task_running) { ../Core/Src/main.c(37): error: #20: identifier "KEY3_PORT" is undefined if (Key_Scan(KEY3_PIN, KEY3_PORT) && !task_running) { ../Core/Src/main.c(147): error: #159: declaration is incompatible with previous "Key_Scan" (declared at line 27) uint8_t Key_Scan(uint16_t pin, GPIO_TypeDef *port) { ../Core/Src/main.c(168): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/main.c: 5 warnings, 8 errors compiling stm32f1xx_hal_rcc_ex.c... compiling stm32f1xx_it.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/stm32f1xx_it.c: 1 warning, 0 errors compiling buzzer.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ buzzer.c(26): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ buzzer.c: 2 warnings, 0 errors compiling stm32f1xx_hal_gpio_ex.c... compiling stm32f1xx_hal.c... compiling motor.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ motor.c(51): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ motor.c: 2 warnings, 0 errors compiling gpio.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/gpio.c: 1 warning, 0 errors compiling stm32f1xx_hal_rcc.c... compiling stm32f1xx_hal_tim_ex.c... compiling sensor.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ sensor.c(65): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ sensor.c: 2 warnings, 0 errors compiling stm32f1xx_hal_gpio.c... compiling stm32f1xx_hal_tim.c... compiling tim.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/tim.c: 1 warning, 0 errors compiling stm32f1xx_hal_msp.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/stm32f1xx_hal_msp.c: 1 warning, 0 errors compiling stm32f1xx_hal_dma.c... compiling stm32f1xx_hal_cortex.c... compiling stm32f1xx_hal_pwr.c... compiling stm32f1xx_hal_flash.c... compiling stm32f1xx_hal_flash_ex.c... compiling system_stm32f1xx.c... ../Core/Inc/main.h(49): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/system_stm32f1xx.c(67): warning: #1-D: last line of file ends without a newline /* ?募?末尾???? */ ../Core/Src/system_stm32f1xx.c: 2 warnings, 0 errors compiling stm32f1xx_hal_exti.c... "takeatry\takeatry.axf" - 8 Error(s), 17 Warning(s). Target not created. Build Time Elapsed: 00:02:10
07-13
“”/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "cmsis_os.h" #include "can.h" #include "dma.h" #include "usart.h" #include "usb_otg.h" #include "gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); void MX_FREERTOS_Init(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_CAN1_Init(); MX_USART1_UART_Init(); MX_USART3_UART_Init(); MX_USART6_UART_Init(); MX_USB_OTG_FS_PCD_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Call init function for freertos objects (in cmsis_os2.c) */ MX_FREERTOS_Init(); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 25; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 7; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB buses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) { Error_Handler(); } } /* USER CODE BEGIN 4 */ /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ __disable_irq(); while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */“*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'Can_Serial' compiling chassis_task.c... ..\TASK\chassis_task.c(96): warning: #223-D: function "osDelay" declared implicitly osDelay(CHASSIS_TASK_INIT_TIME); ..\TASK\chassis_task.c(99): warning: #550-D: variable "lastWakeTime" was set but never used static TickType_t lastWakeTime; ..\TASK\chassis_task.c(264): warning: #1035-D: single-precision operand implicitly converted to double-precision chassis_move.vx_set=-(fp32)speedx*0.4; ..\TASK\chassis_task.c(265): warning: #1035-D: single-precision operand implicitly converted to double-precision chassis_move.vy_set=-(fp32)speedy*0.4; ..\TASK\chassis_task.c(269): warning: #1035-D: single-precision operand implicitly converted to double-precision chassis_move.wz_set= chassis_move.wz_set*1.2; ..\TASK\chassis_task.c: 5 warnings, 0 errors linking... Can_Serial\Can_Serial.axf: Error: L6218E: Undefined symbol MX_USB_OTG_FS_PCD_Init (referred from main.o). Can_Serial\Can_Serial.axf: Error: L6218E: Undefined symbol chassis_control_loop (referred from chassis_task.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 2 error messages. "Can_Serial\Can_Serial.axf" - 2 Error(s), 5 Warning(s). Target not created. Build Time Elapsed: 00:00:03”
06-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值