Commit 8a96ebea authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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.
parent 64c58403
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "smallint.h" #include "smallint.h"
#include "objgenerator.h" #include "objgenerator.h"
#include "lexer.h" #include "lexer.h"
#include "stackctrl.h"
#if 0 // print debugging info #if 0 // print debugging info
#define DEBUG_PRINT (1) #define DEBUG_PRINT (1)
...@@ -69,6 +70,8 @@ const mp_obj_module_t mp_module___main__ = { ...@@ -69,6 +70,8 @@ const mp_obj_module_t mp_module___main__ = {
}; };
void mp_init(void) { void mp_init(void) {
stack_ctrl_init();
// call port specific initialization if any // call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC #ifdef MICROPY_PORT_INIT_FUNC
MICROPY_PORT_INIT_FUNC; MICROPY_PORT_INIT_FUNC;
......
...@@ -187,7 +187,6 @@ static const char fresh_readme_txt[] = ...@@ -187,7 +187,6 @@ static const char fresh_readme_txt[] =
int main(void) { int main(void) {
// TODO disable JTAG // TODO disable JTAG
stack_ctrl_init();
// Stack limit should be less than real stack size, so we // Stack limit should be less than real stack size, so we
// had chance to recover from limit hit. // had chance to recover from limit hit.
stack_set_limit(&_ram_end - &_heap_end - 512); stack_set_limit(&_ram_end - &_heap_end - 512);
......
...@@ -265,7 +265,6 @@ void pre_process_options(int argc, char **argv) { ...@@ -265,7 +265,6 @@ void pre_process_options(int argc, char **argv) {
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
stack_ctrl_init();
stack_set_limit(32768); stack_set_limit(32768);
pre_process_options(argc, argv); pre_process_options(argc, argv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment