Skip to content

Commit 4aee119

Browse files
committed
stm: Initialize sys.path with ["0:/", "0:/src", "0:/lib"].
This is compatible with what search path was before sys.path refactor, with addition of module library path ("0:/lib").
1 parent c839584 commit 4aee119

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

py/makeqstrdata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
# add some custom names to map characters that aren't in HTML
1212
codepoint2name[ord('.')] = 'dot'
13+
codepoint2name[ord(':')] = 'colon'
14+
codepoint2name[ord('/')] = 'slash'
1315

1416
# this must match the equivalent function in qstr.c
1517
def compute_hash(qstr):

stm/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ int main(void) {
411411
// Micro Python init
412412
qstr_init();
413413
rt_init();
414+
mp_obj_t def_path[3];
415+
def_path[0] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_);
416+
def_path[1] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_src);
417+
def_path[2] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib);
418+
sys_path = mp_obj_new_list(3, def_path);
414419

415420
#if MICROPY_HW_HAS_LCD
416421
// LCD init (just creates class, init hardware by calling LCD())

stm/qstrdefsport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ Q(Usart)
3030
Q(ADC)
3131
Q(open)
3232
Q(File)
33+
// Entries for sys.path
34+
Q(0:/)
35+
Q(0:/src)
36+
Q(0:/lib)

0 commit comments

Comments
 (0)