From f21261d39c39a4a61d6b21b693d16a075deded12 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 21 Nov 2019 11:44:45 +0100 Subject: [PATCH 1/3] esp32s2beta: don't use crtbegin from the toolchain Similar to 22514c1dd91 for esp32 --- components/esp32s2beta/ld/esp32s2beta.project.ld.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/esp32s2beta/ld/esp32s2beta.project.ld.in b/components/esp32s2beta/ld/esp32s2beta.project.ld.in index 597b07e814..95bbae561e 100644 --- a/components/esp32s2beta/ld/esp32s2beta.project.ld.in +++ b/components/esp32s2beta/ld/esp32s2beta.project.ld.in @@ -267,12 +267,12 @@ SECTIONS __eh_frame = ABSOLUTE(.); KEEP(*(.eh_frame)) . = (. + 7) & ~ 3; - /* C++ constructor and destructor tables, properly ordered: */ + /* C++ constructor and destructor tables + + Make a point of not including anything from crtbegin.o or crtend.o, as IDF doesn't use toolchain crt + */ __init_array_start = ABSOLUTE(.); - KEEP (*crtbegin.*(.ctors)) - KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors .ctors.*)) __init_array_end = ABSOLUTE(.); KEEP (*crtbegin.*(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) From 04324e4c3c79046a4940476d3f0c9b49ddddb910 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 21 Nov 2019 11:45:02 +0100 Subject: [PATCH 2/3] esp32s2beta: re-enable entering the debugger on panic --- components/esp32s2beta/panic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/esp32s2beta/panic.c b/components/esp32s2beta/panic.c index 0082e0a85e..bb10f71728 100644 --- a/components/esp32s2beta/panic.c +++ b/components/esp32s2beta/panic.c @@ -408,7 +408,6 @@ void xt_unhandled_exception(XtExcFrame *frame) panicPutStr("Unknown"); } panicPutStr(")"); -#ifdef PANIC_COMPLETE_IN_ESP32C if (esp_cpu_in_ocd_debug_mode()) { panicPutStr(" at pc="); panicPutHex(frame->pc); @@ -426,7 +425,6 @@ void xt_unhandled_exception(XtExcFrame *frame) setFirstBreakpoint(frame->pc); return; } -#endif panicPutStr(". Exception was unhandled.\r\n"); } commonErrorHandler(frame); From 096dc8fc2b049dbbc49981722ace7f5c7803ad98 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 21 Nov 2019 15:29:00 +0100 Subject: [PATCH 3/3] esp32s2beta: rename output linker script --- components/esp32s2beta/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32s2beta/CMakeLists.txt b/components/esp32s2beta/CMakeLists.txt index f0d46758b7..3dd73a9d87 100644 --- a/components/esp32s2beta/CMakeLists.txt +++ b/components/esp32s2beta/CMakeLists.txt @@ -57,7 +57,7 @@ else() # Process the template file through the linker script generation mechanism, and use the output for linking the # final binary - target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2beta.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32.project.ld") + target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2beta.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32s2beta.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2beta.peripherals.ld") target_link_libraries(${COMPONENT_LIB} PUBLIC gcc)