当前位置: 首页 > news >正文

MDK报错:Undefined symbol assert_failed报错解决策略

MDK报错:Undefined symbol assert_failed报错解决策略


  • 🎯🪕在全网搜索相关MDK编译报错:Error: L6218E: Undefined symbol assert_param (referred from xxx.o).

✨有些问题看似很简单,可能产生的问题是由于不经意的细节原因导致。引起报错的问题有很多种可能,没有放之四海皆准的解决方案。

  • 🌿提供的解决问题的可能方案一:添加宏定义USE_STDPERIPH_DRIVER
    在这里插入图片描述
  • 🌿提供的解决问题的可能方案二:没有将相对应的驱动头文件(.h)路径包含进来或者是源文件(.c)添加到工程中。
  • 🔖这里针对的是具体的驱动文件或驱动头文件。
    在这里插入图片描述
    在这里插入图片描述
  • 🌿提供的解决问题的可能方案三:在main.c文件中,补充下面的void assert_failed()断言报错函数:
#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,tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) *//* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
✨很多外部导入的工程源码,添加完标准库文件后,编译报此错误,往往可能是忽略标准库驱动文件中定义了此断言assert_failed函数,却没有写实现的地方,才会出现有调用assert_param宏的驱动文件中报错。

、

/* Exported macro ------------------------------------------------------------*/
#define USE_FULL_ASSERT#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)0U : assert_failed((uint8_t *)__FILE__, __LINE__))/* Exported functions ------------------------------------------------------- */void assert_failed(uint8_t *file, uint32_t line);
#else#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
http://www.lryc.cn/news/178963.html

相关文章:

  • LLM - Make Causal Mask 构造因果关系掩码
  • Python函数式编程(一)概念和itertools
  • Guava限流器原理浅析
  • 第四十二章 持久对象和SQL - 用于创建持久类和表的选项
  • 集合-ArrayList源码分析(面试)
  • 跨类型文本文件,反序列化与类型转换的思考
  • ubuntu20安装nvidia驱动
  • gma 2 成书计划
  • 从零手搓一个【消息队列】项目设计、需求分析、模块划分、目录结构
  • 【Spring Cloud】深入探索 Nacos 注册中心的原理,服务的注册与发现,服务分层模型,负载均衡策略,微服务的权重设置,环境隔离
  • No156.精选前端面试题,享受每天的挑战和学习
  • 如何在PIL图像和PyTorch Tensor之间进行相互转换,使用pytorch进行PIL和tensor之间的数据转换
  • STM32F4X UCOSIII任务消息队列
  • 8个居家兼职,帮助自己在家搞副业
  • 管理与系统思维
  • 电死人的是电流还是电压?
  • mac 编译问题记录
  • centos 7.9同时安装JDK1.8和openjdk11两个版本
  • 【JavaEE】HTML
  • 【数据结构--八大排序】之堆排序
  • c# 中的类
  • 基于单片机的煤气泄漏检测报警装置设计
  • [导弹打飞机H5动画制作] 导弹每次飞行的随机路线制作
  • OpenCV实现FAST算法角点检测 、ORB算法特征点检测
  • 【Unity的 Built-in 渲染管线下实现好用的GUI模糊效果_Blur_案例分享(内附源码)】
  • AR智能眼镜:提升现场服务技能、效率与盈利能力的利器(一)
  • ChatGPT 在机器学习中的应用
  • 【JavaEE】锁策略
  • 在 SDXL 上用 T2I-Adapter 实现高效可控的文生图
  • Python分支结构和循环结构