Skip to content

Commit 68ac937

Browse files
committed
Add example-4
1 parent a27abac commit 68ac937

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

example4/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
CC = arm-linux-gnueabihf-gcc
2+
CFLAGS = -O2 -ggdb -Wall
3+
LDFLAGS = -fno-stack-protector
4+
5+
objects = example4.o
6+
7+
default: example4
8+
9+
.PHONY: default clean
10+
11+
example4: $(objects)
12+
$(CC) -o $@ $^
13+
14+
example4.o: example4.c
15+
16+
%.o: %.c
17+
$(CC) -c $(CFLAGS) $(LDFLAGS) -o $@ $<
18+
19+
clean:
20+
rm -f $(objects) example4
21+
22+
qemu: example4
23+
qemu-arm -L /usr/arm-linux-gnueabihf ./example4

example4/example4.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <stdio.h>
2+
3+
int multiply(int a, int b);
4+
5+
int main(void)
6+
{
7+
int a, b, d;
8+
a = 221412523;
9+
b = 3;
10+
d = multiply(a,b);
11+
printf("a * b is %d\n", d);
12+
13+
return 0;
14+
}
15+
16+
int multiply(int a, int b)
17+
{
18+
return (a*b);
19+
}

0 commit comments

Comments
 (0)