[Bootloader]

- fixed cannot jump to application after flash update

git-svn-id: http://moon:8086/svn/projects/HendiControl@185 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-03-30 19:35:50 +00:00
parent 8f77e6dc2d
commit 0c4e46d9f7
+5 -6
View File
@@ -94,7 +94,7 @@ int main(void)
cli();
if (is_bsel())
{
bootloader_enter();
bootloader_enter();
led_bsel(1);
uart_init(115200);
uart_puts("Hendi-Control Bootloader v1.2\n");
@@ -227,10 +227,11 @@ int main(void)
state = state_next;
}
} while (!leave_loop);
uart_puts("Exit bootloader!\n\n");
bootloader_exit();
// After flash update: Without RWW section enable, jump to app will fail
boot_rww_enable();
}
bootloader_exit();
/* Return to address 0x0000 */
startApplication();
@@ -238,7 +239,6 @@ int main(void)
void erase_page(uint16_t page_addr)
{
// uart_puts("ErasePage: "); print_word(page_addr); uart_puts("\n");
eeprom_busy_wait ();
boot_spm_busy_wait ();
boot_page_erase (page_addr);
@@ -248,7 +248,6 @@ void write_page(uint16_t page_addr, uint8_t *pPageBuffer)
{
uint16_t i;
// uart_puts("Write page 0x"); print_word(page_addr); uart_puts("\n");
boot_spm_busy_wait (); /* Wait until the memory is erased. */
for (i=0; i<SPM_PAGESIZE; i+=2)