Warm Reboot
mirror
Posts: 322
Is it possible to do a "warm" reboot?
What I'd like is a reboot that doesn't re-read the EEPROM, but does do everything else associated with a reboot.
What I'd like is a reboot that doesn't re-read the EEPROM, but does do everything else associated with a reboot.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I ended up using 'abort' to drop out of the deepest level methods right back down to a simple first public method which restarts everything again. Variables have to be re-intialised and some Cogs may need killing off ( running or not flags are persistent across soft-resets ) but this may be a quick and dirty solution ...
[noparse][[/noparse]edit]
I have an idea for doing something similar in hardware by putting two EEPROMS on the bus and having them addressed with a D Flip-flop. Then the Propeller would change the state of the flip-flop and then reboot. I would prefer to do this without added hardware if I can, using the 64K address space on the demo board to hold two programs.
[noparse][[/noparse]/edit]
Thanks!
Ken
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
Post Edited (Ken Peterson) : 9/25/2007 4:37:34 PM GMT
You could do what you described with two EEPROMs. The Hydra does something similar when you plug a memory expansion card in.
The only way you could handle two programs without using two EEPROMs and extra hardware would be to use an EEPROM loader like the one in FemtoBasic (sdspiFemto.spin). This object is designed to be incorporated into other programs as well as FemtoBasic. The loader also will stop any cogs still running before it loads and starts the new program. You just need to call BootEEPROM passing the address in EEPROM of the program to be loaded (see the comments). You can copy the 2nd program to the upper part of the EEPROM by loading it into the 1st 32K of the EEPROM with the Propeller Tool, then downloading FemtoBasic to RAM and using the COPY command (see the FemtoBasic documentation).
Getting Cog 0 running again using the newly uploaded program with its stack pointers initialised correctly is what I do not know how to do.
Take a look at sdspiFemto.spin from FemtoBasic. Once it loads the HUB memory from EEPROM, it starts up a new Spin interpreter just as if the HUB were loaded by the boot loader. The routine is "nowBootSpin" near the end of the source file.
There are quite a few gems hidden inside project and example code, the trick seems to be in finding them.
I'll definitely look into sdspiFemto.spin to see if it solves my problem. Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
Basically I don't want to start the same code again, but different code. I don't have the pins to do hardware switching, but have a 1GByte SD card (so that means 32000·code images could be stored in the SD card). Practically I only want to store a couple of images in the SD card. What this allows is a bootloader in EEPROM, which is able to program and then use·images stored in SD.
The bootloader could check the image in the SD before running it, as the SD image(s) may have been updated using a remote connection.
·
I used the routines from femptoBasic to do precisely this, it would fetch DEMOX.BIN from the card where X was A,B,C,... and changed on the fly according to the particular demo selected by the used. As long as the card is inserted and loaded with the appropriate files it works beautifully.
I placed the bootloader in the EEPROM so pressing the reset got you back to the kiosk program. I did this so I wouldn't have to go and change every program and insert the bootloading code, but when you create all the programs it is a simple task to insert the bootloader. You will likely want to modify it so you deal with raw sectors, it makes it more difficult to load the SD card, but you wont need to include the FAT layer in every program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 9/25/2007 10:20:11 PM GMT
This seems to be the info that I'm looking for.
I'm already doing raw access of sectors on SD card, so that bit is easy!