project generated for AB32VG1 board full of errors(not compiling)

Created at 2023-03-02 02:28:49

Hello. Project generated for AB32VG1 board does not compile because of errors. No custom code added, just a clean generated project with default "PE.1" Blink example.

RT-Thread Studio Version: 2.2.6 Build id: 202211231640
RT-Thread 4.1.1 (intalled using SDK Manager)
Risc-V GCC Toolchain (intalled using SDK Manager, path in Project->Properties->MCU->Toolchain point to correct place)
Board: Prougen AB32VG1

Console Output in IDE:

make -j2 all2 
riscv64-unknown-elf-gcc "../rt-thread/components/libc/compilers/common/cstdlib.c"
riscv64-unknown-elf-gcc "../libraries/hal_drivers/drv_common.c"
../rt-thread/components/libc/compilers/common/cstdlib.c: In function 'ltoa':
../rt-thread/components/libc/compilers/common/cstdlib.c:64:19: error: 'NULL' undeclared (first use in this function)
   64 |     if (string == NULL)
      |                   ^~~~
../rt-thread/components/libc/compilers/common/cstdlib.c:18:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
   17 | #include <rtdbg.h>
  +++ |+#include <stddef.h>
   18 | 
../rt-thread/components/libc/compilers/common/cstdlib.c:64:19: note: each undeclared identifier is reported only once for each function it appears in
   64 |     if (string == NULL)
      |                   ^~~~
../rt-thread/components/libc/compilers/common/cstdlib.c: In function 'ultoa':
../rt-thread/components/libc/compilers/common/cstdlib.c:119:19: error: 'NULL' undeclared (first use in this function)
  119 |     if (string == NULL)
      |                   ^~~~
../rt-thread/components/libc/compilers/common/cstdlib.c:119:19: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
make: *** [rt-thread/components/libc/compilers/common/subdir.mk:33: rt-thread/components/libc/compilers/common/cstdlib.o] Error 1
make: *** Waiting for unfinished jobs....
../libraries/hal_drivers/drv_common.c:19:12: error: expected declaration specifiers or '...' before string constant
   19 | RT_SECTION(".irq.uart")
      |            ^~~~~~~~~~~
../libraries/hal_drivers/drv_common.c:26:12: error: expected declaration specifiers or '...' before string constant
   26 | RT_SECTION(".irq.uart")
      |            ^~~~~~~~~~~
../libraries/hal_drivers/drv_common.c:33:12: error: expected declaration specifiers or '...' before string constant
   33 | RT_SECTION(".irq.uart")
      |            ^~~~~~~~~~~
make: *** [libraries/hal_drivers/subdir.mk:24: libraries/hal_drivers/drv_common.o] Error 1
"make -j2 all2" terminated with exit code 2. Build might be incomplete.

More

Follower
0
Views
217
2 Answers
牧尘
牧尘 2023-03-06

First please find rtconfig_preinc.h
than write the following to the file:

#define RT_USING_LIBC
#define RT_USING_NEWLIBC
#define _POSIX_C_SOURCE 1

Second
There might be some mistakes as follow

RT_SECTION(".irq.uart")

Please send all the'RT_ SECTION'was replaced with'rt_ section'

These methods could solve the problem, but they were not the best way

Write Your Answer

Log in to publish your answer.,Click here to log in.

Create
Post

Share