Page 1 of 18

Uzebox SD Gameloader V0.4.5

Posted: Sat Jul 25, 2009 7:54 am
by uze6666
This is the official thread for the Uzebox Gameloader (aka bootloader). Thw Gameloader allows the loading of games stored on the SD card. Here's the features & limitations for this release:

Image

Features
----------
-240x224 graphics (40x28 characters)
-Basic sound
-Only regular SD cards are supported (SDHC won't work)
-FAT16 support only
-No fragmentation support yet. The SD card *must* be formatted before putting stuff on it or who knows what will happen!
-Only files in the root folder are detected
-Up to 128 .uze files, using page navigation
-Uses new ".uze" files. These binary versions of .HEX files with a 512 bytes header. The header includes info like game name, author, year, etc...I've made a C tool to convert .hex to .uze and it's made to be included in the MAKE process.
-When selecting a game, a check is performed against the program memory to not reprogram the same game. Uses the EEPROM to store a CRC of the flashed game. For the time being if your EEPROM is not yet "formatted", run Pac-Man, it will kindly do it for you! :)
-Fully open sourced


Installation
The Fuzebox owners out there, for now at least, are left if the blues. The Fuzebox already comes with a bootloader, and it *can not* overwrite itself since it has the protection fuses programmed. To flash this new bootloader you need and ISP programmer. There could be a way to reprogram the FTDI bootloader with some clever programming but then, you will not be able to reprogram any more games since the FTDI code will not be there anymore! Unless we can find a way to fit 2K in about 512 bytes...If anyone's interested let me know.

So this procedure is *only* for peoples with an ISP or high voltage programmer(i.e: AVRISPMKII, STK500 or USBtinyISP). I'm not responsible if you brick your chip using and FTDI cable!

Here's the code and procedure to install it. Note that I will only give the steps for AVR Studio since I don't know any other programmers. If you figure it out for AVR dude or other please post, I'll make a WIKI page for it.

First, you need to program the following fuses:
-BOOTSZ to 2048 words (4 Kbytes). Tells the AVR the size and start address of the bootloader.
-BOOTRST . Tells the AVR to reset into our bootloader.
Image

Then flash the following HEX:

Latest version 0.4.5
-Small fix to the way the bootloader detect that a game is already flashed.

Notes:
  • If you are confortable fiddling with fuses, after flashing the bootloader, you can set the bootloader lock bits. This will prevent game that exceeds 61440 bytes to overwrite the bootloader. In AVR Strudio: Progamming dialog->LockBits tab->BLB1="SPM Prohibited in Boot Section"
  • I've put Uzeamp in there, so you may want to add a few songs from here.
  • The movie demo will try to find the first ".uzm" file, if there's none it will start playing garbage. Get a movie file from here.
  • Get some pre-converted .UZE files from SVN by downloading this package.
  • Bootloader uses only .UZE files. Run the packrom tool to convert .HEX files to .UZE files. Check this wiki page for more info.
Insert, reset and enjoy...Up and down to select a game, press start to load it. Let me know how it goes and if I forgot anything (eh, it's almost 3:00AM here!). Also and any comments regarding the Gameloader is welcome.

Cheers,

-Uze

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

Posted: Sat Jul 25, 2009 1:55 pm
by paul
Exceptional work, Uze! I would give feedback, but I *still* haven't made my Uzebox...

It's now a real console :D

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

Posted: Sat Jul 25, 2009 2:45 pm
by cjoudrey
1 word: AWESOME !!! :)

Good job to both of you !!

Really a step forward !! :)

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

Posted: Sun Jul 26, 2009 5:42 pm
by codecrank
you're the man !

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

Posted: Mon Jul 27, 2009 12:40 am
by rogerlevy
Thanks for making this, uze.

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

Posted: Fri Jul 31, 2009 8:57 pm
by havok1919
Sweet! Thanks Uze. :) That was a lot of hard work, I'm sure!

I don't know if this is old news or not, but I ran across it the other day:

http://www.avrfreaks.net/index.php?modu ... pe=project

Could be something useful/interesting in there.

-Clay

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

Posted: Fri Jul 31, 2009 10:11 pm
by uze6666
Hey Clay, nice to see you around! Yeah that was indeed quite some work. But it was worth it, specially considering most of the stuff and size optimizations done will end up in the main kernel. :)
Thanks for the link, that will be useful info if we ever add FAT32 support. If you try the bootloader let me know your toughs/suggestions!

-Uze

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

Posted: Sat Aug 01, 2009 6:15 am
by braddock
I want to use SD support in an app. How would I best do that? Is an "SD Core" now part of the kernel, or will I need to maintain a downstream copy?

Is this SD/FAT code from the bootloader checked in somewhere? Sorry, still learning where all the code lives...

thanks!
braddock

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

Posted: Sat Aug 01, 2009 3:37 pm
by uze6666
There's 'primitive' SD & FAT libraries in SVN under the beta4 branch: http://code.google.com/p/uzebox/source/ ... l-4-uzeamp. It has lots of limitations (ie: read only, no fragmentation support), but was more developed as a proof of concept. It's only used by Uzeamp and this bootloader demo (so far). Pragma id another developer of the bootloader and has worked to enhance (or should I say complete re-write :D ) my stuff to support fragmentation, offer write support, etc. Plus it been done in pure assembler to save lots of space and gain a bit of speed too. Once done, this code should become the baseline in the kernel. In the mean time, you'll have to hack something or use third party libraries...For this have a look at this:
http://www.avrfreaks.net/index.php?modu ... pe=project fat32 library for AVR. Don't know how it works, or it's size, but foir a non-bootloader application, it could work just fine.

-Uze

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

Posted: Sat Aug 01, 2009 4:47 pm
by braddock
My dream app requirements are read-only for only one or two FAT files and fragmentation isn't a concern since I'll be preparing the card myself. So it sounds like the dev branch SD/FAT functionality is appropriate - and will only get better with time.

Plus I imagine you could use an alpha tester. When I worked with embedded FAT USB drivers before, all sorts of whacky things turned up with some manufacturers.

But is the dev kernel branch in general (not just SD) basically stable enough to develop an app for, or am I asking for a world of hurt? What is the timeline for a release?

Thanks,
Braddock Gaskill