RT-Thread论坛
直播中

李巍

8年用户 1532经验值
私信 关注
[问答]

通过scons生成RT-Thread Studio工程,编译报rtconfig_preinc.h告警怎么解决?

我在 github 下载 V5.1.0 的代码,在 gd32f450 的 bsp 中通过命令 scons --dist-ide 生成能够在 RT-Thread Studio 下运行的工程。在编译时会爆出大量告警:

  • 14:52:09 **** Build of configuration Debug for project rt-studio-project ****
  • make -j8 all
  • arm-none-eabi-gcc "../rt-thread/src/klibc/kstdio.c"
  • arm-none-eabi-gcc "../rt-thread/src/klibc/kstring.c"
  • arm-none-eabi-gcc "../rt-thread/src/clock.c"
  • arm-none-eabi-gcc "../rt-thread/src/components.c"
  • arm-none-eabi-gcc "../rt-thread/src/idle.c"
  • arm-none-eabi-gcc "../rt-thread/src/ipc.c"
  • arm-none-eabi-gcc "../rt-thread/src/irq.c"
  • arm-none-eabi-gcc "../rt-thread/src/kservice.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • ../rt-thread/src/klibc/kstdio.c:294:9: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
  • #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
  •          ^
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • ../rt-thread/src/clock.c: In function 'rt_tick_increase':
  • ../rt-thread/src/clock.c:100:5: warning: implicit declaration of function 'rt_sched_tick_increase' [-Wimplicit-function-declaration]
  •      rt_sched_tick_increase();
  •      ^
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • ../rt-thread/src/ipc.c: In function 'rt_susp_list_dequeue':
  • ../rt-thread/src/ipc.c:118:17: warning: implicit declaration of function 'rt_sched_thread_ready' [-Wimplicit-function-declaration]
  •          error = rt_sched_thread_ready(thread);
  •                  ^
  • ../rt-thread/src/ipc.c: In function 'rt_susp_list_enqueue':
  • ../rt-thread/src/ipc.c:262:21: warning: implicit declaration of function 'rt_sched_thread_get_curr_prio' [-Wimplicit-function-declaration]
  •                  if (rt_sched_thread_get_curr_prio(thread) < rt_sched_thread_get_curr_prio(sthread))
  •                      ^
  • ../rt-thread/src/ipc.c: In function '_thread_get_mutex_priority':
  • ../rt-thread/src/ipc.c:849:27: warning: implicit declaration of function 'rt_sched_thread_get_init_prio' [-Wimplicit-function-declaration]
  •      rt_uint8_t priority = rt_sched_thread_get_init_prio(thread);
  •                            ^
  • ../rt-thread/src/ipc.c: In function '_thread_update_priority':
  • ../rt-thread/src/ipc.c:876:11: warning: implicit declaration of function 'rt_sched_thread_change_priority' [-Wimplicit-function-declaration]
  •      ret = rt_sched_thread_change_priority(thread, priority);
  •            ^
  • ../rt-thread/src/ipc.c:878:31: warning: implicit declaration of function 'rt_sched_thread_is_suspended' [-Wimplicit-function-declaration]
  •      while ((ret == RT_EOK) && rt_sched_thread_is_suspended(thread))
  •                                ^
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/src/mem.c"
  • arm-none-eabi-gcc "../rt-thread/src/mempool.c"
  • arm-none-eabi-gcc "../rt-thread/src/object.c"
  • arm-none-eabi-gcc "../rt-thread/src/scheduler_comm.c"
  • arm-none-eabi-gcc "../rt-thread/src/scheduler_up.c"
  • arm-none-eabi-gcc "../rt-thread/src/thread.c"
  • arm-none-eabi-gcc "../rt-thread/src/timer.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/libcpu/arm/cortex-m4/context_gcc.S"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • ../rt-thread/src/scheduler_comm.c: In function 'rt_sched_thread_init_ctx':
  • ../rt-thread/src/scheduler_comm.c:30:5: warning: implicit declaration of function 'rt_sched_thread_init_priv' [-Wimplicit-function-declaration]
  •      rt_sched_thread_init_priv(thread, tick, priority);
  •      ^
  • ../rt-thread/src/scheduler_comm.c: In function 'rt_sched_thread_ready':
  • ../rt-thread/src/scheduler_comm.c:140:13: warning: implicit declaration of function 'rt_sched_insert_thread' [-Wimplicit-function-declaration]
  •              rt_sched_insert_thread(thread);
  •              ^
  • ../rt-thread/src/scheduler_comm.c: In function 'rt_sched_thread_change_priority':
  • ../rt-thread/src/scheduler_comm.c:184:9: warning: implicit declaration of function 'rt_sched_remove_thread' [-Wimplicit-function-declaration]
  •          rt_sched_remove_thread(thread);
  •          ^
  • ../rt-thread/src/scheduler_up.c: In function 'rt_system_scheduler_start':
  • ../rt-thread/src/scheduler_up.c:180:5: warning: implicit declaration of function 'rt_sched_remove_thread' [-Wimplicit-function-declaration]
  •      rt_sched_remove_thread(to_thread);
  •      ^
  • ../rt-thread/src/scheduler_up.c: In function 'rt_schedule':
  • ../rt-thread/src/scheduler_up.c:249:21: warning: implicit declaration of function 'rt_sched_insert_thread' [-Wimplicit-function-declaration]
  •                      rt_sched_insert_thread(from_thread);
  •                      ^
  • ../rt-thread/src/scheduler_up.c: At top level:
  • ../rt-thread/src/scheduler_up.c:370:6: warning: conflicting types for 'rt_sched_insert_thread'
  • void rt_sched_insert_thread(struct rt_thread *thread)
  •       ^
  • ../rt-thread/src/scheduler_up.c:249:21: note: previous implicit declaration of 'rt_sched_insert_thread' was here
  •                      rt_sched_insert_thread(from_thread);
  •                      ^
  • ../rt-thread/src/scheduler_up.c:422:6: warning: conflicting types for 'rt_sched_remove_thread'
  • void rt_sched_remove_thread(struct rt_thread *thread)
  •       ^
  • ../rt-thread/src/scheduler_up.c:180:5: note: previous implicit declaration of 'rt_sched_remove_thread' was here
  •      rt_sched_remove_thread(to_thread);
  •      ^
  • ../rt-thread/src/thread.c: In function '_thread_exit':
  • ../rt-thread/src/thread.c:92:5: warning: implicit declaration of function 'rt_sched_remove_thread' [-Wimplicit-function-declaration]
  •      rt_sched_remove_thread(thread);
  •      ^
  • ../rt-thread/src/thread.c:98:5: warning: implicit declaration of function 'rt_sched_thread_close' [-Wimplicit-function-declaration]
  •      rt_sched_thread_close(thread);
  •      ^
  • In file included from ../rt-thread/src/thread.c:41:0:
  • ../rt-thread/src/thread.c: In function '_thread_timeout':
  • ../rt-thread/src/thread.c:134:15: warning: implicit declaration of function 'rt_sched_thread_is_suspended' [-Wimplicit-function-declaration]
  •      RT_ASSERT(rt_sched_thread_is_suspended(thread));
  •                ^
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrt-threadinclude/rtthread.h:782:7: note: in definition of macro 'RT_ASSERT'
  • if (!(EX))
  •        ^
  • ../rt-thread/src/thread.c:142:5: warning: implicit declaration of function 'rt_sched_insert_thread' [-Wimplicit-function-declaration]
  •      rt_sched_insert_thread(thread);
  •      ^
  • ../rt-thread/src/thread.c: In function '_thread_init':
  • ../rt-thread/src/thread.c:193:5: warning: implicit declaration of function 'rt_sched_thread_init_ctx' [-Wimplicit-function-declaration]
  •      rt_sched_thread_init_ctx(thread, tick, priority);
  •      ^
  • ../rt-thread/src/thread.c: In function 'rt_thread_startup':
  • ../rt-thread/src/thread.c:404:5: warning: implicit declaration of function 'rt_sched_thread_startup' [-Wimplicit-function-declaration]
  •      rt_sched_thread_startup(thread);
  •      ^
  • arm-none-eabi-gcc "../rt-thread/libcpu/arm/cortex-m4/cpuport.c"
  • ../rt-thread/src/thread.c: In function '_thread_detach':
  • ../rt-thread/src/thread.c:452:21: warning: implicit declaration of function 'rt_sched_thread_get_stat' [-Wimplicit-function-declaration]
  •      thread_status = rt_sched_thread_get_stat(thread);
  •                      ^
  • ../rt-thread/src/thread.c: In function 'rt_thread_yield':
  • ../rt-thread/src/thread.c:583:5: warning: implicit declaration of function 'rt_sched_thread_yield' [-Wimplicit-function-declaration]
  •      rt_sched_thread_yield(rt_thread_self());
  •      ^
  • ../rt-thread/src/thread.c: In function 'rt_thread_control':
  • ../rt-thread/src/thread.c:786:21: warning: implicit declaration of function 'rt_sched_thread_change_priority' [-Wimplicit-function-declaration]
  •              error = rt_sched_thread_change_priority(thread, *(rt_uint8_t *)arg);
  •                      ^
  • ../rt-thread/src/thread.c:819:20: warning: implicit declaration of function 'rt_sched_thread_bind_cpu' [-Wimplicit-function-declaration]
  •              return rt_sched_thread_bind_cpu(thread, cpu);
  •                     ^
  • ../rt-thread/src/thread.c: In function 'rt_thread_suspend_to_list':
  • ../rt-thread/src/thread.c:949:5: warning: implicit declaration of function 'rt_sched_thread_timer_stop' [-Wimplicit-function-declaration]
  •      rt_sched_thread_timer_stop(thread);
  •      ^
  • ../rt-thread/src/thread.c: In function 'rt_thread_resume':
  • ../rt-thread/src/thread.c:1007:13: warning: implicit declaration of function 'rt_sched_thread_ready' [-Wimplicit-function-declaration]
  •      error = rt_sched_thread_ready(thread);
  •              ^
  • arm-none-eabi-gcc "../rt-thread/libcpu/arm/common/div0.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/libcpu/arm/common/showmem.c"
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/newlib/syscalls.c"
  • ../rt-thread/src/timer.c: In function 'rt_timer_start':
  • ../rt-thread/src/timer.c:516:9: warning: implicit declaration of function 'rt_sched_thread_timer_start' [-Wimplicit-function-declaration]
  •          rt_sched_thread_timer_start(thread);
  •          ^
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/cctype.c"
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/cstdlib.c"
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/cstring.c"
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/ctime.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/cunistd.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/cwchar.c"
  • arm-none-eabi-gcc "../rt-thread/components/finsh/cmd.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/finsh/msh.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/finsh/msh_file.c"
  • arm-none-eabi-gcc "../rt-thread/components/finsh/msh_parse.c"
  • arm-none-eabi-gcc "../rt-thread/components/finsh/shell.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/serial/serial.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/pin/pin.c"
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/completion.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/condvar.c"
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/dataqueue.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/pipe.c"
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/ringblk_buf.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/ringbuffer.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/waitqueue.c"
  • arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/workqueue.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • arm-none-eabi-gcc "../rt-thread/components/drivers/core/device.c"
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/src/dfs.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/src/dfs_file.c"
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/src/dfs_fs.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/src/dfs_posix.c"
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c"
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/filesystems/elmfat/ff.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../rt-thread/components/dfs/dfs_v1/filesystems/elmfat/ffunicode.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/gd32_drivers/drv_gpio.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/gd32_drivers/drv_usart.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_dma.c"
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_exti.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_gpio.c"
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_misc.c"
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_rcu.c"
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_syscfg.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/GD32F4xx_standard_peripheral/Source/gd32f4xx_usart.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/CMSIS/GD/GD32F4xx/Source/GCC/startup_gd32f4xx.s"
  • arm-none-eabi-gcc "../libraries/GD32F4xx_Firmware_Library/CMSIS/GD/GD32F4xx/Source/system_gd32f4xx.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • arm-none-eabi-gcc "../board/board.c"
  • arm-none-eabi-gcc "../applications/main.c"
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • In file included from :0:0:
  • D:SoftwareRT-ThreadStudioLMM_dischargert-studio-projectrtconfig_preinc.h:8:0: warning: "GD32F450" redefined
  • #define GD32F450
  • ^
  • :0:0: note: this is the location of the previous definition
  • linking...
  • arm-none-eabi-objcopy -O binary "rtthread.elf"  "rtthread.bin"
  • arm-none-eabi-size --format=berkeley "rtthread.elf"
  •    text       data        bss        dec        hex    filename
  • 116848       2472       4756     124076      1e4ac    rtthread.elf

  •               Used Size(B)           Used Size(KB)
  • Flash:         119320 B              116.52 KB
  • RAM:             7228 B                7.06 KB

  • 14:52:12 Build Finished. 0 errors, 87 warnings. (took 2s.786ms)


求助各位大佬,该问题是如何产生的呢?


回帖(1)

刘丹

2025-10-13 18:11:55

我们通过 `scons --dist-ide` 命令生成 RT-Thread Studio 工程后,在编译时出现大量告警,这通常是由于一些配置或头文件包含问题导致的。根据你提供的信息,问题可能集中在 `rtconfig_preinc.h` 文件上。这个文件是在工程配置过程中自动生成的预包含头文件。

常见的告警可能包括:
1. 头文件重复包含
2. 宏定义重复
3. 未使用的变量或函数
4. 类型不匹配等

但是,由于你提到是生成了工程后出现的告警,我们需要关注生成过程中是否有配置遗漏或错误。

解决步骤:

1. **检查生成工程时是否指定了正确的 BSP 路径**:确保在 `scons --dist-ide` 之前已经通过 `scons --menuconfig` 正确配置了工程,并且保存了配置(生成 `.config` 和 `rtconfig.h`)。

2. **检查 rtconfig_preinc.h 文件**:这个文件通常是在生成 Studio 工程时由脚本自动生成的,它包含了 `rtconfig.h` 中的配置,以预包含头文件的形式应用于所有源文件。如果这个文件中的宏定义与原有头文件冲突,可能会导致告警。

3. **查看具体告警信息**:你提供的日志中并没有具体的告警内容,所以需要你查看编译输出的告警信息,确定告警的具体原因。常见的告警可能是“宏重定义”或者“未使用的变量”等。

4. **清理工程**:尝试清理生成的 Studio 工程,然后重新编译。在 RT-Thread Studio 中,可以执行 Project -> Clean。

5. **更新 RT-Thread 版本**:你使用的是 V5.1.0,可以尝试更新到最新的版本(比如从 GitHub 上拉取最新的代码),因为可能这个问题在后续版本已经修复。

6. **手动修改 rtconfig_preinc.h**:如果告警是由于某个宏重复定义引起的,可以尝试在 `rtconfig_preinc.h` 中注释掉重复的宏定义。但请注意,这可能会影响功能,所以需要谨慎。

7. **检查预包含头文件设置**:在 RT-Thread Studio 工程中,检查预包含头文件(`rtconfig_preinc.h`)的包含路径和顺序。确保没有其他头文件在它之前被包含。

8. **忽略特定告警**:如果确认告警是安全的,可以在编译选项中添加告警屏蔽标志。例如,在 Studio 的工程属性中,找到 C/C++ Build -> Settings -> Tool Settings -> GCC C Compiler -> Warnings,添加 `-Wno-xxxx` 来屏蔽特定告警。但这不是根本解决办法,仅作为临时措施。

由于你提供的信息有限,下面是一个通用的排查步骤:

具体操作:

步骤1:在 BSP 目录下,执行以下命令生成 Studio 工程。
```
scons --dist-ide
```

步骤2:在生成的 rt-studio-project 文件夹中,打开 RT-Thread Studio 工程。

步骤3:编译工程,查看具体告警信息。例如,如果告警是关于“RT_USING_USER_MAIN”的重定义,那么可以在 `rtconfig_preinc.h` 中查找该宏定义,并查看是否有多个定义。

步骤4:如果发现 `rtconfig.h` 和 `rtconfig_preinc.h` 中有重复的宏定义,可以尝试修改生成脚本,避免重复。但请注意,`rtconfig_preinc.h` 是自动生成的,所以可能需要修改生成逻辑。

然而,对于 GD32F450 的 BSP,可能存在已知问题。你可以查看 RT-Thread 的 GitHub 仓库的 Issues 部分,看看是否有类似问题。

步骤5:如果以上步骤无效,尝试手动修改 `rtconfig_preinc.h` 文件,但记住每次重新生成工程时都需要修改。或者,你可以在生成工程后,在 Studio 工程设置中移除预包含头文件 `rtconfig_preinc.h`,然后改为在编译选项中直接包含 `rtconfig.h`。但这样做可能会带来其他问题,因为预包含头文件机制是为了确保配置被正确应用。

步骤6:如果告警是未使用变量或函数,这通常不影响程序运行,但如果你希望消除告警,可以修改源代码(例如,添加 `RT_UNUSED` 宏)或者屏蔽特定告警。

由于没有具体的告警内容,我无法给出更具体的解决方案。建议将具体的告警信息提供出来,以便进一步分析。

如果你能提供具体的告警信息,我可以帮助你更精确地定位问题。

编译时出现大量告警的问题通常与预编译头文件 rtconfig_preinc.h 的配置或包含方式有关。以下是逐步解决方案:




1. 检查预编译头文件生成


rtconfig_preinc.h 是由 SCons 自动生成的预包含文件,用于将 rtconfig.h 的配置注入所有源文件。常见问题包括:



  • 文件内容重复

  • 宏定义冲突

  • 包含路径错误


解决步骤:



  • bsp/gd32f450 目录下运行:
    scons --dist-ide

    确保生成工程时没有错误。


  • 打开生成的 rt-studio-project 文件夹,检查 rtconfig_preinc.h 文件内容:
    // rtconfig_preinc.h 应类似以下结构:
    #define USE_HAL_DRIVER
    #define RT_USING_XXX
    ... // 其他宏定义

    确认其中无重复宏(如多次定义 RT_USING_USER_MAIN)。





2. 排查头文件包含顺序


在 RT-Thread Studio 中,预编译头文件必须在所有源文件最前面包含。如果其他头文件(如 rtconfig.h)被提前包含,会导致宏重复定义。


解决方法:



  • 在工程属性中设置预编译头路径:

    • 右键工程 → PropertiesC/C++ BuildSettingsTool Settings 标签:

    • GCC C CompilerPreprocessor

      • 添加预包含文件路径:"${workspace_loc:/${ProjName}/rtconfig_preinc.h}"


    • Include paths (-I)
      确保 rtconfig_preinc.h 所在目录(通常是工程根目录)已包含。





3. 禁用冗余配置


rtconfig.hrtconfig_preinc.h 内容冲突,需修改 BSP 配置:


步骤:



  1. 进入 bsp/gd32f450 目录,运行菜单配置:
    scons --menuconfig

  2. 检查以下配置项:

    • RT-Thread KernelEnable components initialization → 关闭 Enable user main(若未使用自定义 main)。

    • 确保配置与芯片型号匹配(如 GD32F450)。


  3. 保存配置后重新生成工程:
    scons --dist-ide




4. 清理并重建工程



  • 清理生成文件

    • 在 Studio 中:Project → Clean

    • 手动删除工程目录下的 Debugbuild 文件夹。


  • 重新编译Project → Build All




5. 忽略特定告警(临时方案)


如果告警来自第三方代码且不影响功能,可屏蔽告警:



  • 在工程属性中:C/C++ Build → Settings → Tool Settings

    • GCC C Compiler → Warnings → 添加 -Wno-unused-variable -Wno-unused-function 等选项。





6. 验证 BSP 兼容性


确认使用的 GD32F450 BSP 适配 RT-Thread v5.1.0:



  • 检查 bsp/gd32f450/README.md 或查阅 RT-Thread 文档。若 BSP 未正式支持 v5.1.0,可尝试:

    • 使用 master 分支最新代码。

    • 回退到旧版本(如 v4.1.0)。





7. 示例:修复预包含路径


在工程 .cproject 文件中检查预包含设置(XML 格式):



  
  

确保路径正确且无重复包含。




通过以上步骤,应能解决 rtconfig_preinc.h 引发的告警问题。如仍有异常,请提供具体告警日志进一步分析。

举报

更多回帖

发帖
×
20
完善资料,
赚取积分