stm32MDK错误码(不定时更新)

#513-D …\HARDWARE\1U\src\Uart.c(1134): warning: #513-D: a value of type “char *” cannot be assigned to an entity of type "uchar "
p = strrchr(Command,’
’);
修改

#513 …\HARDWARE\src\uart.c(396): error: #513: a value of type “u8 *” cannot be assigned to an entity of type “uint8_t”
temp = USART2_RX_BUF;
修改

#1293-D …\HARDWARE\1U\src\Uart.c(1114): warning: #1293-D: assignment in condition(转让的条件)
……
if(p = strrchr(Command,’’))
{……}
修正:…….
p = strrchr(Command,’
’)
if§ {……}

#375-D …\1u\v2.3xe\API…/hal/si_hal.h(161): warning: #375-D: declaration requires a typedef name
};
修改:将有问题的变量,定义好

#1-D …\HEADER\head.h(49): warning: #1-D: last line of file ends without a newline
#endif
修改:在末尾添加空行

#9-D …\EDID\si_edid.c(483): warning: #9-D: nested comment is not allowed
/* Write to selected EDID ram. *
修改:(不允许嵌套注释)

#550-D …\API\si_api9187B.c(53): warning: #550-D: variable “l_stableHdcp1” was set but never used
static BOOL l_stableHdcp1[PortNumber] = {false};/Y/
修改:在定义的变量前添加volatile 修饰关键字
分析:1、定义的变量在下面代码中,执行函数并将函数返回值赋值给该变量,然而并没有使用该返回值;编译器对这种情况会做优化,分析出函数的返回值没有被使用,给变量附的值被编译器省略,于是只剩该变量,并没有使用变量
2、定义的变量没有使用,而且有同名的局部变量

#177-D …\EDID\si_edid.c(554): warning: #177-D: variable “temp” was declared but never referenced
uint8_t temp = 0;
修改:(定义了没有使用)注释该变量或删除,或使用该变量

#223-D …\HAL\Time.c(103): warning: #223-D: function “NOP” declared implicitly
NOP();
修改:1、在定义NOP()的*.c对应的*.h添加该函数的声明
2、不用可以注释或删除
3、在调用该函数的.c文件添加对应的.h头文件
4、在头文件的#ifndef _XXX_H——#define _XXX_H——#endif
有重复定义_XXX_H,修改_XXX_H名字就好

#128-D …\HAL\uart.c(43): warning: #128-D: loop is not reachable(循环不可到达)
while(*str != ‘\0’){
修改:循环体有问题,不能执行下面的程序,
1、 修改循环条件
2、 删除循环后面的执行语句

L6218E XXX.axf: Error: L6218E: Undefined symbol xxx (referred from xxxx.o).
修改:1、寻找xxxx.o对应的.c/.s文件进行定义xxx或删除xxx
2、可能没有包含对应的.h文件
3、可能定义变量或函数的.c文件没有添加
4、调用的xxx变量或函数,而没有定义该变量或函数

#111-D main.c(175): warning: #111-D: statement is unreachable
return 0;
修改:这只是说函数不会执行到这里,这种情况是上面代码有while(1)

#188-D …\HARDWARE\INIT\Init.c(9): warning: #188-D: enumerated type mixed with another type(枚举类型与另一种类型混合)
|RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO, ENABLE);
修改:删除一个或将重名的更换另一个名字

#5 …\HARDWARE\TIME\time.h(16): error: #5: cannot open source input file “…/inc/datatypes.h”: No such file or directory
#include “…/inc/datatypes.h”
修改:找不到头文件,路径有问题或者是没有这个头文件

#256 …\SYSTEM\datatypes.h(20): error: #256: invalid redeclaration of type name “uint32_t” (declared at line 64 of “C:\Keil_v5\ARM\ARMCC\Bin…\include\stdint.h”)
typedef unsigned long uint32_t;
修改:重新定义了,所以注释掉或直接删除

#40 …\STM32F10x_FWBib\inc\stm32f10x.h(521): error: #40: expected an identifier
typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
修改:可能重复定义,将重复的注释或删除

#20 …\HARDWARE\TIME\Time.c(25): error: #20: identifier “uint” is undefined
uint Updata_Time;
NVIC_InitStructure.NVIC_IRQChannel = TIM8_CC_IRQn;
修改:1、没有定义这个关键字
2、可能是该变量里面的成员没有定义
3、在.c中定义了,.h添加extern
4、没有包含对应头文件
5、有定义这个关键字和包含了该定义的头文件,还会出现编译错误
6、“XXXXX”定义了,也在对应的头文件中声明了,在引用的文件中也引用了对应的头文件,这个就非常奇怪了,后来遇到了一种情况就是,这个声明头文件有问题,一般头文件开头,都要使用#ifndef __XXXX_H #define __XXXX_H,这样做的目的是为了防止多个头文件的存在,需要注意的是这里的__XXXX_H中的XXXX一定要跟这个头文件的名称一致,否则,这个头文件就是失败的,错误的,那么引用的时候,自然也会引用错误了。(这里来自:https://blog.csdn.net/ARM_Tutor/article/details/38333207)

#47-D …\HARDWARE\HAL\hal.h(236): warning: #47-D: incompatible redefinition of macro “Close_Uart1” (declared at line 60 of “…\HARDWARE\UART\uart.h”)
#define Close_Uart1() {UCSRB &= 0x6F;UCSRA &= 0x7F;}
修改:宏不兼容重新定义,即定义了两次或两次以上,修改名字或注释其中一个或删除一个

#147 …\HARDWARE\TIME\time.h(86): error: #147: declaration is incompatible with “uint16_t RX1_Erase” (declared at line 20)
extern unsigned int RX1_Erase ;
修改:(声明不兼容)可能存在重复定义,将其中一个注释就编译成功

#940-D …\HARDWARE\UART\Uart.c(268): warning: #940-D: missing return statement at end of non-void function “Uart1_Handler”
}
修改:缺少返回值

L6200E .\Objects\StmHdmi0404Main.axf: Error: L6200E: Symbol Reset_Flag_Bit multiply defined (by variable.o and hal.o).
修改:Reset_Flag_Bit多出定义,在variable.o and hal.o存在,修改:去掉赋值部分(我的是直接删除其中一个)
可能存在现象:应该是定义变量定义在头文件,修改:头文件的删除,在对应.c文件定义
定义的变量需要在其它.c/.h使用,.c中定义了,修改:需要添加extern

#137 …\HARDWARE\UART\Uart.c(469): error: #137: expression must be a modifiable lvalue
Mail_ACK_Low();
修改

#550-D …\HARDWARE\IIC\iic.c(3): warning: #550-D: variable “Port_SDA” was set but never used
static uint8_t Port_SDA,Port_SCL,PIN_Sda,PIN_Scl;
修改:变量已设置,但没有使用,可以改为定义时加上volatile

#247 …\HARDWARE\IIC\iic.c(183): error: : function “IIC_Write_Byte” has already been defined
uint8_t IIC_Write_Byte(uint8_t str)
修改:重复定义了函数

#1295-D …\HARDWARE\TIME\time.h(114): warning: #1295-D: Deprecated declaration NOP - give arg types
void NOP();//10
修改:无参函数NOP(),声明时括号缺少void关键字

L6304W …\HDMI1602_Firmware\SiI9687_1_4.axf: Warning: L6304W: Duplicate input file …\hdmi1602_firmware\main_1.o ignored.
Program Size: Code=52680 RO-data=5472 RW-data=1876 ZI-data=7356
修改

#136 main.c(135): error: #136: struct “” has no field “GPIO_OType”
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
修改:

L6236E .\Objects\project.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.
Not enough information to list image symbols.
Not enough information to list the image map.
修改

#69-D main.c(58): warning: #69-D: integer conversion resulted in truncation(整数转换导致截断)
Led_Refresh_En(250,60000);
修改:个人猜测应该是括号里的数据超出定义类型的范围

#31 main.c(73): error: #31: expression must have integral type
switch(USART2_IRQHandler())
修改:switch括号里的变量要整型数

#268 …\HARDWARE\src\uart.c(196): error: #268: declaration may not appear after executable statement in block
uint8_t USART2_Handler(void) //串口2中断服务程序
修改:该函数缺少了“}”,在第196行前加上,一般#268与#67一起出现
修改:声明在执行语句后,将声明语句放到最前

#67 …\HARDWARE\src\uart.c(196): error: #67: expected a “}”
uint8_t USART2_Handler(void) //串口2中断服务程序
修改:在第196行前面少了“}”
当#7 #67 #40一起出现时,存在中文符号,修改后还存在#7 #29 #2969-D,我的是将后面的换行符删除,就是格式不正确导致的现象,我也不太清楚,因为代码的上一行和下一行可以使用换行符的
原:0x20, 0xF8, 0x14, 0xFB, 0x98, 0xB9, 0x57, 0x00, 0xC0, 0x09, 0x14, 0xFB, 0x05, 0x00, \
改:0x20, 0xF8, 0x14, 0xFB, 0x98, 0xB9, 0x57, 0x00, 0xC0, 0x09, 0x14, 0xFB, 0x05, 0x00,

#109 …\HARDWARE\src\uart.c(131): error: #109: expression preceding parentheses of apparent call must have (pointer-to-) function type(显式调用前括号的表达式必须具有(指针到-)函数类型)
data=Check_Mail_ACK();
修改

#42 headware\simulation_uart.c(94): error: #42: operand types are incompatible (“uint16_t” and “uint8_t *”)(操作数据类型不兼容)
if(USART_ReceiveData(USART2) == buf)
修改:需要强制转换成另一个类型

#7 main.c(32): error: #7: unrecognized token
CUart_Simulation_Print(0, 0xFF, 0xFF);
修改:存在不可见字符,中文字符等,找到该行修改或删除

#224-D …\HARDWARE\src\uart.c(398): warning: #224-D: the format string requires additional arguments
printf("RX Msg:%s\r\n"USART2_RX_BUF);
修改:格式字符串需要额外的参数

#18 …\HARDWARE\src\uart.c(398): error: #18: expected a “)”
printf("RX Msg:%s\r\n"USART2_RX_BUF);
修改:括号前缺少东西

#181-D …\HARDWARE\src\uart.c(399): warning: #181-D: argument is incompatible with corresponding format string conversion
printf(“process msg:%s %d\r\n”,&Process_ptr,&Process_ptr);
修改:参数与相应的格式字符串转换不兼容

#2548-D main.c(22): warning: #2548-D: multicharacter character literal (potential portability problem)
uchar buf[5] = {‘0xff’,‘0x01’,‘0x0a’,‘0xa0’,‘0x80’};
修改:表达式错误

#29 main.c(22): error: #29: expected an expression
u8 buf[6] = {};
修改:表达式错误,根据这种情况可修改为u8 buf[6] = {0}; / u8 buf[6];

#144 main.c(102): error: #144: a value of type “char *” cannot be used to initialize an entity of type “const uint8_t”(不能使用类型为“char *”的值初始化类型为“const uint8_t”的实体)
const uint8_t buf[6] = {“0xe1”,“0xff”,“0x0a”,“0xa0”,“0x01”,“0xaa”};
修改:我这里可能修改为const uint8_t buf[6] = {0xe1,0xff,0x0a,0xa0,0x01,0xaa};

#32 …\HARDWARE\src\uart.c(166): error: #32: expression must have arithmetic type
printf(“Show The Receive Msg:%02x-%02x-%02x-%02x-%02x-%02x\r\n”,(Receive_ptRX1-6)(Receive_ptRX1-5)(Receive_ptRX1-4)(Receive_ptRX1-3)(Receive_ptRX1-2)(Receive_ptRX1-1));
修改:(表达式具有算术类型),这里是缺少逗号
rintf(“Show The Receive Msg:%02x-%02x-%02x-%02x-%02x-%02x\r\n”,
(Receive_ptRX1-6),(Receive_ptRX1-5),(Receive_ptRX1-4),(Receive_ptRX1-3),(Receive_ptRX1-2),(Receive_ptRX1-1));

#12-D …\USER\stm32f10x.h(472): warning: #12-D: parsing restarts here after previous syntax error
} IRQn_Type;
修改
与#67同时出现:
1、(程序使用的芯片换成比原来flash小的芯片)找到STM32F10X_HD,将STM32F10X_HD里面的内容注释或删除
2、(程序使用的芯片换成比原来flash大的芯片)找到STM32F10X_MD,将STM32F10X_MD里面的内容注释或删除
与#65同时出现:
在错误行缺少”;”字符,应该是出现的do{}while();的while后面

#186-D …\HARDWARE\src\Infrared-Timer3.c(120): warning: #186-D: pointless comparison of unsigned integer with zero(无符号整数与零的无意义比较)
if((bHex>=0)&&(bHex<=9))
修改:bHex为无符号整型,“bHex>=0”没意义,可以改为if(bHex<=9)

#167 …\HARDWARE\src\Infrared-Timer3.c(326): error: #167: argument of type “uint32_t” is incompatible with parameter of type “uint8_t *”(声明不能再执行语句后面)
USB_TxWrite(ir_data,300);
修改: 1、将执行语句放到声明语句后面
2、指针类型不匹配,修改变量类型或强转

#2969-D …\HARDWARE\src\Infrared-Timer3.c(135): warning: #2969-D: “” followed by white space is not a line splice
修改:将“”里面的符号删除

#1514 …\HARDWARE\src\Infrared-Timer3.c(121): error: #1514: an empty initializer is invalid for an array with unspecified bound
u8 irtestbuf[]={};
修改:初始化无效,我这里可改为u8 irtestbuf[]={0}; 或 u8 irtestbuf[2];

#11-D …\HEADWARE\init\init.c(1): error: #11-D: unrecognized preprocessing directive
#inclucde “init.h”
修改:关键字写错,我这里可改为#include “init.h”

#159 main.c(18): error: #159: declaration is incompatible with previous “flash_test” (declared at line 15)
void flash_test(void)
修改:该函数的使用在定义或声明函数的前面

#28 main.c(132): error: #28: expression must have a constant value
uint8_t Temp_Data[array_one][200] = {0};
修改:表达式必须有一个常量

#42 …\HEADWARE\EXTI\EXTI.c(165): error: #42: operand types are incompatible (“uint32_t *” and “int”)
for(i=0; i<800 && (uint32_t *)SendBuf[i]!=0xffff; i++)
while(read_buf[i++] != “P”);
修改:1、#42、#167、#148一起出现时,修饰变量的关键字不对应,出现严重的错误
2、第二条错误,引用号修改为’P’

#148 …\HEADWARE\USBProcess\USBProcess.c(11): error: #148: variable “cCONE_Reack” has already been initialized
uint8_t cCONE_Reack[] = “PTN001202CONE10----79END”;
修改

#852 …\HEADWARE\flash\flash.c(46): error: #852: expression must be a pointer to a complete object type
*(uint32_t *)&ReadBuf[i] = (__IO uint32_t)addr_start;
修改

#81 …\HEADWARE\EXTI\EXTI.h(17): error: #81: more than one storage class may not be specified(不能指定多个存储类)
extern static u8 irLearnStatus;
修改:extern 和static 不能同时存在,删除其中一个

#165 …\HEADWARE\USBProcess\USBProcess.c(86): error: #165: too few arguments in function call
if(‘P’==buf[0] && ‘T’==buf[1] && ‘N’==buf[2] && (strstr((const char *)buf锛?40PRES")))
修改:当#7、#20、#165、#18一起出现时,说明这行代码出现中文符号,将之修改即可

#175-D …\HEADWARE\USBProcess\USBProcess.c(245): warning: #175-D: subscript out of range
send_buf[197] = ‘E’;
修改:数组下标超出范围,修改数组大小或,将赋值的数组下标修改,删除….

#170-D …\HEADWARE\USBProcess\USBProcess.c(235): warning: #170-D: pointer points outside of underlying object
CharToHLChar(chesksum,(u8 *)(send_buf+195));
修改:指针指到数组外部,将数字改小或将数组下标加大

#951-D main.c(6): warning: #951-D: return type of function “main” must be “int”
void main(void)
修改:main函数返回必须是int类型

#767-D …\HEADWARE\USBProcess\USBProcess.c(289): warning: #767-D: conversion from pointer to smaller integer
CharToHLChar((char )acount_len,(u8 *)send_buf+193);
修改

#1441-D …\HEADWARE\USBProcess\USBProcess.c(298): warning: #1441-D: nonstandard cast on lvalue
(u8 *)send_buf[193] = acount_len[0];
修改:非标强制转换

#259 …\HEADWARE\USBProcess\USBProcess.c(147): error: #259: constant value is not known
u8 read_buf[len];
修改:常数值未知,将定义的常量赋初值

#92 …\HEADWARE\DataAnalyze\DataAnalyze.h(4): error: #92: identifier-list parameters may only be used in a function definition
void analyze_data(total_len,read_buf);
修改:标识符列表参数只能在函数定义中使用

#65 …\HEADWARE\USBProcess\USBProcess.c(160): error: #65: expected a “;”
for(i = 0; i < total_len; i++)
修改:缺少“;”字符

#37 …\HARDWARE\src\uart.c(23): error: #37: the #endif for this directive is missing
#if EN_USART2_RX //如果使能了接收
修改:#endif缺失,前面有#if等语句

  • 22
    点赞
  • 55
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
odrive是一个开源的电机驱动器项目,它的主要设计目标是为了实现高性能的电机控制系统。而STMicroelectronics的MDK则是一款为STM32微控制器提供集成开发环境的软件工具。 移植odrive到STM32 MDK环境中需要进行以下步骤: 1. 首先,需要下载并安装MDK软件工具,确保与所使用的STM32微控制器兼容。能够成功编译和下载代码。 2. 然后,需要获取odrive的源代码,这可以通过从GitHub上克隆odrive项目来完成。确保获取了最新稳定版本的代码。 3. 接下来,需要创建一个新的MDK工程,并将odrive的源代码添加到工程中。根据需要对工程进行配置,例如选择正确的编译器、调试接口等。 4. 确保在MDK工程中正确设置了STM32微控制器的引脚配置,以便与odrive的硬件设计相匹配。这可能涉及到对GPIO、SPI、UART等引脚进行适当配置。 5. 确保在MDK工程中包含了odrive的所有依赖项,例如相关的库文件、驱动程序等。 6. 对odrive源代码进行必要的修改和调整,以适应STM32 MDK环境。这可能涉及到修改编译选项、函数调用、变量定义等。 7. 最后,进行编译和下载测试,确保odrive在STM32 MDK环境下能够正常工作。在调试过程中可能会遇到一些问题,需要根据具体情况进行调试和修复。 总之,移植odrive到STM32 MDK环境需要确保正确配置MDK工程和STM32微控制器,适配odrive的源代码,并进行必要的调试和修复。通过这些步骤,便可以将odrive成功移植到STM32 MDK环境中,为电机控制系统提供高性能的驱动功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值