Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic: Bootloader (over gsm) — Parallax Forums

PropBasic: Bootloader (over gsm)

VonSzarvasVonSzarvas Posts: 3,523
edited 2010-11-16 10:21 in Propeller 1
My latest endeavour is to create a bootloader in PropBasic which can read/write firmware updates to eeprom via a gsm connection.

Something simple like:
doUpdate("http://www.myserver.com/update.binary")

As with my previous building-block tasks, posting here should help me to "keep at it". It is always preferable to finish what I start, and rewarding to share at the same time! If anyone has already started or finished something similar, I would be really interested to learn more.

This is the basic plan so far:

1. Prop starts up and loads "bootloader code" from first 32k of eeprom. (as usual)

2. Bootloader detects "upgrade" IO pin state..
If high, download(gsm) new firmware into ram
(and if checksum correct, copy to eeprom).
If low, copy top half of eeprom into ram and execute.
(checksum needed, if image is bad bootloader must attempt to re-download)

3. Device reboots to load the new firmware (or try again if it failed).

--

The GSM/GPRS comms is working fine using serial AT commands to an old modem. I have stable success "dialing up" to my server and downloading entirely useless bytes!

Now I start work on the I2C routines, and understanding what addresses to write the received bytes to in the eeprom will be my first hurdle.

Previously (during an early pondering phase) I received some good advice, and was referred to the ybox2 project by Mike Green (http://forums.parallax.com/showthread.php?t=120743). I have since bought the ybox2, so will study that along with the various obex & forum codes for spin bootloaders.

Should be fun ! (.. will be fun !)

Comments

  • BeanBean Posts: 8,129
    edited 2010-11-16 07:17
    Sounds like a great project.

    The I2C shouldn't be too hard, PropBasic has the I2C commands built in.

    The only part I'm not sure how you are going to do is the "copy top half of eeprom into ram and execute". There probably is a way to reboot the propeller without it reloading the eeprom, but I don't know how.

    Let me know if you need any assistance. I'll be glad to help out.

    Bean
  • VonSzarvasVonSzarvas Posts: 3,523
    edited 2010-11-16 10:21
    Bean, Thank you for the encouragement.

    About your thought/question... My intention may not have been entirely clear, in that I had intended for the Propeller to reboot then go through a set cycle. If the upgrade pin was set, then the downloading happens to populate the upper area of eeprom with the new code. If the upgrade pin is NOT set, then my intermediate bootloader will just load the program from upper area of eeprom to ram and execute it. So it means, after the update we just set the upgrade pin low then reboot the prop. --- Actually, as I hope to use the hub ram as a buffer anyway, it might be possible to run it directly... we shall see!

    I can see how Chip did it in his bootloader.spin code, which is actually ASM. So I figured if all else fails I can stick some ASM tags into my PropBasic code. Although it might be nice to replicate this code part with all propbasic if possible. time will tell!

    :)
Sign In or Register to comment.