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.
-
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
make
from themonocle-micropython
folder.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
-
Open the project in VSCode.
There are some build tasks already configured within
.vscode/tasks.json
. Access them by pressingCtrl-Shift-P
(Cmd-Shift-P
on 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 Chip
task before programming or debugging. -
To enable IntelliSense, be sure to select the correct compiler from within VSCode.
Ctrl-Shift-P
(Cmd-Shift-P
on 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-Link
launch configuration from theRun and Debug
panel, or pressF5
. The project will automatically build and flash before launching. -
To monitor the logs, run the task
RTT Console
and ensure theJ-Link
launch configuration is running.
-
Download and install nrfutil including the
nrf5sdk-tools
package: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
mergehex
tool 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
For information on developing and flashing the FPGA binary. Check the Monocle FPGA repository.