User Tools

Site Tools


buildingthemicropythonfirmware

Building the MicroPython Firmware (for ESP8266)

This article will take you through all the currently required step to build a MicroPython .bin file for the ESP8266. It uses VirtualBox to create a virtual development environment with all the suitable toolsets required to build MicroPython.

Prerequisites:

  • Desktop PC
  • Latest version of VirtualBox installed
  • About 20GB of free space
  • ubuntu-14.04.6-desktop-i386.iso

Prepare A Virtual Machine:

Create a new virtual machine:

Give it a name and configure it for 32-bit Ubuntu
More memory is better. Here is am using 4GB.
I choose to create the virtual hard disk now.
I leave the default as VDI.
I choose to dynamically size the hard drive.
The hard disk for the virtual machine needs at least 20GB
When that step has completed you will now be ready to install the OS

Install Ubuntu

Open the Setting for the new virtual machine and go to the Storage section. There select the ubuntu iso that we are using for this procedure.
Now we can start the virtual machine and Install Ubuntu
Install with your own preferences.

To simplify the process I choose to Login Automatically and I do not encrypt my home drive.
Once it is installed we can begin the final steps for setting up the virtual machine

Final Steps To Prepare the VM

Update Software

  1. Click on the Ubuntu icon and type 'terminal' and select the terminal application, at the terminal command prompt enter these commands…
    1. sudo apt update
    2. sudo apt upgrade
  2. Shutdown machine from the Ubuntu Menu (Just restarting seems to hang)
  3. Restart the machine

Install VirtualBox Guest Additions

  1. Install Virtual Box Guest Additions from the VirtualBox Devices Menu
  2. When that completes close the window.
  3. Click on the Ubuntu icon and type 'terminal' and select the terminal application. Enter the following command…
    (with the username you created during the install of Ubuntu)
    1. sudo usermod -a -G vboxsf <username>

Setup A Shared Folder

  1. From the DevicesShared Folders menu choose Shared Folders Settings. Create a Machine Shared Folder making sure…
    1. That it is not read-only and
    2. Make it is permanent.
  2. Shutdown machine from the Ubuntu Menu
  3. Restart the machine

Final Touches

  1. Confirm that the Share Folder is created, mounted and writeable.
  2. (optional) Change DevicesShared Clipboard to Bidirectional
  3. (optional) In Ubuntu's Brightness And Lock control panel applet, turn off locking of the screen

We now have a clean Ubuntu development machine to start adding our tools too.

Building the ESP_OPEN_SDK Toolset

  • Click on the Ubuntu icon and type 'terminal' and select the terminal application, at the terminal command prompt enter this command…

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

  • When that has finished installing, enter the following commands…

cd ~
git clone ––recursive https://github.com/pfalcon.esp_open_sdk
cd esp_open_sdk

Before kicking off make we need to fix two issues….

Correction #1 - 121-isl.sh

/esp-open-sdk/crosstool-ng/scripts/build/companion_libs/121-isl.sh needs to be edited in order for the isllib to be found.

https://wezensky.no-ip.org/shared/fwm/isl-0.14.tar.xz

Correction #2 -

/esp-open-sdk_crosstool-ng_config_companion_libs_expat.in needs to be updated to the latest available version.

Edit To…

Building The MicroPython BIN File for the ESP8266

  • Click on the Ubuntu icon and type 'terminal' and select the terminal application, at the terminal command prompt enter these commands…
    • cd ~
    • git clone https://github.com/micropython/micropython.git
    • cd micropython
    • git submodule update –init
    • make -C mpy-cross
    • git checkout 'v1.17'
  • Now you can add your Frozen Modules
  • Now run
    • make
buildingthemicropythonfirmware.txt · Last modified: 2021/11/21 00:50 by joseph