Keil编译错误汇总

1.对于

\Objects\mystm32.axf: Error: L6218E: Undefined symbol assert_param (referred from stm32f10x_flash.o).

打开stm32f10x_conf.h知:

/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT

/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param  expr: If expr is false, it calls assert_failed function which reports 
  *         the name of the source file and the source line number of the call 
  *         that failed. If expr is true, it returns no value.
  * @retval None
  */
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
  void assert_failed(uint8_t* file, uint32_t line);
#else
  #define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */

这个意思就是说如果定义了 USE_FULL_ASSERT,那么就接着定义assert_param(expr)这个函数,也就是当expr为真时空语句操作,不用管,为假时执行assert_failed((uint8_t *) FILE, LINE)),表示函数的作用在库函数中有解释,用来指示出错的行数和文件。但没有定义 USE_FULL_ASSERT的话无操作。

void assert_failed(u8* file, u32 line) {   while (1) { } }

故assert_param(expr):检查参数expr是否有效

详见:http://www.51hei.com/bbs/dpj-40328-1.html

注:
USE_FULL_ASSERT在这里只是一个宏开关,跟STM32F10X_MD,USE_STDPERIPH_DERIVER他们是一样的,可手动添加(将stm32f10x_conf.h里面相应的注释去掉),或者直接添加(options里面的c/c++ define)

2.对于

..\..\Libraries\CMSIS\stm32f10x.h(298): error: #67: expected a "}"
ADC1_2_IRQn = 18, /*!< ADC1 and ADC2 global Interrupt */
..\..\Libraries\CMSIS\stm32f10x.h(472): warning: #12-D: parsing restarts here after previous syntax error
} IRQn_Type;

在C/C++选项卡里,把STM3210X_HD从prepocessor symbol define 里面删掉`(∩_∩)′

这么做的原因:在老版本的官方STM32F10X.H文件里,这句话不是这么写的,若没记错的话,是
…&&!defined(STM32F10X_HD) && …
原来是有括号的,不做标识符来处理,而新版的,如图,直接说明了出来,那就没有必要,可以根据C/C++知识自己去推断;

具体可以看搜“[STM32系列贴-初级]之STM32F10X工程建立详细过程及问题解决”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值