Is there a working 2011 version of u-boot on i.MX31?
Hi,
I tried to upgrade my 2010/09 version of u-boot for our i.MX31
board, fixed the stuff needed for the new relocation scheme and ... nothing, ... no prompt, so I compiled for mx31pdk (without any change of source code) as it is very similar (RAM setup, etc.) and this also shows no action on the uart (DEBUG is on).
After some hours of JTAG debugging I finally found that not even board_early_init_f is called (neither for mx31pdk nor for our board). Tracking down the assembler stuff in start.S and board.c shows that:
1) relocation is done at the end of 'board_init_f'
2) all early init functions are called at the very start of 'board_init_f'
3) these init functions are stored in an array of function pointers 'init_sequence', which is initialized data and which is not initialized yet.
4) the C-code in general is linked using -pie, but the compiler flag -PIE (or -PIC) is missing, so code is not really position independent. It is linked for the RAM addresses (0x87f00000), but relocation is not yet done.
5) uboot dies when the first function (board_early_init_f) should be called.
Adding -PIE in arch/arm/cpu/arm1136/config.mk and putting initialized arrays (with constant values) into the text segment (__attribute__ ((section (".text")) improves the situation, but butts out a little further down the road. I stopped at this point.
There also seems to be a problem with the setup of gd in 'board_init_f' which is placed at exactly the same position where start.S sets the initial stack pointer (in internal RAM). I think this was not intended.
On the other hand I found several patches in the last months about changes in the mx31pdk code which suggest a running uboot port for mx31pdk.
Can someone clarify what I'm missing?
Helmut
--
Scanned by MailScanner.
Dear Helmut Raiger,
Quoted 3 lines · In message <[email protected]> you wrote:
On the other hand I found several patches in the last months about changes in the mx31pdk code which suggest a running uboot port for mx31pdk.
I canot comment on the mx31pdk, but top-of-tree is running fine on some i.MX31 boards, for example qong.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Wisdom is one of the few things that looks bigger the further away it is. - Terry Pratchett, _Witches Abroad_
Helmut,
Quoted 9 lines · Wolfgang Denk
Dear Helmut Raiger,
Quoted 3 lines · In message <[email protected]> you wrote:
On the other hand I found several patches in the last months about changes in the mx31pdk code which suggest a running uboot port for mx31pdk.
I canot comment on the mx31pdk, but top-of-tree is running fine on some i.MX31 boards, for example qong.
I have been using MX31PDK with top-of-tree U-boot version and it works fine for me.
I build it as "make mx31pdk_nand_config" and then I use ATK tool to program u-boot.bin into NAND.
Regards,
Fabio Estevam
Quoted 2 lines · Helmut Raiger
Hi,
Hi Helmut,
Quoted 5 lines
I tried to upgrade my 2010/09 version of u-boot for our i.MX31
board, fixed the stuff needed for the new relocation scheme and ... nothing, ... no prompt, so I compiled for mx31pdk (without any change of source code) as it is very similar (RAM setup, etc.) and this also shows no action on the uart (DEBUG is on).
As Fabio already reported, last release is working on mx31pdk.
Quoted 4 lines
After some hours of JTAG debugging I finally found that not even
board_early_init_fis called (neither for mx31pdk nor for our board). Tracking down the assembler stuff instart.Sandboard.cshows that:
This is ruled by CONFIG_BOARD_EARLY_INIT_F, that is set for the board you mention and for qong, too. This is a second MX.31 board where I am sure that the last u-boot release is running.
Quoted 8 lines
1) relocation is done at the end of '
board_init_f'
2) all early init functions are called at the very start of 'board_init_f'
3) these init functions are stored in an array of function pointers 'init_sequence', which is initialized data and which is not initialized yet.
4) the C-code in general is linked using -pie, but the compiler flag -PIE (or -PIC) is missing, so code is not really position independent. It is linked for the RAM addresses (0x87f00000), but relocation is not yet done.
It seems a problem related to your toolchain. Which gcc compiler are you using ? This can explain what you are reporting.
Quoted 6 lines
5) uboot dies when the first function (
board_early_init_f) should be called.Adding -PIE in
arch/arm/cpu/arm1136/config.mkand putting initialized arrays (with constant values) into the text segment (__attribute__((section (".text")) improves the situation, but butts out a little further down the road. I stopped at this point.
Agree, it should run out-of-the-box.
Quoted 4 lines
There also seems to be a problem with the setup of gd in '
board_init_f' which is placed at exactly the same position wherestart.Ssets the initial stack pointer (in internal RAM). I think this was not intended.
This can be another symptom that the problem is related to the toolchain. Take care that what you are exponing is not strictly related to the i.MX31, and most of ARM boards should be affected, and they are not.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
Hello Stefano,
Quoted 1 line
As Fabio already reported, last release is working on mx31pdk.
Yes, I thought so. Thanks to all for the fast response.
Quoted 3 lines
This is ruled by
CONFIG_BOARD_EARLY_INIT_F, that is set for the board you mention and for qong, too. This is a second MX.31 board where I am sure that the last u-boot release is running.
Sure, I defined CONFIG_BOARD_EARLY_INIT_F.
Quoted 10 lines
Quoted 8 lines
1) relocation is done at the end of '
board_init_f'
2) all early init functions are called at the very start of 'board_init_f'
3) these init functions are stored in an array of function pointers 'init_sequence', which is initialized data and which is not initialized yet.
4) the C-code in general is linked using -pie, but the compiler flag -PIE (or -PIC) is missing, so code is not really position independent. It is linked for the RAM addresses (0x87f00000), but relocation is not yet done.It seems a problem related to your toolchain. Which gcc compiler are you using ? This can explain what you are reporting.
I suspected my toolchain already, so I tested 2 different versions:
1) arm_v6_vfp_le-gcc -v:
Using built-in specs.
Target: armv6fl-montavista-linux-gnueabi
Configured with: ../configure --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --target=armv6fl-montavista-linux-gnueabi
--prefix=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le
--exec-prefix=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le
--bindir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/bin
--sbindir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/sbin
--sysconfdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/etc
--datadir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/share
--includedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/include
--libdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib
--libexecdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/libexec --localstatedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/var --sharedstatedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/share
--mandir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/man
--infodir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/info
--build=i686-pc-linux-gnu --program-transform-name=s,^,arm_v6_vfp_le-,
--enable-cross --enable-poison-system-directories
--with-sysroot=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/target --with-build-sysroot=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/target --with-build-time-tools=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/bin
--enable-shared --enable-languages=c,c++ --enable-__cxa_atexit
--enable-c99 --enable-long-long --enable-threads=posix --with-gxx-include-dir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib/gcc/armv6fl-montavista-linux-gnueabi/4.2.0/../../../../target/usr/include/c++/4.2.0 --disable-libmudflap --disable-libssp --disable-libgomp --with-gnu-as
--with-gnu-ld --enable-symvers=gnu --enable-checking=release
--with-numa-policy=yes --disable-multilib --enable-clocale=gnu
--with-cpu=arm1136jf-s --with-interwork --with-arch=armv6j
--with-tune=arm1136jf-s --with-fpu=vfp --with-float=softfp
--libexecdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib
--with-bugurl=http://www.mvista.com/support --with-versuffix='MontaVista
4.2.0-16.0.46.custom 2009-03-17'
Thread model: posix
gcc version 4.2.0 (MontaVista 4.2.0-16.0.46.custom 2009-03-17)
2) arm-angstrom-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with:/home/HALE/vogc/openembedded/tmp/work/i686-armv6-sdk-angstrom-linux-gnueabi/gcc-cross-sdk-4.3.3-r20.3/gcc-4.3.3/configure --build=i686-linux --host=i686-linux --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/angstrom/arm --exec_prefix=/usr/local/angstrom/arm --bindir=/usr/local/angstrom/arm/bin
--sbindir=/usr/local/angstrom/arm/bin
--libexecdir=/usr/local/angstrom/arm/libexec
--datadir=/usr/local/angstrom/arm/share
--sysconfdir=/usr/local/angstrom/arm/etc
--sharedstatedir=/usr/local/angstrom/arm/share/com
--localstatedir=/usr/local/angstrom/arm/var
--libdir=/usr/local/angstrom/arm/lib
--includedir=/usr/local/angstrom/arm/include
--oldincludedir=/usr/local/angstrom/arm/include
--infodir=/usr/local/angstrom/arm/share/info
--mandir=/usr/local/angstrom/arm/share/man --with-gnu-ld --enable-shared --enable-languages=c,c++,objc,fortran --enable-threads=posix
--disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu
--enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi-
--enable-target-optspace --enable-cheaders=c_std --enable-libssp
--disable-bootstrap --disable-libgomp --disable-libmudflap --with-sysroot=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi --with-build-time-tools=/home/HALE/vogc/openembedded/tmp/sysroots/i686-linux/usr/armv6/arm-angstrom-linux-gnueabi/bin --with-build-sysroot=/home/HALE/vogc/openembedded/tmp/sysroots/armv6-angstrom-linux-gnueabi --disable-libunwind-exceptions --disable-libssp --disable-libgomp
--disable-libmudflap
--with-mpfr=/home/HALE/vogc/openembedded/tmp/sysroots/i686-linux/usr
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.3 (GCC)
... only to generate the same result. We even tested on different
machines, again the same result. What toolchain are you guys using? Could you send me an elf binary of an u-boot built for mx31pdk. I'm pretty much into disassembling these days, so this could probably give me a hint.
Quoted 4 lines
This can be another symptom that the problem is related to the toolchain. Take care that what you are exponing is not strictly related to the i.MX31, and most of ARM boards should be affected, and they are not.
You're right, I was mx31 blinkered.
Even if this is toolchain dependent, I think this is a bug, as it shouldn't. The 'init_sequence' array is initialized data and has to be initialized by the startup code before it is usable by C-code, which in fact is not done. The same holds true for the compile flag -fPIC (or PIE). Early C-code is XIPed (at least for NOR-flash boots) and on i.MX31 CS0 is remapped to address 0 in this case, so it must either be linked for address 0 and then relocated when uboot is copied to RAM or code must be position indepependent. Currently boards link with TEXT_BASE (start of text segment) set to the RAM address when relocated.
Maybe Heiko Schocher could comment on these issues.
Regards,
Helmut
--
Scanned by MailScanner.
Quoted 65 lines
I suspected my toolchain already, so I tested 2 different versions:
1) arm_v6_vfp_le-gcc -v:
Using built-in specs.
Target: armv6fl-montavista-linux-gnueabi
Configured with: ../configure --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --target=armv6fl-montavista-linux-gnueabi
--prefix=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le
--exec-prefix=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le
--bindir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/bin
--sbindir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/sbin
--sysconfdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/etc
--datadir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/share
--includedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/include
--libdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib
--libexecdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/libexec --localstatedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/var --sharedstatedir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/share
--mandir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/man
--infodir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/info
--build=i686-pc-linux-gnu --program-transform-name=s,^,arm_v6_vfp_le-,
--enable-cross --enable-poison-system-directories
--with-sysroot=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/target --with-build-sysroot=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/target --with-build-time-tools=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/bin
--enable-shared --enable-languages=c,c++ --enable-__cxa_atexit
--enable-c99 --enable-long-long --enable-threads=posix --with-gxx-include-dir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib/gcc/armv6fl-montavista-linux-gnueabi/4.2.0/../../../../target/usr/include/c++/4.2.0 --disable-libmudflap --disable-libssp --disable-libgomp --with-gnu-as
--with-gnu-ld --enable-symvers=gnu --enable-checking=release
--with-numa-policy=yes --disable-multilib --enable-clocale=gnu
--with-cpu=arm1136jf-s --with-interwork --with-arch=armv6j
--with-tune=arm1136jf-s --with-fpu=vfp --with-float=softfp
--libexecdir=/opt/montavista/mobilinux/devkit/arm/v6_vfp_le/lib
--with-bugurl=http://www.mvista.com/support --with-versuffix='MontaVista
4.2.0-16.0.46.custom 2009-03-17'
Thread model: posix
gcc version 4.2.0 (MontaVista 4.2.0-16.0.46.custom 2009-03-17)2) arm-angstrom-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with:/home/HALE/vogc/openembedded/tmp/work/i686-armv6-sdk-angstrom-linux-gnueabi/gcc-cross-sdk-4.3.3-r20.3/gcc-4.3.3/configure--build=i686-linux --host=i686-linux --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/angstrom/arm --exec_prefix=/usr/local/angstrom/arm --bindir=/usr/local/angstrom/arm/bin
--sbindir=/usr/local/angstrom/arm/bin
--libexecdir=/usr/local/angstrom/arm/libexec
--datadir=/usr/local/angstrom/arm/share
--sysconfdir=/usr/local/angstrom/arm/etc
--sharedstatedir=/usr/local/angstrom/arm/share/com
--localstatedir=/usr/local/angstrom/arm/var
--libdir=/usr/local/angstrom/arm/lib
--includedir=/usr/local/angstrom/arm/include
--oldincludedir=/usr/local/angstrom/arm/include
--infodir=/usr/local/angstrom/arm/share/info
--mandir=/usr/local/angstrom/arm/share/man --with-gnu-ld --enable-shared --enable-languages=c,c++,objc,fortran --enable-threads=posix
--disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu
--enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi-
--enable-target-optspace --enable-cheaders=c_std --enable-libssp
--disable-bootstrap --disable-libgomp --disable-libmudflap --with-sysroot=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi
Quoted 9 lines
--with-build-time-tools=/home/HALE/vogc/openembedded/tmp/sysroots/i686-linux/usr/armv6/arm-angstrom-linux-gnueabi/bin --with-build-sysroot=/home/HALE/vogc/openembedded/tmp/sysroots/armv6-angstrom-linux-gnueabi --disable-libunwind-exceptions --disable-libssp --disable-libgomp
--disable-libmudflap
--with-mpfr=/home/HALE/vogc/openembedded/tmp/sysroots/i686-linux/usr
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.3 (GCC)
I just tested Sourcery G++ Lite 2011.03-41, again with the same result. This contains gcc 4.5.2.
Helmut
--
Scanned by MailScanner.
Hi Helmut,
Quoted 2 lines · Helmut Raiger
? ? ... only to generate the same result. We even tested on different machines, again the same result. What toolchain are you guys using?
I have just built top-of-tree U-boot for MX31PDK and it booted fine here:
U-Boot 2011.06-rc1-00002-g5d1ee00 (May 31 2011 - 20:43:07)
CPU: Freescale i.MX31 rev 2.0 at 531 MHz.Reset cause: POR Board: MX31PDK DRAM: 128 MiB NAND: 256 MiB In: serial Out: serial Err: serial Net: smc911x-0 Hit any key to stop autoboot: 0
uboot>
My toolchain is:
$ arm-none-linux-gnueabi-gcc --version arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1
Quoted 3 lines
Could you send me an elf binary of an u-boot built for mx31pdk. I'm pretty much into disassembling these days, so this could probably give me a hint.
Yes, will send you on a private email.
Regards,
Fabio Estevam
Quoted 23 lines · Fabio Estevam
I have just built top-of-tree U-boot for MX31PDK and it booted fine here:
U-Boot 2011.06-rc1-00002-g5d1ee00 (May 31 2011 - 20:43:07)
CPU: Freescale i.MX31 rev 2.0 at 531 MHz.Reset cause: POR Board: MX31PDK DRAM: 128 MiB NAND: 256 MiB In: serial Out: serial Err: serial Net: smc911x-0 Hit any key to stop autoboot: 0uboot>
My toolchain is:
$ arm-none-linux-gnueabi-gcc --version arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1Quoted 3 lines
Could you send me an elf binary of an u-boot built for mx31pdk. I'm pretty much into disassembling these days, so this could probably give me a hint.
Quoted 9 lines
Yes, will send you on a private email.
Regards,
Fabio Estevam
--
Scanned by MailScanner.
I've finally produced a working u-boot for our board. Thanx to Fabio I did:
- compare the elf files for the NAND build between toolchains, no change.
- flash his mx31pdk NAND flash version to our NAND and it started correctly
- compile mx31pdk_nand_config, flash to NAND, again everything fine.
- compile a NAND flash version for our board and it worked as-well
- test 3 different toolchains and all of them performed equally well.
While I now got a running NAND flash version, I'm still unable to get the NOR flash version into gears. The NAND version is significantly different, as the NAND-spl loads the u-boot directly to the location in RAM that it was linked for.
I compiled 'mx31pdk_config' top-of-tree and it did not start up.
I'm still inclined to say that something is wrong with the NOR flash version of the startup code, so I'd like to rephrase my original question:
Is there working version of a 2011 arm uboot (possibly for i.MX31) that boots from NOR flash?
Helmut
--
Scanned by MailScanner.
Hi Helmut,
On Mon, Jun 6, 2011 at 10:31 AM, Helmut Raiger <[email protected]> wrote:
..
Quoted 2 lines
Is there working version of a 2011 arm uboot (possibly for i.MX31) that boots from NOR flash?
Yes, we have at least MX31ADS and MX31Litekit (from LogicPD) that are booting from NOR.
Please see the 2 patches I sent this weekend that made both boards to boot correctly. They are already present int the latest u-boot-imx git tree now.
Some suggestions:
- Make sure you use board_early_init for configuring the IOMUX for the peripherals
- Make sure you use CONFIG_SYS_TEXT_BASE = 0xa0000000 for the NOR boot case
Regards,
Fabio Estevam
Quoted 6 lines · Helmut Raiger
I'm still inclined to say that something is wrong with the NOR flash version of the startup code, so I'd like to rephrase my original question:
Is there working version of a 2011 arm uboot (possibly for i.MX31) that boots from NOR flash?
Yes. The qong board boots from NOR.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
Quoted 7 lines · Fabio Estevam
Yes, we have at least MX31ADS and MX31Litekit (from LogicPD) that are booting from NOR.
Please see the 2 patches I sent this weekend that made both boards to boot correctly. They are already present int the latest u-boot-imx git tree now.
Quoted 7 lines
Some suggestions:
- Make sure you use
board_early_initfor configuring the IOMUX for the peripherals
- Make sure you useCONFIG_SYS_TEXT_BASE=0xa0000000for the NOR boot case
Hi Fabio,
I saw your patches right after sending my last mail. I just tested
it and this did the trick, it boots from NOR now.
Thx for the support.
Helmut
--
Scanned by MailScanner.