no boot.py after custom frozen modules build

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
mcL
Posts: 9
Joined: Wed Dec 25, 2019 1:36 am

no boot.py after custom frozen modules build

Post by mcL » Thu Jun 25, 2020 12:29 am

I've successfully used a couple of my .py files to build frozen modules, built the firmware, and programmed a 1M Sonoff R3 8266. After incorporating new magic into my code I re-built the firmware and loaded into the Sonoff (erased first, power cycle, etc.). Now I appear to not have a filesystem or boot.py on the device. rshell connects fine but there are zero files shown via 'ls -la' and I get an error if I try to copy anything to it. I can REPL in but it initially starts in edit mode (I think?) with the '>' prompt. I can get to the >>> prompt by ^b to exiting edit mode, and then help('modules') and see the frozen modules including my new ones. uos.listdir('/') shows nothing. Right after a reboot (^d in REPL) it reports "could not find module _boot.py". I've been researching the best I can but I'm out of ideas. I must have messed up the build somehow? I'm using/used these https://github.com/micropython/micropyt ... ts/esp8266 instructions.

I also erased and flash an out-of-box new device with the same result. Thanks for any ideas!

Code: Select all

 rshell -p /dev/ttyUSB0 -b 115200
Using buffer-size of 32
Connecting to /dev/ttyUSB0 (buffer-size 32)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... 
Setting time ... Jun 24, 2020 17:12:14
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.

cp junk /pyboard/junk
timed out or error in transfer to remote: b'F'

mcL
Posts: 9
Joined: Wed Dec 25, 2019 1:36 am

Re: no boot.py after custom frozen modules build

Post by mcL » Thu Jun 25, 2020 8:21 pm

Ok, figured it out, so I will answer my own question in case other run into this (others have as indicated by issue #5320 and elsewhere). I don't know if this is the blessed way to resolve this (please advise if you know a better procedure).

Problem:
* Manifest files are exclusive OR: only one or the other is used for the build. There is the standard one in ..boards/. If one wants a custom (freeze some of your scripts) you'll probably want to make a your own manifest.py in your project directory (so it can be tracked via git/etc.) and put your scripts in there.
* If you use the FROZEN_MANIFEST directive to use that, the standard one won't be used; only your project one is used. This means (I guess) that the standard ones, which you want/need, will be excluded.
* This is confusing as ../frozen_mpy still shows the other/older/orginal .mpy files. I think it's fair for the user to assume that those .mpy files would all be used in the make. Apparently they aren't.

Solution: (please advise if you of a better way, maybe with an 'include'. Just happy to get it working I don't want to break it again!)
* Copy/paste contents of ../boards/manifest.py and and append to your projects manifest.py
* re-make (in my case) with BOARD=GENERIC_1M FROZEN_MANIFEST=<your_project_dir>/manifest.py. erase, flash, smile, crack a beer.

User avatar
jimmo
Posts: 1710
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: no boot.py after custom frozen modules build

Post by jimmo » Mon Jun 29, 2020 6:18 am

mcL wrote:
Thu Jun 25, 2020 8:21 pm
Solution: (please advise if you of a better way, maybe with an 'include'.
Yep! That's why we added the include feature.

See e.g. https://github.com/micropython/micropyt ... anifest.py

User avatar
pythoncoder
Posts: 4268
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: no boot.py after custom frozen modules build

Post by pythoncoder » Mon Jun 29, 2020 3:13 pm

mcL wrote:
Thu Jun 25, 2020 8:21 pm
...
* Copy/paste contents of ../boards/manifest.py and append to your projects manifest.py
...
It's also worth noting that you can put symlinks to files or directories in your frozen modules directory and the build system will follow them. In some cases this is preferable to include (and usually better than copy-paste).
Peter Hinch

Post Reply