谷动谷力

 找回密码
 立即注册
查看: 1736|回复: 0
打印 上一主题 下一主题
收起左侧

RT-Thread Studio_AB32VG1新建模板工程编译出现错误解决方法

[复制链接]
跳转到指定楼层
楼主
发表于 2021-10-1 18:56:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
新建模板工程编译出现错误:

  1. ../libraries/hal_drivers/drv_common.c: In function 'uart0_irq_post':
  2. ../libraries/hal_drivers/drv_common.c:22:5: error: unknown type name 'uint8_t'; did you mean 'rt_uint8_t'?
  3.    22 |     uint8_t mq_msg = MSG_UART0_IRQ;
  4.       |     ^~~~~~~
  5.       |     rt_uint8_t
  6. ../libraries/hal_drivers/drv_common.c: In function 'uart1_irq_post':
  7. ../libraries/hal_drivers/drv_common.c:29:5: error: unknown type name 'uint8_t'; did you mean 'rt_uint8_t'?
  8.    29 |     uint8_t mq_msg = MSG_UART1_IRQ;
  9.       |     ^~~~~~~
  10.       |     rt_uint8_t
  11. ../libraries/hal_drivers/drv_common.c: In function 'uart2_irq_post':
  12. ../libraries/hal_drivers/drv_common.c:36:5: error: unknown type name 'uint8_t'; did you mean 'rt_uint8_t'?
  13.    36 |     uint8_t mq_msg = MSG_UART2_IRQ;
  14.       |     ^~~~~~~
  15.       |     rt_uint8_t
  16. ../libraries/hal_drivers/drv_common.c: In function 'drv_thread_entry':
  17. ../libraries/hal_drivers/drv_common.c:42:5: error: unknown type name 'uint8_t'; did you mean 'rt_uint8_t'?
  18.    42 |     uint8_t mq_msg = 0;
  19.       |     ^~~~~~~
  20.       |     rt_uint8_t
  21. make: *** [libraries/hal_drivers/subdir.mk:24: libraries/hal_drivers/drv_common.o] Error 1
  22. make: *** Waiting for unfinished jobs....
  23. ../libraries/hal_drivers/drv_usart.c: In function 'rt_hw_usart_init':
  24. ../libraries/hal_drivers/drv_usart.c:327:42: error: 'NULL' undeclared (first use in this function)
  25.   327 |                                        , NULL);
  26.       |                                          ^~~~
  27. ../libraries/hal_drivers/drv_usart.c:20:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
  28.    19 | #include <drv_log.h>
  29.   +++ |+#include <stddef.h>
  30.    20 |
  31. ../libraries/hal_drivers/drv_usart.c:327:42: note: each undeclared identifier is reported only once for each function it appears in
  32.   327 |                                        , NULL);
  33.       |      
  34.      ^~~~
复制代码

                           
大意是:uint8_t  NULL 未定义

解决方法:
在出错的文件里增加头文件(添加在drv_common.h可一次性解决)

  1. #include <stdint.h>
  2. #include <stddef.h>
复制代码

重新编译成功

  1. ........
  2.    text    data     bss     dec     hex filename
  3. 140572       0   78188  218760   35688 rtthread.elf
  4. sh ../pre_build.sh
  5. riscv32-elf-xmaker -b rtthread.xm
  6. CODE SIZE: 147 KB
  7. save file "rtthread.dcf" successful
  8. riscv32-elf-xmaker -b download.xm
  9. 18:39:02 Build Finished. 0 errors, 0 warnings. (took 7s.301ms)
复制代码


+10
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-11-24 15:43 , Processed in 0.301513 second(s), 39 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

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