/monocle-micropython

Micropython ported to the Monocle

Primary LanguageCISC LicenseISC

MicroPython for Monocle

A custom deployment of MicroPython designed specifically for Monocle. Read the docs.

Flash you Monocle

  1. Download the latest .hex file from the releases page.

  2. Ensure you have the nRF Command Line Tools installed.

  3. Connect your debugger as described here.

  4. Flash your device using the command:

nrfjprog --program *.hex --chiperase -f nrf52 --verify --reset

Getting started with development

  1. Ensure you have the ARM GCC Toolchain installed.

  2. Ensure you have the nRF Command Line Tools installed.

  3. Clone this repository, submodules and build:

    # Clone and jump into this repo
    git clone https://github.com/brilliantlabsAR/monocle-micropython.git
    cd monocle-micropython
    
    # Initialize the submodules
    git submodule update --init
    git -C micropython submodule update --init lib/micropython-lib
    
    # Build mpy-cross toolchain
    make -C micropython/mpy-cross
  4. You can now close the terminal and open the project in VSCode.

    There are three build tasks already configured and ready for use. Access them by pressing Ctrl-Shift-P (Cmd-Shift-P on MacOS) → Tasks: Run Task.

    1. Build (Ctrl-B / Cmd-B)
    2. Build & flash
    3. Clean

Generating final release .hex and DFU .zip files

  1. Download and install nrfutil including the nrf5sdk-tools package:

    chmod +x nrfutil
    # Make sure to add nrfutil to your path
    nrfutil install nrf5sdk-tools
  2. 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
  3. Download and install the mergehex tool which is a part of the nRF Command Line Tools.

  4. 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
  5. 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.