Removed old supervisor stack setting code and revert some 'optimisations'

This commit is contained in:
Bill Sideris 2023-02-16 13:33:37 +02:00
parent a61a9f4bde
commit 6dc179dc4a
No known key found for this signature in database
GPG Key ID: 1BEF1BCEBA58EA33
3 changed files with 18 additions and 50 deletions

View File

@ -35,6 +35,20 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: main.c
msgid ""
"\n"
"WARNING: Allocating pystack failed, defaulting back to build value.\n"
"\n"
msgstr ""
#: main.c
msgid ""
"\n"
"WARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n"
"\n"
msgstr ""
#: py/obj.c
msgid " File \"%q\""
msgstr ""
@ -376,12 +390,6 @@ msgstr ""
msgid "*x must be assignment target"
msgstr ""
#: main.c
msgid ""
", defaulting back to build value.\n"
"\n"
msgstr ""
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -488,10 +496,6 @@ msgstr ""
msgid "All timers in use"
msgstr ""
#: main.c
msgid "Allocating pystack failed"
msgstr ""
#: ports/espressif/common-hal/_bleio/Adapter.c
#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Already advertising."
@ -1240,10 +1244,6 @@ msgstr ""
msgid "Invalid BSSID"
msgstr ""
#: main.c
msgid "Invalid CIRCUITPY_PYSTACK_SIZE"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Invalid MAC address"
msgstr ""
@ -2363,7 +2363,7 @@ msgid "Voltage read timed out"
msgstr ""
#: main.c
msgid "WARNING: "
msgid "WARNING: Your code filename has two extensions\n"
msgstr ""
#: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c
@ -2424,10 +2424,6 @@ msgid ""
"You pressed the reset button during boot. Press again to exit safe mode."
msgstr ""
#: main.c
msgid "Your code filename has two extensions\n"
msgstr ""
#: supervisor/shared/micropython.c
msgid "[truncated due to length]"
msgstr ""

13
main.c
View File

@ -150,19 +150,13 @@ STATIC vm_memory_t allocate_vm_memory(void) {
// Check if value is valid
pystack_size = pystack_size - pystack_size % sizeof(size_t); // Round down to multiple of 4.
if (pystack_size < 384) {
serial_write("\n");
serial_write_compressed(translate("WARNING: "));
serial_write_compressed(translate("Invalid CIRCUITPY_PYSTACK_SIZE"));
serial_write_compressed(translate(", defaulting back to build value.\n\n"));
serial_write_compressed(translate("\nWARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n\n"));
pystack_size = CIRCUITPY_PYSTACK_SIZE; // Reset
}
#endif
res.pystack = allocate_memory(pystack_size, false, false);
if (res.pystack == NULL) {
serial_write("\n");
serial_write_compressed(translate("WARNING: "));
serial_write_compressed(translate("Allocating pystack failed"));
serial_write_compressed(translate(", defaulting back to build value.\n\n"));
serial_write_compressed(translate("\nWARNING: Allocating pystack failed, defaulting back to build value.\n\n"));
res.pystack = allocate_memory(CIRCUITPY_PYSTACK_SIZE, false, false);
}
#endif
@ -471,8 +465,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
if (!found_main) {
found_main = maybe_run_list(double_extension_filenames, MP_ARRAY_SIZE(double_extension_filenames));
if (found_main) {
serial_write_compressed(translate("WARNING: "));
serial_write_compressed(translate("Your code filename has two extensions\n"));
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
}
}
#else

View File

@ -168,26 +168,6 @@ MP_PROPERTY_GETSET(supervisor_runtime_ble_workflow_obj,
(mp_obj_t)&supervisor_runtime_get_ble_workflow_obj,
(mp_obj_t)&supervisor_runtime_set_ble_workflow_obj);
//| next_stack_limit: int
//| """The size of the stack for the next vm run. If its too large, the default will be used."""
//|
STATIC mp_obj_t supervisor_runtime_get_next_stack_limit(mp_obj_t self) {
return mp_obj_new_int(get_next_stack_size());
}
MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_next_stack_limit_obj, supervisor_runtime_get_next_stack_limit);
STATIC mp_obj_t supervisor_runtime_set_next_stack_limit(mp_obj_t self, mp_obj_t size_obj) {
mp_int_t size = mp_obj_get_int(size_obj);
mp_arg_validate_int_min(size, 256, MP_QSTR_size);
set_next_stack_size(size);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_next_stack_limit_obj, supervisor_runtime_set_next_stack_limit);
MP_PROPERTY_GETSET(supervisor_runtime_next_stack_limit_obj,
(mp_obj_t)&supervisor_runtime_get_next_stack_limit_obj,
(mp_obj_t)&supervisor_runtime_set_next_stack_limit_obj);
//| rgb_status_brightness: int
//| """Set brightness of status RGB LED from 0-255. This will take effect
//| after the current code finishes and the status LED is used to show
@ -220,7 +200,6 @@ STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_runtime_run_reason_obj) },
{ MP_ROM_QSTR(MP_QSTR_autoreload), MP_ROM_PTR(&supervisor_runtime_autoreload_obj) },
{ MP_ROM_QSTR(MP_QSTR_ble_workflow), MP_ROM_PTR(&supervisor_runtime_ble_workflow_obj) },
{ MP_ROM_QSTR(MP_QSTR_next_stack_limit), MP_ROM_PTR(&supervisor_runtime_next_stack_limit_obj) },
{ MP_ROM_QSTR(MP_QSTR_rgb_status_brightness), MP_ROM_PTR(&supervisor_runtime_rgb_status_brightness_obj) },
};