forked from M-Labs/kirdy
67 lines
2.4 KiB
Markdown
67 lines
2.4 KiB
Markdown
|
# Testing Firmware for the Sinara 1550 Kirdy
|
||
|
|
||
|
- This repo is for testing only. Not intended for production use.
|
||
|
|
||
|
## Building
|
||
|
|
||
|
### Reproducible build with Nix
|
||
|
|
||
|
kirdy firmware is packaged using the [Nix](https://nixos.org) Flakes system. Install Nix 2.4+ and enable flakes by adding ``experimental-features = nix-command flakes`` to ``nix.conf`` (e.g. ``~/.config/nix/nix.conf``).
|
||
|
|
||
|
Once you have Flakes enabled, you can use ``nix build`` to build the firmware.
|
||
|
|
||
|
### Development environment
|
||
|
|
||
|
Clone this repository and with Nix Flakes enabled, use the following commands:
|
||
|
|
||
|
```shell
|
||
|
nix develop
|
||
|
cargo build
|
||
|
```
|
||
|
|
||
|
The resulting ELF file will be located under `target/thumbv7em-none-eabihf/release/kirdy`.
|
||
|
|
||
|
Alternatively, you can install the Rust toolchain without Nix using rustup; see the Rust manifest file pulled in `flake.nix` to determine which Rust version to use.
|
||
|
|
||
|
## Debugging
|
||
|
|
||
|
Connect SWDIO/SWCLK/RST/GND to a programmer such as ST-Link v2.1. Run OpenOCD:
|
||
|
```shell
|
||
|
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg
|
||
|
```
|
||
|
|
||
|
You may need to power up the programmer before powering the device.
|
||
|
Leave OpenOCD running. Run the GNU debugger:
|
||
|
```shell
|
||
|
gdb target/thumbv7em-none-eabihf/release/kirdy
|
||
|
|
||
|
(gdb) source openocd.gdb
|
||
|
```
|
||
|
|
||
|
## Flashing
|
||
|
There are several options for flashing kirdy. DFU requires only a USB-C connector, whereas OpenOCD needs a JTAG/SWD adapter.
|
||
|
|
||
|
### dfu-util on Linux
|
||
|
* Install the DFU USB tool (dfu-util).
|
||
|
* Convert firmware from ELF to BIN: `arm-none-eabi-objcopy -O binary kirdy kirdy.bin` (you can skip this step if using the BIN from Hydra)
|
||
|
* Connect to the USB Type C connector to kirdy above the RJ45.
|
||
|
* Add jumper to kirdy v2.0 across 2-pin jumper adjacent to JTAG connector.
|
||
|
* Cycle board power to put it in DFU update mode
|
||
|
* Push firmware to flash: `dfu-util -a 0 -s 0x08000000:leave -D kirdy.bin`
|
||
|
* Remove jumper
|
||
|
* Cycle power to leave DFU update mode
|
||
|
|
||
|
### st.com DfuSe tool on Windows
|
||
|
On a Windows machine install [st.com](https://st.com) DfuSe USB device firmware upgrade (DFU) software. [link](https://www.st.com/en/development-tools/stsw-stm32080.html).
|
||
|
- add jumper to kirdy across 2-pin jumper adjacent to JTAG connector
|
||
|
- cycle board power to put it in DFU update mode
|
||
|
- connect USB Type C to PC
|
||
|
- use st.com software to upload firmware
|
||
|
- remove jumper
|
||
|
- cycle power to leave DFU update mode
|
||
|
|
||
|
### OpenOCD
|
||
|
```shell
|
||
|
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c "program target/thumbv7em-none-eabihf/debug/kirdy verify reset; exit"
|
||
|
```
|