bootapp cleanup

This commit is contained in:
Alex Voinea 2023-09-27 17:11:19 +02:00
parent 5466bfb500
commit dd32f7be3c
4 changed files with 7 additions and 7 deletions

View File

@ -920,7 +920,7 @@ void update_sec_lang_from_external_flash()
} }
} }
} }
boot_app_flags &= ~BOOT_APP_FLG_USER0; boot_app_magic = 0;
} }
@ -4092,8 +4092,7 @@ void process_commands()
} }
else if (code_seen_P(PSTR("RESET"))) { // PRUSA RESET else if (code_seen_P(PSTR("RESET"))) { // PRUSA RESET
#if defined(XFLASH) && defined(BOOTAPP) #if defined(XFLASH) && defined(BOOTAPP)
boot_app_magic = BOOT_APP_MAGIC; boot_app_magic = 0;
boot_app_flags = BOOT_APP_FLG_RUN;
#endif //defined(XFLASH) && defined(BOOTAPP) #endif //defined(XFLASH) && defined(BOOTAPP)
softReset(); softReset();
} }

View File

@ -24,8 +24,7 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
{ {
cli(); cli();
boot_app_magic = BOOT_APP_MAGIC; boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags |= BOOT_APP_FLG_COPY; boot_app_flags |= BOOT_APP_FLG_COPY | BOOT_APP_FLG_ERASE;
boot_app_flags |= BOOT_APP_FLG_ERASE;
boot_copy_size = (uint16_t)size; boot_copy_size = (uint16_t)size;
boot_src_addr = (uint32_t)rptr; boot_src_addr = (uint32_t)rptr;
boot_dst_addr = (uint32_t)fptr; boot_dst_addr = (uint32_t)fptr;
@ -38,6 +37,7 @@ void bootapp_reboot_user0(uint8_t reserved)
cli(); cli();
boot_app_magic = BOOT_APP_MAGIC; boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags = BOOT_APP_FLG_USER0; boot_app_flags = BOOT_APP_FLG_USER0;
boot_copy_size = 0;
boot_reserved = reserved; boot_reserved = reserved;
// bootapp_print_vars(); // bootapp_print_vars();
softReset(); softReset();

View File

@ -17,11 +17,10 @@
#define BOOT_APP_FLG_ERASE 0x01 #define BOOT_APP_FLG_ERASE 0x01
#define BOOT_APP_FLG_COPY 0x02 #define BOOT_APP_FLG_COPY 0x02
#define BOOT_APP_FLG_FLASH 0x04 #define BOOT_APP_FLG_FLASH 0x04
#define BOOT_APP_FLG_RUN 0x08
#define BOOT_APP_FLG_USER0 0x80 #define BOOT_APP_FLG_USER0 0x80
#define BOOT_APP_MAGIC 0x55aa55aa #define BOOT_APP_MAGIC 0x55aa55aaUL
#if defined(__cplusplus) #if defined(__cplusplus)

View File

@ -161,6 +161,8 @@ uint8_t optiboot_xflash_enter()
lcd_clear(); lcd_clear();
lcd_puts_at_P(0, 1, PSTR(" Upgrading xflash\n Do not disconnect!")); lcd_puts_at_P(0, 1, PSTR(" Upgrading xflash\n Do not disconnect!"));
boot_app_magic = 0; //disable the bootapp if a watchdog reset is going to be used
/* Forever loop: exits by causing WDT reset */ /* Forever loop: exits by causing WDT reset */
for (;;) { for (;;) {
/* get character from UART */ /* get character from UART */