sdcc version 3.4.0, 3.4.1
on PIC18F46K22 when comping target with
--use-non-free --pstack-model=large --extended --std-sdcc99
When call function, after returning from it stack pointer grow:
so function:
uint8_t test(uint8_t a){
return a;
}
for this function call generated asm code:
; .line 30; main.c test(a);
MOVF _a, W, B
MOVWF POSTDEC1
CALL _test
MOVF POSTINC1, F
where _test
; ; Starting pCode block
S_main__test code
_test:
; .line 10; main.c uint8_t test(uint8_t a){
MOVFF FSR2H, POSTDEC1
MOVFF FSR2L, POSTDEC1
MOVFF FSR1H, FSR2H
MOVFF FSR1L, FSR2L
MOVLW 0x03
MOVFF PLUSW2, 0x00
; .line 11; main.c return a;
MOVF 0x00, W
MOVFF PREINC1, 0x00
MOVFF PREINC1, FSR2L
MOVFF PREINC1, FSR2H
RETURN
so after calling this simple function stack pointer grows on 2
this issue only when compiling with --extended
As long as I know, extended instructions for pic 16 port have never worked well on SDCC and its use is discouraged.
EDIT: sorry Raphael, somehow I misread this as a newbie question so all that I said is fully known by you :D
Last edit: Diego Herranz 2014-07-11
nobody should test sdcc pic16 port with --extended?
i think if we will know all bugs, than we can fix it.
Egan,
I misread it as a question instead of a bug report. I would have deleted my comment completely but it seems that is not possible.
Of course, I agree that it's good to know where the bugs related with --extended are.