Skip to content

Commit dd5c2b0

Browse files
Merge branch 'master' into signedupdates
2 parents 0ae91ae + cb05b86 commit dd5c2b0

File tree

180 files changed

+6131
-9599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+6131
-9599
lines changed

boards.txt

Lines changed: 448 additions & 224 deletions
Large diffs are not rendered by default.

cores/esp8266/Esp.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ uint32_t EspClass::getFreeContStack()
183183
return cont_get_free_stack(g_pcont);
184184
}
185185

186+
void EspClass::resetFreeContStack()
187+
{
188+
cont_repaint_stack(g_pcont);
189+
}
190+
186191
uint32_t EspClass::getChipId(void)
187192
{
188193
return system_get_chip_id();

cores/esp8266/Esp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class EspClass {
111111
void getHeapStats(uint32_t* free = nullptr, uint16_t* max = nullptr, uint8_t* frag = nullptr);
112112

113113
uint32_t getFreeContStack();
114+
void resetFreeContStack();
114115

115116
const char * getSdkVersion();
116117
String getCoreVersion();

cores/esp8266/Updater.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ bool UpdaterClass::end(bool evenIfRemaining){
192192
_size = progress();
193193
}
194194

195-
196195
uint32_t sigLen = 0;
197196
if (_verify) {
198197
ESP.flashRead(_startAddress + _size - sizeof(uint32_t), &sigLen, sizeof(uint32_t));
@@ -248,7 +247,7 @@ bool UpdaterClass::end(bool evenIfRemaining){
248247
#endif
249248
} else if (_target_md5.length()) {
250249
_md5.calculate();
251-
if(_target_md5 != _md5.toString()){
250+
if (strcasecmp(_target_md5.c_str(), _md5.toString().c_str())) {
252251
_setError(UPDATE_ERROR_MD5);
253252
_reset();
254253
return false;

cores/esp8266/WString.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,3 +796,7 @@ float String::toFloat(void) const {
796796
return atof(buffer);
797797
return 0;
798798
}
799+
800+
// global empty string to allow returning const String& with nothing
801+
802+
const String emptyString;

cores/esp8266/WString.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,7 @@ class StringSumHelper: public String {
294294
}
295295
};
296296

297+
extern const String emptyString;
298+
297299
#endif // __cplusplus
298300
#endif // String_class_h

cores/esp8266/cont.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ int cont_get_free_stack(cont_t* cont);
7474
// continuation stack
7575
bool cont_can_yield(cont_t* cont);
7676

77+
// Repaint the stack from the current SP to the end, to allow individual
78+
// routines' stack usages to be calculated by re-painting, checking current
79+
// free, running the routine, then checking the max free
80+
void cont_repaint_stack(cont_t *cont);
81+
82+
7783
#ifdef __cplusplus
7884
}
7985
#endif

cores/esp8266/cont_util.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,18 @@ bool ICACHE_RAM_ATTR cont_can_yield(cont_t* cont) {
6464
return !ETS_INTR_WITHINISR() &&
6565
cont->pc_ret != 0 && cont->pc_yield == 0;
6666
}
67+
68+
// No need for this to be in IRAM, not expected to be IRQ called
69+
void cont_repaint_stack(cont_t *cont)
70+
{
71+
register uint32_t *sp asm("a1");
72+
// Ensure 64 bytes adjacent to the current SP don't get touched to endure
73+
// we don't accidentally trounce over locals or IRQ temps.
74+
uint32_t sp_safe = CONT_STACKSIZE/4 - ((sp - &cont->stack[0] - 64)/4);
75+
76+
// Fill stack with magic values
77+
for(uint32_t pos = 0; pos < sp_safe; pos++)
78+
{
79+
cont->stack[pos] = CONT_STACKGUARD;
80+
}
81+
}

0 commit comments

Comments
 (0)