-
Notifications
You must be signed in to change notification settings - Fork 752
boot: zephyr: Refactor USB DFU entry logic #2277
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
base: main
Are you sure you want to change the base?
Conversation
The tests are failing with the following logs:
What shall I do to make it clone? |
FIH hardening tests can be ignored, these are failing due to a problem with the TFM git server |
boot/zephyr/main.c
Outdated
#if defined(CONFIG_BOOT_USB_DFU_WAIT) | ||
mcuboot_status_change(MCUBOOT_STATUS_USB_DFU_WAITING); | ||
wait_for_usb_dfu(K_MSEC(CONFIG_BOOT_USB_DFU_WAIT_DELAY_MS)); | ||
BOOT_LOG_INF("USB DFU wait time elapsed"); | ||
mcuboot_status_change(MCUBOOT_STATUS_USB_DFU_TIMED_OUT); | ||
#else | ||
wait_for_usb_dfu(K_FOREVER); | ||
BOOT_LOG_INF("USB DFU wait terminated"); | ||
#endif | ||
} |
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.
Something is odd with this block.
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.
Are you talking about alignment? Let me check.
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.
Changed. Please check now.
54b47cb
to
8000f2f
Compare
boot/zephyr/main.c
Outdated
|
||
mcuboot_status_change(MCUBOOT_STATUS_USB_DFU_TIMED_OUT); | ||
} | ||
} |
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.
This one is still not ok.
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.
Changed.
boot/zephyr/main.c
Outdated
#ifdef CONFIG_MCUBOOT_INDICATION_LED | ||
io_led_set(1); | ||
#endif | ||
|
||
mcuboot_status_change(MCUBOOT_STATUS_USB_DFU_ENTERED); | ||
} | ||
#elif defined(CONFIG_BOOT_USB_DFU_WAIT) | ||
usb_dfu_requested = true; |
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.
This one is also incorrectly indented. Are you using tabs or spaces?
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.
I used tabs initially on vim, that is leading to issues. Spaces are aligning correctly.
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.
Just changed.
Consolidates USB DFU entry logic by unifying GPIO and timeout-based DFU triggers under a common flag. This avoids code duplication and improves maintainability. Also improves log clarity for different DFU exit conditions. Signed-off-by: Sayooj K Karun <[email protected]>
8000f2f
to
a77c554
Compare
Please have a look into this @de-nordic @nordicjm |
Consolidates USB DFU entry logic by unifying GPIO and timeout-based DFU triggers under a common flag. This avoids code duplication and improves maintainability.
Also improves log clarity for different DFU exit conditions.