From: Stephan Baerwolf Date: Tue, 10 Sep 2013 13:35:11 +0000 (+0200) Subject: introduce new feature: BOOTLOADERENTRY_FROMSOFTWARE X-Git-Tag: testing-head~27 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/fdd80449610db4cccc152e17b04cdb51de578a61?hp=fdd80449610db4cccc152e17b04cdb51de578a61 introduce new feature: BOOTLOADERENTRY_FROMSOFTWARE An USBaspLoader supporting this feature is able to be called (and bootLoaderConditioned) from user firmware. You can check MCUCSR watchdog-flag to check for success. (If USBaspLoader starts up, all MCUCSR are removed...) You can use something like this code to switch to the bootloader: #define BOOTLOADER_WORDADDRESS (BOOTLOADER_ADDRESS>>1) wdt_enable(WDTO_15MS); asm volatile ( "ldi r29 , %[ramendhi] \n\t" "ldi r28 , %[ramendlo] \n\t" "ldi r16 , %[boothi] \n\t" "st Y+ , r16 \n\t" "ldi r16 , %[bootme] \n\t" "st Y+ , r16 \n\t" "ldi r16 , %[bootlo] \n\t" "st Y+ , r16 \n\t" "resetloop%=: \n\t" "rjmp resetloop%= \n\t" : : [ramendhi] "M" (((RAMEND - 2) >> 8) & 0xff), [ramendlo] "M" (((RAMEND - 2) >> 0) & 0xff), [boothi] "M" (((BOOTLOADER_WORDADDRESS) >>16) & 0xff), [bootme] "M" (((BOOTLOADER_WORDADDRESS) >> 8) & 0xff), [bootlo] "M" (((BOOTLOADER_WORDADDRESS) >> 0) & 0xff) ); Signed-off-by: Stephan Baerwolf ---