Update IDF to v5.1.0

This commit is contained in:
valeros
2023-08-03 13:38:40 +03:00
parent 07820cf6f4
commit fc336a9b99
6 changed files with 60 additions and 33 deletions
+3 -2
View File
@@ -351,7 +351,7 @@ def extract_link_args(target_config):
args = click.parser.split_arg_string(fragment) args = click.parser.split_arg_string(fragment)
if fragment_role == "flags": if fragment_role == "flags":
link_args["LINKFLAGS"].extend(args) link_args["LINKFLAGS"].extend(args)
elif fragment_role == "libraries": elif fragment_role in ("libraries", "libraryPath"):
if fragment.startswith("-l"): if fragment.startswith("-l"):
link_args["LIBS"].extend(args) link_args["LIBS"].extend(args)
elif fragment.startswith("-L"): elif fragment.startswith("-L"):
@@ -1104,6 +1104,7 @@ def install_python_deps():
"pyparsing": "~=3.0.9" if IDF5 else ">=2.0.3,<2.4.0", "pyparsing": "~=3.0.9" if IDF5 else ">=2.0.3,<2.4.0",
"kconfiglib": "~=14.1.0" if IDF5 else "~=13.7.1", "kconfiglib": "~=14.1.0" if IDF5 else "~=13.7.1",
"idf-component-manager": "~=1.2.3" if IDF5 else "~=1.0", "idf-component-manager": "~=1.2.3" if IDF5 else "~=1.0",
"esp-idf-kconfig": "~=1.2.0"
} }
python_exe_path = get_python_exe() python_exe_path = get_python_exe()
@@ -1543,7 +1544,7 @@ if "__test" not in COMMAND_LINE_TARGETS or env.GetProjectOption(
# Add include dirs from PlatformIO build system to project CPPPATH so # Add include dirs from PlatformIO build system to project CPPPATH so
# they're visible to PIOBUILDFILES # they're visible to PIOBUILDFILES
project_env.AppendUnique( project_env.AppendUnique(
CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"] CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR", "$PROJECT_DIR"]
+ get_project_lib_includes(env) + get_project_lib_includes(env)
) )
@@ -9,17 +9,20 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "esp_sleep.h" #include "esp_sleep.h"
#include "nvs.h"
#include "nvs_flash.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h" #include "soc/sens_reg.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/rtc_io.h" #include "driver/rtc_io.h"
#include "driver/dac.h" #include "ulp.h"
#include "esp32/ulp.h"
#include "ulp_main.h" #include "ulp_main.h"
#include "esp_adc/adc_oneshot.h" #include "esp_adc/adc_oneshot.h"
#include "ulp/example_config.h"
#include "ulp_adc.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start"); extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start");
extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end"); extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end");
@@ -42,15 +45,21 @@ void app_main(void)
init_ulp_program(); init_ulp_program();
} else { } else {
printf("Deep sleep wakeup\n"); printf("Deep sleep wakeup\n");
printf("ULP did %d measurements since last reset\n", ulp_sample_counter & UINT16_MAX); printf("ULP did %"PRIu32" measurements since last reset\n", ulp_sample_counter & UINT16_MAX);
printf("Thresholds: low=%d high=%d\n", ulp_low_thr, ulp_high_thr); printf("Thresholds: low=%"PRIu32" high=%"PRIu32"\n", ulp_low_thr, ulp_high_thr);
ulp_last_result &= UINT16_MAX; ulp_last_result &= UINT16_MAX;
printf("Value=%d was %s threshold\n", ulp_last_result, printf("Value=%"PRIu32" was %s threshold\n", ulp_last_result,
ulp_last_result < ulp_low_thr ? "below" : "above"); ulp_last_result < ulp_low_thr ? "below" : "above");
} }
printf("Entering deep sleep\n\n"); printf("Entering deep sleep\n\n");
start_ulp_program(); start_ulp_program();
ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup() ); ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup() );
#if !CONFIG_IDF_TARGET_ESP32
/* RTC peripheral power domain needs to be kept on to keep SAR ADC related configs during sleep */
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
#endif
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
@@ -60,35 +69,31 @@ static void init_ulp_program(void)
(ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t)); (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
ESP_ERROR_CHECK(err); ESP_ERROR_CHECK(err);
//-------------ADC1 Init---------------// ulp_adc_cfg_t cfg = {
adc_oneshot_unit_handle_t adc1_handle; .adc_n = EXAMPLE_ADC_UNIT,
adc_oneshot_unit_init_cfg_t init_config1 = { .channel = EXAMPLE_ADC_CHANNEL,
.unit_id = ADC_UNIT_1, .width = EXAMPLE_ADC_WIDTH,
.atten = EXAMPLE_ADC_ATTEN,
.ulp_mode = ADC_ULP_MODE_FSM, .ulp_mode = ADC_ULP_MODE_FSM,
}; };
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle));
//-------------ADC1 Channel Config---------------// ESP_ERROR_CHECK(ulp_adc_init(&cfg));
// Note: when changing channel here, also change 'adc_channel' constant in adc.S
adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11,
};
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc1_handle, ADC_CHANNEL_6, &config));
/* Set low and high thresholds, approx. 1.35V - 1.75V*/ ulp_low_thr = EXAMPLE_ADC_LOW_TRESHOLD;
ulp_low_thr = 1500; ulp_high_thr = EXAMPLE_ADC_HIGH_TRESHOLD;
ulp_high_thr = 2000;
/* Set ULP wake up period to 20ms */ /* Set ULP wake up period to 20ms */
ulp_set_wakeup_period(0, 20000); ulp_set_wakeup_period(0, 20000);
#if CONFIG_IDF_TARGET_ESP32
/* Disconnect GPIO12 and GPIO15 to remove current drain through /* Disconnect GPIO12 and GPIO15 to remove current drain through
* pullup/pulldown resistors. * pullup/pulldown resistors on modules which have these (e.g. ESP32-WROVER)
* GPIO12 may be pulled high to select flash voltage. * GPIO12 may be pulled high to select flash voltage.
*/ */
rtc_gpio_isolate(GPIO_NUM_12); rtc_gpio_isolate(GPIO_NUM_12);
rtc_gpio_isolate(GPIO_NUM_15); rtc_gpio_isolate(GPIO_NUM_15);
#endif // CONFIG_IDF_TARGET_ESP32
esp_deep_sleep_disable_rom_logging(); // suppress boot messages esp_deep_sleep_disable_rom_logging(); // suppress boot messages
} }
+7 -2
View File
@@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* ULP Example: using ADC in deep sleep /* ULP Example: using ADC in deep sleep
This example code is in the Public Domain (or CC0 licensed, at your option.) This example code is in the Public Domain (or CC0 licensed, at your option.)
@@ -22,9 +27,9 @@
*/ */
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "soc/soc_ulp.h" #include "soc/soc_ulp.h"
#include "example_config.h"
/* ADC1 channel 6, GPIO34 */ .set adc_channel, EXAMPLE_ADC_CHANNEL
.set adc_channel, 6
/* Configure the number of ADC samples to average on each measurement. /* Configure the number of ADC samples to average on each measurement.
For convenience, make it a power of 2. */ For convenience, make it a power of 2. */
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#pragma once
/* Ints are used here to be able to include the file in assembly as well */
#define EXAMPLE_ADC_CHANNEL 6 // ADC_CHANNEL_6, GPIO34 on ESP32, GPIO7 on ESP32-S3
#define EXAMPLE_ADC_UNIT 0 // ADC_UNIT_1
#define EXAMPLE_ADC_ATTEN 3 // ADC_ATTEN_DB_11
#define EXAMPLE_ADC_WIDTH 0 // ADC_BITWIDTH_DEFAULT
/* Set low and high thresholds, approx. 1.35V - 1.75V*/
#define EXAMPLE_ADC_LOW_TRESHOLD 1500
#define EXAMPLE_ADC_HIGH_TRESHOLD 2000
+5 -5
View File
@@ -34,28 +34,28 @@
"type": "toolchain", "type": "toolchain",
"owner": "espressif", "owner": "espressif",
"version": "8.4.0+2021r2-patch5", "version": "8.4.0+2021r2-patch5",
"optionalVersions": ["11.2.0+2022r1"] "optionalVersions": ["12.2.0+20230208"]
}, },
"toolchain-xtensa-esp32s2": { "toolchain-xtensa-esp32s2": {
"type": "toolchain", "type": "toolchain",
"optional": true, "optional": true,
"owner": "espressif", "owner": "espressif",
"version": "8.4.0+2021r2-patch5", "version": "8.4.0+2021r2-patch5",
"optionalVersions": ["11.2.0+2022r1"] "optionalVersions": ["12.2.0+20230208"]
}, },
"toolchain-xtensa-esp32s3": { "toolchain-xtensa-esp32s3": {
"type": "toolchain", "type": "toolchain",
"optional": true, "optional": true,
"owner": "espressif", "owner": "espressif",
"version": "8.4.0+2021r2-patch5", "version": "8.4.0+2021r2-patch5",
"optionalVersions": ["11.2.0+2022r1"] "optionalVersions": ["12.2.0+20230208"]
}, },
"toolchain-riscv32-esp": { "toolchain-riscv32-esp": {
"type": "toolchain", "type": "toolchain",
"optional": true, "optional": true,
"owner": "espressif", "owner": "espressif",
"version": "8.4.0+2021r2-patch5", "version": "8.4.0+2021r2-patch5",
"optionalVersions": ["11.2.0+2022r1"] "optionalVersions": ["12.2.0+20230208"]
}, },
"toolchain-esp32ulp": { "toolchain-esp32ulp": {
"type": "toolchain", "type": "toolchain",
@@ -79,7 +79,7 @@
"type": "framework", "type": "framework",
"optional": true, "optional": true,
"owner": "platformio", "owner": "platformio",
"version": "~3.50002.0", "version": "~3.50100.0",
"optionalVersions": ["~3.40405.0"] "optionalVersions": ["~3.40405.0"]
}, },
"tool-esptoolpy": { "tool-esptoolpy": {
+1 -1
View File
@@ -111,7 +111,7 @@ class Espressif32Platform(PlatformBase):
"xtensa-esp32s3", "xtensa-esp32s3",
"riscv32-esp" "riscv32-esp"
): ):
self.packages["toolchain-%s" % target]["version"] = "11.2.0+2022r1" self.packages["toolchain-%s" % target]["version"] = "12.2.0+20230208"
for available_mcu in ("esp32", "esp32s2", "esp32s3"): for available_mcu in ("esp32", "esp32s2", "esp32s3"):
if available_mcu == mcu: if available_mcu == mcu: