Skip to content

Commit 968e74f

Browse files
committed
Merge branch 'master' into bstream2
2 parents cee7631 + a04c324 commit 968e74f

22 files changed

+263
-83
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ Also known as latest git or master branch.
4848

4949
### Using PlatformIO
5050

51-
[PlatformIO](https://platformio.org?utm_source=github&utm_medium=arduino-esp8266) is an open source ecosystem for IoT
51+
[PlatformIO](https://platformio.org?utm_source=arduino-esp8266) is an open source ecosystem for IoT
5252
development with a cross-platform build system, a library manager, and full support
5353
for Espressif (ESP8266) development. It works on the following popular host operating systems: macOS, Windows,
5454
Linux 32/64, and Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
5555

56-
- [What is PlatformIO?](https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp8266)
57-
- [PlatformIO IDE](https://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp8266)
58-
- [PlatformIO Core](https://docs.platformio.org/en/latest/core.html?utm_source=github&utm_medium=arduino-esp8266) (command line tool)
59-
- [Advanced usage](https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=github&utm_medium=arduino-esp8266) -
56+
- [What is PlatformIO?](https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=arduino-esp8266)
57+
- [PlatformIO IDE](https://platformio.org/platformio-ide?utm_source=arduino-esp8266)
58+
- [PlatformIO Core](https://docs.platformio.org/en/latest/core.html?utm_source=arduino-esp8266) (command line tool)
59+
- [Advanced usage](https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266) -
6060
custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
61-
- [Integration with Cloud and Standalone IDEs](https://docs.platformio.org/en/latest/ide.html?utm_source=github&utm_medium=arduino-esp8266) -
61+
- [Integration with Cloud and Standalone IDEs](https://docs.platformio.org/en/latest/ide.html?utm_source=arduino-esp8266) -
6262
Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
63-
- [Project Examples](https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=github&utm_medium=arduino-esp8266#examples)
63+
- [Project Examples](https://docs.platformio.org/en/latest/platforms/espressif8266.html?utm_source=arduino-esp8266#examples)
6464

6565
### Building with make
6666

boards.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,63 @@ esp8285.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld
625625
esp8285.menu.eesz.1M.build.spiffs_pagesize=256
626626
esp8285.menu.eesz.1M.upload.maximum_size=1023984
627627
esp8285.menu.eesz.1M.build.rfcal_addr=0xFC000
628+
esp8285.menu.eesz.2M64=2MB (FS:64KB OTA:~992KB)
629+
esp8285.menu.eesz.2M64.build.flash_size=2M
630+
esp8285.menu.eesz.2M64.build.flash_size_bytes=0x200000
631+
esp8285.menu.eesz.2M64.build.flash_ld=eagle.flash.2m64.ld
632+
esp8285.menu.eesz.2M64.build.spiffs_pagesize=256
633+
esp8285.menu.eesz.2M64.upload.maximum_size=1044464
634+
esp8285.menu.eesz.2M64.build.rfcal_addr=0x1FC000
635+
esp8285.menu.eesz.2M64.build.spiffs_start=0x1F0000
636+
esp8285.menu.eesz.2M64.build.spiffs_end=0x1FB000
637+
esp8285.menu.eesz.2M64.build.spiffs_blocksize=4096
638+
esp8285.menu.eesz.2M128=2MB (FS:128KB OTA:~960KB)
639+
esp8285.menu.eesz.2M128.build.flash_size=2M
640+
esp8285.menu.eesz.2M128.build.flash_size_bytes=0x200000
641+
esp8285.menu.eesz.2M128.build.flash_ld=eagle.flash.2m128.ld
642+
esp8285.menu.eesz.2M128.build.spiffs_pagesize=256
643+
esp8285.menu.eesz.2M128.upload.maximum_size=1044464
644+
esp8285.menu.eesz.2M128.build.rfcal_addr=0x1FC000
645+
esp8285.menu.eesz.2M128.build.spiffs_start=0x1E0000
646+
esp8285.menu.eesz.2M128.build.spiffs_end=0x1FB000
647+
esp8285.menu.eesz.2M128.build.spiffs_blocksize=4096
648+
esp8285.menu.eesz.2M256=2MB (FS:256KB OTA:~896KB)
649+
esp8285.menu.eesz.2M256.build.flash_size=2M
650+
esp8285.menu.eesz.2M256.build.flash_size_bytes=0x200000
651+
esp8285.menu.eesz.2M256.build.flash_ld=eagle.flash.2m256.ld
652+
esp8285.menu.eesz.2M256.build.spiffs_pagesize=256
653+
esp8285.menu.eesz.2M256.upload.maximum_size=1044464
654+
esp8285.menu.eesz.2M256.build.rfcal_addr=0x1FC000
655+
esp8285.menu.eesz.2M256.build.spiffs_start=0x1C0000
656+
esp8285.menu.eesz.2M256.build.spiffs_end=0x1FB000
657+
esp8285.menu.eesz.2M256.build.spiffs_blocksize=4096
658+
esp8285.menu.eesz.2M512=2MB (FS:512KB OTA:~768KB)
659+
esp8285.menu.eesz.2M512.build.flash_size=2M
660+
esp8285.menu.eesz.2M512.build.flash_size_bytes=0x200000
661+
esp8285.menu.eesz.2M512.build.flash_ld=eagle.flash.2m512.ld
662+
esp8285.menu.eesz.2M512.build.spiffs_pagesize=256
663+
esp8285.menu.eesz.2M512.upload.maximum_size=1044464
664+
esp8285.menu.eesz.2M512.build.rfcal_addr=0x1FC000
665+
esp8285.menu.eesz.2M512.build.spiffs_start=0x180000
666+
esp8285.menu.eesz.2M512.build.spiffs_end=0x1FA000
667+
esp8285.menu.eesz.2M512.build.spiffs_blocksize=8192
668+
esp8285.menu.eesz.2M1M=2MB (FS:1MB OTA:~512KB)
669+
esp8285.menu.eesz.2M1M.build.flash_size=2M
670+
esp8285.menu.eesz.2M1M.build.flash_size_bytes=0x200000
671+
esp8285.menu.eesz.2M1M.build.flash_ld=eagle.flash.2m1m.ld
672+
esp8285.menu.eesz.2M1M.build.spiffs_pagesize=256
673+
esp8285.menu.eesz.2M1M.upload.maximum_size=1044464
674+
esp8285.menu.eesz.2M1M.build.rfcal_addr=0x1FC000
675+
esp8285.menu.eesz.2M1M.build.spiffs_start=0x100000
676+
esp8285.menu.eesz.2M1M.build.spiffs_end=0x1FA000
677+
esp8285.menu.eesz.2M1M.build.spiffs_blocksize=8192
678+
esp8285.menu.eesz.2M=2MB (FS:none OTA:~1019KB)
679+
esp8285.menu.eesz.2M.build.flash_size=2M
680+
esp8285.menu.eesz.2M.build.flash_size_bytes=0x200000
681+
esp8285.menu.eesz.2M.build.flash_ld=eagle.flash.2m.ld
682+
esp8285.menu.eesz.2M.build.spiffs_pagesize=256
683+
esp8285.menu.eesz.2M.upload.maximum_size=1044464
684+
esp8285.menu.eesz.2M.build.rfcal_addr=0x1FC000
628685
esp8285.menu.led.2=2
629686
esp8285.menu.led.2.build.led=-DLED_BUILTIN=2
630687
esp8285.menu.led.0=0

cores/esp8266/Esp.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ bool EspClass::rtcUserMemoryWrite(uint32_t offset, uint32_t *data, size_t size)
193193
}
194194
}
195195

196-
197-
198-
extern "C" void __real_system_restart_local();
199196
void EspClass::reset(void)
200197
{
201198
__real_system_restart_local();

cores/esp8266/StackThunk.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#include <stdint.h>
2828
#include <stdlib.h>
29+
#include <stdio.h>
30+
#include "pgmspace.h"
31+
#include "debug.h"
2932
#include "StackThunk.h"
3033
#include <ets_sys.h>
3134

@@ -46,6 +49,11 @@ void stack_thunk_add_ref()
4649
stack_thunk_refcnt++;
4750
if (stack_thunk_refcnt == 1) {
4851
stack_thunk_ptr = (uint32_t *)malloc(_stackSize * sizeof(uint32_t));
52+
if (!stack_thunk_ptr) {
53+
// This is a fatal error, stop the sketch
54+
DEBUGV("Unable to allocate BearSSL stack\n");
55+
abort();
56+
}
4957
stack_thunk_top = stack_thunk_ptr + _stackSize - 1;
5058
stack_thunk_save = NULL;
5159
stack_thunk_repaint();

cores/esp8266/Updater.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "Updater.h"
22
#include "eboot_command.h"
33
#include <esp8266_peri.h>
4+
#include "StackThunk.h"
45

56
//#define DEBUG_UPDATER Serial
67

@@ -40,6 +41,14 @@ UpdaterClass::UpdaterClass()
4041
{
4142
#if ARDUINO_SIGNING
4243
installSignature(&esp8266::updaterSigningHash, &esp8266::updaterSigningVerifier);
44+
stack_thunk_add_ref();
45+
#endif
46+
}
47+
48+
UpdaterClass::~UpdaterClass()
49+
{
50+
#if ARDUINO_SIGNING
51+
stack_thunk_del_ref();
4352
#endif
4453
}
4554

@@ -199,14 +208,14 @@ bool UpdaterClass::end(bool evenIfRemaining){
199208
#ifdef DEBUG_UPDATER
200209
DEBUG_UPDATER.println(F("no update"));
201210
#endif
211+
_reset();
202212
return false;
203213
}
204214

205215
if(hasError() || (!isFinished() && !evenIfRemaining)){
206216
#ifdef DEBUG_UPDATER
207217
DEBUG_UPDATER.printf_P(PSTR("premature end: res:%u, pos:%zu/%zu\n"), getError(), progress(), _size);
208218
#endif
209-
210219
_reset();
211220
return false;
212221
}
@@ -226,6 +235,7 @@ bool UpdaterClass::end(bool evenIfRemaining){
226235
#endif
227236
if (sigLen != _verify->length()) {
228237
_setError(UPDATE_ERROR_SIGN);
238+
_reset();
229239
return false;
230240
}
231241

@@ -251,6 +261,7 @@ bool UpdaterClass::end(bool evenIfRemaining){
251261
uint8_t *sig = (uint8_t*)malloc(sigLen);
252262
if (!sig) {
253263
_setError(UPDATE_ERROR_SIGN);
264+
_reset();
254265
return false;
255266
}
256267
ESP.flashRead(_startAddress + binSize, (uint32_t *)sig, sigLen);
@@ -262,9 +273,12 @@ bool UpdaterClass::end(bool evenIfRemaining){
262273
DEBUG_UPDATER.printf("\n");
263274
#endif
264275
if (!_verify->verify(_hash, (void *)sig, sigLen)) {
276+
free(sig);
265277
_setError(UPDATE_ERROR_SIGN);
278+
_reset();
266279
return false;
267280
}
281+
free(sig);
268282
#ifdef DEBUG_UPDATER
269283
DEBUG_UPDATER.printf_P(PSTR("[Updater] Signature matches\n"));
270284
#endif

cores/esp8266/Updater.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class UpdaterClass {
5353
typedef std::function<void(size_t, size_t)> THandlerFunction_Progress;
5454

5555
UpdaterClass();
56+
~UpdaterClass();
5657

5758
/* Optionally add a cryptographic signature verification hash and method */
5859
void installSignature(UpdaterHashClass *hash, UpdaterVerifyClass *verify) { _hash = hash; _verify = verify; }

cores/esp8266/core_esp8266_postmortem.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
#include "pgmspace.h"
3333
#include "gdb_hooks.h"
3434
#include "StackThunk.h"
35+
#include "coredecls.h"
3536

3637
extern "C" {
3738

38-
extern void __real_system_restart_local();
39-
4039
// These will be pointers to PROGMEM const strings
4140
static const char* s_panic_file = 0;
4241
static int s_panic_line = 0;

cores/esp8266/core_esp8266_wiring_digital.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,23 @@ extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode)
235235
__attachInterruptFunctionalArg(pin, (voidFuncPtrArg)userFunc, 0, mode, false);
236236
}
237237

238+
extern void __resetPins() {
239+
for (int i = 0; i <= 16; ++i) {
240+
if (!isFlashInterfacePin(i))
241+
pinMode(i, INPUT);
242+
}
243+
}
244+
238245
extern void initPins() {
239246
//Disable UART interrupts
240247
system_set_os_print(0);
241248
U0IE = 0;
242249
U1IE = 0;
243250

244-
for (int i = 0; i <= 5; ++i) {
245-
pinMode(i, INPUT);
246-
}
247-
// pins 6-11 are used for the SPI flash interface
248-
for (int i = 12; i <= 16; ++i) {
249-
pinMode(i, INPUT);
250-
}
251+
resetPins();
251252
}
252253

254+
extern void resetPins() __attribute__ ((weak, alias("__resetPins")));
253255
extern void pinMode(uint8_t pin, uint8_t mode) __attribute__ ((weak, alias("__pinMode")));
254256
extern void digitalWrite(uint8_t pin, uint8_t val) __attribute__ ((weak, alias("__digitalWrite")));
255257
extern int digitalRead(uint8_t pin) __attribute__ ((weak, alias("__digitalRead"), nothrow));

cores/esp8266/coredecls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ void esp_schedule();
2121
void tune_timeshift64 (uint64_t now_us);
2222
void disable_extra4k_at_link_time (void) __attribute__((noinline));
2323
bool sntp_set_timezone_in_seconds(int32_t timezone);
24+
void __real_system_restart_local() __attribute__((noreturn));
2425

2526
uint32_t sqrt32 (uint32_t n);
2627
uint32_t crc32 (const void* data, size_t length, uint32_t crc = 0xffffffff);

cores/esp8266/wiring_private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern "C" {
3737
typedef void (*voidFuncPtr)(void);
3838

3939
void initPins();
40+
void resetPins();
4041

4142
#ifdef __cplusplus
4243
} // extern "C"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy