Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to GCC 10.1 toolchain #6294

Merged
merged 85 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
59023e9
Upgrade to GCC 9.1 toolchain
earlephilhower Jul 13, 2019
8642204
Rebuilt using pure GNU binutils and GCC
earlephilhower Jul 13, 2019
354cfcd
Rebuild bearssl using new toolchain
earlephilhower Jul 13, 2019
99a0c6f
Fix GDBstub linkage options
earlephilhower Jul 13, 2019
83f308e
Fix digitalRead alias warning
earlephilhower Jul 13, 2019
33fee67
Remove gdb stub warnings w/a pragma
earlephilhower Jul 13, 2019
726f0e9
Merge branch 'master' into gcc9.1
earlephilhower Jul 13, 2019
3afe9e3
Fix deprecated implicit copy ctors in IP code
earlephilhower Jul 13, 2019
ef74b7c
Fix AxTLS alias function defs to match real code
earlephilhower Jul 13, 2019
a15ab56
Fix WiFiClientSecure implicit default copy ctor
earlephilhower Jul 13, 2019
3065a3f
Dummy size for heap to avoid GCC 8/9 warnings
earlephilhower Jul 13, 2019
a68d8ce
Make heap an undefined extend array
earlephilhower Jul 14, 2019
b0a5fe6
Trivial tab to space fix
earlephilhower Jul 14, 2019
bb3df45
Update SDFat to remove FatFile warnings
earlephilhower Jul 14, 2019
71f48ac
Fix ticker function cast warnings in GCC 9
earlephilhower Jul 14, 2019
f4cc2d1
Remove GCC support fcn that's in ROM
earlephilhower Jul 14, 2019
1168360
Merge branch 'master' into gcc9.1
earlephilhower Jul 14, 2019
1cb9282
Make exceptions work again, get std::regex up
earlephilhower Jul 15, 2019
e5ee285
Rebuild Bearssl using latest GCC push
earlephilhower Jul 15, 2019
86812e6
Merge branch 'master' into gcc9.1
earlephilhower Jul 15, 2019
9f6c8f5
Automate building of BearSSL and LWIP w/new toolchain
earlephilhower Jul 15, 2019
c5fcedd
Workaround g++ template section problem for exception strings
earlephilhower Jul 16, 2019
b279f33
Rebuild moving exception.what to unique names
earlephilhower Jul 16, 2019
3c695a5
Merge branch 'master' into gcc9.1
earlephilhower Jul 16, 2019
8240618
Rebuild with new LWIP locking
earlephilhower Jul 16, 2019
357e2eb
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Jul 21, 2019
0151092
Update to latest libs, save iram
earlephilhower Jul 21, 2019
bb3bde9
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Jul 25, 2019
6944b6f
Update BearSSL to latest release
earlephilhower Jul 25, 2019
cf04569
Merge branch 'master' into gcc9.1
devyte Aug 19, 2019
b7cdc03
Fix umm_perf reference to ROM function
earlephilhower Aug 20, 2019
7f2ad70
Fix "reinterpret_case is not a constexpr" error
earlephilhower Aug 20, 2019
58e909e
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Sep 29, 2019
1c3d12b
Update libc.a to latest rev
earlephilhower Sep 29, 2019
230891d
Full rebuild of toolchain and libs
earlephilhower Sep 29, 2019
22ecb65
Upgrade to GCC 9.2, released in August 2019
earlephilhower Sep 29, 2019
d17bac3
Move to --std=gnu++14 (C++14 + GNU extensions)
earlephilhower Oct 10, 2019
910fe3a
Merge branch 'master' into gcc9.1
earlephilhower Oct 10, 2019
e4c2c69
Fix Ticker merge conflict
earlephilhower Nov 19, 2019
89c3add
Fix json merge conflict
earlephilhower Nov 19, 2019
293ba4d
Merge branch 'master' into gcc9.1
earlephilhower Nov 19, 2019
8115e1f
One more merge diff fix
earlephilhower Nov 19, 2019
9d6f0f1
Reapply Ticker.h casting warning fixes for gcc9
earlephilhower Nov 19, 2019
e684db1
Merge branch 'master' into gcc9.1
earlephilhower Nov 19, 2019
075d9c1
Update with fixes from Sming repo for PSTR and ASM
earlephilhower Dec 7, 2019
fe8b4da
Merge branch 'master' into gcc9.1
earlephilhower Dec 7, 2019
541c92e
Upgrade to -gnu4 toolchain
earlephilhower Dec 8, 2019
e9a315c
Move to gnu5 build with add'l softFP from ROM
earlephilhower Dec 8, 2019
b33206d
Move add'l softFP from IRAM to flash
earlephilhower Dec 8, 2019
4e292d7
Move to std=c++17/c17 in platform, remove abs/round
earlephilhower Dec 8, 2019
0f2e6ab
Use std::abs/round to replace the macro definitions
earlephilhower Dec 9, 2019
98aa5f0
Merge branch 'master' into gcc9.1
devyte Dec 9, 2019
f5f7673
Remove using std::abs which conflicted with C lib headers
earlephilhower Dec 11, 2019
54013d7
Add 2nd arg (exception handler) to ets_isr_t
earlephilhower Dec 11, 2019
d79cd6c
Move the gdbstub example to a subdir
earlephilhower Dec 11, 2019
39dd0b9
Fix ets_irq_arratch redefinition and core IRQ handlers
earlephilhower Dec 11, 2019
6686826
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Dec 11, 2019
87a9a50
Actually rebuild the libc.a using GCC 9.2
earlephilhower Dec 11, 2019
7090f68
Fix SPISlave interrupt attach's 2nd parameter
earlephilhower Dec 12, 2019
a00e6b9
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Feb 24, 2020
91d21b6
Rebuild eboot.elf with GCC 9
earlephilhower Feb 24, 2020
5d2f09d
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Feb 27, 2020
9074bb9
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Feb 28, 2020
89cacef
Update to latest SoftwareSerial for Delegate fix
earlephilhower Feb 28, 2020
4ffe519
Upgrade to GCC 9.3
earlephilhower Mar 21, 2020
afff569
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Mar 21, 2020
7926828
Rebuild all arch toolchains
earlephilhower Apr 30, 2020
d661ac6
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Apr 30, 2020
70ec21a
Move to GCC 10.1
earlephilhower May 15, 2020
24f5500
Merge master and fix eboot build
earlephilhower May 15, 2020
43f9f0e
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower May 15, 2020
8ca6e78
Built complete toolchain for all archs
earlephilhower May 15, 2020
d2b4e4c
Pull in latest PSTR changes and fix GCC10.1 build
earlephilhower May 20, 2020
ce07fd5
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower May 20, 2020
7c29e67
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
earlephilhower Jun 3, 2020
7a20b53
Update platform.io to platform C/C++ standards
earlephilhower Jun 8, 2020
20b620d
Use PR's toolchain in platformio build
earlephilhower Jun 9, 2020
c4dea28
Fix several asm warnings in PIO build
earlephilhower Jun 10, 2020
803bcf8
Optional stack smash protection -fstack-protector
earlephilhower Jun 17, 2020
8f8a196
Merge branch 'master' into gcc9.1
earlephilhower Jun 17, 2020
2c99453
Fix duplicated stc=gnu99/c17 in build
earlephilhower Jun 17, 2020
5559729
Dump faulting function PC in stack overflow
earlephilhower Jun 17, 2020
db8ef89
Rebuild with Platform.io JSON tag in release tgzs
earlephilhower Jul 7, 2020
d17dc0f
Merge branch 'master' into gcc9.1
d-a-v Jul 7, 2020
837a4e0
Merge branch 'master' into gcc9.1
d-a-v Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions boards.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bootloaders/eboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ INC += -I../../tools/sdk/include -I../../tools/sdk/uzlib/src

CFLAGS += -std=gnu99

CFLAGS += -Os -g -Wall -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections
CFLAGS += -Os -fcommon -g -Wall -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -ffunction-sections -fdata-sections

CFLAGS += $(INC)

Expand Down
Binary file modified bootloaders/eboot/eboot.elf
Binary file not shown.
9 changes: 2 additions & 7 deletions cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,8 @@ void timer0_isr_init(void);
void timer0_attachInterrupt(timercallback userFunc);
void timer0_detachInterrupt(void);

// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
#endif

#define abs(x) ((x)>0?(x):-(x))
// Use stdlib abs() and round() to avoid issues with the C++ libraries
earlephilhower marked this conversation as resolved.
Show resolved Hide resolved
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))
Expand Down Expand Up @@ -249,6 +243,7 @@ const int TIM_DIV265 __attribute__((deprecated, weak)) = TIM_DIV256;

using std::min;
using std::max;
using std::round;
using std::isinf;
using std::isnan;

Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/StackThunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern uint32_t stack_thunk_refcnt;

// Thunking macro
#define make_stack_thunk(fcnToThunk) \
__asm("\n\
__asm__ ("\n\
.text\n\
.literal_position\n\
.literal .LC_STACK_VALUE"#fcnToThunk", 0xdeadbeef\n\
Expand Down
5 changes: 3 additions & 2 deletions cores/esp8266/core_esp8266_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ void precache(void *f, uint32_t bytes) {
// page (ie 1 word in 8) for this to work.
#define CACHE_PAGE_SIZE 32

register uint32_t a0 asm("a0");
register uint32_t lines = (bytes/CACHE_PAGE_SIZE)+2;
uint32_t a0;
__asm__("mov.n %0, a0" : "=r"(a0));
uint32_t lines = (bytes/CACHE_PAGE_SIZE)+2;
volatile uint32_t *p = (uint32_t*)((f ? (uint32_t)f : a0) & ~0x03);
uint32_t x;
for (uint32_t i=0; i<lines; i++, p+=CACHE_PAGE_SIZE/sizeof(uint32_t)) x=*p;
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ extern "C" bool ets_post_rom(uint8 prio, ETSSignal sig, ETSParam par);

extern "C" bool IRAM_ATTR ets_post(uint8 prio, ETSSignal sig, ETSParam par) {
uint32_t saved;
asm volatile ("rsr %0,ps":"=a" (saved));
__asm__ __volatile__ ("rsr %0,ps":"=a" (saved));
bool rc=ets_post_rom(prio, sig, par);
xt_wsr_ps(saved);
return rc;
Expand Down
24 changes: 24 additions & 0 deletions cores/esp8266/core_esp8266_postmortem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static const char* s_panic_what = 0;
static bool s_abort_called = false;
static const char* s_unhandled_exception = NULL;

static uint32_t s_stacksmash_addr = 0;

void abort() __attribute__((noreturn));
static void uart_write_char_d(char c);
static void uart0_write_char_d(char c);
Expand All @@ -54,6 +56,7 @@ static void print_stack(uint32_t start, uint32_t end);
// using numbers different from "REASON_" in user_interface.h (=0..6)
enum rst_reason_sw
{
REASON_USER_STACK_SMASH = 253,
REASON_USER_SWEXCEPTION_RST = 254
};
static int s_user_reset_reason = REASON_DEFAULT_RST;
Expand Down Expand Up @@ -147,6 +150,11 @@ void __wrap_system_restart_local() {
else if (rst_info.reason == REASON_SOFT_WDT_RST) {
ets_printf_P(PSTR("\nSoft WDT reset\n"));
}
else if (rst_info.reason == REASON_USER_STACK_SMASH) {
ets_printf_P(PSTR("\nStack overflow detected.\n"));
ets_printf_P(PSTR("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n"),
5 /* Alloca exception, closest thing to stack fault*/, s_stacksmash_addr, 0, 0, 0, 0);
}
else {
ets_printf_P(PSTR("\nGeneric Reset\n"));
}
Expand Down Expand Up @@ -290,4 +298,20 @@ void __panic_func(const char* file, int line, const char* func) {
raise_exception();
}

uintptr_t __stack_chk_guard = 0x08675309 ^ RANDOM_REG32;
void __stack_chk_fail(void) {
s_user_reset_reason = REASON_USER_STACK_SMASH;
ets_printf_P(PSTR("\nPANIC: Stack overrun"));

s_stacksmash_addr = (uint32_t)__builtin_return_address(0);

if (gdb_present())
__asm__ __volatile__ ("syscall"); // triggers GDB when enabled

__wrap_system_restart_local();

while (1); // never reached, needed to satisfy "noreturn" attribute
}


};
2 changes: 1 addition & 1 deletion cores/esp8266/core_esp8266_si2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void ICACHE_RAM_ATTR Twi::busywait(unsigned int v)
unsigned int i;
for (i = 0; i < v; i++) // loop time is 5 machine cycles: 31.25ns @ 160MHz, 62.5ns @ 80MHz
{
asm("nop"); // minimum element to keep GCC from optimizing this function out.
__asm__ __volatile__("nop"); // minimum element to keep GCC from optimizing this function out.
}
}

Expand Down
6 changes: 4 additions & 2 deletions cores/esp8266/core_esp8266_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ extern "C" {

static volatile timercallback timer1_user_cb = NULL;

void ICACHE_RAM_ATTR timer1_isr_handler(void *para){
void ICACHE_RAM_ATTR timer1_isr_handler(void *para, void *frame) {
(void) para;
(void) frame;
if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
T1I = 0;
if (timer1_user_cb) {
Expand Down Expand Up @@ -79,8 +80,9 @@ void ICACHE_RAM_ATTR timer1_disable(){

static volatile timercallback timer0_user_cb = NULL;

void ICACHE_RAM_ATTR timer0_isr_handler(void* para){
void ICACHE_RAM_ATTR timer0_isr_handler(void *para, void *frame) {
(void) para;
(void) frame;
if (timer0_user_cb) {
// to make ISR compatible to Arduino AVR model where interrupts are disabled
// we disable them before we call the client ISR
Expand Down
4 changes: 3 additions & 1 deletion cores/esp8266/core_esp8266_wiring_digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ typedef struct {
static interrupt_handler_t interrupt_handlers[16] = { {0, 0, 0, 0}, };
static uint32_t interrupt_reg = 0;

void ICACHE_RAM_ATTR interrupt_handler(void*)
void ICACHE_RAM_ATTR interrupt_handler(void *arg, void *frame)
{
(void) arg;
(void) frame;
uint32_t status = GPIE;
GPIEC = status;//clear them interrupts
uint32_t levels = GPI;
Expand Down
6 changes: 6 additions & 0 deletions cores/esp8266/gdb_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ static bool ICACHE_RAM_ATTR __gdb_no_op()
return false;
}

// To save space, don't create a dummy no-op for each GCC, just point to the no-op
// Need to turn off GCC's checking of parameter types or we'll get many warnings
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattribute-alias"
#pragma GCC diagnostic ignored "-Wmissing-attributes"
void gdb_init(void) __attribute__ ((weak, alias("__gdb_no_op")));
void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_no_op")));
bool gdb_present(void) __attribute__ ((weak, alias("__gdb_no_op")));
Expand All @@ -40,5 +45,6 @@ bool gdbstub_has_uart_isr_control(void) __attribute__ ((weak, alias("__gdb_no_op
void gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), void* arg) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_write_char(char c) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_write(const char* buf, size_t size) __attribute__ ((weak, alias("__gdb_no_op")));
#pragma GCC diagnostic pop

};
3 changes: 2 additions & 1 deletion cores/esp8266/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ uart_get_rx_buffer_size(uart_t* uart)

// The default ISR handler called when GDB is not enabled
void ICACHE_RAM_ATTR
uart_isr(void * arg)
uart_isr(void * arg, void * frame)
{
(void) frame;
uart_t* uart = (uart_t*)arg;
uint32_t usis = USIS(uart->uart_nr);

Expand Down
2 changes: 1 addition & 1 deletion libraries/GDBStub/src/internal/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static inline int gdbHandleCommand() {
writeByte(i, gdbGetHexVal(&data, 8));
}
//Make sure caches are up-to-date. Procedure according to Xtensa ISA document, ISYNC inst desc.
asm volatile("ISYNC\nISYNC\n");
__asm__ __volatile__ ("ISYNC\nISYNC\n");
gdbSendPacketOK();
} else {
//Trying to do a software breakpoint on a flash proc, perhaps?
Expand Down
3 changes: 2 additions & 1 deletion libraries/SPISlave/src/hspi_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ static void (*_hspi_slave_rx_status_cb)(void * arg, uint32_t data) = NULL;
static void (*_hspi_slave_tx_status_cb)(void * arg) = NULL;
static uint8_t _hspi_slave_buffer[33];

void ICACHE_RAM_ATTR _hspi_slave_isr_handler(void *arg)
void ICACHE_RAM_ATTR _hspi_slave_isr_handler(void *arg, void *frame)
{
(void) frame;
uint32_t status;
uint32_t istatus;

Expand Down
6 changes: 6 additions & 0 deletions libraries/Ticker/src/Ticker.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,22 @@ class Ticker
template<typename TArg>
void attach(float seconds, void (*callback)(TArg), TArg arg)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)");
_attach_ms(1000UL * seconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
#pragma GCC diagnostic pop
}

// callback will be called in SYS ctx when ticker fires
template<typename TArg>
void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)");
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void*>(arg));
#pragma GCC diagnostic pop
}

// callback will be called at following loop() after ticker fires
Expand Down
Loading