IAR报错处理

2023-11-02

问题1:Error[Li005]: no definition for “xxxxx”

解决方法:1.可能是对应的h文件没有引用
2.可能是对应的c文件没有包含进工程里
3.当工程用到c++时候,c语言的内容需要做条件编译,如下:

#ifdef __cplusplus
extern "C" {
#endif

函数、变量等内容

#ifdef __cplusplus
}
#endif

(注意:有时候.h文件已经修改好了,还是报错,此时把该头文件的#include注释掉编译一次,然后把注释去掉再编译一次就好了,因为在编译报错的时候,有时候会继续引用之前的错误数据)

问题2:Fatal Error[Pe035]: #error directive: “Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)”

解决方法:为工程选定芯片,通过宏定义完成。
(其中:USE_STDPERIPH_DRIVER宏用于加载stm32f4xx_conf.h这个头文件;
在这里插入图片描述
(原本是STM32F4XX,看了下stm32f4xx.h里的描述,改成了STM32F40XX就好了)

问题3:Error[2]: Failed to open #include file ‘FreeRTOSConfig.h’

解决方法:这是汇编的头文件,因此需要添加头文件路径。工程名右键->Options…->Assembler->Preprocesser在Additional include directories添加FreeRTOSConfig.h所在目录。
在这里插入图片描述

问题4:

Error[Li005]: no definition for “vPortEnableVFP” [referenced from D:\workspace\Debug\Obj\port.o]

Error[Li005]: no definition for “vPortEnableVFP” [referenced from D:\workspace\Debug\Obj\port.o]

解决方法:将portasm.s添加进工程,因为这两个函数是在这个.s文件里面定义的。

问题5:程序进入HardFault_Handler,发现死在core_cm4.h里的__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)函数

解决方法:将startup_stm32f4xx.s添加进工程

问题6:unable to allocate space for sections/blocks with a total estimated minimum size of 0x10f00 bytes (max align 0x8) in <[0x20000000-0x2000ffff]> (total uncommitted space 0x10000).

解决方法:要么增大icf文件里的ICFEDIT_region_RAM_end尾地址,要么减少变量的内存申请

问题6:包含了自己写的头文件之后(#include “boot/uart_c.h”),就报错

Error[Pe337]: linkage specification is incompatible with previous “get_systick”
Error[Pe337]: linkage specification is incompatible with previous “systick_init”
Error[Pe337]: linkage specification is incompatible with previous “os_delay_cpp”
程序位于UartBoot的app.cpp,暂时未找到问题所在,临时将需要的函数申明一下暂时能解决
//extern “C” void uart_c_Init(void);

解决办法:头文件的出错了,如下
#ifdef __cplusplus
extern “C” {
#endif

void uart_c_Init();
int UartActionCallback(eUART_Action action,char*pBuf,int len);

#ifdef __cplusplus
}
#endif

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

IAR报错处理 的相关文章

  • 卸载 kubernetes

    kubeadm reset f modprobe r ipip lsmod rm rf kube rm rf etc kubernetes rm rf etc systemd system kubelet service d rm rf e

随机推荐