nrf5: Updating main.c to support RAW REPL.

This commit is contained in:
Glenn Ruben Bakke 2017-06-03 19:34:05 +02:00
parent db0f4963b7
commit a37416dc2d
1 changed files with 12 additions and 3 deletions

View File

@ -83,6 +83,7 @@ extern uint32_t _heap_end;
int main(int argc, char **argv) { int main(int argc, char **argv) {
soft_reset:
mp_stack_set_top(&_ram_end); mp_stack_set_top(&_ram_end);
// Stack limit should be less than real stack size, so we have a chance // Stack limit should be less than real stack size, so we have a chance
@ -197,9 +198,15 @@ pin_init0();
#endif #endif
for (;;) { for (;;) {
ret_code = pyexec_friendly_repl(); if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
if (ret_code != 0) { if (pyexec_raw_repl() != 0) {
break; break;
}
} else {
ret_code = pyexec_friendly_repl();
if (ret_code != 0) {
break;
}
} }
} }
@ -207,6 +214,8 @@ pin_init0();
if (ret_code == PYEXEC_FORCED_EXIT) { if (ret_code == PYEXEC_FORCED_EXIT) {
NVIC_SystemReset(); NVIC_SystemReset();
} else {
goto soft_reset;
} }
return 0; return 0;