I'm trying to insert some 2 instruction cycles delays in my code so I tried:
_asm
#if target_clock == 4
nop
nop
#elif target_clock == 10
nop
nop
nop
nop
nop
#endif
_endasm;
That did not work, when I tried to compile it complains about errors in
the peephole optimizations. So I changed it to:
#if target_clock == 4
_asm
nop
nop
_endasm;
#elif target_clock == 10
_asm
nop
nop
nop
nop
nop
_endasm;
#endif
And now it generates the desired assembler, but I want to save some code
memory so I am now trying with:
#if target_clock == 4
_asm
goto $+1
_endasm;
#elif target_clock == 10
_asm
nop
goto $+1
goto $+1
_endasm;
#endif
But when I try to compile it gives the following error:
...
Error while parsing peep rules (check peeph.def)
Line: goto $+1
Token: '$'
If I use 'goto ($+1)' instead the error now is:
Error while parsing peep rules (check peeph.def)
Line: goto ($+1)
Token: '('
OK so then I tried usign labels:
_asm
goto nextinstr
nextinstr:
_endasm;
And the error was:
;#CSRC irda_sir_phys.c 107
; _endasm;
GOTO nextinstr
ERROR: LinkFlow, branch instruction doesn't have label
;#CSRC irda_sir_phys.c 107
; _endasm;
GOTO nextinstr
ERROR: LinkFlow, branch instruction doesn't have label
Couldn't find label nextinstr+ "gpasm" -c "irda_sir_phys-16F873_4.asm"
irda_sir_phys-16F873_4.asm:262:Error [113] Symbol not previously defined
(nextinstr).
irda_sir_phys-16F873_4.asm:263:Error [113] Symbol not previously defined
(nextinstr).
So I used labels like the ones in the manual examples:
_asm
goto 00001$
00001$:
_endasm;
And the error is:
Error while parsing peep rules (check peeph.def)
Line: goto 00001$
Token: '$'
So I will stick to the 'nop' method for now but can someone please tell
me how can I get those gotos inserted in my code?.
Here is the sdcc info:
mono-at-tesla:src$ sdcc --version
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.4.7 #902 (Dec 15 2004) (UNIX)
|