From 34dc7c7e6124de936fd33669976b326379a9f06d Mon Sep 17 00:00:00 2001 From: ZodiusInfuser Date: Thu, 5 Sep 2024 11:52:37 +0100 Subject: [PATCH] Update patch to remove redundant code --- firmware/yukon_reset.patch | 88 -------------------------------------- 1 file changed, 88 deletions(-) diff --git a/firmware/yukon_reset.patch b/firmware/yukon_reset.patch index 5f403cf..9cd91ec 100644 --- a/firmware/yukon_reset.patch +++ b/firmware/yukon_reset.patch @@ -28,91 +28,3 @@ index 19c7178fc..4f98e904b 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) -@@ -562,6 +591,11 @@ target_sources(${MICROPY_TARGET} PRIVATE - ${GEN_PINS_HDR} - ) - -+# Temporary hack to get build finding correct CSV file -+pico_find_in_paths(GEN_PINS_BOARD_CSV PICO_BOARD_HEADER_DIRS pins.csv) -+message(WARNING "${GEN_PINS_BOARD_CSV}") -+set(GEN_PINS_CSV_ARG --board "${GEN_PINS_BOARD_CSV}") -+ - # Generate pins - add_custom_command( - OUTPUT ${GEN_PINS_HDR} ${GEN_PINS_SRC} -diff --git a/ports/rp2/main.c b/ports/rp2/main.c -index 134e0edac..37498dd87 100644 ---- a/ports/rp2/main.c -+++ b/ports/rp2/main.c -@@ -158,6 +158,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(); - -+ bool run_main = true; - for (;;) { - - // Initialise MicroPython runtime. -@@ -191,30 +192,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 && ret != 0) { -- ret = pyexec_file_if_exists("main.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 && ret != 0) { -+ ret = pyexec_file_if_exists("main.py"); -+ if (ret & PYEXEC_FORCED_EXIT) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); -+ goto soft_reset_exit; -+ } -+ } - } -+ run_main = true; - - for (;;) { - if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { -- if (pyexec_raw_repl() != 0) { -+ int ret = pyexec_raw_repl(); -+ if (ret != 0) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); - break; - } - } else { -- if (pyexec_friendly_repl() != 0) { -+ int ret = pyexec_friendly_repl(); -+ if (ret != 0) { -+ run_main = !(ret & PYEXEC_SKIP_USER_CODE); - break; - } - } -diff --git a/shared/runtime/pyexec.h b/shared/runtime/pyexec.h -index 5779d3e09..eb92fbb04 100644 ---- a/shared/runtime/pyexec.h -+++ b/shared/runtime/pyexec.h -@@ -36,6 +36,7 @@ typedef enum { - extern pyexec_mode_kind_t pyexec_mode_kind; - - #define PYEXEC_FORCED_EXIT (0x100) -+#define PYEXEC_SKIP_USER_CODE (0x200) - - int pyexec_raw_repl(void); - int pyexec_friendly_repl(void);