PDA

View Full Version : Bootloader for device with SD card



Alexey
- 9th May 2012, 18:52
Hello again, Guys,

Thanks to http://www.picbasic.co.uk/forum/image.php?u=220&dateline=1288665494I have a device with SD card (still not that advanced as Makrakit's one but it works) and now start thinking that having SD card already connected, it would be very nice to have an option to update firmware from it...

Will very much appreciate if someone could share a sample code for loading firmware from SD card

Thank you,

Alexey

comwarrior
- 18th July 2012, 01:32
I've actually been thinking along similar lines recently since i've finally go FSSD3 working... ish...

The first question becomes, what do you want to do with the system?

I don't know much about the HEX file format, but, theoretically, the hex file could be saved to SD with a specific file name...
When the PIC boots, it looks for that specific file name on the card, loads it sector by sector into ram, and with each sector it self programs into a specific memory location.

The only issues i see, is reconfiguring the fuses... and re-configuring interrupts...

The interrupt issue, if we use DT's interrupt system as an example. All you's need to do is to define every single interrupt and give it it's own sub routine. Make sure each sub routine has it's own specific small block of memory (just enough to add in a jump to your own custom sub routine) then with each new firmware it overwrites all the interup sub routines with jumps to your own sub routines for the interrupts your actually using.
If an interrupt that your not using goes off then it jumps into an empty sub routine and then returns clearing the interrupt...

Another way of doing it, is to use one pic to program the other from the new hex... but that has it's own problems too...

mackrackit
- 18th July 2012, 03:42
A friend of mine actually has something like this running. He said it is not quite ready to release into the wild. He will sooner or later.

Alexey
- 18th July 2012, 05:29
Thank you, Mackrackit, we will wait :)

longpole001
- 25th August 2013, 03:23
did some sample bootloader code using a SD eventuate for release