How to make arm-linux-gnueabi support arm926ej-s ?

Started by chjchoi, October 07, 2012, 07:56:02 PM

Previous topic - Next topic

chjchoi

https://github.com/koliqi/imx23-olinuxino/blob/master/Building%20a%20kernel%20%20for%20the%20OLinuXino.md
-----------------------------------------------------------------------------------------------------------
If olinuxino failing to boot because of the error:

Undefined Instruction
r14_unHTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFC   

Probably your toolchain does not support cpu arm926ej-s. Download sources and
compile --with-arch=armv5te --with-tune=arm926ej-s. If you prefer premade binaries,
download arm-none-eabi toolchain. It is proven to work with arm926ej-s.
----------------------------------------------------------------------
I have met the message above..
and I'm really newbi so
I don't know how to make arm-linux-gnueabi toolchain which support cpuarm926ej-s..
I should use arm-linux-gnueabi .. because it succeeded to compile my application.
and ..arm-none-eabi failed ..

Could any one explain how to make arm-linux-gnueabi support the imx233-micro board?

nidalpres

If you are not familiar with compiling gcc you better stick to prebuilt binaries for now. This will make you get to where you want with your project. Later on, when you have some free time, go on and find tutorials on building gcc for cross compiling and learn how to do that.

As for your problem, just follow instructions there, i.e. read rest of the readme file:

-------------------------------------------------------------
It is proven to work with arm926ej-s.

Add PPA in your system:

$: sudo add-apt-repository ppa:germia/archive3 

Refresh list of software available, including the PPA you just added:

$: sudo apt-get update 

Install packages:

sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi \ 
newlib-arm-none-eabi \ 
gdb-arm-none-eabi 

Instead of CROSS_COMPILE=arm-linux-gnueabi- write CROSS_COMPILE=arm-none-eabi-
and follow instructions in section 1) and 2).
-------------------------------------------------------------

Good luck,
NP

Fadil Berisha

Hi chjchoi,

I am responsible for that message and author of arm-none-eabi toolchain.
I will try to clarify thinks:
Quote
I should use arm-linux-gnueabi .. because it succeeded to compile my application.
and ..arm-none-eabi failed ..

arm-none-eabi toolchain, as name show, is dedicated for systems with no operating system. I recommended arm-none-eabi for compiling kernel -  because kernel code is not related to any library. It is proved many times, it works without problems.   

If your application need to run in machine with operating system - you need to use arm-linux-gnueabi toolchain. I can see from your comment that you have binaries, compiled application and  probably application does not run on olinuxino.

Recompiling toolchain is very time consuming process, so I will suggest you 1st to try to pass flag to compiler. Compile your application with:

arm-linux-gnueabi-gcc -mcpu=arm926ej -o <your_applicaion>.o <your_application>.c

If you want to recompile, sources are here:

http://packages.ubuntu.com/precise/gcc-arm-linux-gnueabi

Regards
Fadil Berisha

chjchoi

Yes. I know.. arm-none-eabi buildings have made good result for OS or filesystem or bootlet
But my application building has failed .. they don't meet the demand of header files in include directory.
----------------------------------------------------------------------------
Quote from: nidalpres on October 07, 2012, 10:58:25 PM
If you are not familiar with compiling gcc you better stick to prebuilt binaries for now. This will make you get to where you want with your project. Later on, when you have some free time, go on and find tutorials on building gcc for cross compiling and learn how to do that.

As for your problem, just follow instructions there, i.e. read rest of the readme file:

-------------------------------------------------------------
It is proven to work with arm926ej-s.

Add PPA in your system:

$: sudo add-apt-repository ppa:germia/archive3 

Refresh list of software available, including the PPA you just added:

$: sudo apt-get update 

Install packages:

sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi \ 
newlib-arm-none-eabi \ 
gdb-arm-none-eabi 

Instead of CROSS_COMPILE=arm-linux-gnueabi- write CROSS_COMPILE=arm-none-eabi-
and follow instructions in section 1) and 2).
-------------------------------------------------------------

Good luck,
NP

phinguyen

Hi Fadil Berisha,

I'm using IMX233-Olinuxino-mini.
I compile file hello.c:
   arm-linux-gnueabi-gcc -mcpu=arm926ej-s -o <my_applicaion>.o <my_application>.c
A binary file was created.
I have a fault when i run the binary file under the board: :( :( :(
   Segmentation fault (core dumped)

Please tell me what i should do now?

Thanks and Best Regards,
phinguyen

jlumme

If you are cross compiling and use dynamic linking, you have to be sure that library is also present in the system you are running it on.
Or you could compile statically (add -static to your gcc call)

phinguyen

Hi jlumme, :D
Thanks for your replay!
I install package gcc-arm-linux-gnueabi in the host linux by:
    sudo apt-get install gcc-arm-linux-gnueabi
I think it presented in my system.
I try to with:
    arm-linux-gnueabi-gcc -mcpu=arm926ej-s -static -o <my_applicaion>.o <my_application>.c
I copy the binary file into the target board, but met a different fault:
    Illegal instruction
Should i have to link to the library?

Thanks,
phinguyen

jlumme

What does the compiled binary look like?

~> file hih6030_read_static
hih6030_read_static: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.31, BuildID[sha1]=0x857f8f2f1c4d044bed12e6f18a426d125ed26669, not stripped


Try to get just a simple hello world compiled and executing first, so that you can verify your toolchain is ok, and worry about libraries later. I usually haven't set the mcpu flag, and the programs work fine without it.

Im building on Ubuntu, though usually I'm using cross compiler created with buildroot. But the one in Ubuntu repository has worked fine as well.

phinguyen

Hi jlumme,
I'm building on Ubuntu too. (12.04 LTS 32-bit)
My compiled binary file look like:
~>file hello-world
ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0x44e69f6760a74ee969e8e4225d3c0cafbbe8f32c, not stripped

I'm only try to compile a hello-world project first.
I tried to compile the hello-world.c without mcpu flag first, but I meet the error:
~>arm-linux-gnueabi-gcc -o hello-world hello-world.c
Segmentation fault

After that, I have tried to compile with -mcpu flag.
~>arm-linux-gnueabi-gcc -mcpu=arm926ej-s -o hello-world hello-world.c
Here is my hello-world.c:
#include <stdio.h>

int main (int argc, char *argv[])
{
        if (argc > 1)
        {
                printf("\nHello %s!\n", argv[1]);
        }
        else
        {
                printf("\nHello World!!!\n");
        }

        return 0;
}


Thanks,
phinguyen