From: Frans S. <fra...@gm...> - 2009-03-02 08:16:50
|
Hi Francesco, I think this is a great approach, especially if we can load all the data from piklab directly. I really haven't done anything with XML files yet, so I will have to read some tutorials I guess. Do you know if there are some standard tools to parse them using simple scripts or something? I agree that the hex flags are ugly, it was just something I still had in mind for the future :) I don't know yet what to do with the PicFamily, This one is quite necessary for the firmware... The config mask won't be necessary anymore since the flag names replace it. The devid mask is something very important, since the devid is divided into two portions, devid and revision. Some devid's have 4 bits for the revision and some have 5, so we can't just hard-code it to 4 or 5 bits. Let me check out how piklab does it... Cheers, Frans Francesco Montorsi wrote: > Hi Frans, > I'm looking at implementing loading PIC data from Piklab XML as we talked > about some time ago. > This would allow to have an "Info" page next to the "Code", "Cfg flags" and > "Data" current pages with lots of info about the selected PIC and to have the > "Configuration flags" page reorganized to contain e.g. an array of checkboxes > which indicate "Oscillator type", etc etc. This last feature in particular would > help very much IMO (looking at the flags in hexadecimal form is quite ugly). > > Looking at the UPP source file, for example for PIC16F84A, I see: > > { > "P16F84A", //Name > 0x1FF*2, //CodeSize > 0x2007, //ConfigAddress > 0x2100, //DataAddress in hex file > 0x40, //Datasize > 0x2, //ConfigSize > P16F84A, //PicFamily > 0x0560, //DevId > 0x3FE0, //DevIdMask > {0xFF,0x3F} > }, > > the relative XML data is: > > <device name="16F84A" ... id="0x0560" ...> > .... > > <!--* Memory ***************************************************************--> > <memory name="code" start="0x0000" end="0x03FF" /> > <memory name="user_ids" start="0x2000" end="0x2003" rmask="0x007F" /> > <memory name="device_id" start="0x2006" end="0x2006" /> > <memory name="config" start="0x2007" end="0x2007" /> > <memory name="eeprom" start="0x0000" end="0x003F" hexfile_offset="0x2100" /> > > <!--* Configuration bits ***************************************************--> > <config offset="0x0" name="" wmask="0x3FFF" bvalue="0x3FFF" > > <mask name="FOSC" value="0x0003" > > <value value="0x0000" name="LP" cname="_LP_OSC" /> > <value value="0x0001" name="XT" cname="_XT_OSC" /> > <value value="0x0002" name="HS" cname="_HS_OSC" /> > <value value="0x0003" name="EXTRC_CLKOUT" cname="_RC_OSC" /> > </mask> > <mask name="WDT" value="0x0004" > > <value value="0x0000" name="Off" cname="_WDT_OFF" /> > <value value="0x0004" name="On" cname="_WDT_ON" /> > </mask> > <mask name="PWRTE" value="0x0008" > > <value value="0x0000" name="On" cname="_PWRTE_ON" /> > <value value="0x0008" name="Off" cname="_PWRTE_OFF" /> > </mask> > <mask name="CP" value="0x3FF0" > > <value value="0x0000" name="All" cname="_CP_ON" /> > <value value="0x3FF0" name="Off" cname="_CP_OFF" /> > <value value="default" name="invalid" /> > </mask> > </config> > .... > </device> > > So that the info we currently keep in pictype.cpp could be loaded from (using a > pseudo syntax to refer to the XML tags and XML attributes): > > typedef struct { > string Name; <== "P"+ <device@name> > int CodeSize; <== <memory@name="code"@end> - <memory@name="code"@start> > int ConfigAddress; <== <memory@name="config"@start> > int DataAddress; //in hex file <== <memory@name="eeprom"@hexfile_offset> > int DataSize; <== <memory@name="eeprom"@end> - <memory@name="eeprom"@start> > int ConfigSize; <== <memory@name="config"@end> - <memory@name="config"@start> > PicFamily picFamily; > int DevId; <== <device@id> > int DevIdMask; > int ConfigMask[16]; > } Pic; > > stuff that seems cannot be loaded from XML is thus: > > 1) PicFamily picFamily; > This is a number corresponding to the UPP internal classification of > the PIC families and thus is obviously not present in Piklab XML files. > I think we can't do nothing about this. > > 2) > int DevIdMask; > int ConfigMask[16]; > maybe I'm just missing something but this data cannot be derived from the data > contained in Piklab XML files in some way? > > > It would be nice to be able to load all data from the Piklab XML files without > being forced to modify them so that we could simply overwrite our XML files with > Piklab's updated ones from time to time. > > Thanks, > Francesco > > |