Introduction to developing MicroPython #3 – Learning the Build System


Getting started with developing MicroPython

After learning the structure and the environment setup, now it’s time to get real into developing. There are two things we need to familiarize ourself with,

Let’s first take a look at the directory at which we start developing,

Directory

Directory is very important when comes to using GNU make and all the pre-written make recipes we have created to make the building process much easier. The directory you wanna navigate to is as follows,

{Your PC Directory}\ambd_micropython\MicroPython_RTL8722\ports\rtl8722

Make Recipes

GNU make works with pre-defined precedures a.k.a recipes. Each recipe comprises of from few steps to thousands of step and even invoking other recipes as one of the steps. Thanks to this highly simplified paradigm, we can execute thousands of line of command with just a single line of “make” followed by the “recipe’s name”, and here are the recipes that you can use at your disposal,

make all

make and make all means the same thing, both of them execute the commands and build a usable MicroPython firmware for us. This is the recipe that you use most frequently

make upload

once you make successfully, you may wanna upload the firmware to ameba to test it out, so this is the recipe you can use. PS: before using this recipe, make sure to update your ameba’s COM port name to “UPLOAD_PATH” variable in the Makefile (can be found inside this folder)

make purge

MicroPython works the best when compile from the start after each time you make changes to the source code, use this recipe to make sure your directory is completely clean and free of previously compiled object files and middle files

make com

This recipe only works when using Linux and you already installed “picocom”, a free software used for serial communication between ameba and your PC via REPL

make release

Use this if you are happy with your changes and wanna backup your MicroPython firmware you just built so it won’t be wiped out everytime you perform make purge


This is about it for this part of the introduction, now you have the knowledge and the tools to build the firmware the way you like~

Stay tuned and happy coding :wink:

1 Like