开发环境:IAR
单片机型号:stm8
具体报错:
Error[Li005]: no definition for "assert_failed"[referenced from <工程路径、名称>\Debug\Obj\stm810x_gpio.o]
Error while running Linker
参考截图:
解决办法:经过检查,感觉不出什么错误,然后百度了解决办法,先参考了这个帖子stm8 Error[Li005]: no definition for XXX 的解决办法_luoyir1997的博客-优快云博客
发现不适用。经过检查,发现是因为在stm8s_conf.h中只声明了一个函数接口 void assert_failed(u8* file, u32 line),但是没有地方实现它。方案有2。
找个地方写个空函数就行,常见在main.c中末尾加此函数。
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 %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}