summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/m5/Makefile.arm14
-rw-r--r--util/m5/Makefile.thumb17
-rw-r--r--util/m5/m5op.h7
3 files changed, 30 insertions, 8 deletions
diff --git a/util/m5/Makefile.arm b/util/m5/Makefile.arm
index 0e05b028a..a90dc1011 100644
--- a/util/m5/Makefile.arm
+++ b/util/m5/Makefile.arm
@@ -46,6 +46,7 @@ endif
CC=$(CROSS_COMPILE)gcc
AS=$(CROSS_COMPILE)as
LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
JC=javac
JH=javah
@@ -54,11 +55,13 @@ JR=jar
#JDK_PATH=/path/to/jdk/version_number
CFLAGS=-O2 -I $(JDK_PATH)/include/ -I $(JDK_PATH)/include/linux
+LDFLAGS=-L. -lm5
-OBJS=m5.o m5op_arm.o
+LIB_OBJS=m5op_arm.o
+OBJS=m5.o
JNI_OBJS=m5op_arm.o jni_gem5Op.o
-all: m5
+all: libm5.a m5
%.o: %.S
$(CC) $(CFLAGS) -o $@ -c $<
@@ -67,7 +70,10 @@ all: m5
$(CC) $(CFLAGS) -o $@ -c $<
m5: $(OBJS)
- $(CC) -o $@ $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LDFLAGS)
+
+libm5.a: $(LIB_OBJS)
+ $(AR) rcs $@ $<
gem5OpJni: gem5OpJni.jar $(JNI_OBJS)
$(CC) --shared -o lib$@.so $(JNI_OBJS)
@@ -78,4 +84,4 @@ gem5OpJni.jar:
$(JR) cvf $@ jni/*.class
clean:
- rm -f *.o m5 libgemOpJni.so gem5OpJni.jar jni/*.class
+ rm -f *.o m5 libgemOpJni.so gem5OpJni.jar jni/*.class libm5.a
diff --git a/util/m5/Makefile.thumb b/util/m5/Makefile.thumb
index 9848f5d93..5e34e77af 100644
--- a/util/m5/Makefile.thumb
+++ b/util/m5/Makefile.thumb
@@ -47,12 +47,17 @@ endif
CC=$(CROSS_COMPILE)gcc
AS=$(CROSS_COMPILE)as
LD=$(CROSS_COMPILE)ld
+AR=$(CROSS_COMPILE)ar
#CFLAGS=-O2 -march=armv7 -mthumb
CFLAGS=-O2 -mthumb
-OBJS=m5.o m5op_arm.o
+LDFLAGS=-L. -lm5
-all: m5
+OBJS=m5.o
+LIB_OBJS=m5op_arm.o
+
+
+all: libm5.a m5
%.o: %.S
$(CC) $(CFLAGS) -o $@ -c $<
@@ -61,7 +66,11 @@ all: m5
$(CC) $(CFLAGS) -o $@ -c $<
m5: $(OBJS)
- $(CC) -o $@ -march=armv7 -mthumb $(OBJS)
+ $(CC) -o $@ -march=armv7 -mthumb $(OBJS) $(LDFLAGS)
+
+libm5.a: $(LIB_OBJS)
+ $(AR) rcs $@ $<
+
clean:
- rm -f *.o m5
+ rm -f *.o m5 libm5.a
diff --git a/util/m5/m5op.h b/util/m5/m5op.h
index 4e1d0b638..9e693258e 100644
--- a/util/m5/m5op.h
+++ b/util/m5/m5op.h
@@ -32,6 +32,10 @@
#ifndef __M5OP_H__
#define __M5OP_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdint.h>
void arm(uint64_t address);
@@ -79,4 +83,7 @@ uint64_t m5a_getid(void);
#define M5_AN_FL_LINK 0x10
#define M5_AN_FL_RESET 0x20
+#ifdef __cplusplus
+}
+#endif
#endif // __M5OP_H__