On Mon, Dec 28, 2015 at 07:18:29PM +0200, Siarhei Siamashka wrote:
> On Mon, 28 Dec 2015 13:18:46 +0100
> Piotr Król <[email protected]> wrote:
> 
> > On Thu, Dec 17, 2015 at 01:19:02PM +0100, Piotr Król wrote:
> > > Hi all,
> > > I'm trying to enter FEL mode by using SD card image provided in
> > > sunxi-tools. I follow procedure:
> > > 
> > > http://linux-sunxi.org/FEL#Through_a_special_SD_card_image
> > > 
> > > it doesn't seem to work as expected. Booting process stall. It doesn't
> > > not proceed through boot order, so this seems to be ok. But FEL tool
> > > cannot communicate with device and there is no logs in Linux dmesg
> > > showing that new USB device was detected. So I assume device didn't
> > > enter FEL.
> > > 
> > > Running FEL mode using button works fine, but I would like to validate
> > > procedures that can work without FEL/Recovery button.
> > > 
> > > What I tried:
> > > 
> > > * Cubietruck and A20-OLinuXino-MICRO
> > > * toolchains (Linaro 2014.07, 2015.05)
> > > * different order of power on and inserting USB cable
> > > * SD cards (Samsung, SanDisk, Kingston)
> > > * enter using UART method:
> > >   http://linux-sunxi.org/FEL#Through_serial_console
> > > 
> > > Can someone confirm that this feature ever worked with mentioned boards?
> > > 
> > > Have you got any ideas what may be wrong or how to enter FEL without
> > > button ?  
> > 
> > Hi all,
> > for those having similar issues. I was able to resolve problem using
> > binaries already available on github:
> > https://github.com/linux-sunxi/sunxi-tools/tree/master/bin
> 
> Hi,
>  
> > I assume there is problem with modern Linaro toolchain, which not
> > produce expected result. I tried also recent Debian 
> > gcc-arm-linux-gnueabi package, but without luck.
> 
> In your original e-mail you did not even mention that you tried to
> compile fel-sdboot.sunxi yourself. It is difficult to help you
> because you are not telling us any details even now.

Hi Siarhei,
I mentioned that I used various toolchains. Sorry for not putting this
clearer. I will try to give you more details in future.

> 
> > Which toolchain was used for fel-sdboot.sunxi stored on github ?
> > 
> > Does anyone built fel-sdboot with recent toolchain ?
> 
> $ arm-linux-gnueabihf-gcc -v
> 

Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/pietrushnic/bin/gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.1/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: 
/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/gcc-linaro-4.9-2014.07/configure
 --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu 
--target=arm-linux-gnueabihf 
--prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install
 
--with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc
 --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch 
--with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 
--with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1-4.9-2014.07 - 
Linaro GCC 4.9-2014.07' --with-bugurl=https://bugs.launchpad.net/gcc-linaro 
--enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp 
--with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 
--with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 
--with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 
--with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 
--with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 
--with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static
 --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id 
--enable-plugin --enable-gold 
--with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc
 --enable-c99 --enable-long-long --with-mode=thumb --disable-multilib 
--with-float=hard
Thread model: posix
gcc version 4.9.1 20140710 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.07 
- Linaro GCC 4.9-2014.07) 

> 
> $ CROSS_COMPILE=arm-linux-gnueabihf- make fel-sdboot.sunxi
> 
> $ r2 -a arm fel-sdboot.sunxi
> [0x00000000]> pd
>        ,=< 0x00000000    060000ea     b 0x20
>        |   0x00000004    65474f4e     cdpmi p7, 4, c4, c15, c5, 3
>        |   0x00000008    2e425430     subslo r4, r4, lr, lsr 4
>        |   0x0000000c    8c55b361     invalid
>        |   0x00000010    00200000     andeq r2, r0, r0
>        |   0x00000014    53504c01     qdaddeq r5, r3, ip
>        |   0x00000018    00000000     andeq r0, r0, r0
>        |   0x0000001c    00000000     andeq r0, r0, r0
>        `-> 0x00000020    08402de9     push {r3, lr}
>            0x00000024    04309fe5     ldr r3, [pc, 4] ; [:4]=0xffff0020 ; '0'
>            0x00000028    33ff2fe1     blx r3
>               0x00000045()
>            0x0000002c    0880bde8     pop {r3, pc}
> 

It looks like my version of radare2 doesn't decode instructions correctly.
Maybe you are using different version (I'm on Debian):

radare2 0.9.6 @ linux-little-x86-64 git.0.9.6
commit: 1: build: 2015-06-26

[0x00000000]> pd
            0x00000000    060000ea     ands x6, x0, x0
            0x00000004    65474f4e     .inst 0x4e4f4765
            0x00000008    2e425430     adr x14, 0x000a884d
            0x0000000c    e110498d     .inst 0x8d4910e1
            0x00000010    00200000     .inst 0x00002000
            0x00000014    53504c01     .inst 0x014c5053
            0x00000018    00000000     .inst 0x00000000
            0x0000001c    00000000     .inst 0x00000000
            0x00000020    04000000     .inst 0x00000004
            0x00000024    14000000     .inst 0x00000014
            0x00000028    03000000     .inst 0x00000003
            0x0000002c    474e5500     .inst 0x00554e47
            0x00000030    8f2e3945     .inst 0x45392e8f
            0x00000034    6753f158     ldr x7, 0xfffffffffffe2aa0
            0x00000038    29a9f212     .inst 0x12f2a929
            0x0000003c    fd4d5924     .inst 0x24594dfd
            0x00000040    1e986ba7     .inst 0xa76b981e
            0x00000044    004b1847     .inst 0x47184b00
            0x00000048    2000ffff     .inst 0xffff0020


> $ sudo dd if=fel-sdboot.sunxi of=/dev/sdX bs=1024 seek=8
> 
> Then insert this SD card into a Cubietruck board and power it on:
> 
> $ sunxi-fel ver
> AWUSBFEX soc=00001651(A20) 00000001 ver=0001 44 08 scratchpad=00007e00
> 
> 
> For comparison, the current fel-sdboot.sunxi binary contains the
> following code:
> 
> $ r2 -a arm bin/fel-sdboot.sunxi 
> [0x00000000]> pd
>        ,=< 0x00000000    060000ea     b 0x20
>        |   0x00000004    65474f4e     cdpmi p7, 4, c4, c15, c5, 3
>        |   0x00000008    2e425430     subslo r4, r4, lr, lsr 4
>        |   0x0000000c    2cc70742     andmi ip, r7, 0xb00000
>        |   0x00000010    00020000     andeq r0, r0, r0, lsl 4
>        |   0x00000014    00000000     andeq r0, r0, r0
>        |   0x00000018    00000000     andeq r0, r0, r0
>        |   0x0000001c    00000000     andeq r0, r0, r0
>        `-> 0x00000020    08402de9     push {r3, lr}
>            0x00000024    08309fe5     ldr r3, [pc, 8] ; [:4]=0xffff0020 ; '4'
>            0x00000028    0fe0a0e1     mov lr, pc
>       ,==< 0x0000002c    13ff2fe1     bx r3
>       |    0x00000030    0880bde8     pop {r3, pc}
> 
> 
> My random guess is that your toolchain is probably generating thumb2
> code by default. We might need to add '-marm' option to CFLAGS in the
> makefile.

Tried that, unfortunately doesn't help.

Best Regards,
-- 
Piotr Król
Embedded Systems Consultant
http://3mdeb.com | @3mdeb_com

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to