Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 2 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions 16 rtic_v5/bluepill_blinky/.embed.toml
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"
Copy link
Contributor

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.)

Copy link
Contributor

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 as cargo embed --release --chip <chip-spec>. That way no config files need to be adjusted!

Copy link
Contributor

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?


[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
62 changes: 6 additions & 56 deletions 62 rtic_v5/bluepill_blinky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

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?


```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.
Copy link
Contributor

Choose a reason for hiding this comment

The 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 cargo embed --release command (which will fail if the wrong chip is selected).

Copy link
Contributor

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?

15 changes: 0 additions & 15 deletions 15 rtic_v5/bluepill_blinky/openocd.cfg

This file was deleted.

42 changes: 0 additions & 42 deletions 42 rtic_v5/bluepill_blinky/openocd.gdb

This file was deleted.

16 changes: 16 additions & 0 deletions 16 rtic_v5/heartbeat_stm32l4/.embed.toml
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
63 changes: 6 additions & 57 deletions 63 rtic_v5/heartbeat_stm32l4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,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`:

```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.
15 changes: 0 additions & 15 deletions 15 rtic_v5/heartbeat_stm32l4/openocd.cfg

This file was deleted.

42 changes: 0 additions & 42 deletions 42 rtic_v5/heartbeat_stm32l4/openocd.gdb

This file was deleted.

3 changes: 3 additions & 0 deletions 3 rtic_v5/hid_mouse_stm32f0/.embed.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Refer to https://github.com/probe-rs/cargo-embed/blob/master/src/config/default.toml
# for the comprehensive list of options

[default.general]
chip = "STM32F042G6Ux"

Expand Down
16 changes: 16 additions & 0 deletions 16 rtic_v5/monotonic_nrf52/.embed.toml
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
11 changes: 11 additions & 0 deletions 11 rtic_v5/monotonic_nrf52/README.md
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.
29 changes: 0 additions & 29 deletions 29 rtic_v5/monotonic_nrf52/jlink.cfg

This file was deleted.

19 changes: 0 additions & 19 deletions 19 rtic_v5/monotonic_nrf52/openocd.gdb

This file was deleted.

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.