Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨[BSP][ESP32-C3] task issue #5941

Open
5 of 8 tasks
supperthomas opened this issue May 13, 2022 · 15 comments
Open
5 of 8 tasks

🔨[BSP][ESP32-C3] task issue #5941

supperthomas opened this issue May 13, 2022 · 15 comments
Labels
good first issue Good for newcomers 新手任务

Comments

@supperthomas
Copy link
Member

supperthomas commented May 13, 2022

task issue as follow

  • combine IDF and scons --targe=cmake build system
  • porting drv_gpio.c with cmake system
  • porting drv_uart.c with cmake system
  • porting drv_iic.c with cmake system
  • porting drv_spi.c with cmake system
  • porting drv_pwm.c with cmake system
  • add the menuconfig to rtconfig.h
  • fix IDF_PATH to local path
@supperthomas supperthomas added the good first issue Good for newcomers 新手任务 label May 13, 2022
@supperthomas supperthomas changed the title [BSP][ESP32-C3] task issue 🔨[BSP][ESP32-C3] task issue Jun 2, 2022
@supperthomas
Copy link
Member Author

fix IDF_PATH to local path 目前可以考虑将IDF_PATH路径修改成pkgs里面的软件包作为编译的时候的IDF_PATH. 不过尝试多次之后,效果不是很理想,也比较麻烦。 暂时不是很方便,后面再考虑,先把软件包提交上去。如果大伙有什么更好的办法,欢迎提供。目前需求是: 如何编译的时候将IDF_PATH 指定到本地package/rtt_esp_idf-latest 文件夹下面,而且可以顺利编译通过。

@supperthomas
Copy link
Member Author

#6247

@supperthomas
Copy link
Member Author

新版ESP32_C3 BSP发布
https://club.rt-thread.org/ask/article/46de5889adf71acc.html

@supperthomas
Copy link
Member Author

【ESP32C3】基于ESP32C3运行RT-THREAD

https://club.rt-thread.org/ask/article/6749217c538b42cd.html

@supperthomas
Copy link
Member Author

【请社区公测】新版ESP32_C3 BSP发布
https://club.rt-thread.org/ask/article/46de5889adf71acc.html

@supperthomas
Copy link
Member Author

@WCX1024979076
单独打开BLE 这个app_main没有定义。
https://github.com/RT-Thread/rt-thread/actions/runs/6709048939/job/18231225581

LINK rtthread.elf
/opt/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld: build/main/main.o: in function `main':
/home/runner/work/rt-thread/rt-thread/bsp/ESP32_C3/main/main.c:24: undefined reference to `app_main'

@WCX1024979076
Copy link
Contributor

WCX1024979076 commented Oct 31, 2023 via email

@supperthomas
Copy link
Member Author

这个需要参考readme里面将esp-idf的nimble样例程序加入到编译中

---Original--- From: "Supper @.> Date: Tue, Oct 31, 2023 23:59 PM To: @.>; Cc: @.@.>; Subject: Re: [RT-Thread/rt-thread] 🔨[BSP][ESP32-C3] task issue (Issue #5941) @WCX1024979076 单独打开BLE 这个app_main没有定义。 https://github.com/RT-Thread/rt-thread/actions/runs/6709048939/job/18231225581 LINK rtthread.elf /opt/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld: build/main/main.o: in function main': /home/runner/work/rt-thread/rt-thread/bsp/ESP32_C3/main/main.c:24: undefined reference to app_main' — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

image

这里用户自己操作起来问题会比较多,是不是可以提供一个step by step的步骤?

@supperthomas
Copy link
Member Author

@WCX1024979076
https://club.rt-thread.org/ask/article/419a30e57384a239.html
可否看下能不能默认状态下打开BLE宏,编译能通过?

@WCX1024979076
Copy link
Contributor

WCX1024979076 commented Nov 1, 2023 via email

@1078249029
Copy link
Contributor

请问现在的工具链可以确保编译成功么?

我在使用esp官方的gcc编译链产生编译错误:

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
riscv32-esp-elf-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

然后我在rtconfig.py文件中指定nosys.specs位置
DEVICE = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs '
之后又缺失cc1工具,当时使用脚本下载乐鑫的sdk被默认下载到/usr/lib里了,然后我又将cc1复制到了乐鑫默认sdk文件夹里 cp /usr/lib/riscv32-esp-elf/libexec/gcc/riscv32-esp-elf/11.2.0/cc1 /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
然后又爆出标准库文件丢失的错误

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
In file included from drivers/board.c:12:
packages/ESP-IDF-latest/components/hal/include/hal/systimer_hal.h:9:10: fatal error: stdint.h: No such file or directory
    9 | #include <stdint.h>
      |          ^~~~~~~~~~
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

根据网上的信息很可能是工具链设置出错,但是我是根据目前最新的教程移植的,请问楼主您最近移植rtt到esp32c3了么?可以编译通过么?

下面是我的环境配置

gcc:

lzx@DESKTOP-EPJK785 ESP32_C3 (master) $ /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
Target: riscv32-esp-elf
Configured with: /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=riscv32-esp-elf --prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --exec_prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf --with-headers=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf/include --with-newlib --enable-threads=no --disable-shared --with-arch=rv32gc --with-abi=ilp32 --with-pkgversion='crosstool-NG esp-13.2.0_20230928' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libstdcxx-verbose --with-gmp=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (crosstool-NG esp-13.2.0_20230928)

rtconfig.py

import os

# toolchains options
ARCH        ='risc-v'
CPU         =''
CROSS_TOOL  ='gcc'

if os.getenv('RTT_CC'):
    CROSS_TOOL = os.getenv('RTT_CC')
print("CROSS_TOOL=",CROSS_TOOL)

if CROSS_TOOL == 'gcc':
    PLATFORM    = 'gcc'
    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin'
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/'  # 三套编译链都试过了,后两套找不到ll库
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin'
else:
    print('Please make sure your toolchains is GNU GCC!')
    exit(0)

if os.getenv('RTT_EXEC_PATH'):
    EXEC_PATH = os.getenv('RTT_EXEC_PATH')
EXEC_PATH = os.path.expanduser(EXEC_PATH)
print("EXEC_PATH=",EXEC_PATH)
BUILD = 'debug'

if PLATFORM == 'gcc':
    # toolchains
    PREFIX = 'riscv32-esp-elf-'
    CC = PREFIX + 'gcc'
    CXX = PREFIX + 'g++'
    AS = PREFIX + 'gcc'
    AR = PREFIX + 'ar'
    LINK = PREFIX + 'g++'
    TARGET_EXT = 'elf'
    SIZE = PREFIX + 'size'
    OBJDUMP = PREFIX + 'objdump'
    OBJCPY = PREFIX + 'objcopy'
    STRIP = PREFIX + 'strip'

    DEVICE  = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs '
    CFLAGS = DEVICE + '-gdwarf-4 -ggdb -Og'
    AFLAGS =  ' -c' + DEVICE + ' -x assembler-with-cpp'
    LFLAGS = DEVICE + ' -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T idf_port/ld/memory.ld -T idf_port/ld/sections.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld -T packages/ESP-IDF-latest/components/soc/esp32c3/ld/esp32c3.peripherals.ld  -Wl,--wrap=_Unwind_SetEnableExceptionFdeSorting -Wl,--wrap=__register_frame_info_bases -Wl,--wrap=__register_frame_info -Wl,--wrap=__register_frame -Wl,--wrap=__register_frame_info_table_bases -Wl,--wrap=__register_frame_info_table -Wl,--wrap=__register_frame_table -Wl,--wrap=__deregister_frame_info_bases -Wl,--wrap=__deregister_frame_info -Wl,--wrap=_Unwind_Find_FDE -Wl,--wrap=_Unwind_GetGR -Wl,--wrap=_Unwind_GetCFA -Wl,--wrap=_Unwind_GetIP -Wl,--wrap=_Unwind_GetIPInfo -Wl,--wrap=_Unwind_GetRegionStart -Wl,--wrap=_Unwind_GetDataRelBase -Wl,--wrap=_Unwind_GetTextRelBase -Wl,--wrap=_Unwind_SetIP -Wl,--wrap=_Unwind_SetGR -Wl,--wrap=_Unwind_GetLanguageSpecificData -Wl,--wrap=_Unwind_FindEnclosingFunction -Wl,--wrap=_Unwind_Resume -Wl,--wrap=_Unwind_RaiseException -Wl,--wrap=_Unwind_DeleteException -Wl,--wrap=_Unwind_ForcedUnwind -Wl,--wrap=_Unwind_Resume_or_Rethrow -Wl,--wrap=_Unwind_Backtrace -Wl,--wrap=__cxa_call_unexpected -Wl,--eh-frame-hdr -Wl,--wrap=__gxx_personality_v0  -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0'
    CXXFLAGS = CFLAGS

    POST_ACTION = OBJCPY + ' -Oihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'

@supperthomas
Copy link
Member Author

请问现在的工具链可以确保编译成功么?

我在使用esp官方的gcc编译链产生编译错误:

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
riscv32-esp-elf-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

然后我在rtconfig.py文件中指定nosys.specs位置 DEVICE = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs ' 之后又缺失cc1工具,当时使用脚本下载乐鑫的sdk被默认下载到/usr/lib里了,然后我又将cc1复制到了乐鑫默认sdk文件夹里 cp /usr/lib/riscv32-esp-elf/libexec/gcc/riscv32-esp-elf/11.2.0/cc1 /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin 然后又爆出标准库文件丢失的错误

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
In file included from drivers/board.c:12:
packages/ESP-IDF-latest/components/hal/include/hal/systimer_hal.h:9:10: fatal error: stdint.h: No such file or directory
    9 | #include <stdint.h>
      |          ^~~~~~~~~~
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

根据网上的信息很可能是工具链设置出错,但是我是根据目前最新的教程移植的,请问楼主您最近移植rtt到esp32c3了么?可以编译通过么?

下面是我的环境配置

gcc:

lzx@DESKTOP-EPJK785 ESP32_C3 (master) $ /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
Target: riscv32-esp-elf
Configured with: /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=riscv32-esp-elf --prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --exec_prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf --with-headers=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf/include --with-newlib --enable-threads=no --disable-shared --with-arch=rv32gc --with-abi=ilp32 --with-pkgversion='crosstool-NG esp-13.2.0_20230928' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libstdcxx-verbose --with-gmp=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (crosstool-NG esp-13.2.0_20230928)

rtconfig.py

import os

# toolchains options
ARCH        ='risc-v'
CPU         =''
CROSS_TOOL  ='gcc'

if os.getenv('RTT_CC'):
    CROSS_TOOL = os.getenv('RTT_CC')
print("CROSS_TOOL=",CROSS_TOOL)

if CROSS_TOOL == 'gcc':
    PLATFORM    = 'gcc'
    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin'
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/'  # 三套编译链都试过了,后两套找不到ll库
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin'
else:
    print('Please make sure your toolchains is GNU GCC!')
    exit(0)

if os.getenv('RTT_EXEC_PATH'):
    EXEC_PATH = os.getenv('RTT_EXEC_PATH')
EXEC_PATH = os.path.expanduser(EXEC_PATH)
print("EXEC_PATH=",EXEC_PATH)
BUILD = 'debug'

if PLATFORM == 'gcc':
    # toolchains
    PREFIX = 'riscv32-esp-elf-'
    CC = PREFIX + 'gcc'
    CXX = PREFIX + 'g++'
    AS = PREFIX + 'gcc'
    AR = PREFIX + 'ar'
    LINK = PREFIX + 'g++'
    TARGET_EXT = 'elf'
    SIZE = PREFIX + 'size'
    OBJDUMP = PREFIX + 'objdump'
    OBJCPY = PREFIX + 'objcopy'
    STRIP = PREFIX + 'strip'

    DEVICE  = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs '
    CFLAGS = DEVICE + '-gdwarf-4 -ggdb -Og'
    AFLAGS =  ' -c' + DEVICE + ' -x assembler-with-cpp'
    LFLAGS = DEVICE + ' -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T idf_port/ld/memory.ld -T idf_port/ld/sections.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld -T packages/ESP-IDF-latest/components/soc/esp32c3/ld/esp32c3.peripherals.ld  -Wl,--wrap=_Unwind_SetEnableExceptionFdeSorting -Wl,--wrap=__register_frame_info_bases -Wl,--wrap=__register_frame_info -Wl,--wrap=__register_frame -Wl,--wrap=__register_frame_info_table_bases -Wl,--wrap=__register_frame_info_table -Wl,--wrap=__register_frame_table -Wl,--wrap=__deregister_frame_info_bases -Wl,--wrap=__deregister_frame_info -Wl,--wrap=_Unwind_Find_FDE -Wl,--wrap=_Unwind_GetGR -Wl,--wrap=_Unwind_GetCFA -Wl,--wrap=_Unwind_GetIP -Wl,--wrap=_Unwind_GetIPInfo -Wl,--wrap=_Unwind_GetRegionStart -Wl,--wrap=_Unwind_GetDataRelBase -Wl,--wrap=_Unwind_GetTextRelBase -Wl,--wrap=_Unwind_SetIP -Wl,--wrap=_Unwind_SetGR -Wl,--wrap=_Unwind_GetLanguageSpecificData -Wl,--wrap=_Unwind_FindEnclosingFunction -Wl,--wrap=_Unwind_Resume -Wl,--wrap=_Unwind_RaiseException -Wl,--wrap=_Unwind_DeleteException -Wl,--wrap=_Unwind_ForcedUnwind -Wl,--wrap=_Unwind_Resume_or_Rethrow -Wl,--wrap=_Unwind_Backtrace -Wl,--wrap=__cxa_call_unexpected -Wl,--eh-frame-hdr -Wl,--wrap=__gxx_personality_v0  -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0'
    CXXFLAGS = CFLAGS

    POST_ACTION = OBJCPY + ' -Oihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'

https://github.com/RT-Thread/rt-thread/actions/runs/10645398186/job/29511156571
请参考这个链接

@1078249029
Copy link
Contributor

请问现在的工具链可以确保编译成功么?
我在使用esp官方的gcc编译链产生编译错误:

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
riscv32-esp-elf-gcc: fatal error: cannot read spec file 'nosys.specs': No such file or directory
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

然后我在rtconfig.py文件中指定nosys.specs位置 DEVICE = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs ' 之后又缺失cc1工具,当时使用脚本下载乐鑫的sdk被默认下载到/usr/lib里了,然后我又将cc1复制到了乐鑫默认sdk文件夹里 cp /usr/lib/riscv32-esp-elf/libexec/gcc/riscv32-esp-elf/11.2.0/cc1 /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin 然后又爆出标准库文件丢失的错误

scons: Reading SConscript files ...
CROSS_TOOL= gcc
EXEC_PATH= /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/drivers/board.o
In file included from drivers/board.c:12:
packages/ESP-IDF-latest/components/hal/include/hal/systimer_hal.h:9:10: fatal error: stdint.h: No such file or directory
    9 | #include <stdint.h>
      |          ^~~~~~~~~~
compilation terminated.
scons: *** [build/drivers/board.o] Error 1
scons: building terminated because of errors.

根据网上的信息很可能是工具链设置出错,但是我是根据目前最新的教程移植的,请问楼主您最近移植rtt到esp32c3了么?可以编译通过么?
下面是我的环境配置
gcc:

lzx@DESKTOP-EPJK785 ESP32_C3 (master) $ /home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/home/lzx/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
Target: riscv32-esp-elf
Configured with: /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=riscv32-esp-elf --prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --exec_prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf --with-headers=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/riscv32-esp-elf/include --with-newlib --enable-threads=no --disable-shared --with-arch=rv32gc --with-abi=ilp32 --with-pkgversion='crosstool-NG esp-13.2.0_20230928' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libstdcxx-verbose --with-gmp=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/riscv32-esp-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (crosstool-NG esp-13.2.0_20230928)

rtconfig.py

import os

# toolchains options
ARCH        ='risc-v'
CPU         =''
CROSS_TOOL  ='gcc'

if os.getenv('RTT_CC'):
    CROSS_TOOL = os.getenv('RTT_CC')
print("CROSS_TOOL=",CROSS_TOOL)

if CROSS_TOOL == 'gcc':
    PLATFORM    = 'gcc'
    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin'
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/'  # 三套编译链都试过了,后两套找不到ll库
#    EXEC_PATH   = r'~/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin'
else:
    print('Please make sure your toolchains is GNU GCC!')
    exit(0)

if os.getenv('RTT_EXEC_PATH'):
    EXEC_PATH = os.getenv('RTT_EXEC_PATH')
EXEC_PATH = os.path.expanduser(EXEC_PATH)
print("EXEC_PATH=",EXEC_PATH)
BUILD = 'debug'

if PLATFORM == 'gcc':
    # toolchains
    PREFIX = 'riscv32-esp-elf-'
    CC = PREFIX + 'gcc'
    CXX = PREFIX + 'g++'
    AS = PREFIX + 'gcc'
    AR = PREFIX + 'ar'
    LINK = PREFIX + 'g++'
    TARGET_EXT = 'elf'
    SIZE = PREFIX + 'size'
    OBJDUMP = PREFIX + 'objdump'
    OBJCPY = PREFIX + 'objcopy'
    STRIP = PREFIX + 'strip'

    DEVICE  = ' -nostartfiles -march=rv32imc --specs=/usr/lib/riscv32-esp-elf/riscv32-esp-elf/nosys.specs '
    CFLAGS = DEVICE + '-gdwarf-4 -ggdb -Og'
    AFLAGS =  ' -c' + DEVICE + ' -x assembler-with-cpp'
    LFLAGS = DEVICE + ' -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T idf_port/ld/memory.ld -T idf_port/ld/sections.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld -T packages/ESP-IDF-latest/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld -T packages/ESP-IDF-latest/components/soc/esp32c3/ld/esp32c3.peripherals.ld  -Wl,--wrap=_Unwind_SetEnableExceptionFdeSorting -Wl,--wrap=__register_frame_info_bases -Wl,--wrap=__register_frame_info -Wl,--wrap=__register_frame -Wl,--wrap=__register_frame_info_table_bases -Wl,--wrap=__register_frame_info_table -Wl,--wrap=__register_frame_table -Wl,--wrap=__deregister_frame_info_bases -Wl,--wrap=__deregister_frame_info -Wl,--wrap=_Unwind_Find_FDE -Wl,--wrap=_Unwind_GetGR -Wl,--wrap=_Unwind_GetCFA -Wl,--wrap=_Unwind_GetIP -Wl,--wrap=_Unwind_GetIPInfo -Wl,--wrap=_Unwind_GetRegionStart -Wl,--wrap=_Unwind_GetDataRelBase -Wl,--wrap=_Unwind_GetTextRelBase -Wl,--wrap=_Unwind_SetIP -Wl,--wrap=_Unwind_SetGR -Wl,--wrap=_Unwind_GetLanguageSpecificData -Wl,--wrap=_Unwind_FindEnclosingFunction -Wl,--wrap=_Unwind_Resume -Wl,--wrap=_Unwind_RaiseException -Wl,--wrap=_Unwind_DeleteException -Wl,--wrap=_Unwind_ForcedUnwind -Wl,--wrap=_Unwind_Resume_or_Rethrow -Wl,--wrap=_Unwind_Backtrace -Wl,--wrap=__cxa_call_unexpected -Wl,--eh-frame-hdr -Wl,--wrap=__gxx_personality_v0  -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0'
    CXXFLAGS = CFLAGS

    POST_ACTION = OBJCPY + ' -Oihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'

https://github.com/RT-Thread/rt-thread/actions/runs/10645398186/job/29511156571 请参考这个链接

谢谢,根据action已经配好了。应该是我之前下载esp-if工具链冲突了。后期我看看能不能把spi和pwm的驱动给补上

@supperthomas
Copy link
Member Author

ok, 感谢反馈

@1078249029
Copy link
Contributor

1078249029 commented Oct 8, 2024

这是我写的spi驱动,大佬看看还有什么问题? @supperthomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 新手任务
Projects
None yet
Development

No branches or pull requests

3 participants