学科のサーバの1つ DALMORE 上で CbC を CrossCompile? した時のメモ

準備 

  • arm の Toolchain をインストール
    % sudo yum install gcc-arm-linux-gnu.x86_64
    % sudo -s
    % cd /net/open/Linux/arm
    % wget 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2?revision=375265d4-e9b5-41c8-bf23-56cbe927e156?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2017-q4-major'
    % bunzip2 < gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2\?revision\=375265d4-e9b5-41c8-bf23-56cbe927e156\?product\=GNU\ Arm\ Embedded\ Toolchain\,64-bit\,\,Linux\,7-2017-q4-major |tar xvf -
    % cd gcc-arm-none-eabi-7-2017-q4-major
    % /usr/bin/arm-linux-gnu-nm lib/gcc/arm-none-eabi/7.2.1/libgcc.a     (armのコードが吐かれているか確認)
    % /usr/bin/arm-linux-gnu-objdump -D lib/gcc/arm-none-eabi/7.2.1/libgcc.a

CrossCompile?

  • hello.c を作って実行する
    • プログラミング例
      #include<stdio.h>
      
      int main() {
        printf("Hello World!\n");
      } 
  • CrossCompile?
    % ./bin/clang -target arm-linux-gnueabi -mfpu=neon-fp16 -marm -I /net/open/Linux/arm/gcc-arm-none-eabi-7-2017-q4-major/arm-none-eabi/include/ hello.c -c -mfloat-abi=hard
  • Raspberry Pi で動くことを確認する
    DALMORE上で
    % scp hello.o pi@innparusu-rpi.cr.ie.u-ryukyu.ac.jp
    Raspberry pi  上で
    % gcc hello.o
    % ./a.out
  • GCC arm cross compiler

configure の前に prefix のところに arm-monte-eabi-as などがある必要がある。

../CbC_gcc/configure --prefix=/usr/local/arm-cbc --disable-nls --disable-bootstrap --target=arm-none-eabi --enable-languages=c --enable-checking=tree,rtl,assert,types

 % make -j24 all-gcc
 % make install-gcc

liggcc.a は以下のように作る

 make -j24 all-target-libgcc
 make install-target-libgcc

/usr/local/arm-cbc/bin/arm-none-eabi-gcc -B/usr/local/arm-cbc/bin/arm-none-eabi- ~/src/hello-cbc.c

のように-Bをつけて使用する


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2018-02-25 (日) 18:54:09 (2252d)