Skip to content

Commit 4bcd33b

Browse files
authored
Merge branch 'master' into master
2 parents 2dc7ec9 + 48072ee commit 4bcd33b

File tree

20 files changed

+738
-201
lines changed

20 files changed

+738
-201
lines changed

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

+36-13
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPA
3535
echo "Action: $action, Branch: $RELEASE_BRANCH, ID: $RELEASE_ID"
3636
echo "Tag: $RELEASE_TAG, Draft: $draft, Pre-Release: $RELEASE_PRE"
3737

38+
# Try extracting something like a JSON with a "boards" array/element and "vendor" fields
39+
BOARDS=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.boards[]? // .boards? // empty' | xargs echo -n 2>/dev/null`
40+
VENDOR=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.vendor? // empty' | xargs echo -n 2>/dev/null`
41+
if ! [ -z "${BOARDS}" ]; then echo "Releasing board(s): $BOARDS" ; fi
42+
if ! [ -z "${VENDOR}" ]; then echo "Setting packager: $VENDOR" ; fi
43+
3844
function get_file_size(){
3945
local file="$1"
4046
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -170,12 +176,26 @@ mkdir -p "$PKG_DIR/tools"
170176

171177
# Copy all core files to the package folder
172178
echo "Copying files for packaging ..."
173-
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
179+
if [ -z "${BOARDS}" ]; then
180+
# Copy all variants
181+
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
182+
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
183+
else
184+
# Remove all entries not starting with any board code or "menu." from boards.txt
185+
cat "$GITHUB_WORKSPACE/boards.txt" | grep "^menu\." > "$PKG_DIR/boards.txt"
186+
for board in ${BOARDS} ; do
187+
cat "$GITHUB_WORKSPACE/boards.txt" | grep "^${board}\." >> "$PKG_DIR/boards.txt"
188+
done
189+
# Copy only relevant variant files
190+
mkdir "$PKG_DIR/variants/"
191+
for variant in `cat ${PKG_DIR}/boards.txt | grep "\.variant=" | cut -d= -f2` ; do
192+
cp -Rf "$GITHUB_WORKSPACE/variants/${variant}" "$PKG_DIR/variants/"
193+
done
194+
fi
174195
cp -f "$GITHUB_WORKSPACE/package.json" "$PKG_DIR/"
175196
cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/"
176197
cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/"
177198
cp -Rf "$GITHUB_WORKSPACE/libraries" "$PKG_DIR/"
178-
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
179199
cp -f "$GITHUB_WORKSPACE/tools/espota.exe" "$PKG_DIR/tools/"
180200
cp -f "$GITHUB_WORKSPACE/tools/espota.py" "$PKG_DIR/tools/"
181201
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/"
@@ -201,19 +221,22 @@ RVTC_NEW_NAME="esp-rv32"
201221
echo "Generating platform.txt..."
202222
cat "$GITHUB_WORKSPACE/platform.txt" | \
203223
sed "s/version=.*/version=$RELEASE_TAG/g" | \
204-
sed 's/tools.esp32-arduino-libs.path={runtime.platform.path}\/tools\/esp32-arduino-libs/tools.esp32-arduino-libs.path=\{runtime.tools.esp32-arduino-libs.path\}/g' | \
205-
sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
206-
sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
207-
sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
208-
sed 's/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
209-
sed "s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\\/tools\\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
210-
sed 's/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
211-
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
212-
sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
213-
sed 's/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \
214-
sed 's/debug.server.openocd.scripts_dir.windows={runtime.platform.path}\\tools\\openocd-esp32\\share\\openocd\\scripts\\/debug.server.openocd.scripts_dir.windows=\{runtime.tools.openocd-esp32.path\}\\share\\openocd\\scripts\\/g' \
224+
sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \
225+
sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
226+
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
227+
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
228+
sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
229+
sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
230+
sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
231+
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
232+
sed 's/{runtime\.platform\.path}.tools.openocd-esp32/\{runtime.tools.openocd-esp32.path\}/g' \
215233
> "$PKG_DIR/platform.txt"
216234

235+
if ! [ -z ${VENDOR} ]; then
236+
# Append vendor name to platform.txt to create a separate section
237+
sed -i "/^name=.*/s/$/ ($VENDOR)/" "$PKG_DIR/platform.txt"
238+
fi
239+
217240
# Add header with version information
218241
echo "Generating core_version.h ..."
219242
ver_define=`echo $RELEASE_TAG | tr "[:lower:].\055" "[:upper:]_"`

Diff for: boards.txt

+14-3
Original file line numberDiff line numberDiff line change
@@ -33474,9 +33474,22 @@ nano_nora.build.psram_type=opi
3347433474
nano_nora.build.memory_type={build.boot}_{build.psram_type}
3347533475
nano_nora.build.disable_pin_remap=
3347633476

33477+
nano_nora.debug_config.nano_nora.cortex-debug.custom.name=Arduino on Nano ESP32
33478+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.0=set remote hardware-watchpoint-limit 2
33479+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.1=monitor reset halt
33480+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.2=monitor gdb_sync
33481+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.3=interrupt
33482+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
33483+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
33484+
nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.2=interrupt
33485+
nano_nora.debug.additional_config=debug_config.nano_nora
33486+
3347733487
nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin"
3347833488
nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset erase_flash
3347933489

33490+
nano_nora.programmer.default=esptool
33491+
nano_nora.debug.executable=
33492+
3348033493
nano_nora.menu.PartitionScheme.default=With FAT partition (default)
3348133494
nano_nora.menu.PartitionScheme.spiffs=With SPIFFS partition (advanced)
3348233495
nano_nora.menu.PartitionScheme.spiffs.build.partitions=app3M_spiffs9M_fact512k_16MB
@@ -33488,9 +33501,7 @@ nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_G
3348833501
nano_nora.menu.USBMode.default=Normal mode (TinyUSB)
3348933502
nano_nora.menu.USBMode.hwcdc=Debug mode (Hardware CDC)
3349033503
nano_nora.menu.USBMode.hwcdc.build.usb_mode=1
33491-
nano_nora.menu.USBMode.hwcdc.build.copy_jtag_files=1
33492-
nano_nora.menu.USBMode.hwcdc.build.openocdscript=esp32s3-builtin.cfg
33493-
nano_nora.menu.USBMode.hwcdc.build.debugconfig=esp32s3-arduino.json
33504+
nano_nora.menu.USBMode.hwcdc.debug.executable={build.path}/{build.project_name}.elf
3349433505

3349533506
##############################################################
3349633507

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

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <MD5Builder.h>
66
#include <functional>
77
#include "esp_partition.h"
8-
#include "aes/esp_aes.h"
98

109
#define UPDATE_ERROR_OK (0)
1110
#define UPDATE_ERROR_WRITE (1)

Diff for: libraries/Update/src/Updater.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "spi_flash_mmap.h"
44
#include "esp_ota_ops.h"
55
#include "esp_image_format.h"
6+
#include "mbedtls/aes.h"
67

78
static const char * _err2str(uint8_t _error){
89
if(_error == UPDATE_ERROR_OK){
@@ -312,17 +313,27 @@ bool UpdateClass::_decryptBuffer(){
312313
uint8_t tweaked_key[ENCRYPTED_KEY_SIZE]; //tweaked crypt key
313314
int done = 0;
314315

315-
esp_aes_context ctx; //initialize AES
316-
esp_aes_init( &ctx );
316+
/*
317+
Mbedtls functions will be replaced with esp_aes functions when hardware acceleration is available
318+
319+
To Do:
320+
Replace mbedtls for the cases where there's no hardware acceleration
321+
*/
322+
323+
mbedtls_aes_context ctx; //initialize AES
324+
mbedtls_aes_init( &ctx );
317325
while((_bufferLen - done) >= ENCRYPTED_BLOCK_SIZE){
318326
for(int i=0; i < ENCRYPTED_BLOCK_SIZE; i++) _cryptBuffer[(ENCRYPTED_BLOCK_SIZE - 1) - i] = _buffer[i + done]; //reverse order 16 bytes to decrypt
319327
if( ((_cryptAddress + _progress + done) % ENCRYPTED_TWEAK_BLOCK_SIZE) == 0 || done == 0 ){
320328
_cryptKeyTweak(_cryptAddress + _progress + done, tweaked_key); //update tweaked crypt key
321-
if( esp_aes_setkey( &ctx, tweaked_key, 256 ) ){
329+
if( mbedtls_aes_setkey_enc( &ctx, tweaked_key, 256 ) ){
330+
return false;
331+
}
332+
if( mbedtls_aes_setkey_dec( &ctx, tweaked_key, 256 ) ){
322333
return false;
323334
}
324335
}
325-
if( esp_aes_crypt_ecb( &ctx, ESP_AES_ENCRYPT, _cryptBuffer, _cryptBuffer ) ){ //use ESP_AES_ENCRYPT to decrypt flash code
336+
if( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_ENCRYPT, _cryptBuffer, _cryptBuffer ) ){ //use MBEDTLS_AES_ENCRYPT to decrypt flash code
326337
return false;
327338
}
328339
for(int i=0; i < ENCRYPTED_BLOCK_SIZE; i++) _buffer[i + done] = _cryptBuffer[(ENCRYPTED_BLOCK_SIZE - 1) - i]; //reverse order 16 bytes from decrypt

Diff for: libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ void handleRoot() {
4444
digitalWrite(led, 1);
4545
char temp[400];
4646
int sec = millis() / 1000;
47-
int min = sec / 60;
48-
int hr = min / 60;
47+
int hr = sec / 3600;
48+
int min = (sec / 60) % 60;
49+
sec = sec % 60;
4950

5051
snprintf(temp, 400,
5152

@@ -64,7 +65,7 @@ void handleRoot() {
6465
</body>\
6566
</html>",
6667

67-
hr, min % 60, sec % 60
68+
hr, min, sec
6869
);
6970
server.send(200, "text/html", temp);
7071
digitalWrite(led, 0);

Diff for: libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#include <WiFiClientSecure.h>
22

3+
/* This is a very INSECURE approach.
4+
* If for some reason the secure, proper example WiFiClientSecure
5+
* does not work for you; then you may want to check the
6+
* WiFiClientTrustOnFirstUse example first. It is less secure than
7+
* WiFiClientSecure, but a lot better than this totally insecure
8+
* approach shown below.
9+
*/
10+
311
const char* ssid = "your-ssid"; // your network SSID (name of wifi network)
412
const char* password = "your-password"; // your network password
513

Diff for: libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/.skip.esp32h2

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/* STARTSSL example
2+
3+
Inline upgrading from a clear-text connection to an SSL/TLS connection.
4+
5+
Some protocols such as SMTP, XMPP, Mysql, Postgress and others allow, or require,
6+
that you start the connection without encryption; and then send a command to switch
7+
over to encryption.
8+
9+
E.g. a typical SMTP submission would entail a dialogue such as this:
10+
11+
1. client connects to server in the clear
12+
2. server says hello
13+
3. client sents a EHLO
14+
4. server tells the client that it supports SSL/TLS
15+
5. client sends a 'STARTTLS' to make use of this faciltiy
16+
6. client/server negiotiate a SSL or TLS connection.
17+
7. client sends another EHLO
18+
8. server now tells the client what (else) is supported; such as additional authentication options.
19+
... conversation continues encrypted.
20+
21+
This can be enabled in WiFiClientSecure by telling it to start in plaintext:
22+
23+
client.setPlainStart();
24+
25+
and client is than a plain, TCP, connection (just as WiFiClient would be); until the client calls
26+
the method:
27+
28+
client.startTLS(); // returns zero on error; non zero on success.
29+
30+
After which things switch to TLS/SSL.
31+
*/
32+
33+
#include <WiFiClientSecure.h>
34+
35+
#ifndef WIFI_NETWORK
36+
#define WIFI_NETWORK "YOUR Wifi SSID"
37+
#endif
38+
39+
#ifndef WIFI_PASSWD
40+
#define WIFI_PASSWD "your-secret-password"
41+
#endif
42+
43+
#ifndef SMTP_HOST
44+
#define SMTP_HOST "smtp.gmail.com"
45+
#endif
46+
47+
#ifndef SMTP_PORT
48+
#define SMTP_PORT (587) // Standard (plaintext) submission port
49+
#endif
50+
51+
const char* ssid = WIFI_NETWORK; // your network SSID (name of wifi network)
52+
const char* password = WIFI_PASSWD; // your network password
53+
const char* server = SMTP_HOST; // Server URL
54+
const int submission_port = SMTP_PORT; // submission port.
55+
56+
WiFiClientSecure client;
57+
58+
static bool readAllSMTPLines();
59+
60+
void setup() {
61+
int ret;
62+
//Initialize serial and wait for port to open:
63+
Serial.begin(115200);
64+
delay(100);
65+
66+
Serial.print("Attempting to connect to SSID: ");
67+
Serial.print(ssid);
68+
WiFi.begin(ssid, password);
69+
70+
// attempt to connect to Wifi network:
71+
while (WiFi.status() != WL_CONNECTED) {
72+
Serial.print(".");
73+
// wait 1 second for re-trying
74+
delay(1000);
75+
}
76+
77+
Serial.print("Connected to ");
78+
Serial.println(ssid);
79+
80+
Serial.printf("\nStarting connection to server: %s:%d\n", server, submission_port);
81+
82+
83+
// skip verification for this demo. In production one should at the very least
84+
// enable TOFU; or ideally hardcode a (CA) certificate that is trusted.
85+
client.setInsecure();
86+
87+
// Enable a plain-test start.
88+
client.setPlainStart();
89+
90+
if (!client.connect(server, SMTP_PORT)) {
91+
Serial.println("Connection failed!");
92+
return;
93+
};
94+
95+
Serial.println("Connected to server (in the clear, in plaintest)");
96+
97+
if (!readAllSMTPLines()) goto err;
98+
99+
Serial.println("Sending : EHLO\t\tin the clear");
100+
client.print("EHLO there\r\n");
101+
102+
if (!readAllSMTPLines()) goto err;
103+
104+
Serial.println("Sending : STARTTLS\t\tin the clear");
105+
client.print("STARTTLS\r\n");
106+
107+
if (!readAllSMTPLines()) goto err;
108+
109+
Serial.println("Upgrading connection to TLS");
110+
if ((ret=client.startTLS()) <= 0) {
111+
Serial.printf("Upgrade connection failed: err %d\n", ret);
112+
goto err;
113+
}
114+
115+
Serial.println("Sending : EHLO again\t\tover the now encrypted connection");
116+
client.print("EHLO again\r\n");
117+
118+
if (!readAllSMTPLines()) goto err;
119+
120+
// normally, as this point - we'd be authenticating and then be submitting
121+
// an email. This has been left out of this example.
122+
123+
Serial.println("Sending : QUIT\t\t\tover the now encrypted connection");
124+
client.print("QUIT\r\n");
125+
126+
if (!readAllSMTPLines()) goto err;
127+
128+
Serial.println("Completed OK\n");
129+
err:
130+
Serial.println("Closing connection");
131+
client.stop();
132+
}
133+
134+
// SMTP command repsponse start with three digits and a space;
135+
// or, for continuation, with three digits and a '-'.
136+
static bool readAllSMTPLines() {
137+
String s = "";
138+
int i;
139+
140+
// blocking read; we cannot rely on a timeout
141+
// of a WiFiClientSecure read; as it is non
142+
// blocking.
143+
const unsigned long timeout = 15 * 1000;
144+
unsigned long start = millis(); // the timeout is for the entire CMD block response; not per character/line.
145+
while (1) {
146+
while ((i = client.available()) == 0 && millis() - start < timeout) {
147+
/* .. wait */
148+
};
149+
if (i == 0) {
150+
Serial.println("Timeout reading SMTP response");
151+
return false;
152+
};
153+
if (i < 0)
154+
break;
155+
156+
i = client.read();
157+
if (i < 0)
158+
break;
159+
160+
if (i > 31 && i < 128) s += (char)i;
161+
if (i == 0x0A) {
162+
Serial.print("Receiving: ");
163+
Serial.println(s);
164+
if (s.charAt(3) == ' ')
165+
return true;
166+
s = "";
167+
}
168+
}
169+
Serial.printf("Error reading SMTP command response line: %d\n", i);
170+
return false;
171+
}
172+
173+
void loop() {
174+
// do nothing
175+
}
176+

Diff for: libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/.skip.esp32h2

Whitespace-only changes.

0 commit comments

Comments
 (0)