Skip to content

Commit 1a1f484

Browse files
authored
Merge branch 'master' into upload/destroy-erase-improve
2 parents 92c1e32 + 1a13ab9 commit 1a1f484

File tree

21 files changed

+222
-68
lines changed

21 files changed

+222
-68
lines changed

.github/workflows/style-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: |
2828
sudo apt update
2929
python ./tests/test_restyle.py --quiet
30-
bash ./tests/ci/style_check.sh
30+
env CLANG_FORMAT="clang-format-18" bash ./tests/ci/style_check.sh
3131
3232
# Validate orthography
3333

cores/esp8266/StackThunk.cpp

+42-1
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,26 @@
2727
#include <stdint.h>
2828
#include <stdlib.h>
2929
#include <stdio.h>
30-
#include "pgmspace.h"
30+
3131
#include "debug.h"
3232
#include "StackThunk.h"
33+
34+
#include <pgmspace.h>
3335
#include <ets_sys.h>
36+
3437
#include <umm_malloc/umm_malloc.h>
3538
#include <umm_malloc/umm_heap_select.h>
3639

3740
extern "C" {
3841

42+
extern void optimistic_yield(uint32_t);
43+
3944
uint32_t *stack_thunk_ptr = NULL;
4045
uint32_t *stack_thunk_top = NULL;
46+
4147
uint32_t *stack_thunk_save = NULL; /* Saved A1 while in BearSSL */
48+
uint32_t *stack_thunk_yield_save = NULL; /* Saved A1 when yielding from within BearSSL */
49+
4250
uint32_t stack_thunk_refcnt = 0;
4351

4452
/* Largest stack usage seen in the wild at 6120 */
@@ -150,4 +158,37 @@ void stack_thunk_fatal_smashing()
150158
__stack_chk_fail();
151159
}
152160

161+
/* Called within bearssl code instead of optimistic_yield(...) */
162+
void stack_thunk_yield();
163+
asm(
164+
".section .text.stack_thunk_yield,\"ax\",@progbits\n\t"
165+
".literal_position\n\t"
166+
".align 4\n\t"
167+
".global stack_thunk_yield\n\t"
168+
".type stack_thunk_yield, @function\n\t"
169+
"\n"
170+
"stack_thunk_yield:\n\t"
171+
/* Keep the original caller */
172+
"addi a1, a1, -16\n\t"
173+
"s32i.n a0, a1, 12\n\t"
174+
/* Swap bearssl <-> cont stacks */
175+
"movi a2, stack_thunk_yield_save\n\t"
176+
"s32i.n a1, a2, 0\n\t"
177+
"movi a2, stack_thunk_save\n\t"
178+
"l32i.n a1, a2, 0\n\t"
179+
/* optimistic_yield(10000) without extra l32r */
180+
"movi a2, 0x10\n\t"
181+
"addmi a2, a2, 0x2700\n\t"
182+
"call0 optimistic_yield\n\t"
183+
/* Swap bearssl <-> cont stacks, again */
184+
"movi a2, stack_thunk_yield_save\n\t"
185+
"l32i.n a1, a2, 0\n\t"
186+
"\n"
187+
/* Restore caller */
188+
"l32i.n a0, a1, 12\n\t"
189+
"addi a1, a1, 16\n\t"
190+
"ret.n\n\t"
191+
".size stack_thunk_yield, .-stack_thunk_yield\n\t"
192+
);
193+
153194
}

cores/esp8266/StackThunk.h

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
extern "C" {
3232
#endif
3333

34+
extern void stack_thunk_yield(void);
35+
3436
extern void stack_thunk_add_ref();
3537
extern void stack_thunk_del_ref();
3638
extern void stack_thunk_repaint();

doc/esp8266wifi/station-class.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Function returns one of the following connection statuses:
473473
- ``WL_IDLE_STATUS`` when Wi-Fi is in process of changing between statuses
474474
- ``WL_DISCONNECTED`` if module is not configured in station mode
475475

476-
Returned value is type of ``wl_status_t`` defined in `wl\_definitions.h <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/include/wl_definitions.h>`__
476+
Returned value is type of ``wl_status_t`` defined in `wl\_definitions.h <https://github.com/esp8266/Arduino/blob/master/cores/esp8266/wl_definitions.h>`__
477477

478478
*Example code:*
479479

@@ -511,7 +511,7 @@ Returned value is type of ``wl_status_t`` defined in `wl\_definitions.h <https:/
511511
Connection status: 3
512512
Connected, IP address: 192.168.1.10
513513

514-
Particular connection statuses 6 and 3 may be looked up in `wl\_definitions.h <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/include/wl_definitions.h>`__ as follows:
514+
Particular connection statuses 6 and 3 may be looked up in `wl\_definitions.h <https://github.com/esp8266/Arduino/blob/master/cores/esp8266/wl_definitions.h>`__ as follows:
515515

516516
::
517517

libraries/ESP8266WebServer/examples/WebServer/WebServer.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public:
153153
// Close the file
154154
if (_fsUploadFile) { _fsUploadFile.close(); }
155155
} // if
156-
} // upload()
156+
} // upload()
157157

158158
protected:
159159
File _fsUploadFile;

libraries/ESP8266mDNS/src/LEAmDNS.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,7 @@ namespace MDNSImplementation
492492
{
493493
MDNSServiceInfo(MDNSResponder& p_pM, MDNSResponder::hMDNSServiceQuery p_hS,
494494
uint32_t p_u32A) :
495-
p_pMDNSResponder(p_pM),
496-
p_hServiceQuery(p_hS), p_u32AnswerIndex(p_u32A) {};
495+
p_pMDNSResponder(p_pM), p_hServiceQuery(p_hS), p_u32AnswerIndex(p_u32A) {};
497496
struct CompareKey
498497
{
499498
bool operator()(char const* a, char const* b) const

libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ namespace MDNSImplementation
631631
}
632632
}
633633
} // service tiebreak possibility
634-
} // for services
635-
} // ANY answers
634+
} // for services
635+
} // ANY answers
636636
}
637637
else
638638
{
@@ -955,7 +955,7 @@ namespace MDNSImplementation
955955
}
956956

957957
pRRAnswer = pRRAnswer->m_pNext; // Next collected answer
958-
} // while (answers)
958+
} // while (answers)
959959
} while ((bFoundNewKeyAnswer) && (bResult));
960960
} // else: No answers provided
961961
DEBUG_EX_ERR(if (!bResult) {
@@ -1110,7 +1110,7 @@ namespace MDNSImplementation
11101110
}
11111111
pServiceQuery = pServiceQuery->m_pNext;
11121112
} // while(service query)
1113-
} // else: No p_pSRVAnswer
1113+
} // else: No p_pSRVAnswer
11141114
DEBUG_EX_ERR(if (!bResult) {
11151115
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processSRVAnswer: FAILED!\n"));
11161116
});
@@ -1173,7 +1173,7 @@ namespace MDNSImplementation
11731173
}
11741174
pServiceQuery = pServiceQuery->m_pNext;
11751175
} // while(service query)
1176-
} // else: No p_pTXTAnswer
1176+
} // else: No p_pTXTAnswer
11771177
DEBUG_EX_ERR(if (!bResult) {
11781178
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processTXTAnswer: FAILED!\n"));
11791179
});
@@ -1261,7 +1261,7 @@ namespace MDNSImplementation
12611261
}
12621262
pServiceQuery = pServiceQuery->m_pNext;
12631263
} // while(service query)
1264-
} // else: No p_pAAnswer
1264+
} // else: No p_pAAnswer
12651265
DEBUG_EX_ERR(if (!bResult) {
12661266
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _processAAnswer: FAILED!\n"));
12671267
});
@@ -1349,7 +1349,7 @@ namespace MDNSImplementation
13491349
}
13501350
pServiceQuery = pServiceQuery->m_pNext;
13511351
} // while(service query)
1352-
} // else: No p_pAAAAAnswer
1352+
} // else: No p_pAAAAAnswer
13531353

13541354
return bResult;
13551355
}
@@ -2121,7 +2121,7 @@ namespace MDNSImplementation
21212121
} // IP4 flagged
21222122

21232123
pIP4Address = pNextIP4Address; // Next
2124-
} // while
2124+
} // while
21252125
#endif
21262126
#ifdef MDNS_IP6_SUPPORT
21272127
// IP6Address (from AAAA)
@@ -2185,7 +2185,7 @@ namespace MDNSImplementation
21852185
} // IP6 flagged
21862186

21872187
pIP6Address = pNextIP6Address; // Next
2188-
} // while
2188+
} // while
21892189
#endif
21902190
pSQAnswer = pNextSQAnswer;
21912191
}

libraries/ESP8266mDNS/src/LEAmDNS_Structs.cpp

+14-25
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ namespace MDNSImplementation
5555
MDNSResponder::stcMDNSServiceTxt::stcMDNSServiceTxt(const char* p_pcKey /*= 0*/,
5656
const char* p_pcValue /*= 0*/,
5757
bool p_bTemp /*= false*/) :
58-
m_pNext(0),
59-
m_pcKey(0), m_pcValue(0), m_bTemp(p_bTemp)
58+
m_pNext(0), m_pcKey(0), m_pcValue(0), m_bTemp(p_bTemp)
6059
{
6160
setKey(p_pcKey);
6261
setValue(p_pcValue);
@@ -67,8 +66,7 @@ namespace MDNSImplementation
6766
*/
6867
MDNSResponder::stcMDNSServiceTxt::stcMDNSServiceTxt(
6968
const MDNSResponder::stcMDNSServiceTxt& p_Other) :
70-
m_pNext(0),
71-
m_pcKey(0), m_pcValue(0), m_bTemp(false)
69+
m_pNext(0), m_pcKey(0), m_pcValue(0), m_bTemp(false)
7270
{
7371
operator=(p_Other);
7472
}
@@ -614,9 +612,8 @@ namespace MDNSImplementation
614612
bool p_bRA /*= false*/, unsigned char p_ucRCode /*= 0*/, uint16_t p_u16QDCount /*= 0*/,
615613
uint16_t p_u16ANCount /*= 0*/, uint16_t p_u16NSCount /*= 0*/,
616614
uint16_t p_u16ARCount /*= 0*/) :
617-
m_u16ID(p_u16ID),
618-
m_1bQR(p_bQR), m_4bOpcode(p_ucOpcode), m_1bAA(p_bAA), m_1bTC(p_bTC), m_1bRD(p_bRD),
619-
m_1bRA(p_bRA), m_3bZ(0), m_4bRCode(p_ucRCode), m_u16QDCount(p_u16QDCount),
615+
m_u16ID(p_u16ID), m_1bQR(p_bQR), m_4bOpcode(p_ucOpcode), m_1bAA(p_bAA), m_1bTC(p_bTC),
616+
m_1bRD(p_bRD), m_1bRA(p_bRA), m_3bZ(0), m_4bRCode(p_ucRCode), m_u16QDCount(p_u16QDCount),
620617
m_u16ANCount(p_u16ANCount), m_u16NSCount(p_u16NSCount), m_u16ARCount(p_u16ARCount)
621618
{
622619
}
@@ -813,8 +810,7 @@ namespace MDNSImplementation
813810
*/
814811
MDNSResponder::stcMDNS_RRAttributes::stcMDNS_RRAttributes(
815812
uint16_t p_u16Type /*= 0*/, uint16_t p_u16Class /*= 1 DNS_RRCLASS_IN Internet*/) :
816-
m_u16Type(p_u16Type),
817-
m_u16Class(p_u16Class)
813+
m_u16Type(p_u16Type), m_u16Class(p_u16Class)
818814
{
819815
}
820816

@@ -910,8 +906,7 @@ namespace MDNSImplementation
910906
MDNSResponder::stcMDNS_RRAnswer::stcMDNS_RRAnswer(
911907
enuAnswerType p_AnswerType, const MDNSResponder::stcMDNS_RRHeader& p_Header,
912908
uint32_t p_u32TTL) :
913-
m_pNext(0),
914-
m_AnswerType(p_AnswerType), m_Header(p_Header), m_u32TTL(p_u32TTL)
909+
m_pNext(0), m_AnswerType(p_AnswerType), m_Header(p_Header), m_u32TTL(p_u32TTL)
915910
{
916911
// Extract 'cache flush'-bit
917912
m_bCacheFlush = (m_Header.m_Attributes.m_u16Class & 0x8000);
@@ -955,8 +950,7 @@ namespace MDNSImplementation
955950
*/
956951
MDNSResponder::stcMDNS_RRAnswerA::stcMDNS_RRAnswerA(
957952
const MDNSResponder::stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
958-
stcMDNS_RRAnswer(AnswerType_A, p_Header, p_u32TTL),
959-
m_IPAddress(0, 0, 0, 0)
953+
stcMDNS_RRAnswer(AnswerType_A, p_Header, p_u32TTL), m_IPAddress(0, 0, 0, 0)
960954
{
961955
}
962956

@@ -1094,8 +1088,8 @@ namespace MDNSImplementation
10941088
*/
10951089
MDNSResponder::stcMDNS_RRAnswerSRV::stcMDNS_RRAnswerSRV(
10961090
const MDNSResponder::stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
1097-
stcMDNS_RRAnswer(AnswerType_SRV, p_Header, p_u32TTL),
1098-
m_u16Priority(0), m_u16Weight(0), m_u16Port(0)
1091+
stcMDNS_RRAnswer(AnswerType_SRV, p_Header, p_u32TTL), m_u16Priority(0), m_u16Weight(0),
1092+
m_u16Port(0)
10991093
{
11001094
}
11011095

@@ -1132,8 +1126,7 @@ namespace MDNSImplementation
11321126
*/
11331127
MDNSResponder::stcMDNS_RRAnswerGeneric::stcMDNS_RRAnswerGeneric(
11341128
const stcMDNS_RRHeader& p_Header, uint32_t p_u32TTL) :
1135-
stcMDNS_RRAnswer(AnswerType_Generic, p_Header, p_u32TTL),
1136-
m_u16RDLength(0), m_pu8RDData(0)
1129+
stcMDNS_RRAnswer(AnswerType_Generic, p_Header, p_u32TTL), m_u16RDLength(0), m_pu8RDData(0)
11371130
{
11381131
}
11391132

@@ -1212,8 +1205,7 @@ namespace MDNSImplementation
12121205
MDNSResponder::stcMDNSService::stcMDNSService(const char* p_pcName /*= 0*/,
12131206
const char* p_pcService /*= 0*/,
12141207
const char* p_pcProtocol /*= 0*/) :
1215-
m_pNext(0),
1216-
m_pcName(0), m_bAutoName(false), m_pcService(0), m_pcProtocol(0), m_u16Port(0),
1208+
m_pNext(0), m_pcName(0), m_bAutoName(false), m_pcService(0), m_pcProtocol(0), m_u16Port(0),
12171209
m_u8ReplyMask(0), m_fnTxtCallback(0)
12181210
{
12191211
setName(p_pcName);
@@ -1538,9 +1530,7 @@ namespace MDNSImplementation
15381530
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address::stcIP4Address constructor
15391531
*/
15401532
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address::stcIP4Address(
1541-
IPAddress p_IPAddress, uint32_t p_u32TTL /*= 0*/) :
1542-
m_pNext(0),
1543-
m_IPAddress(p_IPAddress)
1533+
IPAddress p_IPAddress, uint32_t p_u32TTL /*= 0*/) : m_pNext(0), m_IPAddress(p_IPAddress)
15441534
{
15451535
m_TTL.set(p_u32TTL);
15461536
}
@@ -2172,9 +2162,8 @@ namespace MDNSImplementation
21722162
*/
21732163
MDNSResponder::stcMDNSSendParameter::stcDomainCacheItem::stcDomainCacheItem(
21742164
const void* p_pHostnameOrService, bool p_bAdditionalData, uint32_t p_u16Offset) :
2175-
m_pNext(0),
2176-
m_pHostnameOrService(p_pHostnameOrService), m_bAdditionalData(p_bAdditionalData),
2177-
m_u16Offset(p_u16Offset)
2165+
m_pNext(0), m_pHostnameOrService(p_pHostnameOrService),
2166+
m_bAdditionalData(p_bAdditionalData), m_u16Offset(p_u16Offset)
21782167
{
21792168
}
21802169

libraries/I2S/examples/InputSerialPlotter/InputSerialPlotter.ino

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ void setup() {
2121
// start I2S at 8 kHz with 24-bits per sample
2222
if (!I2S.begin(I2S_PHILIPS_MODE, 8000, 24)) {
2323
Serial.println("Failed to initialize I2S!");
24-
while (1)
25-
; // do nothing
24+
while (1); // do nothing
2625
}
2726
}
2827

libraries/I2S/examples/SimpleTone/SimpleTone.ino

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ void setup() {
2626
// start I2S at the sample rate with 16-bits per sample
2727
if (!I2S.begin(I2S_PHILIPS_MODE, sampleRate, 16)) {
2828
Serial.println("Failed to initialize I2S!");
29-
while (1)
30-
; // do nothing
29+
while (1); // do nothing
3130
}
3231
}
3332

0 commit comments

Comments
 (0)