|
From: Vangelis R. <vr...@ot...> - 2003-05-09 22:41:49
|
Hi,
I have started writing a flex script to convert .dev files to SDCC
headers so that we can stop relaying on comments from the .inc files comming
from MPASM.
Well, below I cite a piece of a .dev file:
---
PIC8F442.DEV ---------------------------------------------------------------
sfr (key=TXSTA addr=0xFAC size=1)
reset (por='0000-010' mclr='0000-010')
bit (names='CSRC TX9 TXEN SYNC - BRGH TRMT TX9D')
sfr (key=RCSTA addr=0xFAB size=1)
reset (por='0000000x' mclr='0000000x')
bit (names='SPEN RX9 SREN CREN ADDEN FERR OERR RX9D')
cfgbits (key=CONFIG0H addr=0x300001 unused=0x0)
field (key=OSC mask=0x7 desc="Oscillator")
setting (req=0x7 value=0x7 desc="RC-OSC2 as RA6")
setting (req=0x7 value=0x6 desc="HS-PLL Enabled")
setting (req=0x7 value=0x5 desc="EC-OSC2 as RA6")
setting (req=0x7 value=0x4 desc="EC-OSC2 as Clock Out")
setting (req=0x7 value=0x3 desc="RC")
setting (req=0x7 value=0x2 desc="HS")
setting (req=0x7 value=0x1 desc="XT")
setting (req=0x7 value=0x0 desc="LP")
field (key=OSCS mask=0x20 desc="Osc. Switch Enable")
setting (req=0x20 value=0x20 desc="Disabled")
setting (req=0x20 value=0x0 desc="Enabled")
---------------------------------------------------------------------------
-
As one can see the SFRs can be generated without problem. The language
parsing directives are already working and I can use them to generate the
header file.
The problem is when trying to parse the configuration registers bit names.
In fact, THERE ARE NO names for the configuration bits (as you can see
above!!!). I could generate them from the <desc> field, but this would not
be compatible.
There are 2 possibilities (in fact there are 3 if I just abort the
script!):
1. we ask Microchip to add a field like name="_OSC_XT" in each
<setting> entry,
or
2. we continue using the comment lines from the .inc files just for the
configuration registers bit names.
I'll be waiting for your comments.
Vangelis Rokas
PS. Finally one could correct the problem in inc2h.pl (but I see there are
more issues, since the PORTx bit names are not defined. Is there a reason
for that?)
|