15 Jun 2012 22:11
[pic16] --stack-auto with sdcclib
Hello,
I found that using --stack-auto when (re)compiling sdcclib for needed
reetrancy (as manual recommends) can break int (and long)
multiplication in "user" code when interrupts are on.
And not only int/long, libmath too.
Looks like an "empty" ISR (which has only a prologue and epilogue) has
impact on _mulint result and using simple code:
volatile int x;
int main(){
while(1){
x=100;
x=x*x; // <x becomes not 10000 when ISR is active
}
When I disable interrupts at the end of _mulint reentrant code:
[...]
BCF _INTCONbits,7
MOVFF PREINC1, r0x09
MOVFF PREINC1, r0x08
MOVFF PREINC1, r0x07
MOVFF PREINC1, r0x06
MOVFF PREINC1, r0x05
MOVFF PREINC1, r0x04
MOVFF PREINC1, r0x03
MOVFF PREINC1, r0x02
MOVFF PREINC1, r0x01
MOVFF PREINC1, r0x00
MOVWF POSTINC1
MOVLW 0x05
(Continue reading)
RSS Feed