A free Gamebuino if you compile the SD card bootloader !

Libraries, utilities, bootloaders...

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Mon Mar 10, 2014 9:08 am

I'm happy to have a crack at this if it's still needed. I currently write Arduino security software professionally and I also spent 16 years as a console/handheld game developer so I should be able to put something together pretty quickly. I do have two recommendations though...

Flash memory only has a 10,000 cycle life time. If you're "loading" the program name that's stored in EEPROM every time the unit is turned on and/or reset then that's a Flash burn every time. Power cycle your unit 10 times a day and you can expect it to fail after 3 years. I'd suggest popping up a logo or something and if the user doesn't press a key within a second or two then the bootloader executes whatever is already in Flash.

My second recommendation would be for the bootloader to save the current EEPROM state into a save file alongside the old hex file before reflashing the unit with a different title (obviously it would also need to restore it if the original game is loaded again). This would save developers a TON of work as it would allow them to always treat EEPROM as safe storage for high scores etc even when the player changes games. A closely related suggestion would be to use a context file on the SD to store the current title name instead of EEPROM. Developers need every single byte of EEPROM they can get, and in my experience any attempt by you to convince them to leave your little bit intact will be repeatedly ignored thus breaking the menu app for unsuspecting users of those games who may not know any better.

In any case gimme a few days and I'll see what I can come up with. I'm still waiting on my 5110 displays to arrive but they should be here in another day or so.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby rodot » Mon Mar 10, 2014 9:29 am

Greetings and welcome on the forum, Myndale !

I totally agree with you about using a button to trigger the game loading. I think about holding a button while you turn the Gamebuino on. That would avoid having a delay during wich you have to press the button (you would miss the delay all the time, and it would slow down the start up).

Your idea about the EEPROM backup is a great, I'm affraid it won't fit the 2KB botloader... but if you can do it, that would be... MARVELOUS.

Keep in mind that you also have to fit the USB bootloader alongside with the SD bottloader.

Good luck, Sir ! I look forward seeing a working SD bootloader :D
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Mon Mar 10, 2014 11:29 am

Actually the EEPROM save/restore can be added to LOADER, it'll only get wiped if the user overwrites it with ISP.

My first task in the morning will be to try to get 2boots compiling, I've had a look through the source code and it seems straightforward enough. How much compatibility with existing boot loaders do you want? 2boot still has code that Gamebuino probably doesn't need e.g. code to dump Flash and EEPROM, are you happy to lose functionality that isn't required by the IDE for game uploads?
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Wed Mar 12, 2014 12:10 am

I have this working now as per the stated requirements, it needs some cleanup before release proper but I'll wait until someone gets a chance to confirm its behavior first on the Gamebuino hardware.

Rodot do you have a preferred place you want me to send/upload this? I have a wiki account but no write/edit access.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Wed Mar 12, 2014 7:25 am

Ok, I've believe I've got something up and running now that fits the required specs, I've attached a zip to this post containing the project and a pre-built copy of the firmware ready for upload. The README.TXT file contains everything you need to know.

I was a bit hesitant to use the 2boots source without modification due to the fact that the original supposedly contained bugs and the updated version was too large (4kb according to a post I read). What I did instead was take the standard firmware for the Ardiuno Uno (i.e. optiboot) and patch it with the 2boot FAT and hex parse code (which is actually quite good) along with a little glue code code to divert flow control in the event that the C button is pressed on startup.

The size of the firmware as it currently stands is 4kb but this is just for the test phase, once rodot's happy and I've added any extra functionality etc I'll take it back down to 2kb. Either way the fuse bits on the Gamebuino have to be set to accommodate this so I've added information to the README.TXT showing the changes to make if you're burning the bootloader via the official Arduino IDE (you can't use the ones for Uno because optiboot is set to 512 bytes).

The project still needs a bit of cleanup and optimization, apart from taking the size back to 2kb the SD and MMC bootloaders are both using their own flash write routines...by replacing that with a common routine we should wind up with a few hundred bytes extra to spare which can probably be used for a start-up logo or something if so desired. It also needs to be packaged better with proper attribution and licensing notices for the code I've used.

Rodot, if you encounter any problems with this then let me know and I'll send you a build with some extra debugging functionality.
Attachments
gamebuino_boot.zip
Prototype Gamebuino firmware
(30.59 KiB) Downloaded 676 times
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby rodot » Wed Mar 12, 2014 9:17 am

Hey Myndale !
Thank you very much for your hard work ! :)
To be able to edit on the wiki, you have to verify you email address (it's to struggle against spammer bots). If you still can edit after that, contact me we'll figure this out.
I'm going to test your bootloader right now, I'm really excited. I'll keep you updated of my progress.
Did you try it ? I can't believe we have something working :D
That's really cool, thanks !
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Wed Mar 12, 2014 9:24 am

Yes, I've tested it extensively on an Arduino Uno, seems to be working fine. The only difference in my set-up is that the SD reader I'm using is the one on the official Ethernet shield which uses ditial pin 4 for SD. I changed it to pin 10 for the version I uploaded, that's the only difference between the version I've tested so hopefully I got it right (the port settings are specified in the makefile).

I thought I did respond to the account verification email, even so the last post I made here still said it had to await moderation. Weird.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby rodot » Wed Mar 12, 2014 9:42 am

All posts on the forum need moderation, or all the topics would be full of nonsense/gibberish/spam. Sorry for the delay it creates, I come to moderate the forum as often as I can.
On the wiki, once you verified your email, you should be able to edit.
I just soldered an SD card slot on my Gamebuino, it's working fine, I'm about to burn your bootloader. I'm surprise you made a 4KB bootloader, I thought 2KB was the maximum.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: A free Gamebuino if you compile the SD card bootloader

Postby Myndale » Wed Mar 12, 2014 10:02 am

BTW I just realized that my bootloader only launches the application that's been written to EEPROM as described in the README.TXT file which is how 2boots works. I've just re-read your principle and realize you want it to load the LOADER application which then allows the user to select a game and have it flashed to the chip.

No problem, that won't be much extra work at all, but what I've uploaded so far should at least show that it's working in principle.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: A free Gamebuino if you compile the SD card bootloader

Postby rodot » Wed Mar 12, 2014 10:25 am

Hey Myndale,
I would like to know if the binaries of the bootloader you uploaded are the version with the button C (PC3) ? I recently formatted my PC and no longer have the compiling tools. I'm going to install them back.

I've burn the bootloader and uploading programs through USB works fine. But when I hold down the button C during startup, it starts normally (it doesn't change anything). I've put the files on a FAT16 SD card with the right name formatting, and burnt that name in the EEPROM using NameBoardSketch.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

PreviousNext

Return to Software Development

Who is online

Users browsing this forum: No registered users and 44 guests

cron