You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

bootloader.c 459B

12345678910111213141516
  1. #include "bootloader.h"
  2. #include "ch.h"
  3. #ifdef STM32_BOOTLOADER_ADDRESS
  4. #define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
  5. extern uint32_t __ram0_end__;
  6. void bootloader_jump(void) {
  7. *((unsigned long *)(SYMVAL(__ram0_end__) - 4)) = 0xDEADBEEF; // set magic flag => reset handler will jump into boot loader
  8. NVIC_SystemReset();
  9. }
  10. #else /* STM32_BOOTLOADER_ADDRESS */
  11. void bootloader_jump(void) {}
  12. #endif /* STM32_BOOTLOADER_ADDRESS */