Welcome, Guest

Author Topic: How to make arm-linux-gnueabi support arm926ej-s ?  (Read 10042 times)

chjchoi

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
How to make arm-linux-gnueabi support arm926ej-s ?
« on: October 07, 2012, 07:56:02 PM »
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

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #1 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

Fadil Berisha

  • Full Member
  • ***
  • Posts: 124
  • Karma: +7/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #2 on: October 07, 2012, 11:57:01 PM »
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

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #3 on: October 08, 2012, 04:37:47 AM »
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.
----------------------------------------------------------------------------
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

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #4 on: July 08, 2014, 11:42:11 AM »
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

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-1
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #5 on: July 09, 2014, 03:54:00 AM »
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
Code: [Select]
-static to your gcc call)

phinguyen

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #6 on: July 10, 2014, 01:53:17 PM »
Hi jlumme, :D
Thanks for your replay!
I install package gcc-arm-linux-gnueabi in the host linux by:
   
Code: [Select]
sudo apt-get install gcc-arm-linux-gnueabiI think it presented in my system.
I try to with:
   
Code: [Select]
arm-linux-gnueabi-gcc -mcpu=arm926ej-s -static -o <my_applicaion>.o <my_application>.cI copy the binary file into the target board, but met a different fault:
   
Code: [Select]
Illegal instructionShould i have to link to the library?

Thanks,
phinguyen

jlumme

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-1
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #7 on: July 11, 2014, 03:32:40 AM »
What does the compiled binary look like?

Code: [Select]
~> 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

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: How to make arm-linux-gnueabi support arm926ej-s ?
« Reply #8 on: July 11, 2014, 11:20:00 AM »
Hi jlumme,
I'm building on Ubuntu too. (12.04 LTS 32-bit)
My compiled binary file look like:
Code: [Select]
~>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:
Code: [Select]
~>arm-linux-gnueabi-gcc -o hello-world hello-world.c
Segmentation fault
After that, I have tried to compile with -mcpu flag.
Code: [Select]
~>arm-linux-gnueabi-gcc -mcpu=arm926ej-s -o hello-world hello-world.cHere is my hello-world.c:
Code: [Select]
#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