summaryrefslogtreecommitdiff
path: root/esp8266/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-06 00:02:58 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-06 00:02:58 +0100
commitc98c128fe885e539ecd73843756340f8950115c8 (patch)
tree72030c7c91a12aea609edced0a233e1aa7d9c8cf /esp8266/main.c
parent367d4d10983c0047d2f1c91ebe44a45e5f2bbf65 (diff)
pyexec: Make raw REPL work with event-driven version of pyexec.
esp8266 port now has working raw and friendly REPL, as well as working soft reset (CTRL-D at REPL, or raise SystemExit). tools/pyboard.py now works with esp8266 port.
Diffstat (limited to 'esp8266/main.c')
-rw-r--r--esp8266/main.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/esp8266/main.c b/esp8266/main.c
index b6024f3c5..a3878c0e7 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -39,8 +39,7 @@
STATIC char heap[16384];
-void user_init(void) {
-soft_reset:
+STATIC void mp_reset(void) {
mp_stack_set_limit(10240);
mp_hal_init();
gc_init(heap, heap + sizeof(heap));
@@ -48,29 +47,20 @@ soft_reset:
mp_init();
mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_init(mp_sys_argv, 0);
+}
- printf("\n");
+void soft_reset(void) {
+ mp_hal_stdout_tx_str("PYB: soft reset\r\n");
+ mp_hal_udelay(10000); // allow UART to flush output
+ mp_reset();
+ pyexec_event_repl_init();
+}
-#if MICROPY_REPL_EVENT_DRIVEN
- pyexec_friendly_repl_init();
+void user_init(void) {
+ mp_reset();
+ mp_hal_stdout_tx_str("\r\n");
+ pyexec_event_repl_init();
uart_task_init();
- return;
- goto soft_reset;
-#else
- for (;;) {
- if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
- if (pyexec_raw_repl() != 0) {
- break;
- }
- } else {
- if (pyexec_friendly_repl() != 0) {
- break;
- }
- }
- }
-
- goto soft_reset;
-#endif
}
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {