1 / 10

제 4 장 Cross Compiler 설치

제 4 장 Cross Compiler 설치. 목 차. 4.1 toolchain 이란 ? 4.2 toolchain 설치 4.3 toolchain test. 4.1 toolchain 이란 ?. Embedded System 을 개발하기 위해서는 Host System 이란 개발 환경이 필요하다 . 이 개발 환경이 필요한 이유는 Embedded System 의 특성상 큰 용량의 저장 장치를 가지지 못하기 때문이다 . Toolchain 은 이런 개발에 필요한 모든 환경을 통칭하여 말한다 .

vicky
Download Presentation

제 4 장 Cross Compiler 설치

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 제4장 Cross Compiler설치

  2. 목 차 4.1 toolchain 이란? 4.2 toolchain 설치 4.3 toolchain test

  3. 4.1 toolchain 이란? • Embedded System을 개발하기 위해서는 Host System이란 개발 환경이 필요하다. • 이 개발 환경이 필요한 이유는 Embedded System의 특성상 큰 용량의 저장 장치를 가지지 못하기 때문이다. Toolchain은 이런 개발에 필요한 모든 환경을 통칭하여 말한다. • X-Hyper270TKU는 PXA270 MPU를 사용하기 때문에, 일반 desktop의 x86계열과는 다른 compiler(ARM cross compiler)를 사용하게 된다.

  4. 4.1 toolchain 이란? • Target 시스템의 Software 개발을 진행하기 위해 필요한 host system의 cross compile(교차 컴파일)환경. • source code 을 compile하고 build하여 binary 실행 파일을 생성하는데 필요한 각종 Utility 및 Library의 모음. • 기본적으로 Assembler, Linker, C compiler, C library 등으로 구성되어 있다. • 사용할 compiler는 아래와 같이 GNU Tool을 사용한다. • GNU gcc compilers for C, C++ • GNU binutil • assembler, linker, and various object file utilities • GNU C Library • GNU C header

  5. 4.1 toolchain 이란? • GNU Tool은 일반 GNU Tool과는(x86계열) 다른 Compiler (ARM cross compiler)를 사용하기 때문에 compile을 하게 되면 ARM에서 실행 가능한 바이너리가 생성된다. Serial, Ethernet

  6. 4.2 toolchain 설치 • cdrom mount X-Hyper270TKU는 Red Linux 9.0 환경에서 개발되었다. X-Hyper270TKU에서 사용하는 Toolchain은 소스를 직접 컴파일하여 생성된 디렉토리를 압축한 것이다. 사용한 소스는 다음과 같다. • binutils-2.15.tar.gz • gcc-3.4.3.tar.gz • glibc-2.3.2.tar.gz • glibc-linuxthreads-2.3.2.tar.gz 개발 환경 구축을 위한 리소스들은 제공되는 CD에 포함되어있다. 그전에 Host PC에 루트계정으로 로그인되어 있어야 한다. Host PC의 씨디롬에 CD를 넣고 마운트한다.

  7. 4.2 toolchain 설치 • 복사 및 압축 해제 CD의 내용들을 전부 Host PC 디렉토리에 복사를 하여 사용할 것이다. /PXA270-분반번호이란 이름의 작업 디렉토리를 Host PC에 만들고 난 후에 cdrom 안에 있는 모든 파일들과 디렉토리를 작업 디렉토리에 복사한다. 그리고 그 작업 디렉토리로 이동한다. Toolchain 디렉토리 밑에 있는 iwmmxt-1.0.0.tar.gz 파일을 /opt-분반번호밑에 복사한다. 그리고 그 곳에서 압축을 해제한다. 압축이 해제 되면 /opt에 iwmmxt-1.0.0 디렉토리가 생성이 된다. #>mount /dev/cdrom/mnt/cdrom #>cd /mnt/cdrom/toolchain/ #>cp iwmmxt-1.0.0.tgz /opt-분반번호 #>cd /opt-분반번호 #>tar xvfz cross-tools.tgz

  8. 4.2 toolchain 설치 • PATH 설정 • PATH 설정을 위해 /root/.bash_profile 파일을 열다. • PATH를 추가해준다. PATH는 어떤 디렉토리에 있어도 실행 가능하게 한다. • vi ~/.bash_profile PATH=$PATH:/opt/iwmmxt-1.0.0/bin • “source” 명령어를 실행하여, PATH를 적용시킨다. # source ~/.bash_profile • 이제 arm-linux- 로 시작되는 Toolchain을 어느 디렉토리에서든 사용할 수 있다. (arm-까지 입력하고 tap을 두번 치서 arm-linux로 시작하는 여러 명령어 확인 가능)

  9. 4.2 toolchain 설치 • Test 하기 • X86 계열에서 사용하는 리눅스의 gcc와 다른 점은 생성되는 코드가 ARM용으로 생성이 된다. • hello.c 파일을 작성한다. # vi hello.c #include <stdio.h> int main (void) { printf(“hello world.\n”); return 0; }

  10. 4.3 toolchain test • 컴파일 # gcc –o hello hello.c # arm-linux-gcc –o hello_arm hello.c • 실행 두 실행파일을 실행해보고, file 명령어로 파일의 성격 을 보면 cpu type 정보다 다른 것을 확인할 수 있다. #> file hello # ./hello #> file hello-arm 다음과 같은 결과가 나오면.. 크로스 개발 환경이 제대로 설치가 된 것이다. cross_test: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.18, dynamically linked (uses shared libs), not stripped

More Related