10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ARM</strong>과 Thumb의 인터워킹4. 호환되는 디버거를 적절한 디버그 타겟과 함께 사용하여 이미지를 실행합니다.예제 5-5 베니어를 사용한 C, C++ 및 어셈블리 언어 인터워킹이 예제에서는 C로 작성된 Thumb 코드와 어셈블리 언어로 작성된 <strong>ARM</strong> 코드 간의 인터워킹을 보여 줍니다./*********************** thumb.c ***********************/#include extern int arm_function (int) ;int main (void){int i = 1;printf ("i = %d\n", i) ;printf ("And i+4 = %d\n", arm_function (i) ) ;return (0) ;}; *****; arm.s; *****PRESERVE8AREA Arm,CODE,READONLY ; Name this block of code.EXPORT arm_functionarm_functionADD R0,R0,#4 ; Add 4 to first parameter.BX lr ; ReturnEND다음 단계에 따라 모듈을 빌드하고 링크합니다.1. Thumb 코드를 인터워킹용으로 컴파일하려면 다음을 입력합니다.armcc --thumb --debug -c --apcs=/interwork thumb.c2. <strong>ARM</strong> 코드를 인터워킹용으로 어셈블하려면 다음을 입력합니다.armasm --debug --apcs=/interwork arm.s3. 객체 파일을 링크하려면 다음을 입력합니다.armlink arm.o thumb.o -o add.axf5-12 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-ConfidentialUnrestricted Access

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

Saved successfully!

Ooh no, something went wrong!