From: Terry P. <te...@d2...> - 2002-07-25 04:35:09
|
On Wed, Jul 24, 2002 at 06:17:54AM -0700, Scott Dattalo wrote: > On Wed, 24 Jul 2002, Terry Porter wrote: > > > I've got a problem compiling, and was wondering > > if anyone could please give me a pointer ? > > > > It's been a while since I did any PIC programming, and I'm rusty, especially > > with the Trisb command. > > > > The version is the latest SDCC from CVS and has Scotts most recent (ISR) > > fix. gpsim-0.20.14, and gputils-0.10.3. > > > > I must say that Gpsim has come so far since last I looked, and it > > really rocks! > > Thanks Terry. gpsim, btw for others, is the gnupic simulator. Most of the > "it rocks" part is due to Ralf Forsberg enhancements in the gui. Scott is too humble, for a start I can now compile without readline probs, and gpsim is the coolest without the GUI, otherwise how could we poor PIC designers simulate our unworthy code :) > > <snip led.c> > > > > > This is Scott's standard example file, and its unmodified. > > > > I get the following error :- > > > > > > > > sh-2.05a$ make sim > > sdcc -S -mpic14 led.c > > printIvalChar > > No registers saved on this pass > > No registers saved on this pass > > gpasm -c led.asm > > led.asm:500:Message [302] Register in operand not in bank 0. > > Ensure bank bits are correct. > > This is no bug. It's a nuisance warning from gpasm (which in this case is > immitating exactly the nuisance warning you get from MPASM). > > I personally ignore these. However, there is a command line switch in > gpasm that will allow you to warning messages. You can individually select > which message to ignore. I don't recall the command line option off > hand... Warnings don't bother me, as I get a lot when compiling my C code for x86. > > > > > ........................... led.asm............................ > > ; TRISB = 0; > > CLRF _TRISB << line 500 > > BCF _STATUS,5 > > And there's probably a "BSF _STATUS,5" a few lines up. So there is:- _main ;Function start ; 2 exit points BSF _STATUS,5 ;#CSRC led.c 64 ; TRISB = 0; CLRF _TRISB BCF _STATUS,5 > The BSF/BCF are > switching the register banks. Take a look at the 'f877 memory map in the > data sheet. You'll see that TRISB and PORTB have the same lower 7-bits in > their addresses. The upper two bits are selected by RP0 and RP1 in the > status register. You (or SDCC in this case) need to set these upper bits > appropriately so that the proper register is accessed! What gpasm is > telling you in the warning, is that the address of _TRISB (which is 0x86) > is greater than the 7-bits allotted in the CLRF instruction. I thought that was the case, however gpsim wouldnt run, and like a moron I assumed that the code wasnt compiled. Sometimes when I don't get something I *really* don't get something. I've just run the code in gpsim manually without using your "led" example makefile and its working perfectly! Thanks again Scott, I must say the SDCC PIC support has a rock solid feel to it. Does its support the PIC16C/F84 at all ? Although the chip is depreciated, I've a couple here and would like to try some test code on my r&d setup. -- Kind Regards from Terry My Desktop is powered by GNU/LinuX, Sorcerer kernel 2.4.17 Free Micro burner: http://w3w.arafuraconnect.com.au/~tp/burn.html ** Linux Registration Number: 103931, http://counter.li.org ** |