Shop OBEX P1 Docs P2 Docs Learn Events
Auto Updater — Parallax Forums

Auto Updater

mctriviamctrivia Posts: 3,772
edited 2009-02-01 07:37 in Propeller 1
Well I was wondering if anyone wanted to collaborate on an auto update object for the propeller?

What is required.

1) SpinStudio Nic adapter and internet access.
2) Server that can store most up to date eeprom data.(done)
http://prop.aigamez.net/index.html to create account and upload eeproms
http://prop.aigamez.net/download.php?u=xx,p=xx,x=xx,l=xx,c=xx,v=xx
u,p,c are provided by my server.
v is version number
l is page length in 32byte blocks
x is page number

page contents will be # followed by the file contents or ####No Such File,####Current,####End,####Invalid Entry I think they are obvious what they are for.
3) Spin code to download the code in blocks write it to the eeprom here is a start:

Con            'server defined constants
au_u=?         'user number will be same for all your products
au_p=?         'product number can be any 32 bit number
au_v=?         'version number keep increasing it
au_c=?         'anti leach code

Con
  pageLength=32 'size of download buffer area in bytes/32

VAR
  byte  buffer[noparse][[/noparse]pageLength*32]
  
PUB copyBlock(ubBlockNumber) | x
  repeat from 0 to pageLength-1
    i2c.WritePage(i2c#BootPin, i2c#EEPROM, ubBlockNumber*pageLength*32+x*32, @buffer+x*32, 32)
    startTime := cnt ' prepare to check for a timeout
    repeat while i2c.WriteWait(i2c#BootPin, i2c#EEPROM, ubBlockNumber*pageLength*32+x*32)
      if cnt - startTime > clkfreq / 10
        abort ' waited more than a 1/10 second for the write to finish


Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-02-01 07:37
    just a note. I have added minimal error checking so far on the site. please enter only whole numbers where it says 32bit number.
Sign In or Register to comment.