-
Notifications
You must be signed in to change notification settings - Fork 7.4k
API for request MCUboot mode by the application #44512
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,22 @@ extern void z_arm_nmi_init(void); | |
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL | ||
LOG_MODULE_REGISTER(soc); | ||
|
||
int soc_mcuboot_mode_set(uint8_t mode) | ||
{ | ||
nrf_power_gpregret2_set(NRF_POWER, mode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From spot-checking a product specification, the GPREGRET and GPREGRET2 registers seem to be available for application developer use too. Is there any risk in using them for this purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPREGRET is used by NCS internally for instance, it is also place where nRF SoC stores reboot-type in zephyr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can use GPREGRET for transfer both the reboot-type and the recovery-dfu request. This implies that I need to introduce an API for retrieve reboot-type as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't understand your last comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you see usage of GPREGRET2 as the waste of resources I can make a better solution: The idea would be to start using GPREGRET for request of recovery-dfu as well (along with reboot-type to keep of which it is used currently). @mbolivar-nordic What is your opinion on that ^^ idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, OK, I think I understand now. No, if we're already using GPREGRET, from my side I see no harm in using GPREGRET2 as well. You're saying you're not aware of any customers already using this that will be negatively impacted, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alternative: #46084 |
||
|
||
return 0; | ||
} | ||
|
||
uint8_t soc_mcuboot_mode_get(void) | ||
{ | ||
uint8_t mode = nrf_power_gpregret2_get(NRF_POWER); | ||
|
||
nrf_power_gpregret2_set(NRF_POWER, 0); | ||
|
||
return mode; | ||
} | ||
|
||
/* Overrides the weak ARM implementation: | ||
Set general purpose retention register and reboot */ | ||
void sys_arch_reboot(int type) | ||
|
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.
Nothing wrong with this line of code, but the Signed-off-by: line in the commit message has the wrong format.