boot loader
mctrivia
Posts: 3,772
I really quickly threw together some code to act as a bootloader for a board with a 512k eeprom and sd card like my propmodules to allow for eeprom images to be installed from the sd card.
I need to write the pasm copy routine still to copy the top half of eeprom to hub ram but in the roughing out of the code I realized I am not sure how I can start the prop running the eeprom image after copying hence the
start prop???? line.
any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 8:25:33 AM GMT
I need to write the pasm copy routine still to copy the top half of eeprom to hub ram but in the roughing out of the code I realized I am not sure how I can start the prop running the eeprom image after copying hence the
start prop???? line.
any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 8:25:33 AM GMT
Comments
Second thing is ... maybe you shouldn't start at adress 32768 for reading the upper part of the EEPROM. Instead you have to select the right adress (instead of i2C#EEPROM). At least this is my experience with my 64kB FRAM. It has adress $A0 for lower part and $A2 for upper part. Ok ... maybe not a real issue for you because you write the same way - having a 512k EEPROM which uses all available EEPROM adresses. But if you want to run your code on different setups it might be a problem.
For the starting of a new image, have a look at the Femto SD card driver. It provides exactly that functionality - load complete 32k image and run the SPIN interpreter. If you simply don't do a cogstop before, the drivers you loaded with the boot-loader can stay.
I plan to do the same thing somewhen, so if I don't find a PASM I2C driver I'll propably write one ... only I can't say when.
Search for post by me mentioning I2C.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Its a serial bootloader that I used on a robot project last year. I'm going to be reworking this in the next few weeks so I didn't take the time to make an entire working demo of the program, but maybe it'll have what you're looking for.
The python script attached is capable of handling the PC side of things...the only non-standard library you'll need is PySerial.
and the whole project needs a better name... [noparse]:)[/noparse]
What I am really not sure if it will work is the reseting of the prop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 8:26:06 AM GMT
To reboot the propeller from Assembly, write a new clkreg setting with bit7 set:
Andy
Changed the code to use .bin instead of .eeprom because it does not detect the longer extensions. added some code to let me see what is going on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 8:26:32 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
In this case you need to stop all the other running cogs before restarting the interpreter.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
To me, the amount of commentary actually gets in the way of understanding what is important to know about using it ... sorry Mike. I specifically remember having trouble understanding the COG interface method, and thus went off and did something else.
Maybe Mike can explain in a few sentences what needs to be done with the object to fit your need?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
sdspi.bootEEPROM(sdspi#bootAddr + $8000)
The sdspi#bootAddr specifies the EEPROM on I/O pins 28/29 and the $8000 is the starting address of the .binary image in the EEPROM.
Thanks for the help will try right now
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
When I run the program led 5 turns off(pin driven high) then 6,7,8,9,10 in order showing that it finds the card, code, copies it then tries to boot but then all lights turn off and nothing more happens. the image i am copying should run a test patern checking all io lines functionality.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 8:27:00 AM GMT
When you copy to EEPROM, you have to be careful of "page" boundaries, usually 128 bytes in the larger EEPROMs. Have a look at FemtoBasic's COPY statement for examples. It's roughly at line 1080 in FemtoBasic.spin.
Post Edited (Mike Green) : 6/28/2009 9:42:59 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
DUMP 32768 200
and get an error message.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
shows first 32 bytes
attached code sucessfully copies the code into the top half of eeprom but does not yet copy top half of eeprom to hub ram and start it. Assembly routines are never used they were my attempt to do what
is suppose to do.
[noparse]:([/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
you should wait for the EEPROM after writing each page. EEPROMs need a while to do the write. First it has to clear the page and then write it. That's why it'll send an ACK after it's done. But you have to wait for it. So, maybe the first 32 bytes are correct, but I'd bet the next page won't be correct.
You have to add something like that:
sstart is the EEPROM-adress ($800+(j*PAGESIZE)) in your case.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
thank you to everyone for the help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
added a watch dog timer during checking for sd card. now it works.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Post Edited (mctrivia) : 6/30/2009 9:58:29 AM GMT
'maincog:=cogid
is commented out - why?
You don't have error handling for the part waiting for the EEPROM. quit only stops the inner loop ... the outer one will still continue. But the content of the EEPROM might be rubbish.
It's a good idea to let the forum do a code review before you add some code to the ObjectExchange.
The boot-loader has a small footprint. So, there is no need to have a 64kB EEPROM. As long as the own code + bootloader code fits into the 32kB EEPROM why not update it in the normal EEPROM location?
pub bootLoader
....
if EEPROM_ADRESS>32191
· loadtop
else
· main
pub main
' here comes the user code in case you only have a 32kB EEPROM
' otherwise it stays empty
Post Edited (MagIO2) : 6/30/2009 12:32:36 PM GMT