Add error message and guardrail
This commit is contained in:
parent
818d1d4cb1
commit
133045a95a
|
@ -35,6 +35,20 @@ msgid ""
|
||||||
"https://github.com/adafruit/circuitpython/issues\n"
|
"https://github.com/adafruit/circuitpython/issues\n"
|
||||||
msgstr ""
|
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
|
#: py/obj.c
|
||||||
msgid " File \"%q\""
|
msgid " File \"%q\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
7
main.c
7
main.c
|
@ -141,12 +141,15 @@ STATIC supervisor_allocation __attribute__ ((noinline)) * alloc_pystack(void) {
|
||||||
(void)common_hal_os_getenv_int("CIRCUITPY_PYSTACK_SIZE", &pystack_size);
|
(void)common_hal_os_getenv_int("CIRCUITPY_PYSTACK_SIZE", &pystack_size);
|
||||||
// Check if value is valid
|
// Check if value is valid
|
||||||
if ((CIRCUITPY_PYSTACK_SIZE != pystack_size) && ((pystack_size < 384) || (pystack_size % sizeof(size_t) != 0))) {
|
if ((CIRCUITPY_PYSTACK_SIZE != pystack_size) && ((pystack_size < 384) || (pystack_size % sizeof(size_t) != 0))) {
|
||||||
|
serial_write_compressed(translate("\nWARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n\n"));
|
||||||
pystack_size = CIRCUITPY_PYSTACK_SIZE; // Reset
|
pystack_size = CIRCUITPY_PYSTACK_SIZE; // Reset
|
||||||
// TODO: Find a way to inform the user about it.
|
|
||||||
// Perhaps safemode? Or is it too much?
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
supervisor_allocation *pystack = allocate_memory(pystack_size, false, false);
|
supervisor_allocation *pystack = allocate_memory(pystack_size, false, false);
|
||||||
|
if (pystack == NULL) {
|
||||||
|
serial_write_compressed(translate("\nWARNING: Allocating pystack failed, defaulting back to build value. \n\n"));
|
||||||
|
pystack = allocate_memory(CIRCUITPY_PYSTACK_SIZE, false, false);
|
||||||
|
}
|
||||||
return pystack;
|
return pystack;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue