Skip to content

Commit 8a96ebe

Browse files
committed
py: Move stack_ctrl_init() to mp_init().
As stack checking is enabled by default, ports which don't call stack_ctrl_init() are broken now (report RuntimeError on startup). Save them trouble and just init stack control framework in interpreter init.
1 parent 64c5840 commit 8a96ebe

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

py/runtime.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "smallint.h"
4646
#include "objgenerator.h"
4747
#include "lexer.h"
48+
#include "stackctrl.h"
4849

4950
#if 0 // print debugging info
5051
#define DEBUG_PRINT (1)
@@ -69,6 +70,8 @@ const mp_obj_module_t mp_module___main__ = {
6970
};
7071

7172
void mp_init(void) {
73+
stack_ctrl_init();
74+
7275
// call port specific initialization if any
7376
#ifdef MICROPY_PORT_INIT_FUNC
7477
MICROPY_PORT_INIT_FUNC;

stmhal/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ static const char fresh_readme_txt[] =
187187
int main(void) {
188188
// TODO disable JTAG
189189

190-
stack_ctrl_init();
191190
// Stack limit should be less than real stack size, so we
192191
// had chance to recover from limit hit.
193192
stack_set_limit(&_ram_end - &_heap_end - 512);

unix/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ void pre_process_options(int argc, char **argv) {
265265
#endif
266266

267267
int main(int argc, char **argv) {
268-
stack_ctrl_init();
269268
stack_set_limit(32768);
270269

271270
pre_process_options(argc, argv);

0 commit comments

Comments
 (0)