Wednesday, July 6, 2011

Bootloader Beginnings

Before I even begin defining the sensor firmware I want to create a solid, easy to use bootloader. I referenced it in an earlier post and still like the idea of using an SD card. It's platform independent and requires no host machine or software. The drawback will be power consumption. I'm designing the platform to be battery powered and while SD cards aren't huge power hogs they're not exactly power sippers either in terms of embedded systems. Before we even get to the SD part though we need to make it so our PIC can read hex data and program itself. Many of the PICs including the one I'm using for the project are self programmable, meaning you don't need an external programmer to reprogram it. I've done this before using the Microchip bootloader as a base and customized it a bit but I never really loved how it was written and layed out. I'm going for simplicity. So how do we solve this problem if we've never done it before? We do what any good programmer would do with a complicated software problem; break it into small, manageable pieces. So here are the pieces I've come up with to create a bootloader.
  1. Understand the anatomy of a hex file. If we're going to read a hex file and reprogram a PIC then we'd better understand what a hex file looks like.
  2. Understand how to write to the PIC's program memory space.
  3. Implement flash memory routines for the bootloader in C
  4. Implement programming routines to program the PIC from hex data.

The Spec

So what is the specification we are tackling here. I think it's good to define what "done" is so here's what I've got:

As a user I want to be able to update the firmware on the platform with an SD card containing the updated firmware.

It's not too specific but that's ok. In my next post we'll start breaking down the pieces to our problem and see where we get.

No comments:

Post a Comment

Keep it clean and civil. That's all I ask.