Skip to content

Commit df64b49

Browse files
authored
Merge branch 'master' into idf-release/v5.1
2 parents 1d7a245 + dc5bd38 commit df64b49

File tree

8 files changed

+121
-20
lines changed

8 files changed

+121
-20
lines changed

Diff for: .github/scripts/on-release.sh

+22-4
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
216216
##
217217
RVTC_NAME="riscv32-esp-elf-gcc"
218218
RVTC_NEW_NAME="esp-rv32"
219+
X32TC_NAME="xtensa-esp32-elf-gcc"
220+
X32TC_NEW_NAME="esp-x32"
221+
XS2TC_NAME="xtensa-esp32s2-elf-gcc"
222+
XS2TC_NEW_NAME="esp-xs2"
223+
XS3TC_NAME="xtensa-esp32s3-elf-gcc"
224+
XS3TC_NEW_NAME="esp-xs3"
219225

220226
# Replace tools locations in platform.txt
221227
echo "Generating platform.txt..."
@@ -224,9 +230,9 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \
224230
sed 's/tools\.esp32-arduino-libs\.path\.windows=.*//g' | \
225231
sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \
226232
sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
227-
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
228-
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
229-
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
233+
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
234+
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\\{runtime.tools.$XS2TC_NEW_NAME.path\\}/g" | \
235+
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\\{runtime.tools.$XS3TC_NEW_NAME.path\\}/g" | \
230236
sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
231237
sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
232238
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
@@ -342,7 +348,19 @@ rvtc_jq_arg="\
342348
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
343349
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
344350
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).version = \"$RVTC_VERSION\" |\
345-
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\""
351+
(.packages[0].tools[] | select(.name==\"$RVTC_NAME\")).name = \"$RVTC_NEW_NAME\" |\
352+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
353+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
354+
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
355+
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
356+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
357+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
358+
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
359+
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
360+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
361+
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\" |\
362+
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
363+
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\""
346364
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
347365
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
348366

Diff for: boards.txt

+24
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ esp32c2.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SP
8787
esp32c2.menu.PartitionScheme.default.build.partitions=default
8888
esp32c2.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
8989
esp32c2.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
90+
esp32c2.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
91+
esp32c2.menu.PartitionScheme.no_fs.build.partitions=no_fs
92+
esp32c2.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
9093
esp32c2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
9194
esp32c2.menu.PartitionScheme.no_ota.build.partitions=no_ota
9295
esp32c2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -223,6 +226,9 @@ esp32h2.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
223226
esp32h2.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
224227
esp32h2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
225228
esp32h2.menu.PartitionScheme.minimal.build.partitions=minimal
229+
esp32h2.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
230+
esp32h2.menu.PartitionScheme.no_fs.build.partitions=no_fs
231+
esp32h2.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
226232
esp32h2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
227233
esp32h2.menu.PartitionScheme.no_ota.build.partitions=no_ota
228234
esp32h2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -400,6 +406,9 @@ esp32c6.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
400406
esp32c6.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
401407
esp32c6.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
402408
esp32c6.menu.PartitionScheme.minimal.build.partitions=minimal
409+
esp32c6.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
410+
esp32c6.menu.PartitionScheme.no_fs.build.partitions=no_fs
411+
esp32c6.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
403412
esp32c6.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
404413
esp32c6.menu.PartitionScheme.no_ota.build.partitions=no_ota
405414
esp32c6.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -666,6 +675,9 @@ esp32s3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
666675
esp32s3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
667676
esp32s3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
668677
esp32s3.menu.PartitionScheme.minimal.build.partitions=minimal
678+
esp32s3.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
679+
esp32s3.menu.PartitionScheme.no_fs.build.partitions=no_fs
680+
esp32s3.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
669681
esp32s3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
670682
esp32s3.menu.PartitionScheme.no_ota.build.partitions=no_ota
671683
esp32s3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -828,6 +840,9 @@ esp32c3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
828840
esp32c3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
829841
esp32c3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
830842
esp32c3.menu.PartitionScheme.minimal.build.partitions=minimal
843+
esp32c3.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
844+
esp32c3.menu.PartitionScheme.no_fs.build.partitions=no_fs
845+
esp32c3.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
831846
esp32c3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
832847
esp32c3.menu.PartitionScheme.no_ota.build.partitions=no_ota
833848
esp32c3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -1026,6 +1041,9 @@ esp32s2.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
10261041
esp32s2.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
10271042
esp32s2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
10281043
esp32s2.menu.PartitionScheme.minimal.build.partitions=minimal
1044+
esp32s2.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
1045+
esp32s2.menu.PartitionScheme.no_fs.build.partitions=no_fs
1046+
esp32s2.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
10291047
esp32s2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
10301048
esp32s2.menu.PartitionScheme.no_ota.build.partitions=no_ota
10311049
esp32s2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -1199,6 +1217,9 @@ esp32.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
11991217
esp32.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
12001218
esp32.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
12011219
esp32.menu.PartitionScheme.minimal.build.partitions=minimal
1220+
esp32.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
1221+
esp32.menu.PartitionScheme.no_fs.build.partitions=no_fs
1222+
esp32.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
12021223
esp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
12031224
esp32.menu.PartitionScheme.no_ota.build.partitions=no_ota
12041225
esp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
@@ -1369,6 +1390,9 @@ esp32da.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
13691390
esp32da.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
13701391
esp32da.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
13711392
esp32da.menu.PartitionScheme.minimal.build.partitions=minimal
1393+
esp32da.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
1394+
esp32da.menu.PartitionScheme.no_fs.build.partitions=no_fs
1395+
esp32da.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
13721396
esp32da.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
13731397
esp32da.menu.PartitionScheme.no_ota.build.partitions=no_ota
13741398
esp32da.menu.PartitionScheme.no_ota.upload.maximum_size=2097152

Diff for: docs/en/esp-idf_component.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
Arduino as an ESP-IDF component
33
###############################
44

5-
This method is recommended for advanced users. To use this method, you will need to have the ESP-IDF toolchain installed.
6-
7-
For a simplified method, see `Installing using Boards Manager <https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager>`_.
5+
About
6+
-----
87

9-
ESP32 Arduino lib-builder
10-
-------------------------
8+
You can use the Arduino framework as an ESP-IDF component. This allows you to use the Arduino framework in your ESP-IDF projects with the full flexibility of the ESP-IDF.
119

12-
If you don't need any modifications in the default Arduino ESP32 core, we recommend you to install using the Boards Manager.
13-
14-
Arduino Lib Builder is the tool that integrates ESP-IDF into Arduino. It allows you to customize the default settings used by Espressif and try them in Arduino IDE.
10+
This method is recommended for advanced users. To use this method, you will need to have the ESP-IDF toolchain installed.
1511

16-
For more information see `Arduino lib builder <https://github.com/espressif/esp32-arduino-lib-builder>`_
12+
For a simplified method, see `Installing using Boards Manager <https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager>`_.
1713

14+
If you plan to use these modified settings multiple times, for different projects and targets, you can recompile the Arduino core with the new settings using the Arduino Static Library Builder.
15+
For more information, see the `Lib Builder documentation <lib_builder.html>`_.
1816

1917
Installation
2018
------------

Diff for: libraries/NetworkClientSecure/src/NetworkClientSecure.cpp

+37-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ NetworkClientSecure::NetworkClientSecure() {
4040
sslclient->socket = -1;
4141
sslclient->handshake_timeout = 120000;
4242
_use_insecure = false;
43+
_stillinPlainStart = false;
44+
_ca_cert_free = false;
45+
_cert_free = false;
46+
_private_key_free = false;
4347
_CA_cert = NULL;
4448
_cert = NULL;
4549
_private_key = NULL;
@@ -68,6 +72,11 @@ NetworkClientSecure::NetworkClientSecure(int sock) {
6872
_connected = true;
6973
}
7074

75+
_use_insecure = false;
76+
_stillinPlainStart = false;
77+
_ca_cert_free = false;
78+
_cert_free = false;
79+
_private_key_free = false;
7180
_CA_cert = NULL;
7281
_cert = NULL;
7382
_private_key = NULL;
@@ -77,7 +86,17 @@ NetworkClientSecure::NetworkClientSecure(int sock) {
7786
_alpn_protos = NULL;
7887
}
7988

80-
NetworkClientSecure::~NetworkClientSecure() {}
89+
NetworkClientSecure::~NetworkClientSecure() {
90+
if (_ca_cert_free && _CA_cert) {
91+
free((void *)_CA_cert);
92+
}
93+
if (_cert_free && _cert) {
94+
free((void *)_cert);
95+
}
96+
if (_private_key_free && _private_key) {
97+
free((void *)_private_key);
98+
}
99+
}
81100

82101
void NetworkClientSecure::stop() {
83102
stop_ssl_socket(sslclient.get());
@@ -310,25 +329,39 @@ void NetworkClientSecure::setInsecure() {
310329
}
311330

312331
void NetworkClientSecure::setCACert(const char *rootCA) {
332+
if (_ca_cert_free && _CA_cert) {
333+
free((void *)_CA_cert);
334+
_ca_cert_free = false;
335+
}
313336
_CA_cert = rootCA;
314337
_use_insecure = false;
315338
}
316339

317340
void NetworkClientSecure::setCACertBundle(const uint8_t *bundle) {
318341
if (bundle != NULL) {
319342
esp_crt_bundle_set(bundle, sizeof(bundle));
343+
attach_ssl_certificate_bundle(sslclient.get(), true);
320344
_use_ca_bundle = true;
321345
} else {
322346
esp_crt_bundle_detach(NULL);
347+
attach_ssl_certificate_bundle(sslclient.get(), false);
323348
_use_ca_bundle = false;
324349
}
325350
}
326351

327352
void NetworkClientSecure::setCertificate(const char *client_ca) {
353+
if (_cert_free && _cert) {
354+
free((void *)_cert);
355+
_cert_free = false;
356+
}
328357
_cert = client_ca;
329358
}
330359

331360
void NetworkClientSecure::setPrivateKey(const char *private_key) {
361+
if (_private_key_free && _private_key) {
362+
free((void *)_private_key);
363+
_private_key_free = false;
364+
}
332365
_private_key = private_key;
333366
}
334367

@@ -367,6 +400,7 @@ bool NetworkClientSecure::loadCACert(Stream &stream, size_t size) {
367400
bool ret = false;
368401
if (dest) {
369402
setCACert(dest);
403+
_ca_cert_free = true;
370404
ret = true;
371405
}
372406
return ret;
@@ -380,6 +414,7 @@ bool NetworkClientSecure::loadCertificate(Stream &stream, size_t size) {
380414
bool ret = false;
381415
if (dest) {
382416
setCertificate(dest);
417+
_cert_free = true;
383418
ret = true;
384419
}
385420
return ret;
@@ -393,6 +428,7 @@ bool NetworkClientSecure::loadPrivateKey(Stream &stream, size_t size) {
393428
bool ret = false;
394429
if (dest) {
395430
setPrivateKey(dest);
431+
_private_key_free = true;
396432
ret = true;
397433
}
398434
return ret;

Diff for: libraries/NetworkClientSecure/src/NetworkClientSecure.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ class NetworkClientSecure : public NetworkClient {
3131
std::shared_ptr<sslclient_context> sslclient;
3232

3333
bool _use_insecure;
34-
bool _stillinPlainStart = false;
34+
bool _stillinPlainStart;
35+
bool _ca_cert_free;
36+
bool _cert_free;
37+
bool _private_key_free;
3538
const char *_CA_cert;
3639
const char *_cert;
3740
const char *_private_key;

Diff for: libraries/NetworkClientSecure/src/ssl_client.cpp

+16-5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ void ssl_init(sslclient_context *ssl_client) {
5151
ssl_client->peek_buf = -1;
5252
}
5353

54+
void attach_ssl_certificate_bundle(sslclient_context *ssl_client, bool att) {
55+
if (att) {
56+
ssl_client->bundle_attach_cb = &esp_crt_bundle_attach;
57+
} else {
58+
ssl_client->bundle_attach_cb = NULL;
59+
}
60+
}
61+
5462
int start_ssl_client(
5563
sslclient_context *ssl_client, const IPAddress &ip, uint32_t port, const char *hostname, int timeout, const char *rootCABuff, bool useRootCABundle,
5664
const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos
@@ -195,11 +203,14 @@ int start_ssl_client(
195203
return handle_error(ret);
196204
}
197205
} else if (useRootCABundle) {
198-
log_v("Attaching root CA cert bundle");
199-
ret = esp_crt_bundle_attach(&ssl_client->ssl_conf);
200-
201-
if (ret < 0) {
202-
return handle_error(ret);
206+
if (ssl_client->bundle_attach_cb != NULL) {
207+
log_v("Attaching root CA cert bundle");
208+
ret = ssl_client->bundle_attach_cb(&ssl_client->ssl_conf);
209+
if (ret < 0) {
210+
return handle_error(ret);
211+
}
212+
} else {
213+
log_e("useRootCABundle is set, but attach_ssl_certificate_bundle(ssl, true); was not called!");
203214
}
204215
} else if (pskIdent != NULL && psKey != NULL) {
205216
log_v("Setting up PSK");

Diff for: libraries/NetworkClientSecure/src/ssl_client.h

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "mbedtls/ctr_drbg.h"
1313
#include "mbedtls/error.h"
1414

15+
typedef esp_err_t (*crt_bundle_attach_cb)(void *conf);
16+
1517
typedef struct sslclient_context {
1618
int socket;
1719
mbedtls_ssl_context ssl_ctx;
@@ -24,6 +26,8 @@ typedef struct sslclient_context {
2426
mbedtls_x509_crt client_cert;
2527
mbedtls_pk_context client_key;
2628

29+
crt_bundle_attach_cb bundle_attach_cb;
30+
2731
unsigned long socket_timeout;
2832
unsigned long handshake_timeout;
2933

@@ -37,6 +41,7 @@ int start_ssl_client(
3741
sslclient_context *ssl_client, const IPAddress &ip, uint32_t port, const char *hostname, int timeout, const char *rootCABuff, bool useRootCABundle,
3842
const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos
3943
);
44+
void attach_ssl_certificate_bundle(sslclient_context *ssl_client, bool att);
4045
int ssl_starttls_handshake(sslclient_context *ssl_client);
4146
void stop_ssl_socket(sslclient_context *ssl_client);
4247
int data_to_read(sslclient_context *ssl_client);

Diff for: tools/partitions/no_fs.csv

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x5000,
3+
otadata, data, ota, 0xe000, 0x2000,
4+
app0, app, ota_0, 0x10000, 0x1F0000,
5+
app1, app, ota_1, 0x200000,0x1F0000,
6+
coredump, data, coredump,0x3F0000,0x10000,

0 commit comments

Comments
 (0)