Skip to content

Commit e0ccc7e

Browse files
authored
Merge pull request #107 from SummerGGift/723
【更新】可以导入 /scripts 目录下的 python 脚本或者库
2 parents ec7f9e4 + 23d67f8 commit e0ccc7e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

port/mpconfigport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ typedef long mp_off_t;
328328
#define MICROPY_PY_SYS_PLATFORM "rt-thread"
329329
#define MICROPY_HW_BOARD_NAME "Universal python platform"
330330
#define MICROPY_HW_MCU_NAME "RT-Thread"
331-
#define MICROPY_PY_PATH "/libs/mpy/"
331+
#define MICROPY_PY_PATH_FIRST "/libs/mpy/"
332+
#define MICROPY_PY_PATH_SECOND "/scripts/"
332333

333334
#define MICROPY_BEGIN_ATOMIC_SECTION() rt_hw_interrupt_disable()
334335
#define MICROPY_END_ATOMIC_SECTION(state) rt_hw_interrupt_enable(state)

port/mpy_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ void mpy_main(const char *filename) {
100100
/* system path initialization */
101101
mp_obj_list_init(mp_sys_path, 0);
102102
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
103-
mp_obj_list_append(mp_sys_path, mp_obj_new_str(MICROPY_PY_PATH, strlen(MICROPY_PY_PATH)));
103+
mp_obj_list_append(mp_sys_path, mp_obj_new_str(MICROPY_PY_PATH_FIRST, strlen(MICROPY_PY_PATH_FIRST)));
104+
mp_obj_list_append(mp_sys_path, mp_obj_new_str(MICROPY_PY_PATH_SECOND, strlen(MICROPY_PY_PATH_SECOND)));
104105
mp_obj_list_init(mp_sys_argv, 0);
105106
readline_init0();
106107

0 commit comments

Comments
 (0)