diff mbox

[U-Boot] ARM: versatile: fix board support

Message ID 20110624153718.GA2609@bee.dooz.org
State Not Applicable
Headers show

Commit Message

Loïc Minier June 24, 2011, 3:37 p.m. UTC
On Fri, Jun 24, 2011, Stefano Babic wrote:
> Versatile board is used as example to run u-boot under qemu.
> The patch fixes relocation for all versatile boards and adds
> a versatileqemu target to be used under qemu.

 Thanks a lot!

> Patch tested only under qemu, not on real boards.
> Tested with QEMU emulator version 0.14.50. 

 I've built u-boot tip with your patch with:
    make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu \
        versatileqemu_config
    make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu -j3
 using the Ubuntu (Linaro-based, 4.6.0-14ubuntu1cross1.52) armel
 cross-compiler but couldn't get this to start with my incantations of:
    qemu-system-arm -M versatilepb -kernel obj-versatileqemu/u-boot \
        -m 128 -serial stdio
 and other combinations I've tried

 However, inspired by your changes I added these changes:

 and built with:
    make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-qemuvexpressa9 \
        qemuvexpressa9_config
    make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-qemuvexpressa9 -j3 \
        $PWD/obj-qemuvexpressa9/u-boot
 and this started fine with:
    qemu-system-arm -M vexpress-a9 -kernel obj-qemuvexpressa9/u-boot \
        -m 1024 -serial stdio

 I wonder whether it would make sense to use the same ifdef for
 versatile and vexpress boards (QEMU_NO_FLASH?) and prefix the board
 names with qemu; e.g. qemu_versatile_foo?

 Could you share your recipe for getting the versatileqemu config to
 start?  I'm using Ubuntu's qemu (Linaro-based,
 0.14.50-2011.06-0-0ubuntu1).

Comments

Stefano Babic June 24, 2011, 4:53 p.m. UTC | #1
Am 24/06/2011 17:37, schrieb Loïc Minier:
> On Fri, Jun 24, 2011, Stefano Babic wrote:
>> Versatile board is used as example to run u-boot under qemu.
>> The patch fixes relocation for all versatile boards and adds
>> a versatileqemu target to be used under qemu.
> 
>  Thanks a lot!

You're welcome.

> 
>> Patch tested only under qemu, not on real boards.
>> Tested with QEMU emulator version 0.14.50. 
> 
>  I've built u-boot tip with your patch with:
>     make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu \
>         versatileqemu_config
>     make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu -j3
>  using the Ubuntu (Linaro-based, 4.6.0-14ubuntu1cross1.52) armel
>  cross-compiler but couldn't get this to start with my incantations of:
>     qemu-system-arm -M versatilepb -kernel obj-versatileqemu/u-boot \
>         -m 128 -serial stdio
>  and other combinations I've tried

I do not know if depends on the compiler (search in the mailing list
against problem with gcc 4.5+). I tested with ELDK-4.2, that means gcc
4.2.2.

I use the same qemu as you, as I tested on Ubuntu-natty:
qemu-system-arm --version
QEMU emulator version 0.14.50 (Debian 0.14.50-2011.03-1-0ubuntu2),
Copyright (c) 2003-2008 Fabrice Bellard

And I start the image with:

qemu-system-arm -M versatilepb -m 128M -kernel u-boot.bin -serial stdio
-net nic,vlan=0,model=smc91c111

Warning: vlan 0 is not connected to host network


U-Boot 2011.06-rc3-00001-gd723904 (Jun 24 2011 - 18:26:27)

DRAM:  128 MiB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   SMC91111-0


Note: because now the RAM is detected, the correct RAM size is displayed
by U-Boot under qemu. In fact, starting with only 16MB I get:

$ qemu-system-arm -M versatilepb -m 16M -kernel u-boot.bin -serial stdio
-net nic,vlan=0,model=smc91c111
Warning: vlan 0 is not connected to host network


U-Boot 2011.06-rc3-00001-gd723904 (Jun 24 2011 - 18:26:27)

DRAM:  16 MiB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   SMC91111-0
VersatilePB #

> 
>  However, inspired by your changes I added these changes:
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -138,6 +138,7 @@ omap5912osk                  arm         arm926ejs   -                   ti
>  edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
>  dkb                         arm         arm926ejs   -                   Marvell        pantheon
>  ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
> +qemuvexpressa9               arm         armv7       vexpress            armltd         -               ca9x4_ct_vxp:ARCH_QEMU_VEXPRESS

Probably we need some feedback from ML to know if we have to save the
vexpress board or we have simply to drop it, because nobody seems to
have interest on it. The versatile is the well known example to run the
bootloader under qemu, I do not know if we have to extend the patch to
include other boards.

For the same reason, I have not dropped in my patch
board/armltd/integrator/split_by_variant.sh. This file is obsolete for
versatile, and should be removed if the integrator boards will be
removed in the next release.

>  I wonder whether it would make sense to use the same ifdef for
>  versatile and vexpress boards (QEMU_NO_FLASH?)

Extending the patch to vexpress, I agree using the same #ifdef. No need
to add a special CONFIG_ for each board we want to run under qemu.

>  Could you share your recipe for getting the versatileqemu config to
>  start?  I'm using Ubuntu's qemu (Linaro-based,
>  0.14.50-2011.06-0-0ubuntu1).

See at the beginning. It seems I am testing on the same distro as you,
and if it does not work, there should be something related to the
different toolchains we are using.
I have tested also with gcc 4.4.1, no problem found.

Best regards,
Stefano Babic
Jason Hobbs June 24, 2011, 5:49 p.m. UTC | #2
Hi Stefano,

On Fri, Jun 24, 2011 at 06:53:31PM +0200, stefano babic wrote:
> Probably we need some feedback from ML to know if we have to save the
> vexpress board or we have simply to drop it, because nobody seems to
> have interest on it. The versatile is the well known example to run
> the bootloader under qemu, I do not know if we have to extend the
> patch to include other boards.
 
I use U-boot in QEMU versatile express regularly. It's my primary
place for testing the pxe/pxecfg/menu patches I've submitted recently.
I have real versatile expresses available, but they're typically busy,
so it's a useful way to try new changes without taking up a real system.

I have a copy of ca9x4_ct_vxp.h I copy in from outside the tree
for building with - it strips out all the flash options, undef's
CONFIG_CMD_IMLS, and def's CONFIG_SYS_NO_FLASH, CONFIG_ENV_IS_NOWHERE.
So, I would welcome a cleaner way to get the same thing done.

Thanks,
Jason
Loïc Minier July 1, 2011, 2:26 p.m. UTC | #3
On Fri, Jun 24, 2011, stefano babic wrote:
> I do not know if depends on the compiler (search in the mailing list
> against problem with gcc 4.5+). I tested with ELDK-4.2, that means gcc
> 4.2.2.

 I tried with arm-linux-gnueabi-gcc-4.5 and arm-linux-gnueabi-gcc-4.4
 and using your qemu-system-arm command line, but didn't have more luck
 than with arm-linux-gnueabi-gcc-4.6.

 I'll try gdbing into this
Stefano Babic July 1, 2011, 2:33 p.m. UTC | #4
On 07/01/2011 04:26 PM, Loïc Minier wrote:
> On Fri, Jun 24, 2011, stefano babic wrote:
>> I do not know if depends on the compiler (search in the mailing list
>> against problem with gcc 4.5+). I tested with ELDK-4.2, that means gcc
>> 4.2.2.
> 

Hi Loïc,

>  I tried with arm-linux-gnueabi-gcc-4.5 and arm-linux-gnueabi-gcc-4.4
>  and using your qemu-system-arm command line, but didn't have more luck
>  than with arm-linux-gnueabi-gcc-4.6.

Do you mean the versatile or the vexpress board ? I get the vexpress
working, but only mapping the RAM to the address 0 and not to the
correct address (0x60000000). This only because qemu maps 64MB starting
from address 0 as RAM. However, setting the real physical address for
SDRAM it does not work - maybe this a qemu related issue ?

Best regards,
Stefano Babic
Loïc Minier July 1, 2011, 2:52 p.m. UTC | #5
On Fri, Jul 01, 2011, Stefano Babic wrote:
> Do you mean the versatile or the vexpress board ? I get the vexpress
> working, but only mapping the RAM to the address 0 and not to the
> correct address (0x60000000). This only because qemu maps 64MB starting
> from address 0 as RAM. However, setting the real physical address for
> SDRAM it does not work - maybe this a qemu related issue ?

 Vexpress works for me out of the box (not changing any code outside of
 the QEMU config patch I've sent); the versatile work doesn't work at
 all, I don't get any serial output.
Jeroen Hofstee July 10, 2011, 5:35 p.m. UTC | #6
Thanks Stefano,

This works for me as well.

Regards,
Jeroen

[jeroen@blue /usr/home/jeroen]$ qemu --version
QEMU emulator version 0.14.0, Copyright (c) 2003-2008 Fabrice Bellard

[jeroen@blue /usr/home/jeroen]$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/compat/linux/usr/local/cs/bin/../libexec/gcc/arm-none-eabi/4.5.2/lto-wrapper
Target: arm-none-eabi
Configured with: 
/scratch/janisjo/arm-eabi-lite/src/gcc-4.5-2011.03/configure 
--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu 
--target=arm-none-eabi --enable-threads --disable-libmudflap 
--disable-libssp --disable-libstdcxx-pch 
--enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld 
--with-specs='%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2011 
-D__CS_SOURCERYGXX_MIN__=3 -D__CS_SOURCERYGXX_REV__=42 
%{O2:%{!fno-remove-local-statics: -fremove-local-statics}} 
%{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: 
-fremove-local-statics}}}' --enable-languages=c,c++ --disable-shared 
--enable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite 
2011.03-42' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ 
--disable-nls --prefix=/opt/codesourcery --with-headers=yes 
--with-sysroot=/opt/codesourcery/arm-none-eabi 
--with-build-sysroot=/scratch/janisjo/arm-eabi-lite/install/arm-none-eabi --with-gmp=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--with-mpfr=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--with-mpc=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--with-ppl=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic 
-lm' 
--with-cloog=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--with-libelf=/scratch/janisjo/arm-eabi-lite/obj/host-libs-2011.03-42-arm-none-eabi-i686-pc-linux-gnu/usr 
--disable-libgomp --enable-poison-system-directories 
--with-build-time-tools=/scratch/janisjo/arm-eabi-lite/install/arm-none-eabi/bin 
--with-build-time-tools=/scratch/janisjo/arm-eabi-lite/install/arm-none-eabi/bin
Thread model: single
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-42)
Albert ARIBAUD Aug. 4, 2011, 9:01 a.m. UTC | #7
Stefano, Loïc,

On 24/06/2011 17:37, Loïc Minier wrote:
> On Fri, Jun 24, 2011, Stefano Babic wrote:
>> Versatile board is used as example to run u-boot under qemu.
>> The patch fixes relocation for all versatile boards and adds
>> a versatileqemu target to be used under qemu.
>
>   Thanks a lot!
>
>> Patch tested only under qemu, not on real boards.
>> Tested with QEMU emulator version 0.14.50.
>
>   I've built u-boot tip with your patch with:
>      make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu \
>          versatileqemu_config
>      make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-versatileqemu -j3
>   using the Ubuntu (Linaro-based, 4.6.0-14ubuntu1cross1.52) armel
>   cross-compiler but couldn't get this to start with my incantations of:
>      qemu-system-arm -M versatilepb -kernel obj-versatileqemu/u-boot \
>          -m 128 -serial stdio
>   and other combinations I've tried
>
>   However, inspired by your changes I added these changes:
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -138,6 +138,7 @@ omap5912osk                  arm         arm926ejs   -                   ti
>   edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
>   dkb                         arm         arm926ejs   -                   Marvell        pantheon
>   ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
> +qemuvexpressa9               arm         armv7       vexpress            armltd         -               ca9x4_ct_vxp:ARCH_QEMU_VEXPRESS
>   efikamx                      arm         armv7       efikamx             -              mx5            mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg
>   mx51evk                      arm         armv7       mx51evk             freescale      mx5            mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
>   mx53evk                      arm         armv7       mx53evk             freescale      mx5            mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
> --- a/include/configs/ca9x4_ct_vxp.h
> +++ b/include/configs/ca9x4_ct_vxp.h
> @@ -148,6 +148,12 @@
>                          "cp ${initrdaddr} ${initrd} ${maxinitrd}; " \
>                          "bootm ${kerneladdr} ${initrd}\0"
>
> +#ifdef CONFIG_ARCH_QEMU_VEXPRESS
> +#define CONFIG_ENV_SIZE                        8192
> +#define CONFIG_SYS_NO_FLASH
> +#define CONFIG_ENV_IS_NOWHERE
> +#define CONFIG_SYS_MONITOR_LEN         0x80000
> +#else
>   /* FLASH and environment organization */
>   #define PHYS_FLASH_SIZE                        0x04000000      /* 64MB */
>   #define CONFIG_SYS_FLASH_CFI           1
> @@ -187,6 +193,7 @@
>   #define CONFIG_SYS_FLASH_EMPTY_INFO    /* flinfo indicates empty blocks */
>   #define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE0, \
>                                            CONFIG_SYS_FLASH_BASE1 }
> +#endif
>
>   /* Monitor Command Prompt */
>   #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */
>
>   and built with:
>      make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-qemuvexpressa9 \
>          qemuvexpressa9_config
>      make CROSS_COMPILE=arm-linux-gnueabi- O=$PWD/obj-qemuvexpressa9 -j3 \
>          $PWD/obj-qemuvexpressa9/u-boot
>   and this started fine with:
>      qemu-system-arm -M vexpress-a9 -kernel obj-qemuvexpressa9/u-boot \
>          -m 1024 -serial stdio
>
>   I wonder whether it would make sense to use the same ifdef for
>   versatile and vexpress boards (QEMU_NO_FLASH?) and prefix the board
>   names with qemu; e.g. qemu_versatile_foo?
>
>   Could you share your recipe for getting the versatileqemu config to
>   start?  I'm using Ubuntu's qemu (Linaro-based,
>   0.14.50-2011.06-0-0ubuntu1).
>

Does this mean Stefano's patch will see a V2, or should I try and apply 
it as-is?

Amicalement,
Loïc Minier Aug. 4, 2011, 10:02 a.m. UTC | #8
On Thu, Aug 04, 2011, Albert ARIBAUD wrote:
> Does this mean Stefano's patch will see a V2, or should I try and
> apply it as-is?

 I personally think you should merge it as it makes it work again for
 Stefano and the board builds again; I guess I should look into the
 toolchain issue I'm seeing and which I bet others will see in the
 future too, but I didn't get to that so far.
Stefano Babic Aug. 4, 2011, 11:06 a.m. UTC | #9
On 08/04/2011 11:01 AM, Albert ARIBAUD wrote:
> Stefano, Loïc,
> 

Hi Albert,

> Does this mean Stefano's patch will see a V2, or should I try and apply
> it as-is?

As far as I know, there someone else who tested the patch successfully:

http://lists.denx.de/pipermail/u-boot/2011-July/095798.html

I think you can take the patch as it is.

I do not know why it does not work for Loïc. We have quite the same
environment, including the same distro and the same qemu version (maybe
it depends I run on the 32 bit and not on the x86_64 ?). We tried
different toolchains with the same results (working for me, not working
for Loïc).

Regards,
Stefano
Albert ARIBAUD Aug. 4, 2011, 11:11 a.m. UTC | #10
Hi Loïc,

On 04/08/2011 12:02, Loïc Minier wrote:
> On Thu, Aug 04, 2011, Albert ARIBAUD wrote:
>> Does this mean Stefano's patch will see a V2, or should I try and
>> apply it as-is?
>
>   I personally think you should merge it as it makes it work again for
>   Stefano and the board builds again; I guess I should look into the
>   toolchain issue I'm seeing and which I bet others will see in the
>   future too, but I didn't get to that so far.

Will do, then.

Note that Patchwork got confused by the fact that in your first reply to 
Stefano's patch, you copy-pasted parts of his patch without the 
quotation headers ("> ") before each line. This caused Patchwork to 
believe that ou'd posted another patch, and to attribute the conversion 
to "your" patch rather than "Stefano's" patch. Not much of a problem 
here as the conversion did not result in a V2 and thus needs not be 
recorded with the patch, but it could have.

I'll mark "your" patch as rejected.

Amicalement,
diff mbox

Patch

--- a/boards.cfg
+++ b/boards.cfg
@@ -138,6 +138,7 @@  omap5912osk                  arm         arm926ejs   -                   ti
 edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
 dkb                         arm         arm926ejs   -                   Marvell        pantheon
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
+qemuvexpressa9               arm         armv7       vexpress            armltd         -               ca9x4_ct_vxp:ARCH_QEMU_VEXPRESS
 efikamx                      arm         armv7       efikamx             -              mx5            mx51evk:IMX_CONFIG=board/efikamx/imximage.cfg
 mx51evk                      arm         armv7       mx51evk             freescale      mx5            mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg
 mx53evk                      arm         armv7       mx53evk             freescale      mx5            mx53evk:IMX_CONFIG=board/freescale/mx53evk/imximage.cfg
--- a/include/configs/ca9x4_ct_vxp.h
+++ b/include/configs/ca9x4_ct_vxp.h
@@ -148,6 +148,12 @@ 
                        "cp ${initrdaddr} ${initrd} ${maxinitrd}; " \
                        "bootm ${kerneladdr} ${initrd}\0"
 
+#ifdef CONFIG_ARCH_QEMU_VEXPRESS
+#define CONFIG_ENV_SIZE                        8192
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_SYS_MONITOR_LEN         0x80000
+#else
 /* FLASH and environment organization */
 #define PHYS_FLASH_SIZE                        0x04000000      /* 64MB */
 #define CONFIG_SYS_FLASH_CFI           1
@@ -187,6 +193,7 @@ 
 #define CONFIG_SYS_FLASH_EMPTY_INFO    /* flinfo indicates empty blocks */
 #define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE0, \
                                          CONFIG_SYS_FLASH_BASE1 }
+#endif
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE              512     /* Console I/O Buffer Size */