51uwb.cn

 找回密码
 立即注册
查看: 151|回复: 10
打印 上一主题 下一主题

使用KEIL5编译源码为什么出现很多错,按照提示把错误修改完成,烧录后却无法运行

[复制链接]

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
跳转到指定楼层
楼主
发表于 2025-6-6 14:17:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

../main.c(819): warning: result of comparison of constant 1024 with expression of type 'int8' (aka 'signed char') is always true [-Wtautological-constant-out-of-range-compare]
  819 |                     if (frame_len <= RX_BUFFER_LEN)
      |                         ~~~~~~~~~ ^  ~~~~~~~~~~~~~
../main.c(972): error: call to undeclared function 'LCD_ClearLines'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  972 |                          LCD_ClearLines();
      |                          ^
../main.c(977): warning: passing 'char[16]' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
  977 |         OLED_ShowString(0, 2,dist_str);
      |                              ^~~~~~~~
../platform\lcd_oled.h(57): note: passing argument to parameter 'p' here
   57 | void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p);
      |                                                    ^
../main.c(983): warning: passing 'char[16]' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
  983 |         OLED_ShowString(0, 4,dist_str);
      |                              ^~~~~~~~
../platform\lcd_oled.h(57): note: passing argument to parameter 'p' here
   57 | void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p);
      |                                                    ^
../main.c(989): warning: passing 'char[16]' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
  989 |         OLED_ShowString(0, 6,dist_str);
      |                              ^~~~~~~~
../platform\lcd_oled.h(57): note: passing argument to parameter 'p' here
   57 | void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p);
      |                                                    ^
../main.c(1074): warning: array index 3 is past the end of the array (that has type 'int[3]') [-Warray-bounds]
1074 |             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((Anthordistance[3]/10)&0xFF);
      |                                                                     ^              ~
../main.c(194): note: array 'Anthordistance' declared here
  194 | int Anthordistance[ANCHOR_MAX_NUM];
      | ^
../main.c(1075): warning: array index 3 is past the end of the array (that has type 'int[3]') [-Warray-bounds]
1075 |             angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((Anthordistance[3]/10 >>8)&0xFF);
      |                                                                     ^              ~
../main.c(194): note: array 'Anthordistance' declared here
  194 | int Anthordistance[ANCHOR_MAX_NUM];
      | ^
14 warnings and 1 error generated.

../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(445): error: non-ASM statement in naked function is not supported
  445 |   uint32_t result=0;
      |   ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(442): note: attribute is here
  442 | uint32_t __get_PSP(void) __attribute__( ( naked ) );
      |                                           ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(465): error: parameter references not allowed in naked functions
  465 |                   "BX  lr     \n\t" : : "r" (topOfProcStack) );
      |                                              ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(461): note: attribute is here
  461 | void __set_PSP(uint32_t topOfProcStack) __attribute__( ( naked ) );
      |                                                          ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(479): error: non-ASM statement in naked function is not supported
  479 |   uint32_t result=0;
      |   ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(476): note: attribute is here
  476 | uint32_t __get_MSP(void) __attribute__( ( naked ) );
      |                                           ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(499): error: parameter references not allowed in naked functions
  499 |                   "BX  lr     \n\t" : : "r" (topOfMainStack) );
      |                                              ^
../../../Libraries/CMSIS/CM3/CoreSupport/core_cm3.c(495): note: attribute is here
  495 | void __set_MSP(uint32_t topOfMainStack) __attribute__( ( naked ) );
      |                                                          ^
4 errors generated.

../platform/port.c(301): error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  301 |     printf("/*****************************************************************/\n");
      |     ^
../platform/port.c(301): note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
../platform/port.c(318): error: call to undeclared function 'putchar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  318 |         putchar(s[i]);
      |         ^
2 errors generated.

../kalman/kalman.c(141): error: call to undeclared function 'MatrixMul'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  141 |     MatrixMul(A, tOpt.XPreOpt, X, A_ROW, X_ROW, X_COLUMN);       //  <BB><F9><D3><DA>系统<B5><C4><C9><CF>一状态<B6><F8>预<B2><E2><CF><D6><D4><DA>状态; X(k|k-1) = A(k,k-1)*X(k-1|k-1)
      |     ^
../kalman/kalman.c(143): error: call to undeclared function 'MatrixCal1'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  143 |     MatrixCal1(A, tCov.PPreOpt, Temp4, SYS_ORDER);
      |     ^
../kalman/kalman.c(144): error: call to undeclared function 'MatrixAdd'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  144 |     MatrixAdd(Temp4, Q, P, P_ROW, P_COLUMN);                     //  预<B2><E2><CA><FD><BE>莸<C4>协<B7><BD><B2><EE><BE><D8><D5><F3>; P(k|k-1) = A(k,k-1)*P(k-1|k-1)*A(k,k-1)'+Q
      |     ^
../kalman/kalman.c(146): error: call to undeclared function 'MatrixCal2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  146 |     MatrixCal2(C, P, Temp1, C_ROW, C_COLUMN);
      |     ^
../kalman/kalman.c(148): error: call to undeclared function 'Gauss_Jordan'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  148 |     Gauss_Jordan(Temp1, C_ROW);
      |     ^
../kalman/kalman.c(149): error: call to undeclared function 'MatrixTrans'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  149 |     MatrixTrans(C, Temp2, C_ROW, C_COLUMN);
      |     ^
../kalman/kalman.c(154): error: call to undeclared function 'MatrixMinus'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  154 |     MatrixMinus(Y, Temp1, Temp1, Y_ROW, Y_COLUMN);
      |     ^
7 errors generated.
compiling kalman.c...
../trilateration/trilateration.c(712): error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  712 |     printf("r1=%f , r2=%f, r3=%f,  r4=%f\r\n",r1,r2,r3,r4);
      |     ^
../trilateration/trilateration.c(712): note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
../trilateration/trilateration.c(941): error: call to undeclared library function 'abs' with type 'int (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  941 |         if (abs(points_AC_0 - circles[2].r) < abs(points_AC_1 - circles[2].r))//cross_point[0]
      |             ^
../trilateration/trilateration.c(941): note: include the header <math.h> or explicitly provide a declaration for 'abs'
../trilateration/trilateration.c(941): warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
  941 |         if (abs(points_AC_0 - circles[2].r) < abs(points_AC_1 - circles[2].r))//cross_point[0]
      |             ^
../trilateration/trilateration.c(941): note: use function 'fabs' instead
  941 |         if (abs(points_AC_0 - circles[2].r) < abs(points_AC_1 - circles[2].r))//cross_point[0]
      |             ^~~
      |             fabs
../trilateration/trilateration.c(941): warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
  941 |         if (abs(points_AC_0 - circles[2].r) < abs(points_AC_1 - circles[2].r))//cross_point[0]
      |                                               ^
../trilateration/trilateration.c(941): note: use function 'fabs' instead
  941 |         if (abs(points_AC_0 - circles[2].r) < abs(points_AC_1 - circles[2].r))//cross_point[0]
      |                                               ^~~
      |                                               fabs
2 warnings and 2 errors generated.
compiling trilateration.c...
../at24c16/AT24C02.c(12): error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   12 |         printf("TEST1\r\n");
      |         ^

".\STM3210E-EVAL\STM3210E-EVAL.axf" - 17 Error(s), 17 Warning(s).

回复

使用道具 举报

35

主题

1152

帖子

4931

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4931
沙发
发表于 2025-6-7 09:53:48 | 只看该作者
1. 用我们资料包的MDK开发工具
2. 代码路径不能有中文
回复

使用道具 举报

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
板凳
 楼主| 发表于 2025-6-9 10:52:07 | 只看该作者
蓝点无限 发表于 2025-6-7 09:53
1. 用我们资料包的MDK开发工具
2. 代码路径不能有中文

感谢,现在可以了,但是烧录后基站和标签好像连接不上是什么原因
回复

使用道具 举报

35

主题

1152

帖子

4931

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4931
地板
发表于 2025-6-9 11:19:12 | 只看该作者
19810610698 发表于 2025-6-9 10:52
感谢,现在可以了,但是烧录后基站和标签好像连接不上是什么原因

提供具体现象,
如果自己编译的代码,给出具体修改了哪些内容

论坛交流,尽量详细描述你的问题,让我可以本地复现你的问题,而非最后的现象
回复

使用道具 举报

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
5#
 楼主| 发表于 2025-6-9 11:30:12 | 只看该作者
本帖最后由 19810610698 于 2025-6-9 11:32 编辑
蓝点无限 发表于 2025-6-9 11:19
提供具体现象,
如果自己编译的代码,给出具体修改了哪些内容

按照教程分别修改了标签和基站的define宏定义,跟踪功能改为1启动,其他代码没动,标签屏幕正常点亮,基站D5led灯闪烁
回复

使用道具 举报

35

主题

1152

帖子

4931

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4931
6#
发表于 2025-6-9 11:43:31 | 只看该作者
19810610698 发表于 2025-6-9 11:30
按照教程分别修改了标签和基站的define宏定义,跟踪功能改为1启动,其他代码没动,标签屏幕正常点亮,基 ...

具体哪些?一步一步描述,感谢&#128591;&#127995;
回复

使用道具 举报

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
7#
 楼主| 发表于 2025-6-9 13:38:09 | 只看该作者
本帖最后由 19810610698 于 2025-6-9 13:47 编辑
蓝点无限 发表于 2025-6-9 11:43
具体哪些?一步一步描述,感谢&#128591;&#127995;

#define TAG
#define TAG_ID 0x0F
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x02
#define SLAVE_TAG_START_INDEX 0x01

//#define ANTHOR
#define ANCHOR_MAX_NUM 2
#define ANCHOR_IND 0  // 0 1 2
按教程修改这个宏定义以及
static void compute_angle_send_to_anthor0(int distance1, int distance2,int distance3)
{

#if 1 //compute angle for smartcar
把小车追踪功能打开,分别修改相应宏定义烧录基站和标签,复位上电,发现屏幕没有显示距离信息,像是标签和基站没有连接上我是一个标签,两个基站,是宏定义没改对吗分别是
标签:
#define TAG
#define TAG_ID 0x0F
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x02
#define SLAVE_TAG_START_INDEX 0x01

//#define ANTHOR
#define ANCHOR_MAX_NUM 2
#define ANCHOR_IND 0  // 0 1 2基站1:
//#define TAG
#define TAG_ID 0x0F
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x02
#define SLAVE_TAG_START_INDEX 0x01

#define ANTHOR
#define ANCHOR_MAX_NUM 2
#define ANCHOR_IND 0  // 0 1 2
基站2:
//#define TAG
#define TAG_ID 0x0F
#define MASTER_TAG 0x0F
#define MAX_SLAVE_TAG 0x02
#define SLAVE_TAG_START_INDEX 0x01

#define ANTHOR
#define ANCHOR_MAX_NUM 2
#define ANCHOR_IND 1 // 0 1 2
回复

使用道具 举报

35

主题

1152

帖子

4931

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4931
8#
发表于 2025-6-9 13:50:03 | 只看该作者
19810610698 发表于 2025-6-9 13:38
#define TAG
#define TAG_ID 0x0F
#define MASTER_TAG 0x0F

MAX ANTHOR保持3,不要修改为2,再试试
回复

使用道具 举报

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
9#
 楼主| 发表于 2025-6-9 14:03:58 | 只看该作者
蓝点无限 发表于 2025-6-9 13:50
MAX ANTHOR保持3,不要修改为2,再试试

有了,感谢
回复

使用道具 举报

3

主题

8

帖子

33

积分

新手上路

Rank: 1

积分
33
10#
 楼主| 发表于 2025-6-9 14:37:36 | 只看该作者
蓝点无限 发表于 2025-6-9 13:50
MAX ANTHOR保持3,不要修改为2,再试试

这个程序,基站没有通过串口发送小车跟踪时的转弯或直行信息,我追踪了一下程序,基站部分代码没有调用
static void compute_angle_send_to_anthor0(int distance1, int distance2,int distance3)
{

#if 1 //compute angle for smartcar
这个函数
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

bphero Inc.  

GMT+8, 2025-7-4 22:01 , Processed in 0.021835 second(s), 5 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

快速回复 返回顶部 返回列表