Flashing
The flashing process allows copying a program on the SmolPhone device. A program can be flashed either via a debugging probe or via the micro USB port of the Raspberry Pico. Make sure you don’t confuse the USB-C port, which provides power to all peripherals, with the micro USB port on the Raspberry Pico. Recent prototypes of the SmolPhone device don’t expose the micro USB port of the Raspberry Pico.
Flashing with a debugging probe
Connect the debugging probe to the Arm Serial Wire Debug (SWD) of the Raspberry Pico. Connect the main power via the USB-C port. Press the power button just before flashing the device. This provides power to peripherals like the display, the SD card, and the keyboard. If you power these peripherals too soon, you can end up in a state where the keyboard is frozen.
You can flash the program using cargo embed or the VSCode debugger.
Using cargo embed
First install probe-rs.
cargo embed is installed within probe-rs.
Use the probe-rs list command to check that the probe is correctly connected and recognized.
Then run cargo-embed with the desired program.
List the available programs running the cargo run --bin command.
cargo embed --release --bin dictionary
This compiles the project, and you should get the following output:
Profile default
Target target/thumbv6m-none-eabi/release/dictionary
Then press the power button to power up the device and flash the device. Note that if you take too much time to power up the device, the flashing process will abort.
defmt messages should be logged on the console.
Note that the dictionary demo loads dictionaries from the SD card.
The SD card must be formatted using the FAT32 file system.
The assets/dict folder must be located at the root of the file system.
Debugging with GDB
Install gdb-multiarch or arm-none-eabi-gdb depending on your Linux distribution.
In the Embed.toml file, set default.gdb.enable to true.
Flash the program without the --release option:
cargo embed --bin dictionary
A TCP port is opened for the GDB server. To connect the GDB server, run the following command:
<gdb-program> -q -x embed.gdb <program-file>
<gdb-program> is either gdb-multiarch or arm-none-eabi-gdb.
<program-file> corresponds to the program binary.
For example, target/thumbv8m.main-none-eabihf/debug/dictionary or target/thumbv6m-none-eabi/debug/dictionary depending on the microcontroller architecture.
See the following resources for more details:
Using the VSCode debugger
First install probe-rs and the probe-rs VSCode extension.
We provide a debug launcher (./.vscode/launch.json) that automatically launch probe-rs.
When launched, the debugger will prompt you for the name of the program to debug.
Flashing with the micro USB port of the Raspberry Pico
We provide a custom runner script (.cargo/runner) that is automatically executed on cargo run.
The script must be executable.
The runner uses picotool to flash the device.
Install it from your distribution repositories.
Before connecting the Raspberry Pico to your computer, hold the reset button. It is a little white button on the Raspberry Pico.
Then run cargo run --release to flash the device.
cargo run --release --bin rphal_display