Skip to content

Commit fc336a9

Browse files
committed
Update IDF to v5.1.0
1 parent 07820cf commit fc336a9

File tree

6 files changed

+60
-33
lines changed

6 files changed

+60
-33
lines changed

builder/frameworks/espidf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def _add_archive(archive_path, link_args):
351351
args = click.parser.split_arg_string(fragment)
352352
if fragment_role == "flags":
353353
link_args["LINKFLAGS"].extend(args)
354-
elif fragment_role == "libraries":
354+
elif fragment_role in ("libraries", "libraryPath"):
355355
if fragment.startswith("-l"):
356356
link_args["LIBS"].extend(args)
357357
elif fragment.startswith("-L"):
@@ -1104,6 +1104,7 @@ def _get_installed_pip_packages(python_exe_path):
11041104
"pyparsing": "~=3.0.9" if IDF5 else ">=2.0.3,<2.4.0",
11051105
"kconfiglib": "~=14.1.0" if IDF5 else "~=13.7.1",
11061106
"idf-component-manager": "~=1.2.3" if IDF5 else "~=1.0",
1107+
"esp-idf-kconfig": "~=1.2.0"
11071108
}
11081109

11091110
python_exe_path = get_python_exe()
@@ -1543,7 +1544,7 @@ def _skip_prj_source_files(node):
15431544
# Add include dirs from PlatformIO build system to project CPPPATH so
15441545
# they're visible to PIOBUILDFILES
15451546
project_env.AppendUnique(
1546-
CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR"]
1547+
CPPPATH=["$PROJECT_INCLUDE_DIR", "$PROJECT_SRC_DIR", "$PROJECT_DIR"]
15471548
+ get_project_lib_includes(env)
15481549
)
15491550

examples/espidf-ulp-adc/main/ulp_adc_example_main.c

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99

1010
#include <stdio.h>
1111
#include <string.h>
12+
#include <inttypes.h>
1213
#include "esp_sleep.h"
13-
#include "nvs.h"
14-
#include "nvs_flash.h"
1514
#include "soc/rtc_cntl_reg.h"
1615
#include "soc/sens_reg.h"
1716
#include "driver/gpio.h"
1817
#include "driver/rtc_io.h"
19-
#include "driver/dac.h"
20-
#include "esp32/ulp.h"
18+
#include "ulp.h"
2119
#include "ulp_main.h"
2220
#include "esp_adc/adc_oneshot.h"
21+
#include "ulp/example_config.h"
22+
#include "ulp_adc.h"
23+
24+
#include "freertos/FreeRTOS.h"
25+
#include "freertos/task.h"
2326

2427
extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start");
2528
extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end");
@@ -42,15 +45,21 @@ void app_main(void)
4245
init_ulp_program();
4346
} else {
4447
printf("Deep sleep wakeup\n");
45-
printf("ULP did %d measurements since last reset\n", ulp_sample_counter & UINT16_MAX);
46-
printf("Thresholds: low=%d high=%d\n", ulp_low_thr, ulp_high_thr);
48+
printf("ULP did %"PRIu32" measurements since last reset\n", ulp_sample_counter & UINT16_MAX);
49+
printf("Thresholds: low=%"PRIu32" high=%"PRIu32"\n", ulp_low_thr, ulp_high_thr);
4750
ulp_last_result &= UINT16_MAX;
48-
printf("Value=%d was %s threshold\n", ulp_last_result,
51+
printf("Value=%"PRIu32" was %s threshold\n", ulp_last_result,
4952
ulp_last_result < ulp_low_thr ? "below" : "above");
5053
}
5154
printf("Entering deep sleep\n\n");
5255
start_ulp_program();
5356
ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup() );
57+
58+
#if !CONFIG_IDF_TARGET_ESP32
59+
/* RTC peripheral power domain needs to be kept on to keep SAR ADC related configs during sleep */
60+
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
61+
#endif
62+
5463
esp_deep_sleep_start();
5564
}
5665

@@ -60,35 +69,31 @@ static void init_ulp_program(void)
6069
(ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
6170
ESP_ERROR_CHECK(err);
6271

63-
//-------------ADC1 Init---------------//
64-
adc_oneshot_unit_handle_t adc1_handle;
65-
adc_oneshot_unit_init_cfg_t init_config1 = {
66-
.unit_id = ADC_UNIT_1,
72+
ulp_adc_cfg_t cfg = {
73+
.adc_n = EXAMPLE_ADC_UNIT,
74+
.channel = EXAMPLE_ADC_CHANNEL,
75+
.width = EXAMPLE_ADC_WIDTH,
76+
.atten = EXAMPLE_ADC_ATTEN,
6777
.ulp_mode = ADC_ULP_MODE_FSM,
6878
};
69-
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle));
7079

71-
//-------------ADC1 Channel Config---------------//
72-
// Note: when changing channel here, also change 'adc_channel' constant in adc.S
73-
adc_oneshot_chan_cfg_t config = {
74-
.bitwidth = ADC_BITWIDTH_DEFAULT,
75-
.atten = ADC_ATTEN_DB_11,
76-
};
77-
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc1_handle, ADC_CHANNEL_6, &config));
80+
ESP_ERROR_CHECK(ulp_adc_init(&cfg));
7881

79-
/* Set low and high thresholds, approx. 1.35V - 1.75V*/
80-
ulp_low_thr = 1500;
81-
ulp_high_thr = 2000;
82+
ulp_low_thr = EXAMPLE_ADC_LOW_TRESHOLD;
83+
ulp_high_thr = EXAMPLE_ADC_HIGH_TRESHOLD;
8284

8385
/* Set ULP wake up period to 20ms */
8486
ulp_set_wakeup_period(0, 20000);
8587

88+
#if CONFIG_IDF_TARGET_ESP32
8689
/* Disconnect GPIO12 and GPIO15 to remove current drain through
87-
* pullup/pulldown resistors.
90+
* pullup/pulldown resistors on modules which have these (e.g. ESP32-WROVER)
8891
* GPIO12 may be pulled high to select flash voltage.
8992
*/
9093
rtc_gpio_isolate(GPIO_NUM_12);
9194
rtc_gpio_isolate(GPIO_NUM_15);
95+
#endif // CONFIG_IDF_TARGET_ESP32
96+
9297
esp_deep_sleep_disable_rom_logging(); // suppress boot messages
9398
}
9499

examples/espidf-ulp-adc/ulp/adc.S

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Unlicense OR CC0-1.0
5+
*/
16
/* ULP Example: using ADC in deep sleep
27
38
This example code is in the Public Domain (or CC0 licensed, at your option.)
@@ -22,9 +27,9 @@
2227
*/
2328
#include "soc/rtc_cntl_reg.h"
2429
#include "soc/soc_ulp.h"
30+
#include "example_config.h"
2531

26-
/* ADC1 channel 6, GPIO34 */
27-
.set adc_channel, 6
32+
.set adc_channel, EXAMPLE_ADC_CHANNEL
2833

2934
/* Configure the number of ADC samples to average on each measurement.
3035
For convenience, make it a power of 2. */
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Unlicense OR CC0-1.0
5+
*/
6+
#pragma once
7+
8+
/* Ints are used here to be able to include the file in assembly as well */
9+
#define EXAMPLE_ADC_CHANNEL 6 // ADC_CHANNEL_6, GPIO34 on ESP32, GPIO7 on ESP32-S3
10+
#define EXAMPLE_ADC_UNIT 0 // ADC_UNIT_1
11+
#define EXAMPLE_ADC_ATTEN 3 // ADC_ATTEN_DB_11
12+
#define EXAMPLE_ADC_WIDTH 0 // ADC_BITWIDTH_DEFAULT
13+
14+
/* Set low and high thresholds, approx. 1.35V - 1.75V*/
15+
#define EXAMPLE_ADC_LOW_TRESHOLD 1500
16+
#define EXAMPLE_ADC_HIGH_TRESHOLD 2000

platform.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@
3434
"type": "toolchain",
3535
"owner": "espressif",
3636
"version": "8.4.0+2021r2-patch5",
37-
"optionalVersions": ["11.2.0+2022r1"]
37+
"optionalVersions": ["12.2.0+20230208"]
3838
},
3939
"toolchain-xtensa-esp32s2": {
4040
"type": "toolchain",
4141
"optional": true,
4242
"owner": "espressif",
4343
"version": "8.4.0+2021r2-patch5",
44-
"optionalVersions": ["11.2.0+2022r1"]
44+
"optionalVersions": ["12.2.0+20230208"]
4545
},
4646
"toolchain-xtensa-esp32s3": {
4747
"type": "toolchain",
4848
"optional": true,
4949
"owner": "espressif",
5050
"version": "8.4.0+2021r2-patch5",
51-
"optionalVersions": ["11.2.0+2022r1"]
51+
"optionalVersions": ["12.2.0+20230208"]
5252
},
5353
"toolchain-riscv32-esp": {
5454
"type": "toolchain",
5555
"optional": true,
5656
"owner": "espressif",
5757
"version": "8.4.0+2021r2-patch5",
58-
"optionalVersions": ["11.2.0+2022r1"]
58+
"optionalVersions": ["12.2.0+20230208"]
5959
},
6060
"toolchain-esp32ulp": {
6161
"type": "toolchain",
@@ -79,7 +79,7 @@
7979
"type": "framework",
8080
"optional": true,
8181
"owner": "platformio",
82-
"version": "~3.50002.0",
82+
"version": "~3.50100.0",
8383
"optionalVersions": ["~3.40405.0"]
8484
},
8585
"tool-esptoolpy": {

platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def configure_default_packages(self, variables, targets):
111111
"xtensa-esp32s3",
112112
"riscv32-esp"
113113
):
114-
self.packages["toolchain-%s" % target]["version"] = "11.2.0+2022r1"
114+
self.packages["toolchain-%s" % target]["version"] = "12.2.0+20230208"
115115

116116
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
117117
if available_mcu == mcu:

0 commit comments

Comments
 (0)