Skip to content
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

How to implement a recovery button? #1377

Open
sjg20 opened this issue Apr 27, 2024 · 5 comments
Open

How to implement a recovery button? #1377

sjg20 opened this issue Apr 27, 2024 · 5 comments

Comments

@sjg20
Copy link
Contributor

sjg20 commented Apr 27, 2024

Many boards have a 'recovery' button which is used in conjunction with reset to put the board into a boot-ROM-recovery mode.

The sequence is:

  • hold down both reset and recovery
  • release reset
  • release recovery

This puts the board into a mode where it can be accessed over USB, to write U-Boot, etc.

What is the best way to implement this? Should it be a new 'recovery' protocol?

@Emantor
Copy link
Member

Emantor commented May 2, 2024

To handle this in labgrid we usually solder additions to the board if the required headers are not exposed and use the IO protocol in a custom strategy to bring the board into the correct state. Labgrid supports USB relais or exported GPIOs from embedded boards such as raspberry pi's for this.

@sjg20
Copy link
Contributor Author

sjg20 commented May 2, 2024

Yes I have wires soldered to the boards. I have added a RecoverProtocol which seems to work OK so will do a PR for that at some point

@Emantor
Copy link
Member

Emantor commented May 3, 2024

Wait, how does your recovery protocol decide which IO port to use for reset and which for the recovery switch? The reason we usually don't encode this into labgrid is that most of these are device specific and aren't easily generalized to other lab configurations.

@jluebbe
Copy link
Member

jluebbe commented May 3, 2024

The actual sequence of actions for a given board is implemented in a Strategy.

@sjg20
Copy link
Contributor Author

sjg20 commented May 3, 2024

OK so here it where I perhaps need to explain my goal a little better. I want to have a lab which can automatically run U-Boot tests on any board automatically, for my lab and for other U-Boot users. I originally implemented this with labman (https://github.com/sjg20/u-boot/tree/lab6a/tools/labman , but I believe it would be better done with labgrid.

From what I can tell, a Strategy is the way to all this, so long as it has suitable parameters to use.

If there is a recovery switch available, then the strategy will use it. Otherwise it won't. This seems to work well enough for me, for now.

It is similar (in a way) to the USBBoot driver. I have added drivers for sunxi and tegra and these seem to work OK.

It is also similar to writing U-Boot to a board, which has different methods. So far my writer driver has rpi3, sunxi, rockchip, em100 and zynq.

labgrid is where all the lab info is kept so I want to avoid adding a cloud of scripts which duplicate that knowledge.

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

No branches or pull requests

3 participants