Rockbox Technical Forums

Third Party => Repairing and Upgrading Rockbox Capable Players => Topic started by: lightrays on August 23, 2012, 06:19:20 PM

Title: ARM Binaries, .sansa format?
Post by: lightrays on August 23, 2012, 06:19:20 PM
Hello. I'm new here. I used rockbox on one of my old players and recently bought a sansa clip zip to mess around with. I then bought another one after discovering a particular capability, with the intent to develop for the clip zip (in the sense of it being a ARM board). Therefore, I have a few quick questions, which I don't mind being pointed elsewhere with.

The sansa clip zip manual mentions a ".sansa" file which contains an executable. I briefly compared the .bin to the .sansa. The header is different but I'm not good at reverse engineering. Can anyone explain what this header is, maybe the format and how to transform ARM code into this "container" format?

Next, I'm using rockbox as a sort of jumping ground. I have done ARM development before. Is there any way to flash a firmware once it's stable enough, overwriting the sansa code, or is it Read-Only? Obviously this is a concern.

I read the wiki, which linked to a (roughly) 130 page forum topic. I really don't have the patience to comb through something so long with (plenty) dead ends. So I'm open to being directed to the important posts if someone doesn't mind.

I dunno who can answer this, and if it isn't the right forum, then feel free to move it. ;D
Title: Re: ARM Binaries, .sansa format?
Post by: torne on August 23, 2012, 06:33:49 PM
The sansa clip zip manual mentions a ".sansa" file which contains an executable. I briefly compared the .bin to the .sansa. The header is different but I'm not good at reverse engineering. Can anyone explain what this header is, maybe the format and how to transform ARM code into this "container" format?
It's just a short header pasted onto the front of a raw binary file, with a model number and checksum. It's just our invention (the same format we use for all our binaries) and is only for our bootloader, nothing to do with the Sansa firmware. Read the source for the "scramble" tool in our tree (it's called that for historical reasons, it doesn't actually scramble anything on most devices, just adds the header). You can just use our tool to produce it.

Quote
Next, I'm using rockbox as a sort of jumping ground. I have done ARM development before. Is there any way to flash a firmware once it's stable enough, overwriting the sansa code, or is it Read-Only? Obviously this is a concern.
You can, yes; just call the file the right thing with the right structure and the sansa firmware will flash it itself. This is how the Rockbox bootloader installation works; we paste a copy of our bootloader onto the original firmware and modify the startup code slightly to jump to our dual-boot stub first (jumping back to the original firmware if a given button is held). I'd suggest you simply use our bootloader; we've already tested it extensively and it leaves a reliable way to get back to USB mass storage mode if you screw something up by booting the original firmware.
Title: Re: ARM Binaries, .sansa format?
Post by: lightrays on August 23, 2012, 06:40:47 PM
Thanks for answering my questions. That was quick!  :P

So I can basically just replace the rockbox binary with whatever I want to launch?

...I didn't suspect it would be so easy. ;D
Title: Re: ARM Binaries, .sansa format?
Post by: saratoga on August 23, 2012, 07:07:27 PM
FWIW, I recommend using our main function or maybe our plugin system for this.  That way you can use our drivers for things like reading buttons or mass storage. 
Title: Re: ARM Binaries, .sansa format?
Post by: lightrays on August 23, 2012, 07:12:00 PM
As much as I'd love to, In the end I'm planning to use the MIT license. The GPL requires linked code, be well, GPL. I'll settle for implementing it myself. :D Plus, from what I've seen, all the rockbox code is pretty tightly integrated. And when it comes to systems development, I like to reinvent the wheel. (Yes, I know I'm crazy.)