To use Just for running commands, first follow the instructions here: https://github.com/casey/just#installation to install Just. Note that `Pillow` must be updated to `8.3.1` for all commands to work properly.
Once Just has been installed, the developer can use `just` commands to perform actions such as building, flashing, resetting and even taking screenshots of the displays screen.
Note that all `just` commands must be run from `ports/stm32/` directory.
Here are some of the most common `just` commands and their usages:
just flash {version} - Builds if necessary, signs with a user key and then flashes the device with the firmware binary created under `build-Passport/`
just reset - Resets the device
just screenshot {filename} - Screenshots the device and saves to the desired filename
See the `Justfile` included in our source for the full list of `just` commands.
OpenOCD server provides a socket on `localhost:4444` that you can connect to and issue commands. This server acts as an intermediary between that socket and the board connected over JTAG.
Once the OpenOCD server is running, you can pretty much ignore this window. You will interact with the OpenOCD client window (see below). Open a second shell and run the following:
Whenever you change any code in the `bootloader` folder or in the `common` folder, you will need to rebuild the bootloader (see above), and then flash it to the device with the following sequence in OpenOCD:
If you are using `just` commands, ocd and telnet steps are not required and instead, flashing the firmware can be done using the following command with the desired version number:
just flash 1.0.7
It will build and sign the firmware first if necessary.
To debug the bootloader, open a new shell window or tab and run the following command from the `passport/ports/stm32/boards/Passport/bootloader` folder:
ddd --debugger gdb-multiarch bootloader.elf &
Go to the `telnet` session with OpenOCD and run the following to prepare to connect DDD:
reset halt
Next, connect DDD to the OpenOCD GDB server with:
target remote localhost:3333
From here you can run normal GDB commands like:
b stm32_main # Stop at stm32_main, which is MicroPython's entry point