Uzebox SD Gameloader V0.4.5

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
DaveyPocket
Posts: 378
Joined: Sun Sep 14, 2008 8:33 pm
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by DaveyPocket » Fri Aug 07, 2009 12:06 am

I haven't been able to try this out yet(I still haven't installed the 3 volt regulator and the SD card socket on my Uzebox yet), but it looks great. Now I have a question; Is it possible to update the bootloader through the bootloader?

User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Re: Uzebox SD Gameloader Alpha...at last!

Post by Jhysaun » Fri Aug 07, 2009 12:21 am

I haven't been able to try this out yet(I still haven't installed the 3 volt regulator and the SD card socket on my Uzebox yet), but it looks great. Now I have a question; Is it possible to update the bootloader through the bootloader?
Im not sure. But I'm sure someone knows.

But we can always put another chip on the uzebox, :o and have that chip be a dedicated programmer for the first one.

Of course, that seems kind difficult when you can just reflash the bootloader.
>J
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by uze6666 » Fri Aug 07, 2009 2:12 pm

Now I have a question; Is it possible to update the bootloader through the bootloader?
The SPM instruction can reprogram the whole flash including the bootloader area. However reprogramming mean reading 4K from the SD card using code stored in the same flash you are trying to reprogram. It's kinda chicken and egg problem... So it's possible but indeed very tricky.

-Uze

braddock
Posts: 26
Joined: Fri Jul 31, 2009 12:09 pm

Re: Uzebox SD Gameloader Alpha...at last!

Post by braddock » Fri Aug 07, 2009 4:11 pm

DaveyPocket wrote:Is it possible to update the bootloader through the bootloader?
We did something like this on a commercial project to allow full firmware upgrade. As Uze says, it is possible, but it is a bit of a risky shell game (relocate the bootloader to rewrite the bootloader flash, etc, check checksums, possibly revert, etc).

Very convenient for us developers once we got it working though! Plug in the USB drive with the new image and reboot...repeat a dozen times for all prototype devices and you're off to the races.

-braddock gaskill

User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Re: Uzebox SD Gameloader Alpha...at last!

Post by Jhysaun » Fri Aug 07, 2009 11:42 pm

However reprogramming mean reading 4K from the SD card using code stored in the same flash you are trying to reprogram.
Won't the whole bootloader fit into RAM, as it is now?
Can you store in RAM the code for reading SD cards, but keep out the code for i/o, and then execute the SD card copy from RAM?

>J
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by uze6666 » Sat Aug 08, 2009 1:09 am

Not that easy since you need some RAM for variables and the call stack. A 512 bytes buffer is also require hold SD sector data.

-Uze

User avatar
Jhysaun
Posts: 214
Joined: Tue Nov 04, 2008 12:32 am

Re: Uzebox SD Gameloader Alpha...at last!

Post by Jhysaun » Sat Aug 08, 2009 2:04 am

Ok,

what if we dump the eeprom on to the SD card, copy the first half of the new bootloader to the eeprom, and write the first half of the bootloader to the Program Mem. then repeat for the second half, and restore the EEPROM.


>J

Edit: when I say "we", again I mean you and Pragma ;)

EDIT2:
512 bytes buffe
Or just have the EEPROM be the buffer.
Lerc wrote:I intend to use my powerful skills of procrastination to ensure that when I get to making things, the chips will be available.

exile
Posts: 11
Joined: Wed Dec 17, 2008 7:40 pm

Re: Uzebox SD Gameloader Alpha...at last!

Post by exile » Thu Aug 13, 2009 2:44 pm

Great work, its make uzebox more complete game station (and it was great before) and love to see the code of bootloader :)
It really make it easy swap between games and demos, how ever reset commando from joy pad don't seem to work on all application "check for a reset condition (a+b+select+start)".

If you really want to upgrade bootloader from SD-card you can have small area (block that won't be eras) that you call from program space and not from bootloader space exmpel:

Code: Select all

//program space
..
#define bspm 0x7ff0
call bspm
..

//botloader space
.org 0x7ff0
bspm:
    spm
    ret
or somethings like that.
then you only have to copy new bootloader from program space and not from SD.... so it (I believe) pretty easy.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by uze6666 » Fri Aug 14, 2009 6:10 am

how ever reset commando from joy pad don't seem to work on all application "check for a reset condition (a+b+select+start)"
Yes, I had an issue at one point with the reset code, it would reboot the console indefinitely if no joystick was plugged in. So it was commented out. It indeed should be fixed as I realized myself it's a bit annoying having to get up and hit the reset button each time I want to switch game. Still, it's a lot less annoying than having to get up to my work room to reprogram each game... :) I'll add it to the todo list on the wiki.

Btw, not sure I fully grasped what you meant, but I think it's a very interesting idea you got concerning the reprogramming of the bootloader from SD. Pre-flashing the bootloader in lower memory would waste a rewrite cycle but that doesn't happen so often so it's no big deal. It would allow to pre-load everything, then require only a few instructions to flash almost all the bootloader from regular memory. I feel it's the way to go.

Onto another subject. One thing I wondered for a while. To the Fuzeboxers outhere: you guys are using the FTDI cable to flash the chip...to use this bootloader you'd have 2 choices. 1.Buy a SPI programmer or 2.buy a new mega644 with our new super-duper bootloader and *ideally* FTDI support also (but definitively not guaranteed). What would you go for (considering an SPI programmer is reusable for any future atmeaga project you'd like in the future)??

-Uze

tim1724
Posts: 30
Joined: Mon Dec 08, 2008 8:38 pm

Re: Uzebox SD Gameloader Alpha...at last!

Post by tim1724 » Fri Aug 14, 2009 7:57 pm

uze6666 wrote: Onto another subject. One thing I wondered for a while. To the Fuzeboxers outhere: you guys are using the FTDI cable to flash the chip...to use this bootloader you'd have 2 choices. 1.Buy a SPI programmer or 2.buy a new mega644 with our new super-duper bootloader and *ideally* FTDI support also (but definitively not guaranteed). What would you go for (considering an SPI programmer is reusable for any future atmeaga project you'd like in the future)??
I have a Fuzebox, but I also have an SPI programmer. :-)

I really don't see any great need for FTDI support. It would be a nice extra, but I think most people would find SD support more useful. I always viewed the FTDI bootloader as just a placeholder for the SD support.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests