Rockbox

Tasklist

FS#6554 - Move bootloader code into a common file

Attached to Project: Rockbox
Opened by Barry Wardell (barrywardell) - Saturday, 20 January 2007, 14:39 GMT
Last edited by Barry Wardell (barrywardell) - Saturday, 20 January 2007, 14:40 GMT
Task Type Patches
Category Bootloader
Status Closed
Assigned To Barry Wardell (barrywardell)
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

There is quite a bit of common code between the bootloaders. At the moment, this code is in separate files for each target which results in code duplication.

This patch pulls all common code out to a common.c file. The functions in common.c are the result of merging the small differences between the corresponding functions in the target specific bootloader files.

Other changes made are:
* more descriptive error messages on targets other than the iPod (the error code is taken from the iPod code).
* power off after 5 seconds when there's a bootloader error on PP targets
* Load directly to DRAM_START and skip memcpy() phase on PP and iPod. This is possible since the bootloader is already copied to and running from IRAM on those targets.
* Remove unneeded #include's from main-pp.c
* Minor whitespace fixes in main-pp.c in the ata_init phase.

I have tested this on my H10 and e200 and it seems to work. It could do with testing on other targets (iPods, X5, H100, H300, are there any others affected?)
This task depends upon

Closed by  Linus Nielsen Feltzing (linusnielsen)
Thursday, 22 February 2007, 15:10 GMT
Reason for closing:  Accepted
Comment by Max Ried (bot47) - Saturday, 20 January 2007, 18:01 GMT
The loader works for my (1st Gen) iPod nano 2GB, but the size of the patched one is 947 bytes larger than the original version.
Comment by Barry Wardell (barrywardell) - Saturday, 20 January 2007, 21:54 GMT
The size increase was due to the dummy functions at the end of common.c being different than they were in ipod.c. I've attached an updated patch which actually results in a decrease in size by 32 bytes. The only difference from the previous one is the choice of dummy functions at the end of common.c
Comment by Barry Wardell (barrywardell) - Sunday, 21 January 2007, 02:50 GMT
The previous patch broke building the X5, H300 and H100 bootloaders. This version should allow building for iPod, H10, e200, X5, H300 and H100. I have only tested building on iPods, X5, H300 and H100. I haven't actually tried the resulting bootloader on a device so testing on those would be welcome.

Binary size increases by about 300-500 bytes on all targets other than the iPod. This is mainly down the the addition of the verbose error messages with the function strerror().
Comment by Barry Wardell (barrywardell) - Monday, 22 January 2007, 11:23 GMT
Updated again to work with Gigabeat and Elio bootloaders. Also fixes the fatal_error() function in iPod bootloaders.
Comment by Barry Wardell (barrywardell) - Monday, 22 January 2007, 16:17 GMT
Updated the behaviour of the iPod bootloader:

1) If hold is on or Menu is pressed, try to load RetailOS
a) If apple_os.ipod exists try to load it.
b) If apple_os.ipod doesn't exist, but RetailOS is already at DRAM_START, load that.
2) If play is pressed, try to load iPod Linux
3) Otherwise try to load rockbox.ipod

If any of those steps fail, direct the user to reboot into disk mode.
Comment by Barry Wardell (barrywardell) - Friday, 26 January 2007, 12:39 GMT
The last patch didn't work on the Gigabeat. Hopefully this one will address that issue (hasn't been tested on-device yet though). I've also updated the Gigabeat bootloader to use the new descriptive error messages.
Comment by Chris (decayed.cell) - Saturday, 27 January 2007, 05:03 GMT
Appears to break iPod Mini 2G. Getting a stack of errors in common.c, like..

common.c:241: error: redefinition of 'reset_screen'
common.c:36: error: previous definiton of 'reset_screen' was here

Comment by Chris (decayed.cell) - Saturday, 27 January 2007, 05:06 GMT
Also breaks iPod Color 4G and iPod Video 5G with the same errors (happens when building bootloader, not firmware for all three devices)
Comment by Chris (decayed.cell) - Sunday, 28 January 2007, 05:10 GMT
Appears to be working correctly on my 5.5G Video
Comment by Barry Wardell (barrywardell) - Sunday, 28 January 2007, 18:45 GMT
I have committed this to SVN for iPods and other PortalPlayer devices. There were reports of the patch not working on X5 and on Gigabeat, so I left those out of the commit. Here's a patch with the bits that were left out of the commit.
Comment by Linus Nielsen Feltzing (linusnielsen) - Wednesday, 21 February 2007, 20:45 GMT
I have made some adjustments and tested on iAudio X5. Works fine.
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 22 February 2007, 12:46 GMT
And now I have tested it on the H100 and H300 series too without problems.

Loading...