Page 1 of 1

Including libraries in the built image

Posted: Tue Feb 21, 2017 11:12 am
by amartino
Hi,
I'm just in the process of building the micropython esp8266 image from source and have managed to do so for the core image by following these steps on Ubuntu 16.10.

mkdir micropython-contribute
cd micropython-contribute/
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf \
flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \
sed git unzip bash help2man wget bzip2 libtool-bin
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make
export PATH=$PATH:$PWD/xtensa-lx106-elf/bin
cd ..
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
cd esp8266
make axtls
make
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 build/firmware-combined.bin


What are the steps required to add some micropython libraries to the final image?

Re: Including libraries in the built image

Posted: Tue Feb 21, 2017 3:22 pm
by fdushin
Copy or symlink the modules you want to include into:

Code: Select all

<path-to-micropython-dir>/esp8266/modules
You can copy or link whole packages (e.g., .../modules/uasyncio/__init__.py, etc) and they will get compiled into the image.

Note that you may run out of space if you add too many modules. I have not worked out (yet) how to increase the size of the image, so as a workaround I have been turning off the build of the btree code, e.g., from a clean slate:

Code: Select all

make PORT=/dev/tty.SLAB_USBtoUART MICROPY_PY_BTREE=0 deploy