でGNU ToolChainを使用してARM/Cを実行するので、IDEでこのコードを実行することについて同様の質問をしたときに、最終的に私が得たアドバイスは、コマンドラインから一緒に実行することを学ぶべきだったということでした。私はアドバイスを受けて、Codesourcery Lite MentorGraphicsからGNUツールチェーンをインストールしました。私ができるコマンドは、Windowsでコマンドライン
> arm-none-eabi-gcc -o main main.c -T script
のようなものですが、私はコマンドの使用方法を正確に知ることができません。試しました
> arm-none-eabi-gcc -o main (my c filename).c -T (my ARM filename).s
ただし、ARMファイルの構文エラーが表示されます。なぜなら私のファイル「のa.out」を取得しますが、私は何のことを知らない外部の「ADD2」
> arm-none-eabi-as add2.s
の私はその後
> arm-none-eabi-gcc -o main (my c filename).c
を実行しようとしました。しかし、それは動作しません。そうです。
はここに私のコードです:
ARM
.global add2
add2:
stmfd sp!, {v1-v6, lr} @ 'standard' entry, save registers on the stack
add a1, a1, a2 @ do the addition requested
ldmfd sp!, {v1-v6, pc}
C
#include <stdio.h> /* standard input and output */
#include <stdlib.h> /* standard library */
extern int add2(int i, int j); /* tell the compiler that the routine is not defined here */
int main(int argc, char * argv[]) /* entry point to the program */
{
int i, j; /* declare the variable types */
int answer;
i = 5; /* give the variables values */
j = 20;
answer = add2(i, j); /* call the assembly language routine */
printf("result is : %d\n", answer); /* print out the answer */
exit(0); /* leave the driver program */
}
任意の助けいただければ幸いです。また、Windows上のUbuntuのbashからこのツールキットをインストールしました。可能であればBASHの解決策があれば()
どのようなエラーが表示されますか? –
どのコマンドですか?あなたがそれを得ているすべてのコマンドのための – wjmccann
。 –