gnupic: SDCC Pic Port
Subject:
Re: SDCC PIC Port
From:
####@####.#### (Linas Vepstas)
Date:
19 May 2002 13:53:41 -0000
Message-Id: <20020519134404.GA7692@backlot.linas.org>
On Thu, May 16, 2002 at 10:15:49PM -0700, Scott Dattalo was heard to remark:
>
> It's been a while since I've said anything about SDCC. A lot has changed.
> I'm not even sure where to begin.
>
> data at 0xa2 unsigned int ui_bank1_temp=0;
>
> and you can do it with bits too:
>
> #define BIT_AT(base,bitno) bit at ((base<<3)+bitno)
> #define TRISB_ADR 0x86
>
> BIT_AT(TRISB_ADR,0) TRISB0;
>
> -- Config word is supported
>
> #define _WDT_OFF 0x3FFB
> #define _PWRTE_ON 0x3FF7
>
> typedef unsigned int word;
>
> word at 0x2007 CONFIG = _WDT_OFF & _PWRTE_ON;
It sure would be nice if someone put together an SDCC-PIC howto
that included the above information. Its all too easy to loose a few
afternoons figuring out the stuff above on one's own; never mind one has
to be clever to figure it out ....
But if one does figure it out, one is rewarded... I was able to write a
fairly long program (some 6 or 8 subroutines, maybe approaching a KLOC
of C code) that, with a few bug work-arounds, works fine (it does a/d
conversions on the 16f873, and spits stuff out on the serial port).
So I think SDCC is quite usable by the more adventurous ...
> -- bugs, bugs, and more bugs were fixed. A special thanks goes to Linas
> Vepstas for numerous bug reports.
Don't know how many of these bugs got fixed. The howto might want to
discuss bug-work-arounds. For example, I tripped on the following
'feature':
const char *mystr = "Hello, World!\n";
works find in SDCC, but
char *mystr = "Hello, World!\n";
does not (the former goes into program memory, since its const; the
latter goes into data registers, since its not const, and might be
altered by the program. PICs have a whole lot more program memory than
data memory ...).
--linas
--
pub 1024D/01045933 2001-02-01 Linas Vepstas (Labas!) ####@####.####
PGP Key fingerprint = 8305 2521 6000 0B5E 8984 3F54 64A9 9A82 0104 5933