Root/plasma/kernel/makefile

1# Makefile for Plasma RTOS and Plasma TCP/IP stack
2
3ifeq ($(LANG),)
4
5# Customize for Windows
6# The MIPS gcc compiler must use the cygwin1.dll that came with the compiler.
7CC_X86 = cl /O1 /nologo /I..\tools
8CP = copy
9RM = del
10DWIN32 = -DWIN32
11BIN_MIPS = ..\gccmips_elf
12TOOLS_DIR = ..\tools\\
13TOOLS2_DIR = ..\tools
14APP_DIR = ..\App\\
15LINUX_PWD =
16ALIASING =
17GCC_MIPS = $(BIN_MIPS)\gcc $(CFLAGS)
18AS_MIPS = $(BIN_MIPS)\as
19LD_MIPS = $(BIN_MIPS)\ld
20DUMP_MIPS = $(BIN_MIPS)\objdump
21CONVERT_BIN = $(TOOLS_DIR)convert_bin.exe
22OBJ = obj
23CFLAGS_X86 = /c /DWIN32
24LFLAGS_X86 =
25
26else
27
28# Customized for Linux
29# See the GNU GCC tab on the Opencores Plasma page
30CC_X86 = gcc -Wall -O -g -I../tools
31CP = cp
32RM = rm -rf
33DWIN32 =
34TOOLS_DIR = ../tools/
35TOOLS2_DIR = ../tools
36APP_DIR = ../App/
37LINUX_PWD = ./
38ALIASING = -fno-strict-aliasing
39GCC_MIPS = $(BIN_MIPS)mips-elf-gcc $(CFLAGS)
40AS_MIPS = $(BIN_MIPS)mips-elf-as
41LD_MIPS = $(BIN_MIPS)mips-elf-ld
42DUMP_MIPS = $(BIN_MIPS)mips-elf-objdump
43CONVERT_BIN = $(TOOLS_DIR)convert_bin.exe
44#CONVERT_BIN = $(BIN_MIPS)mips-elf-objcopy -I elf32-big -O binary test.axf test.bin
45OBJ = o
46CFLAGS_X86 = -c -DWIN32 -DLINUX
47LFLAGS_X86 = -lm
48
49endif
50
51# Use software multiplier (don't use mult.vhd)
52CFLAGS_SW_MULT = -mno-mul -DUSE_SW_MULT
53
54# Use 16 fewer registers (make reg_bank.vhd smaller)
55CFLAGS_FEW_REGS = -ffixed-t0 -ffixed-t1 -ffixed-t2 -ffixed-t3 -ffixed-t4 -ffixed-t5 -ffixed-t6 -ffixed-t7 -ffixed-s0 -ffixed-s1 -ffixed-s2 -ffixed-s3 -ffixed-s4 -ffixed-s5 -ffixed-s6 -ffixed-s7
56
57CFLAGS = -O2 -Wall -c -s -I$(TOOLS2_DIR) -msoft-float -fno-builtin
58#CFLAGS += $(CFLAGS_SW_MULT)
59#CFLAGS += $(CFLAGS_FEW_REGS)
60
61# Build just the Plasma RTOS for Plasma CPU
62rtos:
63    $(AS_MIPS) -o boot.o $(TOOLS_DIR)boot.asm
64    $(GCC_MIPS) rtos.c
65    $(GCC_MIPS) libc.c
66    $(GCC_MIPS) uart.c
67    $(GCC_MIPS) rtos_test.c
68    $(GCC_MIPS) math.c $(ALIASING)
69    $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
70    boot.o rtos.o libc.o uart.o rtos_test.o math.o
71    $(CONVERT_BIN)
72    @sort <test.map >test2.map
73    @$(DUMP_MIPS) --disassemble test.axf > test.lst
74
75# Build the Plasma RTOS, Plasma TCP/IP stack, and web server for the Plasma CPU
76# Use the serial port and etermip for TCP/IP packets
77rtos_tcpip:
78    $(AS_MIPS) -o boot.o $(TOOLS_DIR)boot.asm
79    $(GCC_MIPS) rtos.c
80    $(GCC_MIPS) libc.c
81    $(GCC_MIPS) uart.c
82    $(GCC_MIPS) rtos_test.c -DINCLUDE_HTML -DINCLUDE_CONSOLE
83    $(GCC_MIPS) math.c $(ALIASING)
84    $(GCC_MIPS) tcpip.c -DINCLUDE_FILESYS
85    $(GCC_MIPS) http.c -DINCLUDE_FILESYS -DEXAMPLE_HTML
86    $(GCC_MIPS) netutil.c
87    $(GCC_MIPS) filesys.c
88    $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
89    boot.o rtos.o libc.o uart.o rtos_test.o math.o tcpip.o \
90    http.o netutil.o filesys.o
91    $(CONVERT_BIN)
92    @sort <test.map >test2.map
93    @$(DUMP_MIPS) --disassemble test.axf > test.lst
94
95# Use Ethernet for TCP/IP packets, use flash file system
96rtos_tcpip_eth:
97    $(AS_MIPS) -o boot.o $(TOOLS_DIR)boot.asm
98    $(GCC_MIPS) rtos.c
99    $(GCC_MIPS) libc.c
100    $(GCC_MIPS) uart.c -DNO_PACKETS
101    $(GCC_MIPS) rtos_test.c -DINCLUDE_ETH -DINCLUDE_CONSOLE
102    $(GCC_MIPS) math.c $(ALIASING)
103    $(GCC_MIPS) tcpip.c -DINCLUDE_FILESYS
104    $(GCC_MIPS) http.c -DINCLUDE_FILESYS -DEXAMPLE_HTML
105    $(GCC_MIPS) netutil.c -DINCLUDE_FLASH -DDLL_SETUP
106    $(GCC_MIPS) filesys.c -DINCLUDE_FLASH
107    $(GCC_MIPS) ethernet.c
108    $(GCC_MIPS) flash.c
109    $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
110    boot.o rtos.o libc.o uart.o rtos_test.o math.o tcpip.o \
111    http.o netutil.o filesys.o ethernet.o flash.o
112    $(CONVERT_BIN)
113    @sort <test.map >test2.map
114    @$(DUMP_MIPS) --disassemble test.axf > test.lst
115
116# Build full test application
117rtosfull:
118    $(AS_MIPS) -o boot.o $(TOOLS_DIR)boot.asm
119    $(GCC_MIPS) rtos.c
120    $(GCC_MIPS) libc.c
121    $(GCC_MIPS) uart.c -DNO_PACKETS
122    $(GCC_MIPS) rtos_test.c -DINCLUDE_ETH -DINCLUDE_CONSOLE
123    $(GCC_MIPS) math.c $(ALIASING)
124    $(GCC_MIPS) tcpip.c -DINCLUDE_FILESYS
125    $(GCC_MIPS) http.c -DINCLUDE_FILESYS
126    $(GCC_MIPS) netutil.c -DINCLUDE_FLASH -DDLL_SETUP
127    $(GCC_MIPS) filesys.c -DINCLUDE_FLASH
128    $(GCC_MIPS) ethernet.c
129    $(GCC_MIPS) flash.c
130    $(GCC_MIPS) -I. $(APP_DIR)html.c -DMainThread=HtmlThread
131    $(GCC_MIPS) -I. $(APP_DIR)image.c
132    $(GCC_MIPS) -I. $(APP_DIR)tictac.c
133    $(GCC_MIPS) -I. $(APP_DIR)tic3d.c
134    $(GCC_MIPS) -I. $(APP_DIR)connect4.c
135    $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
136    boot.o rtos.o libc.o uart.o rtos_test.o math.o tcpip.o \
137    http.o netutil.o filesys.o ethernet.o flash.o \
138    html.o image.o tictac.o tic3d.o connect4.o
139    $(CONVERT_BIN)
140    @sort <test.map >test2.map
141    @$(DUMP_MIPS) --disassemble test.axf > test.lst
142
143# Create a separate Dynamically Linked Library executable
144# ftp test.bin to /flash/web/dlltest
145# telnet to board and execute "dlltest"
146dlltest:
147    $(GCC_MIPS) -G0 dlltest.c
148    $(LD_MIPS) -Ttext 0x10100000 -s -N -o test.axf dlltest.o
149    $(CONVERT_BIN)
150    @$(DUMP_MIPS) --disassemble test.axf > test.lst
151
152# Test the RTOS running on a PC
153testrtos:
154    @$(CC_X86) $(CFLAGS_X86) rtos.c
155    @$(CC_X86) $(CFLAGS_X86) libc.c
156    @$(CC_X86) $(CFLAGS_X86) uart.c
157    @$(CC_X86) $(CFLAGS_X86) rtos_test.c
158    @$(CC_X86) $(CFLAGS_X86) math.c $(ALIASING)
159    @$(CC_X86) $(LFLAGS_X86) -o testrtos.exe rtos.$(OBJ) libc.$(OBJ) uart.$(OBJ) rtos_test.$(OBJ) math.$(OBJ)
160    $(LINUX_PWD)testrtos.exe
161
162# Test the TCP/IP protocol stack running on a PC (requires Windows)
163testip:
164    @$(CC_X86) $(CFLAGS_X86) tcpip.c
165    @$(CC_X86) $(CFLAGS_X86) http.c /DEXAMPLE_HTML
166    @$(CC_X86) $(CFLAGS_X86) netutil.c
167    @$(CC_X86) $(CFLAGS_X86) filesys.c
168    @$(CC_X86) $(CFLAGS_X86) libc.c /I$(TOOLS_DIR)
169    @$(CC_X86) $(CFLAGS_X86) /DSIMULATE_PLASMA $(TOOLS_DIR)etermip.c
170    @$(CC_X86) $(CFLAGS_X86) os_stubs.c
171    @$(CC_X86) -o testip.exe etermip.obj $(TOOLS_DIR)wpcap.lib \
172    tcpip.obj http.obj netutil.obj filesys.obj libc.obj os_stubs.obj
173    @echo Try http://plasmb/. Try telnet plasmb. Try ftp plasmb.
174    $(LINUX_PWD)testip.exe
175
176clean:
177    -$(RM) *.o *.obj *.axf *.map *.lst *.hex *.txt *.bin *.exe
178
179# Run a Plasma CPU opcode simulator (can execute rtos target)
180run:
181    @$(TOOLS_DIR)mlite.exe test.bin
182
183disassemble:
184    -@$(TOOLS_DIR)mlite.exe test.bin BD > test.txt
185
186# Start the EtermIP terminal program to download the code to the Plasma CPU
187# and permit an Ethernet packets to be transfered.
188download:
189    @echo Reset board before downloading code
190    $(TOOLS_DIR)etermip.exe
191
192
193

Archive Download this file

Branches:
master



interactive