uf2-samdx1 icon indicating copy to clipboard operation
uf2-samdx1 copied to clipboard

Proposal to allow a GPIO to hold the bootloader from running the app, if its in the correct state

Open stevenj opened this issue 6 years ago • 2 comments

The board i am porting to has no reset button. So, double tap reset isn't an option. I do however have a switch i can use. So this change allows a GPIO to be defined which stops the app running and lets the bootloader continue. This is useful if the App crashes.

To use, a target board would define like this:

// The Pin that will tell us to stay in the bootloader or not.
#define HOLD_PIN PIN_PA02

// Optional, define if a Pull up or pulldown is needed.
#define HOLD_PIN_PULLUP
//#define HOLD_PIN_PULLDOWN

// What is the Hold state of the GPIO, 0 or 1.
#define HOLD_STATE 1

The code is tested on my board and works as advertised. I am not wedded to the macro names I have used, so if there are better ones i am happy to change them.

stevenj avatar Jun 09 '18 13:06 stevenj

Would be good to add some docs, or maybe add the config for your board as an example?

mmoskal avatar Jun 19 '18 00:06 mmoskal

@mmoskal There is a board config that uses this in my proposed debug led refactor. I didn't put it in this pull request because it has other things in it because of the debug led code. However, I just added some documentation for this feature to the readme.

stevenj avatar Jun 19 '18 02:06 stevenj

@mmoskal I'm also working with a board that has no reset button. Is anything holding up this PR, or could it be merged?

erikvanzijst avatar Aug 18 '22 16:08 erikvanzijst

Its really simple code, I haven't tested it since I issued the PR and am not working on this board anymore but assuming it still works, I would be pleased to see this PR finally merged. :smile_cat:

stevenj avatar Aug 19 '22 02:08 stevenj

Sorry for looooong delay...

mmoskal avatar Aug 19 '22 07:08 mmoskal

Awesome!

erikvanzijst avatar Aug 19 '22 14:08 erikvanzijst