WellDone/MoMo-Firmware — pull request #40 by timburke (2014-02-11 01:42:22+00:00)
Title: Final touches on mib12 platform: executive reflashing is now done

There were a few loose ends on the pic12 8-bit platform that this set of commits resolves.

- Finished compressing the mib12_executive so that it can be reflashed in place. Final size on 12lf1822 is 960 words (out of 2048). This means that we can now order chips with the mib12 executive preflashed on them and never need a pickit 2 again (for 8 bit chips).
- Created mib12_reflasher which takes in as a payload the new executive to reflash and when programmed like a normal application module, takes control and overwrites the mib12 executive with the new version. This has been tested in hw on pic16lf1847 and works as expected. The overwritten mib12_executive is byte-for-byte correct.
- In order to facilitate the creation of mib12_reflasher, I created hextool. hextool, like its predecessors mibtool, modtool and pcbtool, is a swiss army knife for one type of task. In this case, it is manipulating 8 bit hex files. hextool can compute checksums, patch instructions, verify hex file contents and importantly, insert one hex file into another in a smart way. This allows building the mib12_executive reflashing hex file which contains a stub (in momo_modules/mib12_reflasher) that just has reflashing code and a payload that contains the actual code to be reflashed over the mib12 executive.
- I also fixed various bugs in the pic12 build system and refactored some of the build tool functionality that was needed for hextool into the pymomo python package.

All of the core 8-bit pic executive code should now be ready to go, including the necessary support tools, build system and unit testing infrastructure.