Skip to content

Commit

Permalink
sn32: support bootloader jump
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter93 committed Jan 11, 2022
1 parent b4fe478 commit 83127a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions platforms/chibios/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ __attribute__((weak)) void bootloader_jump(void) {
}
# endif /* defined(BOOTLOADER_KIIBOHD) */

#elif defined(SN32_BOOTLOADER_ADDRESS)
#elif defined(SN32F2)

# define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
extern uint32_t __ram0_end__;
# define BOOTLOADER_MAGIC 0xDEADBEEF
# define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)

void bootloader_jump(void) {
__attribute__((weak)) void bootloader_jump(void) {
*MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
// Wait for memory to be set before the reset
for(volatile uint32_t i = 0; i < 32; i++){
Expand Down

0 comments on commit 83127a5

Please sign in to comment.