Uploading the program to the board using Segger JLink tools
Even though this program does nothing, we want to upload it to the board. For this, we will use Segger JLink tool suite, as explained in 4SE07 lab.
❎ Ensure that you have either one of arm-none-eabi-gdb or gdb-multiarch installed on your system. If this is not the case, install it before proceeding.
❎ In a dedicated terminal, launch JLinkGDBServer -device STM32L475VG.
We need to configure gdb so that it connects to the JLinkGDBServer program and uploads the program.
❎ Create a jlink.gdb gdb script containing the commands to connect to JLinkGDBServer, upload and run the debugged program:
target extended-remote :2331
load
mon reset
c
We would like cargo run to automatically launch gdb with the script we just wrote. Fortunately, the runner can be configured as well!
❎ In .cargo/config.toml, add the following to the conditional target section you created earlier:
runner = "arm-none-eabi-gdb -q -x jlink.gdb"
⚠ On some systems, one must use gdb-multiarch instead of arm-none-eabi-gdb, check which executable is available.
❎ Upload and run your program using cargo run while your board is connected. You should be able to interrupt gdb using ctrl-c and see that you are indeed looping in the panic handler function.
Congratulations: you are running your first embedded Rust program on a real board.