I'm referring to the PIC microcontrollers, specifically the 16f and 18f series - could the GPIO be used in this way?
If so, how?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
Older PICs relied on the programmer to provide the timing for programming the Flash. I suspect that the RPi would be capable of getting those timings correct. The main difficulty in that case would be the level conversion from 3.3V to 5V for the PIC
Newer PICs do the programming timing internally and some can be programmed at 3.3V. Those should be able to be connected directly to some IO pins.
Now you have the read the programming specification for that specific PIC family and work out how to manipulate the GPIOs to get the program in there.
It will be quite interesting if you get something working.
Software-wise, there is an open source pic programmer program for linux called odyssey. It is used with programmers connected to a parallel port. Odyssey communicates by bitbanging, so it should be possible to adapt it to send the data to the GPIO instead of a parallel port. Odyssey supports a lot of the 16f and 18f PIC:s, and is able to read several formats of HEX files.
Another open project for pic programming is usbpicprog. This one could also be worth a look, but it is more complicated as it is a programer connected to the USB port, built around a pic18f2550. This programmer has a great feature: it generates the +12V programming voltage with a charge pump, thus it doesn't need any other power source than +5V over USB.
Note that these circuits require an external 12V power source, and a few additional components (voltage regulator, transistors, capacitors, resistors, and some LEDs in the advanced one).