|
@@ -68,6 +68,7 @@ static char *heap = RT_NULL;
|
|
|
void mpy_main(const char *filename) {
|
|
void mpy_main(const char *filename) {
|
|
|
int stack_dummy;
|
|
int stack_dummy;
|
|
|
stack_top = (void *)&stack_dummy;
|
|
stack_top = (void *)&stack_dummy;
|
|
|
|
|
+ rt_uint16_t old_flag;
|
|
|
|
|
|
|
|
rtt_getchar_init();
|
|
rtt_getchar_init();
|
|
|
|
|
|
|
@@ -98,6 +99,11 @@ void mpy_main(const char *filename) {
|
|
|
mp_obj_list_init(mp_sys_argv, 0);
|
|
mp_obj_list_init(mp_sys_argv, 0);
|
|
|
readline_init0();
|
|
readline_init0();
|
|
|
|
|
|
|
|
|
|
+ /* Save the open flag */
|
|
|
|
|
+ old_flag = rt_console_get_device()->open_flag;
|
|
|
|
|
+ /* clean the stream flag. stream flag will automatically append '\r' */
|
|
|
|
|
+ rt_console_get_device()->open_flag &= ~RT_DEVICE_FLAG_STREAM;
|
|
|
|
|
+
|
|
|
if (filename) {
|
|
if (filename) {
|
|
|
#ifndef MICROPYTHON_USING_UOS
|
|
#ifndef MICROPYTHON_USING_UOS
|
|
|
rt_kprintf("Please enable uos module in sys module option first.\n");
|
|
rt_kprintf("Please enable uos module in sys module option first.\n");
|
|
@@ -137,6 +143,9 @@ void mpy_main(const char *filename) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* restore the open flag */
|
|
|
|
|
+ rt_console_get_device()->open_flag = old_flag;
|
|
|
|
|
+
|
|
|
gc_sweep_all();
|
|
gc_sweep_all();
|
|
|
|
|
|
|
|
mp_deinit();
|
|
mp_deinit();
|