Changes between Version 5 and Version 6 of ARM_QEMU


Ignore:
Timestamp:
Feb 5, 2008 2:49:28 PM (11 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ARM_QEMU

    v5 v6  
    11 
    2 What do we need: 
    3  * QEMU ARM Emulator (download binaries from http://www.qemu.org) 
    4  * GNU ARM toolchain (download binaries from http://www.gnuarm.com/) 
    5  * Linux kernel source (download from http://www.kernel.org) 
    6  * textinfo 
    72 
    8 == Setting up Development Environment == 
     3== Toolchain Directory Structure == 
    94 
    10 === QEMU ARM Emulator Installation === 
     5For this tutorial, we will put the toolchain in '''{{{/arm}}}''' directory rather than the usual {{{/usr/local}}}. I prefer this approach since it's easier to manage (for example, to delete everything when things don't work or when we're finished with it, or to put it on portable drive to be carried to different system). 
    116 
    12 TBD. 
    13  
    14 === Colinux Installation === 
    15  
    16 === Download, Install, Run === 
    17  
    18 ==== Create a Disk for ARM Development ==== 
    19  
    20  1. Create 3GB blank file with Cygwin: 
    21  {{{ 
    22   # under cygwin! 
    23   $ cd /cygdrive/path/to/colinux 
    24   $ dd if=/dev/zero of=disk_armdev bs=1k count=3000000 
    25  }}} 
    26  (note: the above count is ''three million''). 
    27  1. Stop Colinux: 
    28  {{{ 
    29   # from colinux: 
    30   $ shutdown -h now 
    31  }}} 
    32  1. Edit your configuration: 
    33  {{{ 
    34   cobd3=f:\colinux\disk_armdev 
    35  }}} 
    36  1. Restart colinux: 
    37  {{{ 
    38   net start colinux 
    39  }}} 
    40  1. Format and mount the new disk: 
    41  {{{ 
    42   # In colinux: 
    43   $ mkfs -t ext3 /dev/cobd3 
    44   $ mkdir /arm 
    45   $ mount /dev/cobd3 /arm 
    46  }}} 
    47  
    48 === Directory Structure === 
    49  
     7We'll put files related to installation in '''{{{/arm/setup}}}''' directory: 
    508{{{ 
    51  /arm/download 
    52  /arm/srcs 
    53  /arm/objs 
     9 /arm 
     10  +- setup 
     11     +- download     --> Put downloaded .tgz files here 
     12     +- srcs         --> Unpack .tgz source files here 
     13     +- objs         --> Build sources here 
    5414}}} 
    5515 
    56 == Tools == 
     16Once the toolchain is built, they'll be installed in these directories: 
     17{{{ 
     18 /arm 
     19  +- arm-elf 
     20  +- bin 
     21  +- include 
     22  +- info 
     23  +- lib 
     24.. etc.. 
     25}}} 
     26 
     27This tutorial assumes that you have write access to '''{{{/arm}}}''' directory. 
     28 
     29== Prepare Toolchains == 
    5730 
    5831=== Download Latest binutils, GCC, and newlib === 
    5932 
    60 binutils: 
    61   http://ftp.gnu.org/gnu/binutils/ 
    62  
    63 GCC: 
    64   http://ftp.gnu.org/gnu/gcc/ 
    65  
    66 newlib: 
    67   ftp://sources.redhat.com/pub/newlib/index.html 
     33Download latest toolchain: 
     34 * binutils: http://ftp.gnu.org/gnu/binutils/ 
     35 * gcc: http://ftp.gnu.org/gnu/gcc/ 
     36 * newlib: ftp://sources.redhat.com/pub/newlib/index.html 
    6837 
    6938{{{ 
    70   $ mkdir -p /arm/download 
    71   $ cd /arm/download 
     39  $ mkdir -p /arm/setup/download 
     40  $ cd /arm/setup/download 
    7241  $ wget -c http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2 
    7342  $ wget -c http://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 
    7443  $ wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz 
    7544}}} 
     45 
     46You will also need '''mkinfo''' from '''texinfo''' package to build the toolchain (for building the manuals etc). On Debian based system (Debian, Ubuntu, etc.) you can install it with: 
     47{{{ 
     48  $ sudo apt-get install texinfo 
     49}}} 
     50Or if you're with !RedHat (Fedora, etc), you can install it with: 
     51{{{ 
     52  $ yum install texinfo 
     53}}} 
     54 
    7655 
    7756=== Preparing to build === 
     
    8059 
    8160{{{ 
    82   $ mkdir -p /arm/srcs 
    83   $ cd /arm/srcs 
     61  $ mkdir -p /arm/setup/srcs 
     62  $ cd /arm/setup/srcs 
    8463  $ tar xjf ../download/binutils-2.18.tar.bz2 
    8564  $ tar xjf ../download/gcc-3.4.6.tar.bz2 
     
    8867 
    8968 
    90 ==== Prepare newlib to be built along with gcc ==== 
    91  
    92 {{{ 
    93   $ cd gcc-3.4.6 
    94   $ ln -s ../newlib-1.16.0/newlib . 
    95   $ cd .. 
    96 }}} 
    97  
    98   
    9969=== Build Everything === 
    10070 
     
    10272 
    10373{{{ 
    104   $ mkdir -p /arm/objs/binutils-arm 
    105   $ cd /arm/objs/binutils-arm 
     74  $ mkdir -p /arm/setup/objs/binutils-arm 
     75  $ cd /arm/setup/objs/binutils-arm 
    10676  $ ../../srcs/binutils-2.18/configure --target=arm-elf --prefix=/arm 
    10777  $ make 
    108   $ cd .. 
     78  $ make install 
    10979}}} 
     80''(if you're wondering, that will take 5 minutes on a Core2Duo 2GHz)'' 
    11081 
    11182==== Update binutils Path ==== 
    11283 
    113 Before we build gcc below, we need to first add the path to (thew newly installed) binutils: 
     84Before we build gcc and the rest of the toolchain, add the path to (thew newly installed) binutils. 
    11485 
     86(if you're using Bash): 
    11587{{{ 
    11688  $ export PATH=/arm/bin:$PATH 
     
    12092==== Build gcc ==== 
    12193 
     94First prepare newlib to be built along with gcc: 
    12295{{{ 
    123   $ mkdir /arm/objs/gcc-arm 
    124   $ cd /arm/objs/gcc-arm 
    125   $ ./../srcs/gcc-3.4.6/configure --target=arm-elf --prefix=/arm --enable-threads \ 
    126                                   --with-cpu=arm9 --enable-languages=c --disable-nls \ 
    127                                   --with-newlib 
     96  $ cd /arm/setup/srcs/gcc-3.4.6 
     97  $ ln -sd ../newlib-1.16.0/newlib . 
     98}}} 
     99 
     100Now lets build the beast: 
     101{{{ 
     102  $ mkdir -p /arm/setup/objs/gcc-arm 
     103  $ cd /arm/setup/objs/gcc-arm 
     104  $ ../../srcs/gcc-3.4.6/configure --target=arm-elf --prefix=/arm --enable-threads \ 
     105                                  --with-cpu=arm9 --enable-languages=c,c++ \ 
     106                                  --disable-nls --with-newlib --disable-shared \ 
     107                                  --with-float=soft 
    128108  $ make 
    129109  $ make install 
     110  $ cd .. 
    130111}}} 
    131  
     112''(if you're wondering again, that will take about 8 minutes on a Core2Duo 2GHz)'' 
    132113 
    133114== PJSIP == 
     
    138119  $ cd /your/pjproject/directory 
    139120  $ make distclean 
    140   $ ./aconfigure --host=arm-elf --disable-floating-point --disable-sound 
    141   $ cat << EOF > user.mak 
    142      export CFLAGS += -msoft-float 
    143      EOF 
     121  $ ./aconfigure --host=arm-elf --disable-floating-point --disable-sound CFLAGS='-msoft-float' 
    144122  $ make dep 
    145123  $ make 
    146124 
     125}}} 
     126 
     127== Common Problems == 
     128 
     129=== Link Errors Because of Floating Point Mismatch === 
     130 
     131You may get error about ''configure not being able to create executable'', and {{{config.log}}} reveals error message similar to: 
     132 
     133 ''ERROR: foo uses hardware FP, whereas bar uses software FP'' 
     134 
     135I think, this error was caused by lack of {{{--with-float=soft}}} when configuring gcc. 
    147136 
    148137 
    149 }}}