PDA

View Full Version : Booting from SD-card



Filip S
09-11-2007, 09:52 PM
I'm playing a bit with the binary format and i've sucessfully done a bootloader that can load binaries from tha card (based on objects from rockiki and femtobasic), but I was thinking that I wanted a splash screen while the app were loading and initializing (using an independent serial screen). I've included the picture in the brginning of the binary-file. But it doesnt work to boot the app then.·Is the BootSdCard in FsrwFemto able to boot from any position in the file or does it need som kind of alginment (beginning of sector etc). My image file is 128 * 128 * 2 + 1 bytes (32k + 1 byte).

Thanks Filip

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://fgames.110mb.com

Mike Green
09-15-2007, 09:15 AM
Sorry for the long wait for an answer. I've been away.

The boot routine in FsrwFemto starts loading at the beginning of a sector and continues for the number of bytes specified (minimum of 16 bytes). Keep in mind that, since the code being loaded is expected to overwrite all or most of hub memory, the Spin interpreter is likely to find invalid data as the routine is being loaded, so the loader stops all other cogs before initiating the actual load.

The actual loader (in sdspifemto.spin) doesn't have to start at the beginning of a file. It can start at the beginning of any sector. Have a look at the boot routine in fsrwfemto.spin. You could copy it and give the copy a different name and change where the actual loader is to start (after your splash data).

Fred Hawkins
09-15-2007, 02:47 PM
(hooray! (sincerely) Mike did not Biffle! You were missed.)

Filip S
09-15-2007, 06:52 PM
Thanks Mike

I have seen some error loading an application when the file is fragmented (sectors containing the file isn't after each other) is this a bug or is it just my code?

//Filip

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://fgames.110mb.com

Mike Green
09-15-2007, 08:17 PM
This is a documentation bug. The low level I/O routines, as written, are incapable of handling multiple sector I/O across extent boundaries and the boot I/O is completely handled at the low level (since the higher level routines ... Rokicki's ... are written in Spin and might be overwritten during the boot; the low level routines are in assembly and run in their own cog.)

Filip S
09-15-2007, 11:03 PM
OK, I noticed that, but then i re-formatted my card to 16k sectors (32k didn't word by some reason) so that mostly programs fit into one sector.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://fgames.110mb.com

mpark
09-17-2007, 12:01 PM
Do you mean sectors or clusters? I'm trying to learn this stuff and want to make sure I'm following this conversation correctly.

Mike Green
09-17-2007, 12:07 PM
I don't know about Filip S, but I'm referring to 512 byte sectors. When I mentioned "extents", I was using that term to mean the same thing as clusters. I assumed that Filip S really meant 16K clusters (32 sequential 512 byte sectors) or 32K clusters (64 sequential 512 byte sectors).