gnupic: recommended C compiler ??


Previous by date: 12 Apr 2002 14:06:05 -0000 Re: recommended C compiler ??, Linas Vepstas
Next by date: 12 Apr 2002 14:06:05 -0000 MDaemon Warning - Virus Found, postmaster.e-post.lt
Previous in thread: 12 Apr 2002 14:06:05 -0000 Re: recommended C compiler ??, Linas Vepstas
Next in thread:

Subject: Re: recommended C compiler ??
From: Scott Dattalo ####@####.####
Date: 12 Apr 2002 14:06:05 -0000
Message-Id: <Pine.LNX.4.33.0204120643290.8780-100000@ruckus.brouhaha.com>

On Fri, 12 Apr 2002, Linas Vepstas wrote:

> On Fri, Apr 12, 2002 at 06:03:33AM -0700, Scott Dattalo was heard to remark:
> >
> > If you're using or planning to use SDCC, then I strongly suggest using the
> > version out of CVS.
>
> I tired that, it looked pretty good.  Seemed to have two 'trivial' bugs
> (excuse me, I'm brand-spanking new to PIC's, so I assume they're bugs).
>
> 1) compiling main() { int i; while(1) { i++; }} generated code that
>    sat on top of 0x4 in ROM.  I thought 0x4 was the interrupt vector?

There's nothing wrong with sitting on the interrupt vector as long as you
have no interrupts! Try declaring an interrupt and SDCC will squeeze the
interrupt routine code in there for you.

Take a look at sdcc/src/regression/string1.c

There's interrupt routine declared:


void  isr(void) interrupt 1 using 1
{

  if(arr[3]!=9)
    failures++;
  PORTB = 7;
  B1=1;
}


there's:
    org 0

stuff...

and then:

;;	-----------------------------------------
;;	 function isr
;;	-----------------------------------------
;_isr:
_isr	;Function start
; 0 exit points
	GOTO	END_OF_INTERRUPT+1	;key=000,flow seq=018
;Start of new flow, seq=25
	NOP		;key=000,flow seq=019
	NOP		;key=001,flow seq=019
	NOP		;key=002,flow seq=019
	MOVWF	WSAVE	;key=003,flow seq=019
	SWAPF	STATUS,W	;key=004,flow seq=019
	CLRF	STATUS	;key=005,flow seq=019
	MOVWF	SSAVE	;key=006,flow seq=019

  <snip really inefficient code, sigh..>

	CLRF	STATUS	;key=003,flow seq=020
	SWAPF	SSAVE,W	;key=004,flow seq=020
	MOVWF	STATUS	;key=005,flow seq=020
	SWAPF	WSAVE,F	;key=006,flow seq=020
	MOVF	WSAVE,W	;key=007,flow seq=020
        ^^^^ bug! should be swapf

END_OF_INTERRUPT
	RETFIE		;key=008,flow seq=020

rest of the code...

And after posting this, I see a bug, dammit.

>
> 2) sdcc -m pic14 -p pic16c773 gave me the 16f877 core instead.  In fact,
>    any -p flag gave me the 877 core.  (first or second non-comment line
>    in the generated assembly).


Yes you can select other processors. For the time being, only the f84,
f876, f877, f627, and f628 are supported at the command line. Adding new
devices can be done via device.c. Ultimately, I want to write a script to
parse the microchip supplied .lkr files and extract the register mapping
that's unique for each PIC.


Scott


Previous by date: 12 Apr 2002 14:06:05 -0000 Re: recommended C compiler ??, Linas Vepstas
Next by date: 12 Apr 2002 14:06:05 -0000 MDaemon Warning - Virus Found, postmaster.e-post.lt
Previous in thread: 12 Apr 2002 14:06:05 -0000 Re: recommended C compiler ??, Linas Vepstas
Next in thread:


Powered by ezmlm-browse 0.20.