gnupic: SDCC Pic Port


Previous by date: 12 Nov 2000 23:14:15 -0000 Re: PIC17C7xx gpasm support?, Scott Dattalo
Next by date: 12 Nov 2000 23:14:15 -0000 gpasm-0.8.12 - ERRORLEVEL directive works, Scott Dattalo
Previous in thread:
Next in thread: 12 Nov 2000 23:14:15 -0000 Re: SDCC Pic Port, Wojtek Zabolotny

Subject: SDCC Pic Port
From: Scott Dattalo ####@####.####
Date: 12 Nov 2000 23:14:15 -0000
Message-Id: <Pine.LNX.4.21.0011121700470.27546-100000@tempest2.blackhat.net>

I've gone ahead and bit the bullet. I'm starting to port SDCC, Sandeep Dutta's
Small Device C Compiler, to the PIC. SDCC's home page: 
http://sdcc.sourceforge.net/

Sandeep and his team have done most of the hardwork. SDCC creates an
intermediate file that is processed with the device specific code. Some things
like dead code removal, loop optimization, etc. have already been done. This is
going to be a large effort and I'll say up front: NO promises! I've got a
request to Sandeep to get developer's access to their CVS. I'll keep everyone
here posted on the progress.

As I told Sandeep, the plan is this: 
  phase 1 - Port expression's
  phase 2 - Port Call's/Function entry/exit and psuedo stack/register allocation

The reason for this approach is that I'll hopefully learn the SDCC intracacies
good enough during the expression port that I'll be able to handle the much more
difficult parameter passing and function calls.

I've already got addition and subtraction working. I'm in the process of porting
the boolean operators. If you're interested, here's some real output:


test code :


int aint0 = 0;
char achar0 =0;

int test_plus(void)
{

  achar0++;              /* line 22 of t.c */
  achar0 = achar0 + 1;
  achar0 = achar0 + 2;
  achar0 = achar0 + 3;

  aint0++;
  aint0 = aint0 + 1;
  aint0 = aint0 + 2;
  aint0 = aint0 + 3;

}

Compiled output:

;	t.c 22
	incf	_achar0,f
;	t.c 23
	incf	_achar0,f
;	t.c 24
	incf	_achar0,f
	incf	_achar0,f
;	t.c 25
	movlw	0x3
	addwf	_achar0,f
;	t.c 27
	incf	(_aint0 + 1),f
	incfsz	_aint0,f
	decf	(_aint0 + 1),f
;	t.c 28
	incf	(_aint0 + 1),f
	incfsz	_aint0,f
	decf	(_aint0 + 1),f
;	t.c 29
	movlw	0x2
	addwf	_aint0,f
	rlf	_known_zero,w
	 addwf	(_aint0 + 1),f
;	t.c 30
	movlw	0x3
	addwf	_aint0,f
	rlf	_known_zero,w
	 addwf	(_aint0 + 1),f

In case you're wondering, I have no specific deadline for completing this. In
fact, I'd be surprised if the expression stuff is fully working within 3
months. Of course, if anyone cares to help...

Scott


Previous by date: 12 Nov 2000 23:14:15 -0000 Re: PIC17C7xx gpasm support?, Scott Dattalo
Next by date: 12 Nov 2000 23:14:15 -0000 gpasm-0.8.12 - ERRORLEVEL directive works, Scott Dattalo
Previous in thread:
Next in thread: 12 Nov 2000 23:14:15 -0000 Re: SDCC Pic Port, Wojtek Zabolotny


Powered by ezmlm-browse 0.20.