Skip to content

Conversation

@ccli8
Copy link

@ccli8 ccli8 commented Dec 16, 2025

Summary of changes

This is follow-up of #519. We may trap in DPD/SPD wake-up reset loop when multi-level bootloaders (e.g. LDROM and MCUBoot) and application all or partial integrate this workaround. To avoid this, the wake-up flag CLK_PMUSTS_TMRWK_Msk is used to guard from duplicate wake-up reset setups and the clear-up of this flag is delayed to hal_watchdog_init, which will be invoked via Mbed Watchdog API.

This approach works based on the assumptions:

  1. Only application will set up WDT. LDROM and MCUBoot won't.
  2. WDT setup is done via Mbed Watchdog API, not direct WDT control.

Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

We may trap in DPD/SPD wake-up reset loop when multi-level bootloaders
(e.g. LDROM and MCUBoot) and application all or partial integrate this
workaround. To avoid this, the wake-up flag CLK_PMUSTS_TMRWK_Msk is
used to guard from duplicate wake-up reset setups and the clear-up of
this flag is delayed to hal_watchdog_init, which will be invoked via
Mbed Watchdog API.

This approach works based on the assumptions:
1. Only application will set up WDT. LDROM and MCUBoot won't.
2. WDT setup is done via Mbed Watchdog API, not direct WDT control.
@ccli8 ccli8 force-pushed the nvt_m487_fix_wakeup_reset_loop branch from 0779ca0 to c710bad Compare December 16, 2025 07:33
* by bootloader or by application, but not both.
*/
if (SYS->RSTSTS & ALL_RESET_FLAGS) {
do {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to just remove the do...while(0) loop and just move this code to the outer scope?

Copy link
Collaborator

@multiplemonomials multiplemonomials left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for that one comment!

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

Successfully merging this pull request may close these issues.

2 participants