Merge pull request #62 from glennrub/raw_repl_support
nrf5: Updating main.c to support RAW REPL.
This commit is contained in:
commit
e619b837c0
@ -43,6 +43,8 @@ const char * nrf5_help_text =
|
|||||||
HELP_TEXT_SD
|
HELP_TEXT_SD
|
||||||
#endif
|
#endif
|
||||||
"Control commands:\n"
|
"Control commands:\n"
|
||||||
|
" CTRL-A -- on a blank line, enter raw REPL mode\n"
|
||||||
|
" CTRL-B -- on a blank line, enter normal REPL mode\n"
|
||||||
" CTRL-D -- on a blank line, do a soft reset of the board\n"
|
" CTRL-D -- on a blank line, do a soft reset of the board\n"
|
||||||
" CTRL-E -- on a blank line, enter paste mode\n"
|
" CTRL-E -- on a blank line, enter paste mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
15
nrf5/main.c
15
nrf5/main.c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user