Search found 211 matches

by liudr
Thu Nov 11, 2021 1:33 pm
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

I'm running on ESP 32 and regular PC Python. My hardware has two variants, USB interface for PC, another using ESP 32. I import platform specific things with if platform=='esp32'
by liudr
Thu Nov 11, 2021 5:10 am
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

It seems that the decorator triggers errors when I try to run my code on PC python. I wonder if something can be done to say nullify them when I'm running my scripts on PC, which otherwise run perfectly.
by liudr
Wed Nov 10, 2021 10:21 pm
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

One other thing about mpy files: they have to match the version of the MicroPython interpreter you're running. Thanks. I read that if the 0-5 version values matches then it would be compatible, such as version 5 works for MP version 1.12 and up: https://docs.micropython.org/en/latest/reference/mpyf...
by liudr
Wed Nov 10, 2021 8:24 pm
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

Thanks. I'll try the decorator but I'm still not sure how the pip-installed tool can compile an ESP-IDF project to get binary code for ESP32.

Is the arch parameter for ESP32 extensawin or extensa?
by liudr
Wed Nov 10, 2021 5:57 am
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

So I found this python tool called mpy-cross that can cross compile and easy to install with pip. https://pypi.org/project/mpy-cross/ So I installed on my PC and did the cross compile. Honestly if I compare .mpy loading speed with .py, there is a slight improvement. If I compare .mpy with minified ....
by liudr
Wed Nov 10, 2021 3:10 am
Forum: ESP32 boards
Topic: Expand the file system on FLASH to occupy whole FLASH
Replies: 2
Views: 1141

Re: Expand the file system on FLASH to occupy whole FLASH

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html So partition table is at 0x8000 with length 0xC00. I wonder if the vfs partition in MP firmware has already been pre-formatted so that when it boots for the first time, people don't have to wait for over a m...
by liudr
Wed Nov 10, 2021 3:04 am
Forum: ESP32 boards
Topic: Expand the file system on FLASH to occupy whole FLASH
Replies: 2
Views: 1141

Expand the file system on FLASH to occupy whole FLASH

I'm using the SPIRAM variant of the MP firmware 1.17. In git I see the partition table to only occupy 2MB of space, including 1.5MB of firmware and 2MB of file system starting at 2MB boundary. https://github.com/micropython/micropython/blob/master/ports/esp32/partitions.csv # Name, Type, SubType, Of...
by liudr
Tue Nov 09, 2021 11:39 pm
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

You can also pre-compile your python code to bitcode and store the .mpy files (i.e. bytecode files) and then it won’t have to convert the python to bytecode every time. Is the .mpy file byte code the same as regular python bytecode? If not, can I compile code with REPL? I'm hesitant to attempt to i...
by liudr
Mon Nov 08, 2021 3:01 am
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Re: Building an IoT device: minizing module import time to conserve battery

Thanks Curt. Could you provide a link to your tool? I'd like to try it. I'm thinking, if I strip all the comments, that should speed up load time a bit, right?
by liudr
Sun Nov 07, 2021 7:55 pm
Forum: General Discussion and Questions
Topic: Building an IoT device: minizing module import time to conserve battery
Replies: 15
Views: 4878

Building an IoT device: minizing module import time to conserve battery

I'm building an IoT device that takes data every few minutes and sleeps between taking data. The ESP32 deepsleep function causes the woken CPU to reset so I practically rerun the whole import process after each deepsleep. I think micropython takes about 2 seconds to boot. That's the time I can't opt...