embedded-trainings-2020/embedded-workshop-book/src/flashing-program.md

22 lines
1,013 B
Markdown
Raw Normal View History

2020-07-08 13:06:49 +00:00
# Flashing the Program
2020-07-13 15:20:20 +00:00
✅ Use the following command to flash the ELF file to the device.
2020-07-08 13:06:49 +00:00
``` console
$ cargo flash --chip nRF52840_xxAA --elf target/thumbv7em-none-eabi/debug/hello
```
2020-07-13 15:20:20 +00:00
> NOTE: If you run into an error along the lines of "Debug power request failed" retry the operation and the error should disappear.
2020-07-08 13:06:49 +00:00
Alternatively you can run this command, which builds the application before flashing it.
``` console
$ cargo flash --chip nRF52840_xxAA --bin hello
```
The `cargo-flash` subcommand flashes and runs the program but won't display logs. It is a deployment tool.
2020-07-13 15:20:20 +00:00
**🔎 How does flashing work?**
2020-07-08 13:06:49 +00:00
The flashing process consists of the PC communicating with a second microcontroller on the nRF52840 DK over USB (J2 port). This second microcontroller, named J-Link, is connected to the nRF52840 through a electrical interface known as JTAG. The JTAG protocol specifies procedures for reading memory, writing to memory, halting the target processor, reading the target processor registers, etc.