From cdbc9e01e7fbd9f3b078c513bceb122f365d627f Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 11 Dec 2022 10:07:22 +0100 Subject: [PATCH] sys/usb_board_reset: add dummy reset in bootloader function Definition of a function as weak symbol for reset in bootloader which prints an error message if no real implementation is compiled in and the module `riotboot_reset` is not used. This is required if the module `usb_board_reset` is used to restart the board with an application via an USB CDC ACM interface, but the board's bootloader does not support a reset in the bootloader. --- sys/usb_board_reset/usb_board_reset.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/usb_board_reset/usb_board_reset.c b/sys/usb_board_reset/usb_board_reset.c index 81657befb6..1037c1b668 100644 --- a/sys/usb_board_reset/usb_board_reset.c +++ b/sys/usb_board_reset/usb_board_reset.c @@ -62,6 +62,22 @@ int usb_board_reset_coding_cb(usbus_cdcacm_device_t *cdcacm, return 0; } +#ifndef MODULE_RIOTBOOT_RESET +/* + * Definition of a function as weak symbol for reset in bootloader which + * prints an error message if no real implementation is compiled in and + * the `riotboot_reset` module is not used. This is required if the module + * `usb_board_reset` is used to restart the board with an application via + * an USB CDC ACM interface, but the board's bootloader does not support + * a reset in the bootloader. + */ +__attribute__((weak)) +void usb_board_reset_in_bootloader(void) +{ + LOG_ERROR("[cdc-acm] reset in bootloader is not supported\n"); +} +#endif + void usb_board_reset_in_application(void) { pm_reboot();