DavidAntliff / esp32-ds18b20-example

ESP32-compatible example for Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
MIT License
108 stars 34 forks source link

Compilation failed for target esp32c6 #26

Open AlexCalibur opened 9 months ago

AlexCalibur commented 9 months ago

Hi,

I'm very new with esp32 and esp-idf and I try to learn how to use it.

The, at the first try with your code, I've got the following

-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/esp/esp32-ds18b20-test/build/bootloader
[1/1] cd /home/alex/esp/esp32-ds18b20-test/build/bootloader/esp-idf/esptool_py && /home/alex/.espressif...zes.py --offset 0x8000 bootloader 0x0 /home/alex/esp/esp32-ds18b20-test/build/bootloader/bootloader.binBootloader binary size 0x5300 bytes. 0x2d00 bytes (35%) free.
[874/889] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/app_main.c.objIn file included from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb_rmt.h:41,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb.h:330,
                 from /home/alex/esp/esp32-ds18b20-test/main/app_main.c:30:
/home/alex/esp/esp-idf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
[875/889] Building C object esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_gpio.c.objIn file included from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb_rmt.h:41,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb.h:330,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_gpio.c:44:
/home/alex/esp/esp-idf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
[876/889] Building C object esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.objFAILED: esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj 
/home/alex/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1.1\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/home/alex/esp/esp32-ds18b20-test/build/config -I/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include -I/home/alex/esp/esp-idf/components/newlib/platform_include -I/home/alex/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/home/alex/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include -I/home/alex/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/home/alex/esp/esp-idf/components/freertos/esp_additions/include -I/home/alex/esp/esp-idf/components/freertos/esp_additions/arch/riscv/include -I/home/alex/esp/esp-idf/components/esp_hw_support/include -I/home/alex/esp/esp-idf/components/esp_hw_support/include/soc -I/home/alex/esp/esp-idf/components/esp_hw_support/include/soc/esp32c6 -I/home/alex/esp/esp-idf/components/esp_hw_support/port/esp32c6/. -I/home/alex/esp/esp-idf/components/esp_hw_support/port/esp32c6/private_include -I/home/alex/esp/esp-idf/components/heap/include -I/home/alex/esp/esp-idf/components/log/include -I/home/alex/esp/esp-idf/components/soc/include -I/home/alex/esp/esp-idf/components/soc/esp32c6 -I/home/alex/esp/esp-idf/components/soc/esp32c6/include -I/home/alex/esp/esp-idf/components/hal/esp32c6/include -I/home/alex/esp/esp-idf/components/hal/include -I/home/alex/esp/esp-idf/components/hal/platform_port/include -I/home/alex/esp/esp-idf/components/esp_rom/include -I/home/alex/esp/esp-idf/components/esp_rom/include/esp32c6 -I/home/alex/esp/esp-idf/components/esp_rom/esp32c6 -I/home/alex/esp/esp-idf/components/esp_common/include -I/home/alex/esp/esp-idf/components/esp_system/include -I/home/alex/esp/esp-idf/components/esp_system/port/soc -I/home/alex/esp/esp-idf/components/esp_system/port/include/riscv -I/home/alex/esp/esp-idf/components/esp_system/port/include/private -I/home/alex/esp/esp-idf/components/riscv/include -I/home/alex/esp/esp-idf/components/lwip/include -I/home/alex/esp/esp-idf/components/lwip/include/apps -I/home/alex/esp/esp-idf/components/lwip/include/apps/sntp -I/home/alex/esp/esp-idf/components/lwip/lwip/src/include -I/home/alex/esp/esp-idf/components/lwip/port/include -I/home/alex/esp/esp-idf/components/lwip/port/freertos/include -I/home/alex/esp/esp-idf/components/lwip/port/esp32xx/include -I/home/alex/esp/esp-idf/components/lwip/port/esp32xx/include/arch -I/home/alex/esp/esp-idf/components/driver/include -I/home/alex/esp/esp-idf/components/driver/deprecated -I/home/alex/esp/esp-idf/components/driver/analog_comparator/include -I/home/alex/esp/esp-idf/components/driver/dac/include -I/home/alex/esp/esp-idf/components/driver/gpio/include -I/home/alex/esp/esp-idf/components/driver/gptimer/include -I/home/alex/esp/esp-idf/components/driver/i2c/include -I/home/alex/esp/esp-idf/components/driver/i2s/include -I/home/alex/esp/esp-idf/components/driver/ledc/include -I/home/alex/esp/esp-idf/components/driver/mcpwm/include -I/home/alex/esp/esp-idf/components/driver/parlio/include -I/home/alex/esp/esp-idf/components/driver/pcnt/include -I/home/alex/esp/esp-idf/components/driver/rmt/include -I/home/alex/esp/esp-idf/components/driver/sdio_slave/include -I/home/alex/esp/esp-idf/components/driver/sdmmc/include -I/home/alex/esp/esp-idf/components/driver/sigma_delta/include -I/home/alex/esp/esp-idf/components/driver/spi/include -I/home/alex/esp/esp-idf/components/driver/temperature_sensor/include -I/home/alex/esp/esp-idf/components/driver/touch_sensor/include -I/home/alex/esp/esp-idf/components/driver/twai/include -I/home/alex/esp/esp-idf/components/driver/uart/include -I/home/alex/esp/esp-idf/components/driver/usb_serial_jtag/include -I/home/alex/esp/esp-idf/components/esp_pm/include -I/home/alex/esp/esp-idf/components/esp_ringbuf/include -march=rv32imac_zicsr_zifencei  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -nostartfiles -Og -fmacro-prefix-map=/home/alex/esp/esp32-ds18b20-test=. -fmacro-prefix-map=/home/alex/esp/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj -MF esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj.d -o esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj -c /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c
In file included from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb_rmt.h:41,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb.h:330,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:59:
/home/alex/esp/esp-idf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c: In function '_init':
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:395:48: error: 'RMT_BASECLK_APB' undeclared (first use in this function); did you mean 'RMT_BASECLK_XTAL'?
  395 |             rmt_set_source_clk(rmt_tx.channel, RMT_BASECLK_APB);  // only APB is supported by IDF 4.2
      |                                                ^~~~~~~~~~~~~~~
      |                                                RMT_BASECLK_XTAL
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:395:48: note: each undeclared identifier is reported only once for each function it appears in
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:438:28: error: incompatible types when assigning to type 'gpio_enable_w1ts_reg_t' from type 'int'
  438 |         GPIO.enable_w1ts = (0x1 << gpio_num);
      |                            ^
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:442:26: error: 'gpio_enable1_w1ts_reg_t' has no member named 'data'
  442 |         GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32));
      |                          ^
[878/889] Building C object esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb.c.objIn file included from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb_rmt.h:41,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb.h:330,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb.c:43:
/home/alex/esp/esp-idf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
[879/889] Building C object esp-idf/esp32-ds18b20/CMakeFiles/__idf_esp32-ds18b20.dir/ds18b20.c.objIn file included from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb_rmt.h:41,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include/owb.h:330,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-ds18b20/include/ds18b20.h:37,
                 from /home/alex/esp/esp32-ds18b20-test/components/esp32-ds18b20/ds18b20.c:48:
/home/alex/esp/esp-idf/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
   18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
      |  ^~~~~~~
[880/889] Building C object esp-idf/wifi_provisioning/CMakeFiles/__idf_wifi_provisioning.dir/src/manager.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1

Then, I've applied the action found here : https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s2/migration-guides/release-5.x/peripherals.html#rmt-driver

Then with idf.py menuconfig I can set the flag to → Component config → Driver Configurations → RMT Configuration → [ * ] Suppress legacy driver deprecated warning

But another error occur and I did not find a solution for it.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/esp/esp32-ds18b20-test/build/bootloader
[1/1] cd /home/alex/esp/esp32-ds18b20-test/build/bootloader/esp-idf/esptool_py && /home/alex/.espressif...zes.py --offset 0x8000 bootloader 0x0 /home/alex/esp/esp32-ds18b20-test/build/bootloader/bootloader.binBootloader binary size 0x5300 bytes. 0x2d00 bytes (35%) free.
[873/889] Building C object esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.objFAILED: esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj 
/home/alex/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -DESP_PLATFORM -DIDF_VER=\"v5.1.1\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -I/home/alex/esp/esp32-ds18b20-test/build/config -I/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/include -I/home/alex/esp/esp-idf/components/newlib/platform_include -I/home/alex/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/home/alex/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include -I/home/alex/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/home/alex/esp/esp-idf/components/freertos/esp_additions/include -I/home/alex/esp/esp-idf/components/freertos/esp_additions/arch/riscv/include -I/home/alex/esp/esp-idf/components/esp_hw_support/include -I/home/alex/esp/esp-idf/components/esp_hw_support/include/soc -I/home/alex/esp/esp-idf/components/esp_hw_support/include/soc/esp32c6 -I/home/alex/esp/esp-idf/components/esp_hw_support/port/esp32c6/. -I/home/alex/esp/esp-idf/components/esp_hw_support/port/esp32c6/private_include -I/home/alex/esp/esp-idf/components/heap/include -I/home/alex/esp/esp-idf/components/log/include -I/home/alex/esp/esp-idf/components/soc/include -I/home/alex/esp/esp-idf/components/soc/esp32c6 -I/home/alex/esp/esp-idf/components/soc/esp32c6/include -I/home/alex/esp/esp-idf/components/hal/esp32c6/include -I/home/alex/esp/esp-idf/components/hal/include -I/home/alex/esp/esp-idf/components/hal/platform_port/include -I/home/alex/esp/esp-idf/components/esp_rom/include -I/home/alex/esp/esp-idf/components/esp_rom/include/esp32c6 -I/home/alex/esp/esp-idf/components/esp_rom/esp32c6 -I/home/alex/esp/esp-idf/components/esp_common/include -I/home/alex/esp/esp-idf/components/esp_system/include -I/home/alex/esp/esp-idf/components/esp_system/port/soc -I/home/alex/esp/esp-idf/components/esp_system/port/include/riscv -I/home/alex/esp/esp-idf/components/esp_system/port/include/private -I/home/alex/esp/esp-idf/components/riscv/include -I/home/alex/esp/esp-idf/components/lwip/include -I/home/alex/esp/esp-idf/components/lwip/include/apps -I/home/alex/esp/esp-idf/components/lwip/include/apps/sntp -I/home/alex/esp/esp-idf/components/lwip/lwip/src/include -I/home/alex/esp/esp-idf/components/lwip/port/include -I/home/alex/esp/esp-idf/components/lwip/port/freertos/include -I/home/alex/esp/esp-idf/components/lwip/port/esp32xx/include -I/home/alex/esp/esp-idf/components/lwip/port/esp32xx/include/arch -I/home/alex/esp/esp-idf/components/driver/include -I/home/alex/esp/esp-idf/components/driver/deprecated -I/home/alex/esp/esp-idf/components/driver/analog_comparator/include -I/home/alex/esp/esp-idf/components/driver/dac/include -I/home/alex/esp/esp-idf/components/driver/gpio/include -I/home/alex/esp/esp-idf/components/driver/gptimer/include -I/home/alex/esp/esp-idf/components/driver/i2c/include -I/home/alex/esp/esp-idf/components/driver/i2s/include -I/home/alex/esp/esp-idf/components/driver/ledc/include -I/home/alex/esp/esp-idf/components/driver/mcpwm/include -I/home/alex/esp/esp-idf/components/driver/parlio/include -I/home/alex/esp/esp-idf/components/driver/pcnt/include -I/home/alex/esp/esp-idf/components/driver/rmt/include -I/home/alex/esp/esp-idf/components/driver/sdio_slave/include -I/home/alex/esp/esp-idf/components/driver/sdmmc/include -I/home/alex/esp/esp-idf/components/driver/sigma_delta/include -I/home/alex/esp/esp-idf/components/driver/spi/include -I/home/alex/esp/esp-idf/components/driver/temperature_sensor/include -I/home/alex/esp/esp-idf/components/driver/touch_sensor/include -I/home/alex/esp/esp-idf/components/driver/twai/include -I/home/alex/esp/esp-idf/components/driver/uart/include -I/home/alex/esp/esp-idf/components/driver/usb_serial_jtag/include -I/home/alex/esp/esp-idf/components/esp_pm/include -I/home/alex/esp/esp-idf/components/esp_ringbuf/include -march=rv32imac_zicsr_zifencei  -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -nostartfiles -Og -fmacro-prefix-map=/home/alex/esp/esp32-ds18b20-test=. -fmacro-prefix-map=/home/alex/esp/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj -MF esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj.d -o esp-idf/esp32-owb/CMakeFiles/__idf_esp32-owb.dir/owb_rmt.c.obj -c /home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c: In function '_init':
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:395:48: error: 'RMT_BASECLK_APB' undeclared (first use in this function); did you mean 'RMT_BASECLK_XTAL'?
  395 |             rmt_set_source_clk(rmt_tx.channel, RMT_BASECLK_APB);  // only APB is supported by IDF 4.2
      |                                                ^~~~~~~~~~~~~~~
      |                                                RMT_BASECLK_XTAL
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:395:48: note: each undeclared identifier is reported only once for each function it appears in
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:438:28: error: incompatible types when assigning to type 'gpio_enable_w1ts_reg_t' from type 'int'
  438 |         GPIO.enable_w1ts = (0x1 << gpio_num);
      |                            ^
/home/alex/esp/esp32-ds18b20-test/components/esp32-owb/owb_rmt.c:442:26: error: 'gpio_enable1_w1ts_reg_t' has no member named 'data'
  442 |         GPIO.enable1_w1ts.data = (0x1 << (gpio_num - 32));
      |                          ^
[879/889] Building C object esp-idf/wifi_provisioning/CMakeFiles/__idf_wifi_provisioning.dir/src/manager.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1
AlexCalibur commented 9 months ago

After some investigation, maybe the solution is near https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s2/migration-guides/release-5.x/peripherals.html#rmt-driver to update ./components/esp32-owb/owb_rmt.c , but I don't know how to do it.