8000 Moving microbit_v2 away from openocd to probe-rs by NegrilaRares · Pull Request #4074 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Moving microbit_v2 away from openocd to probe-rs #4074

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 16 commits into from
Aug 27, 2024

Conversation

NegrilaRares
Copy link
Contributor
@NegrilaRares NegrilaRares commented Jul 9, 2024

Pull Request Overview

As a result of the pull request #4054 made by @alevy.

I've changed the makefile of the microbit_v2 to use probe-rs instead of openocd.

Made some changes to the README.md file located in the same folder to reflect the modifications.

Testing Strategy

This pull request was tested by manually running the make flash-bootloader, make flash and make flash-debug with the new makefile configuration.

TODO or Help Wanted

This pull request still needs to change the troubleshooting commands to get rid of the need for openocd.

I would like to get feedback about this before changing all the boards.

@alevy i was wondering if it would be worth using cargo flash instead of probe-rs directly.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

NegrilaRares and others added 3 commits July 9, 2024 12:45
Changed the makefile of the microbit_v2 to use probe-rs instead of openocd.

Made some changes to the README.md file located in the same folder to reflect the modifications.
solving a small typo
fixing a typo
@alexandruradovici alexandruradovici changed the title Moving microbit_v2 away from openocd Moving microbit_v2 away from openocd to probe-rs Jul 9, 2024
added a small installation guide for probe-rs to the README file
@lschuermann lschuermann added the blocked Waiting on something, like a different PR or a dependency. label Jul 9, 2024
@lschuermann
Copy link
Member

Marking as blocked on #4054.

Changed the Makefile to also include the option of openocd, at least until we further move away from it.

And changed the read me to provide the commands for both probe-rs and openocd.
Adding the use of enviroment variables in the makefile and making the necessary command changes in the README file.
8000
ppannuto
ppannuto previously approved these changes Jul 11, 2024
@lschuermann
Copy link
Member

This should wait on #4075.

@alexandruradovici
Copy link
Contributor

Now that #4075 is merge, @NegrilaRares can you adapt this?

@alexandruradovici alexandruradovici removed the blocked Waiting on something, like a different PR or a dependency. label Aug 1, 2024
@alevy
Copy link
Member
alevy commented Aug 1, 2024

Instead of all of this, you could just add a Embed.toml file to the board that looks like this:

# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.

[default.general]
chip = "nRF52833_xxAA"

which would then, if probe-rs is installed, allow you to run commands like

$ cargo flash --release

or

$ cargo embed --release

No need for anything in the Makefiles

@NegrilaRares
Copy link
Contributor Author

so should we get rid of the make file completely or leave it as an option?

@alexandruradovici
Copy link
Contributor

so should we get rid of the make file completely or leave it as an option?

I suggest leaving the makefile in place so users can use both.

@NegrilaRares
Copy link
Contributor Author

so should we get rid of the make file completely or leave it as an option?

I suggest leaving the makefile in place so users can use both.

should the probe-rs options that were already integrated be left there or should they be removed?

i believe keeping them is a good option

ill change the readme file to add the cargo embed explenation tommorow

Copy link
Contributor
@bradjc bradjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the relationship between cargo-embed and probe-rs. Why are we using a cargo-embed config file but not calling cargo embed?

@NegrilaRares
Copy link
Contributor Author

decided to use cargo flash instead of cargo embed

@NegrilaRares
Copy link
Contributor Author

made cargo the default and kept probe-rs and openocd as options

would like some feedback on how to go about the naming convention

bradjc
bradjc previously approved these changes Aug 9, 2024
Copy link
Member
@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from my comment. I have never seen Make targets contain slashes when they're not describing target files, but I'm also not the Make expert here.

Co-authored-by: Leon Schuermann <leon@is.currently.online>
@NegrilaRares
Copy link
Contributor Author

should only the cargo flash default be kept in the readme file?

@NegrilaRares NegrilaRares requested a review from bradjc August 26, 2024 07:56
@bradjc
Copy link
Contributor
bradjc commented Aug 26, 2024

Since you are working with this, how are you handling the fact that make install (ie make flash) erases all installed apps?

@NegrilaRares
Copy link
Contributor Author

well this behaviour isnt anything new as the previous openocd method also gave the same results, removing the apps that were flashed previously

@bradjc
Copy link
Contributor
bradjc commented Aug 27, 2024

Right, is that bothersome? I was surprised by this, and it makes for a poor new user experience, and I'm just wondering what your experience is.

@alevy alevy enabled auto-merge August 27, 2024 17:30
@alevy alevy added this pull request to the merge queue Aug 27, 2024
Merged via the queue into tock:master with commit 4e2bebd Aug 27, 2024
12 checks passed
@bradjc
Copy link
Contributor
bradjc commented Aug 29, 2024

This is a bit rough right now if you don't have the tool:

make install
   Compiling microbit_v2 v0.1.0 (/Users/bradjc/git/tock/boards/microbit_v2)
   Compiling kernel v0.1.0 (/Users/bradjc/git/tock/kernel)
   Compiling cortexv7m v0.1.0 (/Users/bradjc/git/tock/arch/cortex-v7m)
   Compiling cortexm v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m)
   Compiling nrf5x v0.1.0 (/Users/bradjc/git/tock/chips/nrf5x)
   Compiling capsules-core v0.1.0 (/Users/bradjc/git/tock/capsules/core)
   Compiling segger v0.1.0 (/Users/bradjc/git/tock/chips/segger)
   Compiling capsules-system v0.1.0 (/Users/bradjc/git/tock/capsules/system)
   Compiling cortexm4 v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m4)
   Compiling nrf52 v0.1.0 (/Users/bradjc/git/tock/chips/nrf52)
   Compiling capsules-extra v0.1.0 (/Users/bradjc/git/tock/capsules/extra)
   Compiling nrf52833 v0.1.0 (/Users/bradjc/git/tock/chips/nrf52833)
   Compiling components v0.1.0 (/Users/bradjc/git/tock/boards/components)
   Compiling nrf52_components v0.1.0 (/Users/bradjc/git/tock/boards/nordic/nrf52_components)
    Finished `release` profile [optimized + debuginfo] target(s) in 30.28s
   text	   data	    bss	    dec	    hex	filename
 102398	     32	  21644	 124074	  1e4aa	/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/microbit_v2
cargo flash --chip nRF52833_xxAA --verify --path /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/microbit_v2.elf
error: no such command: `flash`

	Did you mean `fetch`?

	View all installed commands with `cargo --list`
	Find a package to install `flash` with `cargo search cargo-flash`
make: *** [flash] Error 101

And then

❯ cargo search cargo-flash
cargo-flash = "1.0.1"          # Deprecated binaries for the probe-rs project.
probe-rs-targets = "0.2.0"     # A collection of on chip debugging tools to comminicate with ARM chips.
probe-rs = "0.24.0"            # A collection of on chip debugging tools to communicate with microchips.
probe-rs-mi = "0.1.0"          # The probe-rs machine interface for computers interfacing probe-rs
probe-rs-target = "0.24.0"     # Target description schema for probe-rs.
probe-rs-tools = "0.24.0"      # A collection of on chip debugging tools to communicate with microchips.
nucleo-wl55jc-bsp = "0.6.1"    # Board support package for the NUCLEO-WL55JC
samd11_bare = "0.10.0"         # Support crate for the ATSAMD11C
lora-e5-bsp = "0.6.1"          # Board support package for the seeed LoRa-E5 development kit
gdb-server = "0.18.0"          # A gdb stub implementation for on chip debugging and flashing of ARM chips.
... and 4 crates more (use --limit N to see more)

And then

❯ cargo install cargo-flash
    Updating crates.io index
  Downloaded cargo-flash v1.0.1
  Downloaded 1 crate (1.8 KB) in 0.06s
  Installing cargo-flash v1.0.1
    Updating crates.io index
   Compiling cargo-flash v1.0.1
error: failed to run custom build command for `cargo-flash v1.0.1`

Caused by:
  process didn't exit successfully: `/var/folders/_4/n3tmwxks3318tsb36d913f600000gn/T/cargo-installwoCSr0/release/build/cargo-flash-017247706eb43d23/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /Users/bradjc/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-flash-1.0.1/build.rs:18:5:

  !!!!!!!!!!!!!!!!!!!!!!!!
  `cargo-flash` is now a part of `probe-rs`. To install it, run the following command:

  curl --proto '=https' --tlsv1.2 -LsSf https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh

  Once installed, you can use the "cargo flash" command just like before, although there might be minor changes in the API. For more information, please refer to the documentation at https://probe.rs/docs/tools/cargo-flash/.
  !!!!!!!!!!!!!!!!!!!!!!!!

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `cargo-flash v1.0.1`, intermediate artifacts can be found at `/var/folders/_4/n3tmwxks3318tsb36d913f600000gn/T/cargo-installwoCSr0`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

I'm not really sure why the guidance from cargo is so poor, but what are users intended to do and how do we communicate that?

@alevy
Copy link
Member
alevy commented Sep 12, 2024

So, you are supposed to either follow the instructions in your last command and install using the curl'd shell script, install from your package manager (nix-shell -p probe-rs for me, it's also available on homebrew), or cargo install probe-rs-tool, which provides the binaries probe-rs, cargo-embed and cargo-flash, so:

$ cargo install probe-rs-tools

I agree this is a suboptimal experience, though it doesn't differ much from the JLinkExe experience---it's not installed automatically and getting it is an exercise for the reader (though it is documented in quick start portion of the book).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0