From ab3b07eb65155234163e1caf94674737fef0afea Mon Sep 17 00:00:00 2001 From: Stephan Baerwolf Date: Wed, 1 Aug 2012 23:37:14 +0200 Subject: [PATCH] change interface function "bootloader__so_spm" to avoid application crashes Signed-off-by: Stephan Baerwolf --- firmware/spminterface.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/firmware/spminterface.h b/firmware/spminterface.h index 846ae87..384ae68 100644 --- a/firmware/spminterface.h +++ b/firmware/spminterface.h @@ -36,7 +36,7 @@ bootloader__do_spm: ;you may also want to disable wdt, since this routine may busy-loop ;================================================================== ;-->INPUT: -;spmcr (spmcrval determines SPM action) will be register: r10 +;spmcr (spmcrval determines SPM action) will be register: r18 ;MCU dependend RA(MPZ should be transfered within register: r11 ;lo8(Z) should be transfered within register: r12 ;hi8(Z) should be transfered within register: r13 @@ -56,13 +56,19 @@ mov r30, r12 mov r31, r13 wait: ;check for previous SPM complete -in temp1, SPMCR -sbrc temp1, SPMEN +in temp0, SPMCR +sbrc temp0, SPMEN rjmp wait out SPMCR, spmcrval ;SPM timed sequence spm +;avoid crash of userapplication +ldi spmcrval, ((1<