Build how to?!?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Build how to?!?

Post by jedie » Sun Dec 29, 2019 6:36 pm

I would like to start, building my own firmware image with my own frozen modules.

I found the "basic" build instructions here: https://github.com/micropython/micropyt ... structions

But this doesn't contain information about frozen modules.

Is there somewhere a project that will compile a own firmware? So i can look, how this can happen?

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Build how to?!?

Post by kevinkk525 » Sun Dec 29, 2019 7:09 pm

Check my scripts in "tools" directory. It copies to the frozen module directory and builds the firmware. Even have a script to set up the building environment.

https://github.com/kevinkk525/pysmartnode
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Sun Dec 29, 2019 7:33 pm

I've figured some stuff out by myself. Current work is here: https://github.com/jedie/micropython-so ... ch/pull/32

The destination is to have just a "update.sh" and a "compile.sh" ...

Current problem is xtensa-lx106-elf-standalone.tar.gz from https://github.com/jepler/esp-open-sdk/releases contains a very old xtensa-lx106-elf/bin/esptool.py
This is v1.2 and works only with Python 2... so it's crashed:

Code: Select all

...
CC ../../drivers/dht/dht.c
CC build-GENERIC/frozen_content.c
LINK build-GENERIC/firmware.elf
   text	   data	    bss	    dec	    hex	filename
 617296	   1024	  66368	 684688	  a7290	build-GENERIC/firmware.elf
Create /home/runner/work/micropython-sonoff-webswitch/micropython-sonoff-webswitch/build/firmware-combined.bin
  File "/home/runner/work/micropython-sonoff-webswitch/micropython-sonoff-webswitch/xtensa-lx106-elf/bin/esptool.py", line 128
    print 'Connecting...'
                        ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Connecting...')?
Makefile:208: recipe for target '/home/runner/work/micropython-sonoff-webswitch/micropython-sonoff-webswitch/build/firmware-combined.bin' failed
make: *** [/home/runner/work/micropython-sonoff-webswitch/micropython-sonoff-webswitch/build/firmware-combined.bin] Error 1

Is there somewhere a new version of xtensa-lx106-elf-standalone.tar.gz ?

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Sun Dec 29, 2019 7:35 pm

kevinkk525 wrote:
Sun Dec 29, 2019 7:09 pm
Check my scripts in "tools" directory. It copies to the frozen module directory and builds the firmware. Even have a script to set up the building environment.

https://github.com/kevinkk525/pysmartnode
I will take a look at this, thanks!

btw. have you tried to build the firmware as github actions? I try this. Current output: https://github.com/jedie/micropython-so ... /367018243

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Build how to?!?

Post by kevinkk525 » Sun Dec 29, 2019 7:37 pm

I have never tried that, looks interesting.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Sun Dec 29, 2019 7:37 pm

jedie wrote:
Sun Dec 29, 2019 7:33 pm
Is there somewhere a new version of xtensa-lx106-elf-standalone.tar.gz ?
Found a solution here: https://github.com/kevinkk525/pysmartno ... .sh#L8-L10
I will try this, too.

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Sun Dec 29, 2019 8:14 pm

kevinkk525 wrote:
Sun Dec 29, 2019 7:37 pm
I have never tried that, looks interesting.
The idea is that a action creates a new github release.

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: Build how to?!?

Post by Christian Walther » Sun Dec 29, 2019 10:26 pm

I’ve had good success with the Docker image recommended by jimmo. Really easy, nothing to install except Docker, no versioning conflicts.

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Mon Dec 30, 2019 7:47 am

Christian Walther wrote:
Sun Dec 29, 2019 10:26 pm
I’ve had good success with the Docker image recommended by jimmo. Really easy, nothing to install except Docker, no versioning conflicts.
Good idea: But the https://hub.docker.com/r/larsks/esp-open-sdk image is also 2 years old. I try a new build.

jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Build how to?!?

Post by jedie » Mon Dec 30, 2019 9:17 am

WIP: https://github.com/jedie/docker-esp-open-sdk
Image is available here: https://hub.docker.com/r/jedie/esp-open-sdk/

EDIT: https://github.com/jedie/docker-esp-open-sdk works now: build and pushed to docker hub via github action...

Now i started https://github.com/jedie/docker-micropython/ to build and push a docker image for compile esp8266 images...
It's hanging with:

Code: Select all

...
GEN build-GENERIC/genhdr/mpversion.h
GEN build-GENERIC/genhdr/moduledefs.h
GEN build-GENERIC/genhdr/qstr.i.last
In file included from ../../py/mphal.h:32:0,
                 from ../../py/mpprint.c:33:
./esp_mphal.h:69:19: fatal error: osapi.h: No such file or directory
 #include "osapi.h"
                   ^
compilation terminated.
In file included from ../../py/mphal.h:32:0,
                 from ../../py/modbuiltins.c:231:
./esp_mphal.h:69:19: fatal error: osapi.h: No such file or directory
 #include "osapi.h"
                   ^
compilation terminated.
GEN build-GENERIC/genhdr/mpversion.h
GEN build-GENERIC/genhdr/moduledefs.h
GEN build-GENERIC/genhdr/qstr.i.last
In file included from ../../py/mphal.h:32:0,
                 from ../../py/mpprint.c:33:
./esp_mphal.h:69:19: fatal error: osapi.h: No such file or directory
 #include "osapi.h"
                   ^
compilation terminated.
In file included from ../../py/mphal.h:32:0,
                 from ../../py/modbuiltins.c:231:
./esp_mphal.h:69:19: fatal error: osapi.h: No such file or directory
 #include "osapi.h"
                   ^
compilation terminated.
...
See complete output: https://github.com/jedie/docker-micropy ... =378341163

Any idea?


EDIT: Found the problem: It's needed to build esp-open-sdk via "make STANDALONE=y" ... I fixed with: https://github.com/jedie/docker-esp-ope ... 684ee8f56b

Now, compiling the esp8266 firmware works, see: https://github.com/jedie/docker-micropy ... =378453918

Post Reply