# HG changeset patch # User Mychaela Falconia # Date 1469480973 0 # Node ID 21eec7569eb858901e5630e817ef0fbc8b694535 # Parent 56b1bab3e09b8d4f24c4d28a7b9ae5d0d4a20484 loadtools support for C139/140 target: -c 1004 compalstage variant supercedes the previous -c 1003 version and supports the new C139 boot code version found in the wild that expects "1004" or greater in the signature bytes diff -r 56b1bab3e09b -r 21eec7569eb8 CHANGES --- a/CHANGES Mon Jul 25 20:15:41 2016 +0000 +++ b/CHANGES Mon Jul 25 21:09:33 2016 +0000 @@ -7,6 +7,14 @@ version 0300 found in the common Calypso devices, but also with the older version 0200 found in the older Calypso silicon on early D-Sample boards. +* loadtools support for C139/140 target: use -h compal -c 1004 command line + options instead of the previous -h compal -c 1003 to support the newer + versions of C139/140 boot code which expect "1004" instead of the more + familiar "1003" in the serially downloaded code image. The new -c 1004 + option ("1004" signature bytes) should work with all currently known + Mot/Compal boot code versions, thus -c 1003 is retained only for backward + compatibility with existing usage. + * tiffs: added -O option to parse FFS images from the ancient 20020917 firmware on the D-Sample. diff -r 56b1bab3e09b -r 21eec7569eb8 doc/Compal-unlock --- a/doc/Compal-unlock Mon Jul 25 20:15:41 2016 +0000 +++ b/doc/Compal-unlock Mon Jul 25 21:09:33 2016 +0000 @@ -64,7 +64,7 @@ 2. On the host end, run fc-loadtool like this: C11x/123: fc-loadtool -h compal /dev/ttyXXX -C139/140: fc-loadtool -h compal -c 1003 /dev/ttyXXX +C139/140: fc-loadtool -h compal -c 1004 /dev/ttyXXX C155/156: fc-loadtool -h c155 /dev/ttyXXX 3. Press the power button on the phone. A momentary press is sufficient and diff -r 56b1bab3e09b -r 21eec7569eb8 loadtools/README --- a/loadtools/README Mon Jul 25 20:15:41 2016 +0000 +++ b/loadtools/README Mon Jul 25 21:09:33 2016 +0000 @@ -77,7 +77,7 @@ Device Needed options ----------------------------------- Mot C11x/123 -h compal - Mot C139/140 -h compal -c 1003 + Mot C139/140 -h compal -c 1004 Mot C155/156 -h c155 Openmoko GTA02 -h gta02 Pirelli DP-L10 -h pirelli diff -r 56b1bab3e09b -r 21eec7569eb8 target-utils/compalstage/Makefile --- a/target-utils/compalstage/Makefile Mon Jul 25 20:15:41 2016 +0000 +++ b/target-utils/compalstage/Makefile Mon Jul 25 21:09:33 2016 +0000 @@ -1,7 +1,8 @@ CC= arm-elf-gcc OBJCOPY=arm-elf-objcopy -TARGETS=compalstage-plain.bin compalstage-thumb.bin compalstage-1003.bin +TARGETS=compalstage-plain.bin compalstage-thumb.bin compalstage-1003.bin \ + compalstage-1004.bin INSTDIR=/usr/local/share/freecalypso all: ${TARGETS} @@ -14,6 +15,9 @@ compalstage-1003.o: compalstage.S ${CC} -DPAD_TO_1003 -c -o $@ $< +compalstage-1004.o: compalstage.S + ${CC} -DPAD_TO_1003 -DMAGIC_1004 -c -o $@ $< + compalstage-plain.o: compalstage.S ${CC} -c -o $@ $< diff -r 56b1bab3e09b -r 21eec7569eb8 target-utils/compalstage/compalstage.S --- a/target-utils/compalstage/compalstage.S Mon Jul 25 20:15:41 2016 +0000 +++ b/target-utils/compalstage/compalstage.S Mon Jul 25 21:09:33 2016 +0000 @@ -22,6 +22,25 @@ .word 0xFFFFFB10 #if PAD_TO_1003 +/* + * The older and most familiar versions of C139/140 boot code expect the + * signature bytes to be "1003" or greater, but a recently encountered + * newer version expects them to be "1004" or greater instead. As the + * actual comparison check in all currently known boot code versions is + * an inequality (the signature bytes in the downloaded image need to be + * greater than or equal to the hard-coded reference values), always + * putting "1004" in our compalstage image instead of "1003" should satisfy + * all existing C1xx boot code versions, or at least all currently known + * ones. However, having an image named compalstage-1003.bin with the + * corresponding -c 1003 loadtools option that is actually "1004" inside + * feels a little "wrong" in some sense, while getting rid of the -c 1003 + * option would break old user instructions, hence let's go ahead and do the + * silly exercise of building both "1003" and "1004" versions. + */ .org 0x3be0 +#if MAGIC_1004 + .ascii "1004" +#else .ascii "1003" #endif +#endif diff -r 56b1bab3e09b -r 21eec7569eb8 target-utils/env/compalram.lds --- a/target-utils/env/compalram.lds Mon Jul 25 20:15:41 2016 +0000 +++ b/target-utils/env/compalram.lds Mon Jul 25 21:09:33 2016 +0000 @@ -28,7 +28,7 @@ /* magic signature for C139/140 bootloader */ .magic 0x803ce0 : { - LONG(0x33303031) + LONG(0x34303031) } /* uninitialized data */