-
Notifications
You must be signed in to change notification settings - Fork 23
Migration to cargo-embed #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Refer to https://github.com/probe-rs/cargo-embed/blob/master/src/config/default.toml | ||
# for the comprehensive list of options | ||
|
||
[default.general] | ||
chip = "STM32F103" | ||
|
||
[default.rtt] | ||
enabled = true | ||
show_timestamps = true | ||
|
||
[default.gdb] | ||
# Whether or not a GDB server should be opened after flashing. | ||
# This is exclusive and cannot be used with RTT at the moment. | ||
enabled = false | ||
# The connection string in host:port format wher the GDB server will open a socket. | ||
# gdb_connection_string |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,63 +35,13 @@ You need to connect you bluepill board to ST-Link and connect pins: | |
|
||
Plug in ST-Link to USB port and wait it to initialize. | ||
|
||
### Upload | ||
### Flashing and running | ||
|
||
We will use openocd to upload the code wit simple one-line one-command script: | ||
Flashing with a standard STLink v2 is easy with `cargo-embed`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why even mention the STLink? Any probe that is supported by probe-rs can be used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed these comments. Could you transfer this to a new PR? |
||
|
||
```bash | ||
openocd -f openocd.cfg -c "program target/thumbv7m-none-eabi/debug/app verify reset exit" | ||
``` | ||
|
||
You will see something like: | ||
|
||
```bash | ||
openocd -f openocd.cfg -c "program target/thumbv7m-none-eabi/debug/app verify reset exit" | ||
Open On-Chip Debugger 0.10.0 | ||
Licensed under GNU GPL v2 | ||
For bug reports, read | ||
http://openocd.org/doc/doxygen/bugs.html | ||
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'. | ||
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD | ||
adapter speed: 1000 kHz | ||
adapter_nsrst_delay: 100 | ||
none separate | ||
Info : Unable to match requested speed 1000 kHz, using 950 kHz | ||
Info : Unable to match requested speed 1000 kHz, using 950 kHz | ||
Info : clock speed 950 kHz | ||
Info : STLINK v2 JTAG v33 API v2 SWIM v7 VID 0x0483 PID 0x3748 | ||
Info : using stlink api v2 | ||
Info : Target voltage: 3.196863 | ||
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints | ||
target halted due to debug-request, current mode: Thread | ||
xPSR: 0x01000000 pc: 0x080033b4 msp: 0x20005000 | ||
** Programming Started ** | ||
auto erase enabled | ||
Info : device id = 0x20036410 | ||
Info : flash size = 64kbytes | ||
target halted due to breakpoint, current mode: Thread | ||
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20005000 | ||
wrote 19456 bytes from file target/thumbv7m-none-eabi/debug/app in 1.118153s (16.992 KiB/s) | ||
** Programming Finished ** | ||
** Verify Started ** | ||
target halted due to breakpoint, current mode: Thread | ||
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20005000 | ||
verified 18588 bytes in 0.288441s (62.933 KiB/s) | ||
** Verified OK ** | ||
** Resetting Target ** | ||
shutdown command invoked | ||
```shell | ||
$ cargo install cargo-embed | ||
$ cargo embed --release | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
If you are lucky and have new version of OpenOCD, you will need to change `openocd.cfg` file. Openocd will report error during the upload process, so you will just need to change line: | ||
|
||
```txt | ||
source [find interface/stlink-v2.cfg] | ||
``` | ||
|
||
to | ||
|
||
```txt | ||
source [find interface/stlink.cfg] | ||
``` | ||
Please review the `.embed.toml` file to change your target IC among other options. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line should be moved up, so that people read it before running the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed these comments. Could you transfer this to a new PR? |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Refer to https://github.com/probe-rs/cargo-embed/blob/master/src/config/default.toml | ||
# for the comprehensive list of options | ||
|
||
[default.general] | ||
chip = "STM32L412" | ||
|
||
[default.rtt] | ||
enabled = true | ||
show_timestamps = true | ||
|
||
[default.gdb] | ||
# Whether or not a GDB server should be opened after flashing. | ||
# This is exclusive and cannot be used with RTT at the moment. | ||
enabled = false | ||
# The connection string in host:port format wher the GDB server will open a socket. | ||
# gdb_connection_string |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Refer to https://github.com/probe-rs/cargo-embed/blob/master/src/config/default.toml | ||
# for the comprehensive list of options | ||
|
||
[default.general] | ||
chip = "nrf52832" | ||
|
||
[default.rtt] | ||
enabled = true | ||
show_timestamps = true | ||
|
||
[default.gdb] | ||
# Whether or not a GDB server should be opened after flashing. | ||
# This is exclusive and cannot be used with RTT at the moment. | ||
enabled = false | ||
# The connection string in host:port format wher the GDB server will open a socket. | ||
# gdb_connection_string |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# nRF52 Monotonic | ||
|
||
In this example we show the use of a custom `rtic::Monotonic` implementation which uses a timer of the `nRF52832` MCU. | ||
|
||
### Flashing and running | ||
|
||
Flashing with a standard STLink v2 is easy with `cargo-embed`: | ||
|
||
```shell | ||
$ cargo install cargo-embed | ||
$ cargo embed --release | ||
``` | ||
|
||
Please review the `.embed.toml` file to change your target IC among other options. |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this even work? I thought the chip needs to be more specific than that. (That's the problem with cargo-embed config files, we cannot omit the chip 🙂 I think I'll open a feature request for that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just found out that apparently cargo-embed now supports specifying the chip on the command line! Very nice.
Therefore I'd suggest leaving away the
chip
configuration in the.embed.toml
file and instead telling the user to run the command ascargo embed --release --chip <chip-spec>
. That way no config files need to be adjusted!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed these comments. Could you transfer this to a new PR?