monocle-micropython
monocle-micropython copied to clipboard
Micropython ported to the Monocle
MicroPython for Monocle
A custom deployment of MicroPython designed specifically for Monocle. Check out the user docs here.
For those of you who want to modify the standard firmware, keep on reading.
Getting started with development
-
Ensure you have the ARM GCC Toolchain installed.
-
Ensure you have the nRF Command Line Tools installed.
-
Clone this repository along with submodules and build the mpy-cross toolchain:
git clone https://github.com/brilliantlabsAR/monocle-micropython.git cd monocle-micropython git submodule update --init git -C micropython submodule update --init lib/micropython-lib make -C micropython/mpy-cross -
You should now be able to build the project by calling
makefrom themonocle-micropythonfolder.make -
Before flashing an nRF5340, you may need to unlock the chip first.
nrfjprog --recover -
You should then be able to flash the device.
make flash
Debugging
-
Open the project in VSCode.
There are some build tasks already configured within
.vscode/tasks.json. Access them by pressingCtrl-Shift-P(Cmd-Shift-Pon MacOS) →Tasks: Run Task.- Build
- Build & Flash Chip
- Erase & Unlock Chip
- Clean
-
Connect your debugger as described here.
-
You many need to unlock the device by using the
Erase Chiptask before programming or debugging. -
To enable IntelliSense, be sure to select the correct compiler from within VSCode.
Ctrl-Shift-P(Cmd-Shift-Pon MacOS) →C/C++: Select IntelliSense Configuration→Use arm-none-eabi-gcc. -
Install the Cortex-Debug extension for VSCode in order to enable debugging.
-
A debugging launch is already configured within
.vscode/launch.json. Run theJ-Linklaunch configuration from theRun and Debugpanel, or pressF5. The project will automatically build and flash before launching. -
To monitor the logs, run the task
RTT Consoleand ensure theJ-Linklaunch configuration is running.
Generating final release .hex and DFU .zip files
-
Download and install nrfutil including the
nrf5sdk-toolspackage:chmod +x nrfutil # Make sure to add nrfutil to your path nrfutil install nrf5sdk-tools -
Generate a settings file:
nrfutil settings generate --family NRF52 --application build/application.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 build/settings.hex -
Download and install the
mergehextool which is a part of the nRF Command Line Tools. -
Merge the settings, bootloader, softdevice and application hex files:
mergehex -m build/settings.hex build/application.hex softdevice/s132_nrf52_7.3.0_softdevice.hex bootloader/build/nrf52832_xxaa_s132.hex -o build/release.hex -
Create the DFU zip package using the command:
nrfutil pkg generate --hw-version 52 --application-version 0 --application build/application.hex --sd-req 0x0124 --key-file bootloader/published_privkey.pem build/release.zip
FPGA
For information on developing and flashing the FPGA binary. Check the Monocle FPGA repository.