diff --git a/core/embed/sys/startup/inc/sys/bootutils.h b/core/embed/sys/startup/inc/sys/bootutils.h index 10b069e913..25cde30bae 100644 --- a/core/embed/sys/startup/inc/sys/bootutils.h +++ b/core/embed/sys/startup/inc/sys/bootutils.h @@ -45,13 +45,6 @@ void __attribute__((noreturn)) reboot_and_upgrade(const uint8_t hash[32]); // unrecoverable error state. void __attribute__((noreturn)) secure_shutdown(void); -// Alternative memset with slightly different arguments -// -// This function writes a 32-bit value to a range of memory addresses. -// The range is defined by the start and stop pointers and must -// be aligned to 4 bytes. -void memset_reg(volatile void *start, volatile void *stop, uint32_t val); - // Jumps to the next booting stage (e.g. bootloader to firmware). // `address` points to the flash at the vector table of the next stage. // diff --git a/core/embed/sys/startup/stm32f4/startup_init.c b/core/embed/sys/startup/stm32f4/startup_init.c index 52634a030f..f934632149 100644 --- a/core/embed/sys/startup/stm32f4/startup_init.c +++ b/core/embed/sys/startup/stm32f4/startup_init.c @@ -240,10 +240,11 @@ __attribute((used)) void clear_otg_hs_memory(void) { __HAL_RCC_USB_OTG_HS_CLK_ENABLE(); // enable USB_OTG_HS peripheral clock so // that the peripheral memory is // accessible - memset_reg( - (volatile void *)USB_OTG_HS_DATA_FIFO_RAM, - (volatile void *)(USB_OTG_HS_DATA_FIFO_RAM + USB_OTG_HS_DATA_FIFO_SIZE), - 0); + __IO uint32_t* usb_fifo_ram = (__IO uint32_t*)USB_OTG_HS_DATA_FIFO_RAM; + + for (uint32_t i = 0; i < USB_OTG_HS_DATA_FIFO_SIZE / 4; i++) { + usb_fifo_ram[i] = 0; + } __HAL_RCC_USB_OTG_HS_CLK_DISABLE(); // disable USB OTG_HS peripheral clock as // the peripheral is not needed right now