历史上的今天
今天是:2025年02月01日(星期六)
2020年02月01日 | STM8 symbol _assert_failed not defined (Debugstm8s_adc1.o )
2020-02-01 来源:eefocus
symbol _assert_failed not defined (Debugstm8s_adc1.o )
在调试STM8的时候出现了这个问题,即函数assert_failed 未定义。查找问题,在stm8s_conf.h中对void assert_failed(u8* file, u32 line) 进行了申明,确没有文件中对该函数体进行编写,因此编译时找不到该函数而出错。因为之前没有使用库文件,全部自己调用寄存器编制的程序就没有碰到这种问题。
在头文件stm8s_conf.h中对函数有引用:
#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 */
新建一个stm8s_assert_fail.c文件,在开始时包含stm8s_conf.h,添加函数体文件如下:
#include “stm8s_conf.h”
#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(u8 file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf(“Wrong parameters value: file %s on line %drn”, file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
编译即可通过。
下一篇:STM8S开发小结
史海拾趣
|
过节了,保不齐成双成对地出去,那么也泼泼冷水吧: 1.不要携带过多现金,将财物放于包里,逛街时应多注意自己的包。不管是挎包还是背包,最好放在身前或是用胳膊夹住,拉锁朝向你能看到的方向。 2.逛街时见到形迹可 ...… 查看全部问答> |
|
#include <MSP430x24x.h> void InitSys(); void InitBhTimerB(); unsigned int Cyc,LastTBCCR0; void main() { WDTCTL = WDTPW + WDTHOLD; InitSys(); LPM3; } void InitSys() { unsigned int iq0; BCSCT ...… 查看全部问答> |
|
上传几本自己珍藏的觉得有用的ZigBee学习书籍给大家一睹为快,放心,就几本,我可不会上传一大堆让你选的。喜欢的就帮顶一下吧。 1.Zigbee Wireless Networking.pdf 2.ZigBee Wireless Networks and Trans ...… 查看全部问答> |




