FS#12380 - e200v2 - mkamsboot cannot patch bootloader since r30937

Attached to Project: Rockbox
Opened by Michael Chicoine (mc2739) - Thursday, 10 November 2011, 16:45 GMT
Task Type Bugs
Category Bootloader
Status New
Assigned To No-one
Operating System Sansa AMSv1
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Since r30937, the e200v2 bootloader is too large and mkamsboot errors with:

[ERR] Packed data (120926 bytes) doesn't fit in the firmware (120860 bytes)

Steps to reproduce:
1. build e200v2 bootloader
2. cd to rbutil/mkamsboot
3. run make to create the mkamsboot utility
4. run mkamsboot <path-to-e200pa.bin> <path-to-bootloader-e200v2.sansa> <path-to-output.bin>
This task depends upon

Comment by Michael Chicoine (mc2739) - Thursday, 10 November 2011, 20:52 GMT
funman suggested using thumb mode for the bootloader. The resulting bootloader is small enough for mkamsboot to patch (120048 bytes total size - 878 bytes smaller) and does boot properly on the e200v2.

The command used to create the thumb version bootloader is:

../tools/configure --target=sansae200v2 --type=b --thumb

edit: It looks like bootloader USB mode is not working with the thumb build
Comment by Fred Bauer (freddyb) - Friday, 11 November 2011, 20:58 GMT
I take it gcc -Os is too dangerous? It saves about 4k.
Comment by Michael Chicoine (mc2739) - Saturday, 12 November 2011, 01:20 GMT
gcc -Os also creates a working bootloader (179 bytes smaller than -O), although it is not as small as the thumb bootloader.

The non-working bootloader USB mode is a separate issue. I will open another bug report for that issue.
Comment by Michael Chicoine (mc2739) - Saturday, 12 November 2011, 01:44 GMT
In reply to kugel's question in #rockbox:

< kugel> mc2739: did the code size increase the bootloader or is there some static array that got larger?

../utils/analysis/ bootloader-30936.elf bootloader-30937.elf
function old new delta
lcd_alpha_bitmap_part_mix - 1272 +1272
lcd_alpha_bitmap_part 1096 92 -1004
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1272/-1004)
Total: 268 bytes