-
8000
Notifications
You must be signed in to change notification settings - Fork 2.1k
bootloaders: fix bootloader button logic #19365
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
Conversation
f43d431
to
51406e6
Compare
Please squash! |
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
5ebee92
to
48b07eb
Compare
Reminds me that we should eventually combine all those riotboot 'applications' into a single one so we can also easily combine e.g. bors merge |
👎 Rejected by too few approved reviews |
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.
bors merge
19365: bootloaders: fix bootloader button logic r=benpicco a=dylad ### Contribution description In lastest master, the `BTN_BOOTLOADER_INVERTED` logic doesn't work as expected. This PR fixes the underlying logic by replacing the `BTN_BOOTLOADER_INVERTED` macro definition by a runtime function. In fact the current code: ``` #ifndef BTN_BOOTLOADER_INVERTED #if (BTN0_MODE == GPIO_IN_PD) #define BTN_BOOTLOADER_INVERTED false #else #define BTN_BOOTLOADER_INVERTED true #endif #endif ``` cannot work because both `BTN0_MODE` and `GPIO_IN_PD` are not known by the precompiler as they are enum values defined at cpu level. Thus, replaces it by a runtime function in our bootloader applications. I've also add `GPIO_OD_PU` along side `GPIO_IN_PU` and add a new define (which can be override at board level or app level) in case an external pullup is used. ### Testing procedure Flash the riotboot_dfu bootloader: `make BOARD=saml21-xpro -C bootloaders/riotboot_dfu flash` Then, flash any test app: `PROGRAMMER=dfu-util USEMODULE=usbus_dfu make BOARD=saml21-xpro -C tests/shell riotboot/flash-slot0` With master, the application will not start. With this PR, the application will start after flashing. ### Issues/PRs references Fixes #19364 Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
bors cancel |
Canceled. |
bors merge |
Already running a review |
Sounds good to me ;) |
Build succeeded: |
Thanks for the review. |
Contribution description
In lastest master, the
BTN_BOOTLOADER_INVERTED
logic doesn't work as expected.This PR fixes the underlying logic by replacing the
BTN_BOOTLOADER_INVERTED
macro definition by a runtime function.In fact the current code:
cannot work because both
BTN0_MODE
andGPIO_IN_PD
are not known by the precompiler as they are enum values defined at cpu level.Thus, replaces it by a runtime function in our bootloader applications.
I've also add
GPIO_OD_PU
along sideGPIO_IN_PU
and add a new define (which can be override at board level or app level) in case an external pullup is used.Testing procedure
Flash the riotboot_dfu bootloader:
make BOARD=saml21-xpro -C bootloaders/riotboot_dfu flash
Then, flash any test app:
PROGRAMMER=dfu-util USEMODULE=usbus_dfu make BOARD=saml21-xpro -C tests/shell riotboot/flash-slot0
With master, the application will not start.
With this PR, the application will start after flashing.
Issues/PRs references
Fixes #19364