[riot-notifications] [RIOT-OS/RIOT] cpu/stm32: implement reset to bootloader (#14119)

benpicco notifications at github.com
Sat May 23 14:31:50 CEST 2020


@benpicco commented on this pull request.



> +    /* remap ROM at zero */
+#if defined(SYSCFG_MEMRMP_MEM_MODE_0)
+    SYSCFG->MEMRMP = SYSCFG_MEMRMP_MEM_MODE_0;
+#elif defined(SYSCFG_CFGR1_MEM_MODE_0)
+    SYSCFG->CFGR1  = SYSCFG_CFGR1_MEM_MODE_0;
+#endif
+
+    /* load bootloader address into r0 */
+    register uint32_t dst __asm__("r0") = STM32_LOADER_ADDR;
+
+    /* jump to the bootloader */
+    __asm__ volatile("mov sp, %0" :: "r" (dst));
+    __asm__ volatile("mov pc, %0" :: "r" (dst));
+}
+
+void __attribute__((weak)) usb_board_reset_in_bootloader(void)

Not all STM32 parts implement a DFU bootloader, e.g. the stm32f103c8 found on the bluepill boards only implements UART mode. So there for flashing over USB you'll need a separate software bootloader like the [STM32duino-bootloader](https://github.com/rogerclarkmelbourne/STM32duino-bootloader).

This way the generic (ROM) bootloader reset can be overwritten by a board-specific boot loader reset. (And yea I'll add conditional compilation to `pre_startup()`)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14119#discussion_r429542098
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200523/bc385002/attachment.htm>


More information about the notifications mailing list