Presentation is loading. Please wait.

Presentation is loading. Please wait.

제4장 Cross Compiler 설치.

Similar presentations


Presentation on theme: "제4장 Cross Compiler 설치."— 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에서 실행 가능한 바이너리가 생성된다. Host system X-Hyper270TKU Cross compiler를 이용하여 Host PC에서 바이너리(bootloader, kernel, application)를 생성한후 X-Hyper270TKU로 Download한다. Download는 serial, ethernet을 이용한다. Serial, Ethernet

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

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

8 4.2 toolchain 설치 PATH 설정 PATH 설정을 위해 /root/.bash_profile 파일을 열다.
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 , dynamically linked (uses shared libs), not stripped


Download ppt "제4장 Cross Compiler 설치."

Similar presentations


Ads by Google