View previous topic :: View next topic |
Author |
Message |
f00dstamps
Joined: 28 Mar 2006 Posts: 10 Location: Kansas City, MO
|
SPI bootloader over MMC |
Posted: Thu Apr 20, 2006 4:43 pm |
|
|
do you all think it's possible to bootload via SPI using a hex file stored on an MMC/SD card? i don't think i could store all the code that would read data from the MMC and store it into program space in 256 words.
please advise. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Apr 20, 2006 6:55 pm |
|
|
Yes it is possible. Why does the bootloader need to fit in 256 words? _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
f00dstamps
Joined: 28 Mar 2006 Posts: 10 Location: Kansas City, MO
|
|
Posted: Thu Apr 20, 2006 10:11 pm |
|
|
i don't know much about bootloaders but from what i've read, i thought they had to be smaller than 256 words in the 1st part of program memory. can you give me instructions on what i need to do to implement bootloading from an MMC? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Apr 20, 2006 10:56 pm |
|
|
There is no limitation to the size of a bootloader. The size depends on the complexity of the technology being used and the capabilities built into the bootloader itself. There are a couple of different approaches - this that require a dedicated client that put all the intelligence at the PC end. This means you have a small footprint in terms of PIC resources but little fault tolerance at the PIC end. The other puts the intelligence into the PIC enabling a range of standard pc appliications, such as Hyperterm, to be used.
In terms of footprint versus technology, one of my bootloaders is an Ethernet bootloader capable of bootloading a remote PIC as long as the PIC is reachable over the internet. If you think about it, it requires the bootloader to have an (admittedly cut down) IP stack. It also has to deal with an external Ethernet controller and survivability (remote system). This bootloader is over 4K in size.
In terms of how to build a SPI bootloader that will load from an MMC card. There are many ways to skin a cat. One way is to follow the old PC DOS model, put a "bootstrap loader" in the master boot record of the MMC. In this approach the PIC contains a very primitive bootloader with enough intelligence to initialise the SPI interface and read the first physical sector (containing the next stage of the bootstrap loader). This code is programmed into flash using standard table write mechanisms. The PIC then jumps to this code. This code then downloads a full bootloader from the root directory of the MMC card (that you put in a file called something like MSDOS.SYS) and programs it into flash. This may be enough alternatively you may need to go to the next step and bootstrap the last part of the bootloader. This bootloader will have sufficient intelligence to read a fat file system, search for a file (like command.com) and load this code into the PIC. The PIC then passes command to this code. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|