10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ARM</strong>과 Thumb의 인터워킹예제 5-4 C 및 C++ 언어 인터워킹이 예제에서는 인터워킹을 통해 <strong>ARM</strong> 서브루틴을 호출하는 Thumb 루틴을 보여줍니다. <strong>ARM</strong> 서브루틴 호출에서는 인터워킹을 통해 Thumb 라이브러리의 printf() 가 호출됩니다./********************** thumbmain.c ***********************/#include extern void arm_function (void) ;int main (void){printf ("Hello from Thumb\n") ;arm_function () ;printf ("And goodbye from Thumb\n") ;return (0) ;}/********************** armsub.c ***********************/#include void arm_function (void){printf ("Hello and Goodbye from <strong>ARM</strong>\n") ;}다음 단계에 따라 모듈을 빌드하고 링크합니다.1. Thumb 코드를 인터워킹용으로 컴파일하려면 다음을 입력합니다.armcc --thumb -c --debug --apcs=/interwork thumbmain.c -o thumbmain.o2. <strong>ARM</strong> 코드를 인터워킹용으로 컴파일하려면 다음을 입력합니다.armcc -c --debug --apcs=/interwork armsub.c -o armsub.o3. 개체 파일을 링크하려면 다음을 입력합니다.armlink thumbmain.o armsub.o -o thumbtoarm.axf또는 인터워킹 베니어의 크기를 보려면 다음을 입력합니다.armlink armsub.o thumbmain.o -o thumbtoarm.axf --info=veneers<strong>ARM</strong> DUI 0203IK Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. 5-11Unrestricted AccessNon-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!