Hi! I have earlier made a project for a pic16f690 micro controller and two days ago, I had to add some new features to it. Usually this is not a problem. But my friend, who use the electronics reported that the new is not working anymore. I made several recompile and sent them, but all failed.
I use linux box for almost everything (coding + svn), and a virtual
WinXP to check the sw with MPLAB.
Whenever I recompile the project under WinXP, it works perfectly, but if
I compile it under linux there are differences in the generated hex
file, and it fails.
The project contains several source files and compiled with makefile,
the c files are compiled to asm with sdcc and then with gpasm; finally
all object files linked with gplink.
I use local tools:
SDCC : pic16/pic14 2.9.7 #5873 (Jul 10 2010) (Linux)
gpasm-0.13.7 beta
I figured out, that the problem might be at switch statements. The
address to the goto field is somehow multiplied by two. Thus the
generated code points to somewhere else.
E.g. the address of label _00113_DS_ is not 0x00e5 but 0x01ca (= 2 *
0x00e5)!
See the code snippet below.
It seems that sdcc compiles well(?), but I don't know how to check the
object files against this to be sure.
Can somebody offer me a solution? Nobody meet this?
I have attached a small code with that produces this.
Theblond
Code snippet from switch.lst:
; .line 11; "switch.c"
switch(a)
0000da 3001 movlw 0x1 MOVLW HIGH(_00113_DS_)
0000db 008a movwf 0xa MOVWF PCLATH
0000dc 30ca movlw 0xca MOVLW _00113_DS_
0000dd 1283 bcf 0x3, 0x5 BANKSEL _a
0000de 1303 bcf 0x3, 0x6
0000df 072c addwf 0x2c, w ADDWF _a,W
0000e0 1803 btfsc 0x3, 0 BTFSC STATUS,0
0000e1 0a8a incf 0xa, f INCF PCLATH,F
0000e2 1283 bcf 0x3, 0x5 BANKSEL PCL
0000e3 1303 bcf 0x3, 0x6
0000e4 0082 movwf 0x2 MOVWF PCL
_00113_DS_
0000e5 28e9 goto 0xe9 GOTO _00105_DS_
0000e6 28ed goto 0xed GOTO _00106_DS_
0000e7 28f1 goto 0xf1 GOTO _00107_DS_
0000e8 28f5 goto 0xf5 GOTO _00108_DS_
switch.tar.bz2
Description: application/redhat-package-manager
------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________ Sdcc-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sdcc-user
