The structure IntDeviceTypes in pictypes.c pictypes.c .h contains the definitions for all the PIC's. The information is obtained from the Microchip programming specification. Beware, they are not always accurate, and they don't always bother correcting them!
When adding a new type, it is good to get a second person to independently create the record, and compare the two, it is easy to get it wrong. (This how the "Add all PIC's" task should be implemented)
This is copied to a data structure, so it can be easily read in from an external file in future.
It is arranged as neat columns keep it this way. Beware: Don't use a leading 0 on numbers 0123 is octal123!
Masks are used to control the bits of the config register
The process is: Choose the nearest device and copy that line,
For bit mask columns: 0= does nothing,
* MASK=active SETS bits in mask, ~MASK=active CLEARS bits of mask
* is_flash [FL] 1 for early flash devices, 2 for later flash devices and 0 for eprom/otp
* core_bits [BIT] 12 or 14 bit instruction set
* prgdly time for 1 program pulse in us. For flash it is MAX time.
* for all flash devices, bulk erase time is 10ms set in erase routine
* ntries [N] maximum number of tries before abandoning programming attempts
* nreburn [RE] number of reburn or over-program pulses=Nactual*RE +B
* [B] see 16C505 datasheet. Currently B is 0 for all devices.
* psize, dsize [PM,DM] program and data(EEPROM) memory sizes
* config_mask; masks config word reads/writes (12C508/9 only reads low 5 bits)
* config_idle [CIDL] This is the idle value, ie set any bit that must be 1 here
* eg unimplemented bits
* fosc [FO] mask for oscillator freq select bits (currently) only 3 or 7
* Config bit flags: Use ~ for flags that are true if set to 0
* eg pwrte=~8 in 16F84 ie bit 3=0 -> pwrt enabled
* for the code protect flags more than one bit may be needed
* CPD is the same as DP on some processors
* device_id [ID] for devices with an id (currently 16F8XX)
* Base Addresses: These are the addresses of the various memory arrays in the
* hex file. Generally only different between 12 & 14 bit cores
* osc_cal [OSCCAL] Location of the oscillator calibration value if present
* (0 otherwise). generally last location in program memory
When you add a new line don't forget to increment NUM_INT_PICTYPES
It is anticipated that the ability to read an external text file containing PIC definitions will be added. The file rdpics.c is the empty shell for this function. rd_types.c contained a start on implementing it.
It would be great to find somewhere that the info can be extracted from files rather than being entered by hand.