2016年5月13日 星期五

Toolchain for ARM-linux

在嵌入式主機上編寫程式還不是什麼大問題
問題在於怎麼complier
嵌入式主機上並不會內建gcc,而且ipkg上的資源很少
最重要的,是速度太慢啊

所以我選擇用ubuntu來做toochain

1. 在 /etc/apt/sources.list 新增底下二行:

deb http://www.emdebian.org/debian/ squeeze main
deb http://opensource.nchc.org.tw/debian/ squeeze main contrib non-free

2.安裝 emdebian-archive-keyring 套件來解決GPG key的問題

sudo apt-get install emdebian-archive-keyring


3. 更新套件狀態

sudo apt-get update


4.安裝 ARM ToolChain

sudo apt-get install gcc-4.8-arm-linux-gnueabi
sudo apt-get install cpp-4.8-arm-linux-gnueabi
sudo apt-get install g++-4.9-arm-linux-gnueabi


5.驗證一下有沒有安裝成功
vi hello.c
#inculde <stdio.h>v oid main(void){  printf("Hello World\n");}
建立alias, toolchain的指令太長了,縮一下
alias armgcc=arm-linux-gnueabi-gcc-4.9
然後來實際來complier看看吧
armgcc hello.c -o hello_arm

complier之後,當然是丟到嵌入式主機去跑看看囉



參考網頁:http://pominglee.blogspot.tw/2013/10/arm-toolchain.html

沒有留言: