Skip to contentSkip to conversation

u-boot compiler issue

Buildroot Yegor Yefremov 2 participants 3 messages May 12, 2011 – May 17, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I was building u-boot with buildroots created toolchain. Everything was working except that pointer passed via r8 was not writable (RAM was not configured etc.). But if the same code was compiled with CodeSourcery everything was working. Here gcc configuration from buidroot:

Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.5.2/lto-wrapper
Target: arm-unknown-linux-uclibcgnueabi
Configured with: /home/YegorYefremov/projects/versioned/tests/buildroot/output/toolchain/gcc-4.5.2/configure --prefix=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-unknown-linux-uclibcgnueabi --enable-languages=c,c++ --with-sysroot=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot --with-build-time-tools=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libssp --disable-multilib --disable-tls --enable-shared --with-gmp=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --with-mpfr=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --with-mpc=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --disable-nls --enable-threads --disa ble-decimal-float --with-float=soft --with-abi=aapcs-linux --with-arch=armv7-a --with-tune=cortex-a8 --with-pkgversion='Buildroot 2011.05-git-00157-gf4c06f4-dirty' --with-bugurl=http://bugs.buildroot.net/
Thread model: posix
gcc version 4.5.2 (Buildroot 2011.05-git-00157-gf4c06f4-dirty)

here CodeSourcery:

Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3 -arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

My buildroot .config is also attached.

How should I configure the toolchain to able to compile OMAP3 u-boot?

Best regards,
Yegor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config
Type: application/xml
Size: 28055 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20110512/6da499ed/attachment-0001.wsdl>

#1 lore raw

Hello,

Quoted 3 lines · On Thu, 12 May 2011 16:17:55 +0200 Yegor Yefremov…

I was building u-boot with buildroots created toolchain. Everything was working except that pointer passed via r8 was not writable (RAM was not configured etc.).

Could you give more details about this analysis ?

Quoted 2 lines

But if the same code was compiled with CodeSourcery everything was working. Here gcc configuration from buidroot:

Does the U-Boot compilation fails, or the compilation works but U-Boot fails to run on the device ? If it's the latter, then which version of U-Boot are you using ? Only recent versions of U-Boot work well with gcc 4.5.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
Quoted 5 lines
Quoted 4 lines

I was building u-boot with buildroots created toolchain. Everything was working except that pointer passed via r8 was not writable (RAM was not configured etc.).

Could you give more details about this analysis ?

#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")

in file arch/arm/cpu/arm_cortexa8/omap3/emif4.c:

int dram_init(void)

{
        DECLARE_GLOBAL_DATA_PTR;
        unsigned int size0 = 0, size1 = 0;

        size0 = get_sdr_cs_size(CS0);

        /*
         * If a second bank of DDR is attached to CS1 this is
         * where it can be started.  Early init code will init
         * memory on CS0.
         */
        if ((sysinfo.mtype == DDR_COMBO) || (sysinfo.mtype == DDR_STACKED))
                size1 = get_sdr_cs_size(CS1);

        gd->bd->bi_dram[0].start = PHYS_SDRAM_1;

        gd->bd->bi_dram[0].size = size0;  <----- this assignment has no effect, afterwards the size is 0

        gd->bd->bi_dram[1].start = PHYS_SDRAM_1 + get_sdr_cs_offset(CS1);
        gd->bd->bi_dram[1].size = size1;

        return 0;
}

with CodeSourcery 's compiler the size will be correctly assigned.

Quoted 6 lines
Quoted 2 lines

But if the same code was compiled with CodeSourcery everything was working. Here gcc configuration from buidroot:

Does the U-Boot compilation fails, or the compilation works but U-Boot fails to run on the device ? If it's the latter, then which version of U-Boot are you using ? Only recent versions of U-Boot work well with gcc 4.5.

This is u-boot 2010.06 from ARAGO project (http://arago-project.org/wiki/index.php/Main_Page). Git tree:
http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=summary

U-Boot compiles correctly in the sense that I get u-boot.bin and it also runs: I get command prompt and can execute various commands. The only things that fail are those that require RAM address and size like bootm and so on.

I hope this info will help.

P.S. I've got a hint that enabling __cxa_atexit would possibly solve the problem. So I added this setting to the toolchain, but it didn't help.

COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/libexec/gcc/arm-unknown-linux-uclibcgnueabi/4.5.2/lto-wrapper
Target: arm-unknown-linux-uclibcgnueabi
Configured with: /home/YegorYefremov/projects/versioned/tests/buildroot/output/toolchain/gcc-4.5.2/configure --prefix=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=arm-unknown-linux-uclibcgnueabi --enable-languages=c,c++ --with-sysroot=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot --with-build-time-tools=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libssp --disable-multilib --disable-tls --enable-shared --with-gmp=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --with-mpfr=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --with-mpc=/home/YegorYefremov/projects/versioned/tests/buildroot/output/host/usr --disable-nls --enable-threads --disable-decimal-float --with-float=soft --with-abi=aapcs-linux --with-arch=armv7-a --with-tune=cortex-a8 --enable-__cxa_atexit --with-pkgversion='Buildroot 2011.05-git-00157-gf4c06f4-dirty' --with-bugurl=http://bugs.buildroot.net/
Thread model: posix
gcc version 4.5.2 (Buildroot 2011.05-git-00157-gf4c06f4-dirty)

--disable-__cxa_atexit

--disable-__cxa_atexit