谷动谷力

 找回密码
 立即注册
谷动谷力 首页 嵌入式 查看内容

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

2022-4-10 20:17| 发布者: 鸣涧| 查看: 73| 评论: 0|原作者: 鸣涧_GC96O

摘要: 新建模板工程编译出现错误: ../libraries/hal_drivers/drv_common.c: In function 'uart0_irq_post': ../libraries/hal_drivers/drv_common.c:22:5: error: unknown type name 'uint8_t'; did you mean 'rt_uint8_t ...
新建模板工程编译出现错误:

  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)

复制代码



鲜花

握手

雷人

路过

鸡蛋

相关阅读

发表评论

最新评论

最新热点

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

GMT+8, 2024-9-30 23:14 , Processed in 0.108584 second(s), 35 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

返回顶部