mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:24:40 +08:00
arch/avr: fixed PC load on chips with more than 128kB program memory
The code used subi instruction to decrement the Y pointer but this instruction only affects a byte, not a word. Fixed it by using pre-decrement in the LD instruction instead.
This commit is contained in:
@@ -465,7 +465,7 @@
|
||||
#if AVR_PC_SIZE <= 16
|
||||
adiw r28, REG_PC0
|
||||
#else
|
||||
adiw r28, REG_PC2
|
||||
adiw r28, (REG_PC2+1) /* Will pre-decrement this on use */
|
||||
#endif
|
||||
|
||||
/* Fetch and set the new stack pointer */
|
||||
@@ -490,14 +490,11 @@
|
||||
push r24 /* Push PC0 and PC1 on the stack (PC1 then PC0) */
|
||||
push r25
|
||||
#else
|
||||
ld r25, y /* Load PC2 (r25) */
|
||||
subi r28,1
|
||||
ld r25, -y /* Load PC2 (r25) */
|
||||
push r25
|
||||
ld r25, y /* Load PC1 (r25) */
|
||||
subi r28,1
|
||||
ld r25, -y /* Load PC1 (r25) */
|
||||
push r25
|
||||
ld r25, y /* Load PC0 (r25) */
|
||||
subi r28,1
|
||||
ld r25, -y /* Load PC0 (r25) */
|
||||
push r25
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user