Experimental try at making an ESP-IDF v4.0 compatible Badge oriented Micropython firmware
make prepare
to clone submodules and install the configuration filesmake build
to build the firmwaremake flash
to flash the firmware to the devicemake prepare-mch2022
to clone submodules and install the configuration filesmake build
to build the firmwarebuild/badge_firmware.bin
as an app via WebUSBmake clean
remove existing build filesmake erase
completely wipe clean the flash memory of the target devicemake flash
program the bootloader, partition table and firmware into the target devicemake monitor
to open the serial monitor and debugger applicationmake menuconfig
to open the SDK menuconfig configuration interfaceA working example can be found in de driver_bus_i2c folder.
In CMakelists.txt added all sources necessary for your driver and requirement for micropython and any other module.
If there is configuration option to disable the driver wrap you srcs in an cmake if statement.
To register the micropython bindings append your files/name as follows:
set(EXTMODS "${EXTMODS}" "${mods}" CACHE INTERNAL "")
set(EXTMODS_NAMES "${EXTMODS_NAMES}" "${mod_name}" CACHE INTERNAL "")
where mods is all the full filepaths containing micropython bindings and mod_name contains the module name in the module files all includes not from uPy should be wrapped in #ifndef NO_QSTR To register driver with an init function register as followed:
set(EXTMODS_INIT "${EXTMODS_INIT}" "\"${mod_name}\"@\"${mod_register}\"^" CACHE INTERNAL "")
where mod_register is the register message. This can also be done in a cmake if statement to not register the init/module when the driver is disabled.
Registering should be done in the project_include.cmake file. This ensures that the mods are registered before micropython is build.
In the main folder there are 2 folders for this. Manifests and python_modules. The python_modules folder is collection of modules people can include in their badge build. To include one these modules add to your badge specific manifest. This manifest should be stored in the manifests folder and can be selected in menuconfig.
The $(PORT_DIR) var is linked to the modules folder. The $(BOARD_DIR) is in python_modules/badge_hardware_name folder. This is included in the default manifest. The $(MPY_DIR) var is linked to the uPy component folder. DO NOT store modules in here.