-
Notifications
You must be signed in to change notification settings - Fork 8.2k
soc: rpi_pico: Add restart to bootloader support. #53811
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
soc: rpi_pico: Add restart to bootloader support. #53811
Conversation
Reboot to the bootloader if non-zero restart type. Signed-off-by: Peter Johanson <[email protected]>
yonsch
left a comment
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.
@petejohanson Please also explain in the commit message the rationale for this change
| Set general purpose retention register and reboot */ | ||
| void sys_arch_reboot(int type) | ||
| { | ||
| if (type != 0) { |
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.
Use SYS_REBOOT_WARM
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.
Does that really match? I know that nRF52840 uses a different special code shoved into a register that various bootloaders will honor to enter the bootloader, which seems a bit different than a normal "warm reboot".
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.
What are you using this for? As far as I know type is either warm or cold
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.
The nrf52840 version of this sets a specific retained register to whatever value is passed in:
void sys_arch_reboot(int type)
{
nrf_power_gpregret_set(NRF_POWER, (uint8_t)type);
NVIC_SystemReset();
}
The adafruit bootloader inspects that register for a specific value, and if detected, enters the bootloader instead of launching the already flashed application.
Ideally, we should be able to replicate that somehow on RP2040. I don't see any consistent conventions for other SoCs, nor any explicit note about the reboot type being extensible. From include/zephyr/sys/reboot.h:
#define SYS_REBOOT_WARM 0
#define SYS_REBOOT_COLD 1
/**
* @brief Reboot the system
*
* Reboot the system in the manner specified by @a type. Not all architectures
* or platforms support the various reboot types (SYS_REBOOT_COLD,
* SYS_REBOOT_WARM).
*
* When successful, this routine does not return.
*/
extern FUNC_NORETURN void sys_reboot(int type);
@gmarull Any suggestions for us?
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
|
@petejohanson Is this still relevant? |
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Reboot to the bootloader if non-zero restart type.
Signed-off-by: Peter Johanson [email protected]
See https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_bootrom/include/pico/bootrom.h#L161 for the API used to reboot into the bootloader in ROM.