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

ESP32 touch_sensor not working #79947

Closed
wmrsouza opened this issue Oct 16, 2024 · 1 comment · Fixed by #79941
Closed

ESP32 touch_sensor not working #79947

wmrsouza opened this issue Oct 16, 2024 · 1 comment · Fixed by #79941
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 Regression Something, which was working, does not anymore

Comments

@wmrsouza
Copy link
Collaborator

Describe the bug

Zephyr branch: main (commit 52540d8)
Board: esp32s2_saola
App: zephyr/samples/subsys/input/input_dump/
Build cmd: west build -b esp32s2_saola zephyr/samples/subsys/input/input_dump/ -DCONFIG_INPUT_ESP32_TOUCH_SENSOR=y --pristine

input_dump sample is not working for Expressif boards after build process succeeds.
First invetigation shows CONFIG_INPUT_ESP32_TOUCH_SENSOR parameter enabling is missing for Espressif boards whose overlay files are present on input_dump sample boards directory.
After creating .conf files inside input_dump sample boards directory for those Espressif boards with overlay files with the contents CONFIG_INPUT_ESP32_TOUCH_SENSOR=y, build process failed showing some hal functions regarding touch_sensor were missing during link stage.

"git bisect" points the commit 37f9958 as the last one (if I keep CONFIG_INPUT_ESP32_TOUCH_SENSOR=y) where the build process of input_dump succeeds and the application runs as expected on the target board (reporting when I touch some specific pins informed under touch node on the board dts overlay file) .

The commit fe57a12 is the one where build process starts to fail and coincides with the preparation for transition for hal_espressif v5.1. Until this point examining the contents of modules/hal/espressif/zephyr/esp32s2/CMakeLists.txt it is possible to observe a section inside this file conditioned to CONFIG_INPUT_ESP32_TOUCH_SENSOR parameter adding touch_sensor related source code files to the list of files that must be compiled.

Further observation shows that when the transition to hal_espressif v5.1 is completed on commit 46a0a72, the hal_espressif revision is updated to 742df6bfc595591603361eb703ac9462ed6384c6 in west.yml file and the section conditoned to the conditioned to CONFIG_INPUT_ESP32_TOUCH_SENSOR parameter inside modules/hal/espressif/zephyr/esp32s2/CMakeLists.txt is missing.

This behavior is also observed for the files modules/hal/espressif/zephyr/esp32/CMakeLists.txt, and modules/hal/espressif/zephyr/esp32s3/CMakeLists.txt

To Reproduce

[building the input_dump for esp32s2_saola board]
$ west init
$ west update
$ cd zephyr; git checkout a501050; cd ..
$ west update
$ west build -b esp32s2_saola zephyr/samples/subsys/input/input_dump/ --pristine
$ west flash
$ west espressif monitor
at this point boot messages can be ovserved, but nothing new happens when I touch board pins with my fingers

[building the input_dump for esp32s2_saola board, but enabling CONFIG_INPUT_ESP32_TOUCH_SENSOR]
$ west init
$ west update
$ cd zephyr; git checkout a501050; cd ..
$ west update
$ west build -b esp32s2_saola zephyr/samples/subsys/input/input_dump/ -DCONFIG_INPUT_ESP32_TOUCH_SENSOR=y --pristine
after that command, the build process fails

Expected behavior

Impact

This issue prevents any application that requires the input_esp32_touch_sensor from working.

Logs and console output

$ west build -b esp32s2_saola zephyr/samples/subsys/input/input_dump/ -DCONFIG_INPUT_ESP32_TOUCH_SENSOR=y --pristine

-- west build: making build dir /home/wmrsouza/projects/espressif/01_feature_cap_touch/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/samples/subsys/input/input_dump
-- CMake version: 3.25.1
-- Found Python3: /usr/bin/python3 (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/wmrsouza/.cache/zephyr
-- Zephyr version: 3.7.99 (/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: esp32s2_saola, qualifiers: esp32s2
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.8 (/opt/zephyr-sdk-0.16.8)
-- Found toolchain: zephyr 0.16.8 (/opt/zephyr-sdk-0.16.8)
-- Found Dtc: /opt/zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/boards/espressif/esp32s2_saola/esp32s2_saola.dts
-- Found devicetree overlay: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/samples/subsys/input/input_dump/boards/esp32s2_saola.overlay
-- Generated zephyr.dts: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/edt.pickle
-- Generated zephyr.dts: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/dts.cmake
Parsing /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/samples/subsys/input/input_dump/Kconfig
Loaded configuration '/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/boards/espressif/esp32s2_saola/esp32s2_saola_defconfig'
Merged configuration '/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/samples/subsys/input/input_dump/prj.conf'
Merged configuration '/home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/.config'
Kconfig header saved to '/home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc
ESP-IDF path: /home/wmrsouza/projects/espressif/01_feature_cap_touch/modules/hal/espressif
esptool path: /home/wmrsouza/projects/espressif/01_feature_cap_touch/modules/hal/espressif/tools/esptool_py/esptool.py
-- Using ccache: /usr/bin/ccache
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wmrsouza/projects/espressif/01_feature_cap_touch/build
-- west build: building application
[1/212] Preparing syscall dependency handling

[8/212] Generating include/generated/zephyr/version.h
-- Zephyr version: 3.7.99 (/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr), build: v3.7.0-4564-ga5010504bc71
[203/212] Building C object zephyr/drivers/input/CMakeFiles/drivers__input.dir/input_esp32_touch_sensor.c.obj
/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c: In function 'esp32_touch_sensor_interrupt_cb':
/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:83:41: warning: unused variable 'dev_data' [-Wunused-variable]
83 | struct esp32_touch_sensor_data *dev_data = dev->data;
| ^~~~~~~~
/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c: In function 'esp32_rtc_isr_install':
/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:167:25: warning: implicit declaration of function 'ESP_PRIO_TO_FLAGS' [-Wimplicit-function-declaration]
167 | ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, priority)) |
| ^~~~~~~~~~~~~~~~~
/home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:168:25: warning: implicit declaration of function 'ESP_INT_FLAGS_CHECK' [-Wimplicit-function-declaration]
168 | ESP_INT_FLAGS_CHECK(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, flags)),
| ^~~~~~~~~~~~~~~~~~~
[207/212] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/zephyr_pre0.map
: && ccache /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/xtensa-espressif_esp32s2_zephyr-elf-gcc -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/xtensa/core/offsets/offsets.c.obj -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/xtensa/core/libarch__xtensa__core.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/subsys/random/libsubsys__random.a zephyr/subsys/input/libsubsys__input.a zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/input/libdrivers__input.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L/home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr zephyr/arch/common/libisr_tables.a -fuse-ld=bfd -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -specs=picolibc.specs -DPICOLIBC_LONG_LONG_PRINTF_SCANF -lgcc -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/src/linker/esp32s2.rom.alias.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.api.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.libgcc.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-funcs.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.newlib-data.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/esp_rom/esp32s2/ld/esp32s2.rom.spiflash.ld -T/home/wmrsouza/projects/espressif/01_feature_cap_touch/hal_espressif/zephyr/esp32s2/../../components/soc/esp32s2/ld/esp32s2.peripherals.ld -Wl,--wrap=longjmp -L"/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0" -lc -lgcc && cd /home/wmrsouza/projects/espressif/01_feature_cap_touch/build/zephyr && /usr/bin/cmake -E true
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x4): undefined reference to touch_sensor_channel_io_map' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x20): undefined reference to touch_hal_init'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x24): undefined reference to rtc_gpio_init' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x28): undefined reference to rtc_gpio_set_direction'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x2c): undefined reference to rtc_gpio_pulldown_dis' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x30): undefined reference to rtc_gpio_pullup_dis'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x34): undefined reference to touch_hal_config' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x38): undefined reference to touch_hal_filter_set_config'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x3c): undefined reference to ESP_PRIO_TO_FLAGS' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj):(.literal.esp32_touch_sensor_init+0x40): undefined reference to ESP_INT_FLAGS_CHECK'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj): in function esp32_touch_sensor_init': /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:205: undefined reference to touch_hal_init'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:240: undefined reference to rtc_gpio_init' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:241: undefined reference to rtc_gpio_set_direction'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:241: undefined reference to rtc_gpio_pulldown_dis' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:242: undefined reference to rtc_gpio_pullup_dis'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:245: undefined reference to touch_hal_config' /opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:282: undefined reference to touch_hal_filter_set_config'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: zephyr/drivers/input/libdrivers__input.a(input_esp32_touch_sensor.c.obj): in function esp32_rtc_isr_install': /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:167: undefined reference to ESP_PRIO_TO_FLAGS'
/opt/zephyr-sdk-0.16.8/xtensa-espressif_esp32s2_zephyr-elf/bin/../lib/gcc/xtensa-espressif_esp32s2_zephyr-elf/12.2.0/../../../../xtensa-espressif_esp32s2_zephyr-elf/bin/ld.bfd: /home/wmrsouza/projects/espressif/01_feature_cap_touch/zephyr/drivers/input/input_esp32_touch_sensor.c:167: undefined reference to `ESP_INT_FLAGS_CHECK'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
'''

Environment (please complete the following information):

  • OS: Linux Ubuntu 22.04.1
  • Toolchain: zephyr-sdk-0.16.8 and zephyr-sdk-0.16.9-rc2
  • Commit SHA or Version used: 52540d8

Additional context

@wmrsouza wmrsouza added bug The issue is a bug, or the PR is fixing a bug Regression Something, which was working, does not anymore labels Oct 16, 2024
Copy link

Hi @wmrsouza! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: ESP32 Espressif ESP32 Regression Something, which was working, does not anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants