Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
Jan 08, 2013
Yann Sionneau lm32 test Makefiles cleanup
Make the makefiles more portable and able to use different toolchain than
lm32-elf (for instance lm32-rtems4.11).

Signed-off-by: Yann Sionneau <yann@minet.net>
Signed-off-by: Michael Walle <michael@walle.cc>
e937900
Yann Sionneau fix compilation of lm32 tests
Fix compiling when using RTEMS toolchain (or any other non-bare-metal
toolchain).

Signed-off-by: Yann Sionneau <yann@minet.net>
Signed-off-by: Michael Walle <michael@walle.cc>
68d407f
13  test/Makefile
... ...
@@ -1,4 +1,4 @@
1  
-PREFIX ?= lm32-elf-
  1
+CROSS_COMPILE ?= lm32-elf-
2 2
 
3 3
 # extra plusargs for simulation
4 4
 # eg. EXTRA_PLUSARGS = "+dump=dump.vcd"
@@ -8,8 +8,9 @@ EXTRA_PLUSARGS ?=
8 8
 # eg. EXTRA_DEFINES = "-DTB_ENABLE_WB_TRACES"
9 9
 EXTRA_DEFINES ?=
10 10
 
11  
-CC := $(PREFIX)gcc
12  
-OBJCOPY := $(PREFIX)objcopy
  11
+CC      = $(CROSS_COMPILE)gcc
  12
+OBJCOPY = $(CROSS_COMPILE)objcopy
  13
+LDFLAGS = -Tlinker.ld -fno-builtin -nostdlib -lgcc
13 14
 
14 15
 RTL ?= ../rtl
15 16
 SOURCES  = tb_lm32_system.v lm32_config.v
@@ -32,19 +33,19 @@ trace_%: %.vh tb_lm32_system
32 33
 	@vvp tb_lm32_system +trace=trace_$*.txt +prog=$< $(EXTRA_PLUSARGS)
33 34
 
34 35
 %.elf:
35  
-	$(CC) -Tlinker.ld -fno-builtin -o $@ $^
  36
+	$(CC) $(LDFLAGS) -o $@ $^
36 37
 
37 38
 %.vh: %.elf
38 39
 	$(OBJCOPY) -O verilog $< $@
39 40
 
40 41
 clean:
41  
-	rm -f tb_lm32_system *.vcd *.elf *.vh trace*.txt
  42
+	$(RM) tb_lm32_system *.vcd *.elf *.vh trace*.txt
42 43
 
43 44
 tb_lm32_system: $(SOURCES)
44 45
 	iverilog -I. -I$(RTL) -o $@ $(SOURCES) $(EXTRA_DEFINES)
45 46
 
46 47
 unittest:
47  
-	make -C unittests check
  48
+	$(MAKE) -C unittests check
48 49
 
49 50
 .PHONY: clean unittest
50 51
 
18  test/unittests/Makefile
... ...
@@ -1,13 +1,13 @@
1  
-CROSS=lm32-elf-
  1
+CROSS_COMPILE  ?= lm32-elf-
2 2
 
3  
-CC      = $(CROSS)gcc
4  
-AS      = $(CROSS)as
  3
+CC      = $(CROSS_COMPILE)gcc
  4
+AS      = $(CROSS_COMPILE)as
5 5
 AS      = $(CC) -x assembler
6  
-SIZE    = $(CROSS)size
  6
+SIZE    = $(CROSS_COMPILE)size
7 7
 LD      = $(CC)
8  
-OBJCOPY = $(CROSS)objcopy
  8
+OBJCOPY = $(CROSS_COMPILE)objcopy
9 9
 
10  
-LDFLAGS = -Tlinker.ld
  10
+LDFLAGS = -Tlinker.ld -nostdlib -lgcc
11 11
 ASFLAGS += -Wa,-I,.
12 12
 
13 13
 CRT        = crt.o
@@ -108,15 +108,15 @@ test_mmu_nop3.S: test_mmu.S
108 108
 build: $(CRT) $(TESTCASES) $(TESTCASES:.elf=.vh)
109 109
 
110 110
 check: $(TESTCASES:.elf=.vh)
111  
-	@make -C .. tb_lm32_system
  111
+	@$(MAKE) -C .. tb_lm32_system
112 112
 	@for case in $(TESTCASES:.elf=.vh); do \
113 113
 		echo -e "\nRunning test case $$case"; \
114 114
 		vvp ../tb_lm32_system +prog=$$case; \
115 115
 	done
116 116
 
117 117
 check_%: test_%.vh
118  
-	@make -C .. tb_lm32_system
  118
+	@$(MAKE) -C .. tb_lm32_system
119 119
 	vvp ../tb_lm32_system +prog=$<
120 120
 
121 121
 clean:
122  
-	$(RM) -fr $(TESTCASES) $(TESTCASES:.elf=.vh) $(CRT) *nop?.S tb_lm32.vcd
  122
+	$(RM) $(TESTCASES) $(TESTCASES:.elf=.vh) $(CRT) *nop?.S tb_lm32.vcd

No commit comments for this range

Something went wrong with that request. Please try again.