Commit graph

10 commits

Author SHA1 Message Date
Thomas Martitz
f6540e800d Sansa Fuzev2: Add mkamsboot and dualboot support. The bootloader doesn't work, but pressing |<< or inserting USB to boot the OF does.
It should be pretty safe to run test code on it now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24924 a1c6a512-1295-4272-9138-f99709370657
2010-02-26 13:55:17 +00:00
Rafaël Carré
b6c20c17e4 mkamsboot: prevents 2 potential problems
We checked if the new firmware block (bootloader+ucl function+packed
bootloader & OF) fit in the OF file, but not if it would run properly.

For example the Clipv2 OF is bigger than 0x50000 bytes uncompressed, but
it fitted in this space when packed and concatenated to a packed
bootloader + ucl function and dualboot code (but we use 1MB of RAM and
not 0x50000 anyway).

Now we check that both bootloader and OF are small enough to be unpacked
at runtime: the unpacked data must be smaller than available memory and
not overlap with ucl function and packed data (although the unpacked and
packed data could probably overlap a bit, I don't know how to calculate
this and this could be quite complex).

total_size() is replaced by check_sizes() which will perform all the
checks and set an error string if the firmware can't be patched.
(both mkamsboot and rbutilqt modified accordingly)

The second problem is that dualboot.S assumed r3 and r5 were left
untouched in the device specific checks. This was undocumented and very
error prone when modifying these checks.

r3 is the last byte of packed copy (bootloader or OF)
r5 is the entry point of uclunpack function derived from r3, so move r5
calculation after the device specific code.

Even if r3 is currently unused in the device specific code, we store it
in memory after copying the ucl function, when it points to the last byte
of packed data (not yet copied at this point since we didn't chose if we
boot the OF or the bootloader), and restore it just before using it so no
restriction is placed on registers usage in device specific code.

Add a new variable ucl_dest in dualboot.S set by mkamsboot.c, which
represents the last bound of buffer where we copy the ucl function, and
then the packed data (bootloader or OF).

RAM_SIZE definition is moved from dualboot.S to mkamsboot.c new
model_memory_size(), where it is a bit better documented.

Tested on e200v2 and Clip+

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24772 a1c6a512-1295-4272-9138-f99709370657
2010-02-19 14:10:26 +00:00
Rafaël Carré
40e833af5f Clip+ remove setting GPIOB PIN0, it seems needed only for power
Also only use 0x50000 bytes of memory since the files just fit in.
TODO: make mkamsboot abort if the decompressed OF or bootloader doesn't
fit in RAM / or overlap on compressed data or uclunpack function

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24727 a1c6a512-1295-4272-9138-f99709370657
2010-02-17 18:27:50 +00:00
Rafaël Carré
7c8dbf46a8 mkamsboot: update dualboot.c / dualboot.h in place
This removes the need for copying these files to ../ and removes the
risk of only copying one of the files (which led to bricking 2 c200v2
already)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24719 a1c6a512-1295-4272-9138-f99709370657
2010-02-17 14:37:06 +00:00
Bertrik Sikken
b4fd5d852a Include dualboot.h in dualboot.c as an additional compile time sanity check
Author: Tobias Diedrich
Flyspray: FS #11009


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24636 a1c6a512-1295-4272-9138-f99709370657
2010-02-13 18:53:29 +00:00
Jack Halpin
aa8da2333e Sansa Clip+: Unset B0 correctly in dualboot.S
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24582 a1c6a512-1295-4272-9138-f99709370657
2010-02-10 14:35:52 +00:00
Jack Halpin
74c48090ac Sansa Clip+: Unset pin B0 correctly in dualboot.S
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24573 a1c6a512-1295-4272-9138-f99709370657
2010-02-09 22:29:23 +00:00
Jack Halpin
de3489a6c8 Sansa Clip+ : Add dualboot support for sansa clip+ to mkamsboot.
Dualboot works on the sansa clip+ by holding either the left "|<<" or home buttons.
The USB pin is still undiscovered at this point and should replace the home button when found.
By including the home button for dualboot we avoid bricking due to a single button failure.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24561 a1c6a512-1295-4272-9138-f99709370657
2010-02-08 06:43:47 +00:00
Rafaël Carré
8b926e98f8 Add Sansa Clip+ target to test mkamsboot
UNTESTED, could ver well brick your Clip+
If it works, booting should just be delayed by a small delay (perhaps
not noticeable)
Hopefully the Clipv2 checks will work for Clip+ and then we'll be able
to test the other Clipv2 code (LCD/button)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24219 a1c6a512-1295-4272-9138-f99709370657
2010-01-13 03:05:29 +00:00
Rafaël Carré
96165abec2 FS#10253 : mkamsboot v1.0
- Bump version to 1.0
- Add Clipv2 target
- Make mkamsboot work as a library (work by domonoky : FS#10185, with a few modifications by me)
  . Use a macro with variadic arguments for error cases in functions which might error.
  . Add detailed descriptions to functions exported by the library (in the header file)
- modify bin2c.c to produce only one pair of .c/.h files with several files embedded in it
- move files needing to be built by an ARM cross compiler into dualboot/
- commit produced .c/.h files (containing nrv2e_d8.S and dualboot.S built for Clip, Fuze, e200v2, c200v2, m200v4, Clipv2)
- Write a real README file
- cosmetics: indent dualboot.S properly, remove trailing spaces, limit lines to 80 characters
- comments: add/correct comments in dualboot.S and mkamsboot.c
- move back extract_fw.c to utils/AMS/hacking

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21118 a1c6a512-1295-4272-9138-f99709370657
2009-05-28 18:27:08 +00:00