[PicForth] 16F88 bootLoader

bitwLister lister at bitwisetech.com
Tue Mar 8 17:05:08 CET 2005


Hi Folks,
   First, thanks and appreciation to Sam and to Dave for sharing work on  
monitor, boot loader.
In the spirit of giving back, I can report success in getting your boot  
loader working on
the PIC 16F88 chip.
   It's flash can be erased only in blocks of 32 words, using a sequence  
similar to the 'flash
write' code but with the 'Flash Row Erase' bit set in the EECON1 control  
word. It is obligatory
to erase flash locations before they can be programmed. I made these  
changes:

  1) In pic16f88.inc, I added an EECON1 bitfield for 'Flash Row Erase'
  2) I copied picflash.fs to picflash-f88 with 'flash-write' cloned as  
pic-row-erase,
     setting and clearing the 'flash row erase' bitfield in tandem with  
'write enable'
  3) In serial monitor code, I added a new command 'B' (Blank Block) that  
calls the
     above routine to erase a 64 byte block of flash
  4) I went to work on Dave's pfd.py serail downloader  to:
       Create a list of block start addresses needing to be erased,
       Vet those addresses to prevent whacking the vector space at 0000
         and of course the config word space
       Add tty commands to call the 'B' Blank Block commands to erase
         flash areas prior to writing the app.
       I've avoided serpents in the past, I'm not proud of the hacks.
     By the way, pfd.py uses a "sum()" function not available in Python
       prior to 2.3 .. for example in Fedora FC1 ..
  5) The 'block erase' nature of the 'f88 imposes a couple of restrictions:
       You must org your app at 0x0020 or higher so that you don't need to
       block erase the vector space at 0x0000.
       The jump vectors at the beginning of serial monitor must sit right  
at the
       edge of an erase block separate from the rest of the monitor, that  
way
       the jump vectors can be erased and re-written without clobbering the
       remainder of sermon
  6) Last point means
       the 'constant origin' at the start of sermon is set to S0DF8;
       pfd.py sets up a forced call to block erase 0x0DE0 thru 0x0DFF
       your app must start at 0x0020 lowest;  0x0DDF highest

   In the words of Miz McElhone, "It isn't so bed" !

  One more thing, I got prog84 working on 16F88 chips by adding  the  
following line
   in pictypes.h ..
   {"16F88"   , FLASH5, 14,  8,  1000,  1,  0, 4096,  256, 0, 0},

   So I don't have to wine any more !

  I hope this helps,

  Cheers, Polly


<=>


More information about the PicForth mailing list