Skip to content

Commit

Permalink
Update patch to remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZodiusInfuser committed Sep 5, 2024
1 parent 649d99f commit 34dc7c7
Showing 1 changed file with 0 additions and 88 deletions.
88 changes: 0 additions & 88 deletions firmware/yukon_reset.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 34dc7c7

Please sign in to comment.