pcnt 例程编译出错

Moderator: ESP_ZT

Ybin_ESP
Posts: 10
Joined: Wed Apr 10, 2024 2:51 am

pcnt 例程编译出错

Postby Ybin_ESP » Sat Aug 24, 2024 3:49 pm

各位大神,小弟最近使用官方例程pcnt 编译出错,不得其解,请赐教。

环境: ESP IDE3.0.0
IDF路径和版本:D:\Espressif\frameworks\esp-idf-v5.2.2
例程路径: D:\Espressif\frameworks\esp-idf-v5.2.2\examples\peripherals\pcnt\rotary_encoder

官方代码未作改动任何,貌似在链接时报的错:
[891/893] cmd.exe /C "cd . && D:\Espressif\tools\riscv32-esp-elf\esp-13.2.0_20230928\riscv32-esp-elf\bin\riscv32-esp-elf-g++.exe -march=rv32imc_zicsr_zifencei -nostartfiles -march=rv32imc_zicsr_zifencei --specs=nosys.specs -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--Map=D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/build/rotary_encoder.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32c3.peripherals.ld -T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.newlib.ld -T esp32c3.rom.version.ld -T esp32c3.rom.eco3.ld -T memory.ld -T sections.ld @CMakeFiles\rotary_encoder.elf.rsp -o rotary_encoder.elf && cd ."
FAILED: rotary_encoder.elf
cmd.exe /C "cd . && D:\Espressif\tools\riscv32-esp-elf\esp-13.2.0_20230928\riscv32-esp-elf\bin\riscv32-esp-elf-g++.exe -march=rv32imc_zicsr_zifencei -nostartfiles -march=rv32imc_zicsr_zifencei --specs=nosys.specs -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32C3=0 -Wl,--Map=D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/build/rotary_encoder.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32c3.peripherals.ld -T esp32c3.rom.ld -T esp32c3.rom.api.ld -T esp32c3.rom.libgcc.ld -T esp32c3.rom.newlib.ld -T esp32c3.rom.version.ld -T esp32c3.rom.eco3.ld -T memory.ld -T sections.ld @CMakeFiles\rotary_encoder.elf.rsp -o rotary_encoder.elf && cd ."
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(rotary_encoder_example_main.c.obj): in function `app_main':
D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:41:(.text.app_main+0x48): undefined reference to `pcnt_new_unit'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:47:(.text.app_main+0xa8): undefined reference to `pcnt_unit_set_glitch_filter'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:55:(.text.app_main+0x110): undefined reference to `pcnt_new_channel'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:61:(.text.app_main+0x150): undefined reference to `pcnt_new_channel'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:64:(.text.app_main+0x1ac): undefined reference to `pcnt_channel_set_edge_action'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:65:(.text.app_main+0x1e0): undefined reference to `pcnt_channel_set_level_action'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:66:(.text.app_main+0x214): undefined reference to `pcnt_channel_set_edge_action'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:67:(.text.app_main+0x248): undefined reference to `pcnt_channel_set_level_action'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:72:(.text.app_main+0x2d2): undefined reference to `pcnt_unit_add_watch_point'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:78:(.text.app_main+0x324): undefined reference to `pcnt_unit_register_event_callbacks'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:81:(.text.app_main+0x37c): undefined reference to `pcnt_unit_enable'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:83:(.text.app_main+0x3d4): undefined reference to `pcnt_unit_clear_count'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:85:(.text.app_main+0x42c): undefined reference to `pcnt_unit_start'
D:/Espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/Espressif/frameworks/esp-idf-v5.2.2/esp-rainmaker/examples/rotary_encoder/main/rotary_encoder_example_main.c:101:(.text.app_main+0x4a0): undefined reference to `pcnt_unit_get_count'

collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
构建完成(14 个错误,0 个警告): D:\Espressif\frameworks\esp-idf-v5.2.2\esp-rainmaker\examples\rotary_encoder\build
Total time taken to build the project: 63,271 ms

以上似乎涉及均为pcnt函数,但通过查阅代码,这些函数均有源文件实体,以及在包含的头文件有定义。
请问如何解决呢?

Ybin_ESP
Posts: 10
Joined: Wed Apr 10, 2024 2:51 am

Re: pcnt 例程编译出错

Postby Ybin_ESP » Sun Aug 25, 2024 1:29 pm

:roll: Bug has been found since I use a target ESP32-C3, however it is not support HW PCNT.

Who is online

Users browsing this forum: No registered users and 7 guests