zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.09k stars 6.2k forks source link

ESP32C3 ADC does not work along with the MCUboot. #73400

Open rana-roy opened 1 month ago

rana-roy commented 1 month ago

Describe the bug The sample zephyr/samples/drivers/adc builds successfully for the esp32c3_devkitm in both cases, the simple west build and sysbuild for MCUboot. The issue is when I just use the west build, it displays the console logs for the ADC readings, while in case of sysbuild, it does not display any logs over the console.

To Reproduce Steps to reproduce the behavior:

  1. west build --sysbuild -b esp32c3_devkitm .
  2. west flash

Expected behavior The logs should be visible over the console for both the builds.

Environment:

de-nordic commented 1 month ago

Can you confirm that the same sample works without MCUboot first. There is possibility that there is something not properly de-initialized before control is passed to an application and was accidentally initialized while executing MCUboot.

de-nordic commented 1 month ago

I have assigned the issue to myself and set severity for low. If the scenario above will not confirm I will reassign the issue to platform maintainer and ask for re-evaluation of severity.

rana-roy commented 1 month ago

Can you confirm that the same sample works without MCUboot first.

Yes, both the things work properly when they are handled individually.

The ADC counts are proper when the sample is built without sysbuild. And, the MCUboot works when built with another sample code.

de-nordic commented 1 month ago

How other sample works with MCUboot does not matter. We need to figure out whether MCUboot affects this specific sample.

Can you build the ADC sample for MCUBoot without sysbuild and MCUboot separately, upload those to pre-erased board and check if that shows the same symptoms? To build application for MCUboot you need to set CONFIG_BOOTLOADER_MCUBOOT=y.

rana-roy commented 1 month ago

Can you build the ADC sample for MCUBoot without sysbuild and MCUboot separately, upload those to the pre-erased board, and check if that shows the same symptoms? To build the application for MCUboot you need to set CONFIG_BOOTLOADER_MCUBOOT=y.

Thank you for getting back to me so quickly. I followed the steps you suggested:

  1. Erased the board using the esptool.py erase_flash
  2. Built and flashed the MCUboot separately using ninja -C build/ flash from the bootloader/mcuboot/boot/espressif
  3. Added the macro in the prj.conf file
  4. Built and flashed the Zephyr ADC sample code into the ESP32C3 devkitm

The behavior of the board is expected. I can get the ADC readings on the console.

rana-roy commented 1 month ago

https://github.com/zephyrproject-rtos/zephyr/pull/73480. Thank you for your support! You have mentioned the ESP32-S3 chip. But, I am facing an issue with the ESP32-C3 chip.

de-nordic commented 1 month ago

Thank you for getting back to me so quickly. I followed the steps you suggested:

1. Erased the board using the esptool.py erase_flash

2. Built and flashed the MCUboot separately using ninja -C build/ flash from the bootloader/mcuboot/boot/espressif

3. Added the macro in the prj.conf file

4. Built and flashed the Zephyr ADC sample code into the ESP32C3 devkitm

The behavior of the board is expected. I can get the ADC readings on the console.

OK so it does not be seem to be issue with MCUboot,

#73480. Thank you for your support! You have mentioned the ESP32-S3 chip. But, I am facing an issue with the ESP32-C3 chip.

@marekmatej Do you maybe have any ideas here? And why separate building MCUboot and app seems to work?

marekmatej commented 1 month ago

2. Built and flashed the MCUboot separately using ninja -C build/ flash from the bootloader/mcuboot/boot/espressif

@rana-roy The boot/zephyr is used in Espressif port of MCUboot. To build the MCUboot Zephyr port please use boot/zephyr. The Zephyr port is used during the --sysbuild.

@de-nordic The recent changes in Zephyr bring additional code to iram0.text section, which size was optimised in MCUboot Zephyr port. This can be fixed easily by increasing the segment length (https://github.com/zephyrproject-rtos/zephyr/pull/73292), but there are clock related issues in other SOCs, which we are fixing now.

And why separate building MCUboot and app seems to work?

The reason for separate build works is because --sysbuild is using sources from west.yml, while separate build use the sources you choose to use.

de-nordic commented 1 month ago

And why separate building MCUboot and app seems to work?

The reason for separate build works is because --sysbuild is using sources from west.yml, while separate build use the sources you choose to use.

Thanks, I have not noticed that different MCUboot path is used.

de-nordic commented 3 weeks ago

@rana-roy Is the issue still present after https://github.com/zephyrproject-rtos/zephyr/pull/73292 got merged?

de-nordic commented 1 week ago

@rana-roy Can you verify whether issue is there and close the report if does not apply anymore?

sylvioalves commented 10 hours ago

Tested esp32c3_devkitm with samples/drivers/adc/adc_dt. Works with https://github.com/zephyrproject-rtos/zephyr/pull/75533