From 5f624a516a1602d3a1f869f2cabd2166a99945d9 Mon Sep 17 00:00:00 2001 From: ZodiusInfuser Date: Tue, 30 Apr 2024 16:32:25 +0100 Subject: [PATCH] Update patches --- firmware/micropython_nano_specs.patch | 11 ++++----- firmware/yukon_reset.patch | 32 +++++++++++++++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/firmware/micropython_nano_specs.patch b/firmware/micropython_nano_specs.patch index 098c0bf..5ae938b 100644 --- a/firmware/micropython_nano_specs.patch +++ b/firmware/micropython_nano_specs.patch @@ -1,11 +1,11 @@ diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index 094031c6852a..5f268414c08f 100644 +index fcc435b7b..efabcb3a3 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt -@@ -374,6 +374,15 @@ target_compile_options(${MICROPY_TARGET} PRIVATE - target_link_options(${MICROPY_TARGET} PRIVATE - -Wl,--defsym=__micropy_c_heap_size__=${MICROPY_C_HEAP_SIZE} +@@ -464,6 +464,16 @@ set_source_files_properties( + COMPILE_OPTIONS "-O2" ) + +# Do not include stack unwinding & exception handling for C++ user modules +target_compile_definitions(usermod INTERFACE PICO_CXX_ENABLE_EXCEPTIONS=0) +target_compile_options(usermod INTERFACE $<$: @@ -15,6 +15,7 @@ index 094031c6852a..5f268414c08f 100644 + -fno-use-cxa-atexit +>) +target_link_options(usermod INTERFACE -specs=nano.specs) - ++ set_source_files_properties( ${PICO_SDK_PATH}/src/rp2_common/pico_double/double_math.c + ${PICO_SDK_PATH}/src/rp2_common/pico_float/float_math.c diff --git a/firmware/yukon_reset.patch b/firmware/yukon_reset.patch index 17a1178..77c7aae 100644 --- a/firmware/yukon_reset.patch +++ b/firmware/yukon_reset.patch @@ -1,8 +1,8 @@ diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index 87bc91b82..bf736ff91 100644 +index 1eaefcfb9..677a5e0e6 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt -@@ -281,6 +281,25 @@ target_include_directories(${MICROPY_TARGET} PRIVATE +@@ -322,6 +322,25 @@ target_include_directories(${MICROPY_TARGET} PRIVATE ${MICROPY_DIR}/shared/tinyusb/ ) @@ -28,7 +28,7 @@ index 87bc91b82..bf736ff91 100644 if (MICROPY_PY_NETWORK_CYW43) string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/cyw43-driver) if((NOT (${ECHO_SUBMODULES})) AND NOT EXISTS ${MICROPY_DIR}/lib/cyw43-driver/src/cyw43.h) -@@ -498,6 +527,11 @@ target_sources(${MICROPY_TARGET} PRIVATE +@@ -548,6 +577,11 @@ target_sources(${MICROPY_TARGET} PRIVATE ${GEN_PINS_HDR} ) @@ -39,12 +39,12 @@ index 87bc91b82..bf736ff91 100644 + # Generate pins add_custom_command( - OUTPUT ${GEN_PINS_HDR} ${GEN_PINS_SRC} ${GEN_PINS_QSTR} + OUTPUT ${GEN_PINS_HDR} ${GEN_PINS_SRC} diff --git a/ports/rp2/main.c b/ports/rp2/main.c -index bb5ecc68d..9890bf580 100644 +index ec58b70ae..8c0571fcc 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c -@@ -150,6 +150,7 @@ int main(int argc, char **argv) { +@@ -152,6 +152,7 @@ int main(int argc, char **argv) { // Hook for setting up anything that can wait until after other hardware features are initialised MICROPY_BOARD_EARLY_INIT(); @@ -52,25 +52,33 @@ index bb5ecc68d..9890bf580 100644 for (;;) { // Initialise MicroPython runtime. -@@ -182,25 +183,34 @@ int main(int argc, char **argv) { +@@ -185,30 +186,39 @@ int main(int argc, char **argv) { pyexec_frozen_module("_boot.py", false); #endif - // Execute user scripts. - int ret = pyexec_file_if_exists("boot.py"); ++ if (run_main) { ++ // Execute user scripts. ++ int ret = pyexec_file_if_exists("boot.py"); + +- #if MICROPY_HW_ENABLE_USBDEV +- mp_usbd_init(); +- #endif ++ #if MICROPY_HW_ENABLE_USBDEV ++ mp_usbd_init(); ++ #endif + - if (ret & PYEXEC_FORCED_EXIT) { - goto soft_reset_exit; - } -- if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { +- if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { - ret = pyexec_file_if_exists("main.py"); -+ if (run_main) { -+ // Execute user scripts. -+ int ret = pyexec_file_if_exists("boot.py"); if (ret & PYEXEC_FORCED_EXIT) { + run_main = !(ret & PYEXEC_SKIP_USER_CODE); goto soft_reset_exit; } -+ if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { ++ if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { + ret = pyexec_file_if_exists("main.py"); + if (ret & PYEXEC_FORCED_EXIT) { + run_main = !(ret & PYEXEC_SKIP_USER_CODE);