Shop OBEX P1 Docs P2 Docs Learn Events
Firmware updates — Parallax Forums

Firmware updates

T ChapT Chap Posts: 4,223
edited 2006-12-06 22:17 in Propeller 1
With a PC or Mac, any suggestions on how to update the Propeller without exposing the user to the PTool? Replacing an eeprom is not a good option either. Ideally, some way to get the complied version of code into a fie that can be sent to the user(email, download etc), along with a proprietary app that will update the program semi-automatocally.. load the app, read the current revision from the Propeller, and press "update" if required.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-06 15:20
    This has come up many times. Chip has posted the algorithm and a sample program that runs on the Propeller and downloads a program to a second Propeller. No one yet has converted the algorithm to a program for the PC or Mac that does the same thing. To do what you're asking (to "read" the current version of a program in the boot EEPROM) is a bit more complicated. You would first have to download a program to RAM and execute it. This would read the version information from EEPROM and send it back to the PC/Mac. The PC/Mac program would have to check the version information and decide what to download if anything, then do so if needed. That's a bit more complicated than just downloading a binary image. There's no standard place/way to store the version information, so a general purpose program would not be possible at this point.
  • Simon AmplemanSimon Ampleman Posts: 19
    edited 2006-12-06 15:54
    To save your software to Binary Data, you push F8.

    I can create a standard C console application (exe and dll) to do it, so you could embed the software inside your own GUI easily. You would call it with the string to search. For example :

    PropCheck.exe -com 4 -version PROPV -format N.NN

    Com : Com port to use
    Version : String to search inside the downloaded binary data
    Format : Format of the version

    This would read the EEPROM in a buffer and search for your version string and return the version according to your format... Then, you could call

    PropDown.exe -com 4 -file newsoft.bin

    Com : Com port to use
    File : Binary data to upload

    This would download the binary data to your prop eeprom on com port x.

    Have a nice day,

    Simon
  • Matthew HayMatthew Hay Posts: 63
    edited 2006-12-06 16:33
    Well depending on your application couldn't you just incorporate a kind of bootloader? I've still not had my chance to use the prop so I'm just going off my experience with other micros.

    I am going to assume you are using some sort of serial interface for the connection to the computer for a firmware update. That would mean that you should be able to add a sort of command that could be sent to return the current firmware version (which should be a const in your props program) and another command to accept chunks of information to be written to the eeprom along with some simple error checking.

    For a little extra security when distributing your firmware file, you could make a pc program to modify the binary data to add extra data as in a header and regularly spaced fix lengths of data that can be removed at update time. Hmmm I guess you could even do some simple encrypting with the prop setup to decrypt.

    Oh well it seems you have some options on the way you want to go (unless I'm completely mistaken about the prop)

    -Matt
  • Simon AmplemanSimon Ampleman Posts: 19
    edited 2006-12-06 16:52
    When the bootloader is inside the eeprom and the software inside independant flash memory, bootloader is the way to go.

    However, with the propeller, the bootloader would be with the same memory as the software, so it becomes very dangerous, if you start writing data to the eeprom and the transfer is interrupted or there is too much noise for some reason, your software will never boot again.
  • T ChapT Chap Posts: 4,223
    edited 2006-12-06 19:22
    I envision a standalone app the user simply gets off the web/CD/DVD/, runs it to update programs. An html version of the program replacement would be nice as well, hook up the product to the computer, the computer reads the version(usb2serial), replaces it as required. In my case I'd love to be able to do this with the Realbasic app, Mac and PC platforms, as users of one of my gadgets are primarily Mac.

    I have seen a lot of products that when downloading, the warning appears: "Do not disconnect or turn off power during download". In case of the mishap, replacement of eeprom is not a big deal.

    Here is something to ponder off topic, but related to downloading and encryption. The FTDI usb to serial chip(FT232RL) is able to be read for it's embedded serial number. The chip's documentation has info on using the chip strictly for ID purposes, or as we call a dongle, to determine if the product or software is registered. If the seral number fails, they aren't regustered. I was wondering if the Prop could read the serial number as well, but likely not as the PC requires a DLL to execute the commands. Anyways, I thought it maight have some usefuless in a hardare approach towards piracy protection. For example, if the dongle was not present, the Prop wouldn't run. If am noy mistaken, the eeprom cn be written to as well with the product name and version. I don't a solid idea, but maybe some combination of FTDI and Propeller could be used for both version tracking and updating that includes anit an anti-piracy feature. Another application of this feature is that without the dongle plugged in, no one could update the program. Maybe useless ideas, but who knows what may come up.
  • rokickirokicki Posts: 1,000
    edited 2006-12-06 19:49
    This should be pretty easy. Use a larger EEPROM (64K), have your real app in the upper half, have the bootloader in the lower half.

    On every reset, the bootloader scans the serial port for some time (say 1 second) looking for a special character pair or something.
    If seen, it just reloads the upper part of the EEPROM from the serial stream (with appropriate checksums, etc.).

    If the character pair is not seen, the chip simply loads the upper half of the EEPROM into the propeller memory and executes that.

    The user procedure would be: connect the prop to the serial/USB port, start this program (which just sends char pairs to the serial port
    until it gets a response, then downloads the app), then hit reset on the hardware. It would be nice to have a pretty blinking light
    saying okay or not.

    Of course, USB might be a tad painful since the customer would have to install the FTDI driver, so just forcing the use of a serial
    port might be the easiest thing to do.

    Another way to do it is to do away with all connections entirely; put a photodiode in the product, have the customer hit reset and
    hold the hardware up to the screen, and have the data be sent over the video by flashing an area of the screen on and off.
  • Matthew HayMatthew Hay Posts: 63
    edited 2006-12-06 20:49
    Yeah I remember the old TIMEX watch that used the flashing screen method.

    Most operations as far as programing the prop is going to result in trouble if you loose power but the 64K EEPROM chip sounds like a neat idea (does the prop work that way?)or even 2 32K chips the bootloader chip having the WP set to keep from any mishaps. Using a method like that would allow you to add more than just a bootloader to the first 32K, like a HW debugger and routines to decrypt the incomming encrypted firmware (if you chose to do something like that). Even add copyright protection of some sort to that part, so that if they did mess with the incomming firmware they could bypass the copyprotection without opening the box/case of your product.
  • Chad GeorgeChad George Posts: 138
    edited 2006-12-06 22:06
    Originator,

    I had this issue earlier and with help from Chip's documentation and others I wrote a Python script that can load a binary image into the propeller without using the propeller tool.

    Here's a link to the original posting.

    http://forums.parallax.com/showthread.php?p=611536

    I've used it on both Windows and Linux, and I've been told it worked on a Mac as well.

    -Chad
  • T ChapT Chap Posts: 4,223
    edited 2006-12-06 22:17
    Thanks Chad for the info. Sounds like a viable option to get what I need done, although it will likely have to be farmed out in this case, it looks way over my head.
Sign In or Register to comment.