alt function pins, small packages with fewer pins, pins.csv
Re: alt function pins, small packages with fewer pins, pins.csv
Thanks, I'll try that. I see I need to use git latest also. I'll do this in a branch called stm32_frozen in case its wanted to merge.
Last edited by jgriessen on Tue Apr 10, 2018 8:41 pm, edited 1 time in total.
John Griessen blog.kitmatic.com
Re: alt function pins, small packages with fewer pins, pins.csv
Something like this:
Code: Select all
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index fb3e843..fae0319 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -593,6 +593,10 @@ soft_reset:
// TODO perhaps have pyb.reboot([bootpy]) function to soft-reboot and execute custom boot.py
if (reset_mode == 1 || reset_mode == 3) {
const char *boot_py = "boot.py";
+#define USE_FROZEN_BOOT_AND_MAIN 1
+#if USE_FROZEN_BOOT_AND_MAIN
+ pyexec_frozen_module(boot_py);
+#else
mp_import_stat_t stat = mp_import_stat(boot_py);
if (stat == MP_IMPORT_STAT_FILE) {
int ret = pyexec_file(boot_py);
@@ -603,6 +607,7 @@ soft_reset:
flash_error(4);
}
}
+#endif
}
// turn boot-up LEDs off
@@ -656,6 +661,9 @@ soft_reset:
} else {
main_py = mp_obj_str_get_str(MP_STATE_PORT(pyb_config_main));
}
+#if USE_FROZEN_BOOT_AND_MAIN
+ pyexec_frozen_module(main_py);
+#else
mp_import_stat_t stat = mp_import_stat(main_py);
if (stat == MP_IMPORT_STAT_FILE) {
int ret = pyexec_file(main_py);
@@ -666,6 +674,7 @@ soft_reset:
flash_error(3);
}
}
+#endif
}
// Main script is finished, so now go into REPL mode.
Re: alt function pins, small packages with fewer pins, pins.csv
I did that change and compiled and compiler shows that then there is no way to get to the goto soft_reset_exit.
Seems like adding a section like below would do it:
Yes, that compiles. Will test now.
Seems like adding a section like below would do it:
Code: Select all
int ret = pyexec_file(main_py);
if (ret & PYEXEC_FORCED_EXIT) {
goto soft_reset_exit;
}
===============================================
#if USE_FROZEN_BOOT_AND_MAIN
pyexec_frozen_module(main_py);
if (ret & PYEXEC_FORCED_EXIT) {
goto soft_reset_exit;
}
John Griessen blog.kitmatic.com