Search found 14 matches

by bhcuong2008
Fri Jun 11, 2021 4:55 am
Forum: General Discussion and Questions
Topic: os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors
Replies: 2
Views: 1683

Re: os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors

For import to run, after traceback, I found the problem. It needs to enable MICROPY_READER_VFS. It solved now.
by bhcuong2008
Thu Jun 10, 2021 5:42 pm
Forum: General Discussion and Questions
Topic: os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors
Replies: 2
Views: 1683

Re: os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors

After creating RAM disk successfully, I create a file to test import as below. But import gives ENOENT (file not found). But I could read the file by opening and reading it. So what problem with import :roll: >>> f1 = open('/ramdisk/test.py', 'w') >>> f1.write('print("Hello")\n') 15 >>> f1.close() >...
by bhcuong2008
Tue Jun 08, 2021 9:16 am
Forum: General Discussion and Questions
Topic: os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors
Replies: 2
Views: 1683

os.VfsFat.mkfs failed with RAM Block Device size < 50 sectors

Hi, I tried the example in section "Custom Block Device" at below link to study MPY filesystem. I change number of sectors, from 1, 10, 20, 30, 40. All mkfs failed with error OSError: [Errno 5] EIO . From 50 is ok. I dont know why. I try on MPY 1.15, ESP32 port. https://docs.micropython.org/en/lates...
by bhcuong2008
Mon Jun 07, 2021 10:37 am
Forum: General Discussion and Questions
Topic: Integrate VFS interface to external other file system
Replies: 1
Views: 833

Re: Integrate VFS interface to external other file system

In file vfs_fat_file.c, MPY 1.15, I really dont understand why. line 217, it calls file_open with NULL as 1st argument. STATIC mp_obj_t file_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_val_t arg_vals[FILE_OPEN_NUM_ARGS]; mp_arg_parse_all_kw_arra...
by bhcuong2008
Mon Jun 07, 2021 8:38 am
Forum: General Discussion and Questions
Topic: Integrate VFS interface to external other file system
Replies: 1
Views: 833

Integrate VFS interface to external other file system

Hi, I integrate MPY as a library to my main program in Arduino ESP32. On ESP32, it already has VFS implementation. So I want to integrate it into MPY VFS. I look at the code of MPY vfs, vfs fat, found that the module is integrated tightly with library oofatfs. Please guide me how to integrate ESP32 ...
by bhcuong2008
Mon Jun 07, 2021 8:25 am
Forum: General Discussion and Questions
Topic: Could ujson.loads be improved faster?
Replies: 8
Views: 2826

Re: Could ujson.loads be improved faster?

Thank you for your guide. I will consult your docs.
by bhcuong2008
Sun Jun 06, 2021 7:57 am
Forum: General Discussion and Questions
Topic: How to add/cache string to qstr pool in runtime in C code
Replies: 5
Views: 2357

Re: How to add/cache string to qstr pool in runtime in C code

Thank stijn. I found this issue. In that post, dpgeorge told that if string not interned, it will use strcmp. It's so slower than that comparing number by using interned string. https://github.com/micropython/micropython/issues/4053 You will see that qstr is important for speed vĂ  saving memory. But...
by bhcuong2008
Sat Jun 05, 2021 1:13 pm
Forum: General Discussion and Questions
Topic: How to add/cache string to qstr pool in runtime in C code
Replies: 5
Views: 2357

Re: How to add/cache string to qstr pool in runtime in C code

I got it. Just call qstr_from_str("a"), then QSTR(a) will be added to QSTR pool. But I dont know how to release these qstrs :(

I also wonder how to add string value, such as list_args[0], to QSTR pool in python code.
by bhcuong2008
Sat Jun 05, 2021 11:47 am
Forum: General Discussion and Questions
Topic: How to add/cache string to qstr pool in runtime in C code
Replies: 5
Views: 2357

Re: How to add/cache string to qstr pool in runtime in C code

I just want it like in REPL. In REPL, if you define a list like this, list_1 = ['a', 'b'] then MPY will create qstr automatically, for "a" and "b". Check it by import micropython module, and run micropython.qstr_info(1) You could check its run time by executing operations with string "a", "b" in C/M...
by bhcuong2008
Sat Jun 05, 2021 11:09 am
Forum: General Discussion and Questions
Topic: How to add/cache string to qstr pool in runtime in C code
Replies: 5
Views: 2357

How to add/cache string to qstr pool in runtime in C code

Hi, I have a list of strings by using ujson loads in C code: char *s = "[\"a\", \"b\"]"; mp_obj_t mp_list_1 = mp_call_function_1(mp_loads_fn, mp_obj_new_str(s, strlen(s))); Now I want to cache strings "a", "b" to QSTR pool. So that further processing that using values "a", "b" is faster. After proce...