IDF Version Migration Issues (SoC Support)

hristesp
Posts: 9
Joined: Wed Oct 11, 2023 2:49 pm

IDF Version Migration Issues (SoC Support)

Postby hristesp » Wed Feb 14, 2024 2:24 pm

I'm currently in the process of migrating my IDF tool-chain from version 4.3 to 5.1.2.

Generally, the migration guides and API guides online have been really helpful and the inclusion of additional header files, changing some syntax and adding requirements to CMakeLists.txt have done a lot of the legwork.

What I've had issues wrestling with at the moment have been related to power management SoC permissions. Namely, I mention parameters ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_DOMAIN_RTC_FAST_MEM and ESP_PD_DOMAIN_RTC_SLOW_MEM (from sleep.h) but they are not being recognised despite me including the header file in the script, and mentioning the component name (esp_hw_support) as a requirement in CMakeLists.txt.

I realised that the reason for the this is because in earlier IDF versions such as 4.4, the parameters are mentioned in a typdef enum (in sleep.h) [1]:
  1. typedef enum {
  2.  
  3. ESP_PD_DOMAIN_RTC_PERIPH, //!< RTC IO, sensors and ULP co-processor
  4.  
  5. ESP_PD_DOMAIN_RTC_SLOW_MEM, //!< RTC slow memory
  6.  
  7. ESP_PD_DOMAIN_RTC_FAST_MEM, //!< RTC fast memory
  8.  
  9. ESP_PD_DOMAIN_XTAL, //!< XTAL oscillator
  10.  
  11. #if SOC_PM_SUPPORT_CPU_PD
  12.  
  13. ESP_PD_DOMAIN_CPU, //!< CPU core
  14.  
  15. #endif
  16.  
  17. ESP_PD_DOMAIN_RTC8M, //!< Internal 8M oscillator
  18.  
  19. ESP_PD_DOMAIN_VDDSDIO, //!< VDD_SDIO
  20.  
  21. ESP_PD_DOMAIN_MAX //!< Number of domains
  22.  
  23. } esp_sleep_pd_domain_t;
However in the updated 5.1 toolchain they are wrapped in #if statements about soc permissions in sleep.h [2]:
  1. typedef enum {
  2.  
  3. #if SOC_PM_SUPPORT_RTC_PERIPH_PD
  4.  
  5. ESP_PD_DOMAIN_RTC_PERIPH, //!< RTC IO, sensors and ULP co-processor
  6.  
  7. #endif
  8.  
  9. #if SOC_PM_SUPPORT_RTC_SLOW_MEM_PD
  10.  
  11. ESP_PD_DOMAIN_RTC_SLOW_MEM, //!< RTC slow memory
  12.  
  13. #endif
  14.  
  15. #if SOC_PM_SUPPORT_RTC_FAST_MEM_PD
  16.  
  17. ESP_PD_DOMAIN_RTC_FAST_MEM, //!< RTC fast memory
  18.  
  19. #endif
I have looked into idf.py menuconfig and have enabled "Support for power management" but that has not stopped my builds from failing unfortunately.

If anyone has had any similar issues when migrating IDF versions or if someone knows about setting SOC support I would appreciate any help, thanks and I hope you're all well!

Links
[1] https://github.com/espressif/esp-idf/bl ... sp_sleep.h
[2] https://github.com/espressif/esp-idf/bl ... sp_sleep.h

Additional Info
IDF: Visual Studio 1.86.1
OS: Ubuntu 22.04

MicroController
Posts: 1704
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: IDF Version Migration Issues (SoC Support)

Postby MicroController » Wed Feb 14, 2024 7:33 pm

if someone knows about setting SOC support...
The SOC...SUPPORT... defines represent what features, or 'capabilities', the SoC, i.e. the target chip's hardware, has/supports. They are set by a chip-specific soc_caps.h. If the target hardware doesn't have a certain capability, i.e. a specific macro is not defined or defined as (0), application code should not try to use this lacking capability.

hristesp
Posts: 9
Joined: Wed Oct 11, 2023 2:49 pm

Re: IDF Version Migration Issues (SoC Support)

Postby hristesp » Thu Feb 15, 2024 12:10 pm

I really appreciate the reply!! With this ESP32-C3-Mini-1 module on the IDF4.3 toolchain there were no issues, so I assumed the SOC supported it. In the newer 5.1 toolchain, in the esp-idf/components/soc/esp32/include/soc/soc_caps.h file these parameters are defined and permitted (shown below).

Code: Select all

/*-------------------------- Power Management CAPS ---------------------------*/
#define SOC_PM_SUPPORT_EXT0_WAKEUP                (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP                (1)
#define SOC_PM_SUPPORT_EXT_WAKEUP                 (1)     /*!<Compatible to the old version of IDF */

#define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP        (1)     /*!<Supports waking up from touch pad trigger */
#define SOC_PM_SUPPORT_RTC_PERIPH_PD              (1)
#define SOC_PM_SUPPORT_RTC_FAST_MEM_PD            (1)
#define SOC_PM_SUPPORT_RTC_SLOW_MEM_PD            (1)
#define SOC_PM_SUPPORT_RC_FAST_PD                 (1)
#define SOC_PM_SUPPORT_VDDSDIO_PD                 (1)
#define SOC_PM_SUPPORT_MODEM_PD                   (1)     /*!<Modem here includes wifi and btdm */

#define SOC_CONFIGURABLE_VDDSDIO_SUPPORTED        (1)
I'm aware this isn't in the chip model specific soc_caps.h, within which (esp-idf/components/soc/esp32c3/include/soc/soc_caps.h) these definitions are not defined.

I have included the component name in the CMakeLists.txt file and have included soc/soc_caps.h so I feel like it should register the power management caps from the esp32 soc_caps header file?

MicroController
Posts: 1704
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: IDF Version Migration Issues (SoC Support)

Postby MicroController » Thu Feb 15, 2024 7:49 pm

Not sure what you're trying to do...
I.o.w.: What do you expect to happen when you try to, e.g., power-manage "RTC_SLOW_MEM" on an ESP32C3 which has no "slow RTC memory"?

Since the power management drivers in the IDF (sleep_modes.c) also use the esp_sleep_pd_domain_t enum you will quickly get into trouble if the esp_sleep_pd_domain_t your application 'sees' is different from what the driver expects.

A 'clean' way of doing things would be to use the same SOC_SUPPORT... macros in #if's in your application code to only use the features available in the current target.

Who is online

Users browsing this forum: ahuar88, Bing [Bot] and 106 guests