Hardware Design: SIE
Sign in or create your account | Project List | Help
Hardware Design: SIE Git Source Tree
Root/
| 1 | # Makefile for Plasma RTOS and Plasma TCP/IP stack |
| 2 | |
| 3 | ifeq ($(LANG),) |
| 4 | |
| 5 | # Customize for Windows |
| 6 | # The MIPS gcc compiler must use the cygwin1.dll that came with the compiler. |
| 7 | CC_X86 = cl /O1 /nologo /I..\tools |
| 8 | CP = copy |
| 9 | RM = del |
| 10 | DWIN32 = -DWIN32 |
| 11 | BIN_MIPS = ..\gccmips_elf |
| 12 | TOOLS_DIR = ..\tools\\ |
| 13 | TOOLS2_DIR = ..\tools |
| 14 | APP_DIR = ..\App\\ |
| 15 | LINUX_PWD = |
| 16 | ALIASING = |
| 17 | GCC_MIPS = $(BIN_MIPS)\gcc $(CFLAGS) |
| 18 | AS_MIPS = $(BIN_MIPS)\as |
| 19 | LD_MIPS = $(BIN_MIPS)\ld |
| 20 | DUMP_MIPS = $(BIN_MIPS)\objdump |
| 21 | CONVERT_BIN = $(TOOLS_DIR)convert_bin.exe |
| 22 | OBJ = obj |
| 23 | CFLAGS_X86 = /c /DWIN32 |
| 24 | LFLAGS_X86 = |
| 25 | |
| 26 | else |
| 27 | |
| 28 | # Customized for Linux |
| 29 | # See the GNU GCC tab on the Opencores Plasma page |
| 30 | CC_X86 = gcc -Wall -O -g -I../tools |
| 31 | CP = cp |
| 32 | RM = rm -rf |
| 33 | DWIN32 = |
| 34 | TOOLS_DIR = ../tools/ |
| 35 | TOOLS2_DIR = ../tools |
| 36 | APP_DIR = ../App/ |
| 37 | LINUX_PWD = ./ |
| 38 | ALIASING = -fno-strict-aliasing |
| 39 | GCC_MIPS = $(BIN_MIPS)mips-elf-gcc $(CFLAGS) |
| 40 | AS_MIPS = $(BIN_MIPS)mips-elf-as |
| 41 | LD_MIPS = $(BIN_MIPS)mips-elf-ld |
| 42 | DUMP_MIPS = $(BIN_MIPS)mips-elf-objdump |
| 43 | CONVERT_BIN = $(TOOLS_DIR)convert_bin.exe |
| 44 | #CONVERT_BIN = $(BIN_MIPS)mips-elf-objcopy -I elf32-big -O binary test.axf test.bin |
| 45 | OBJ = o |
| 46 | CFLAGS_X86 = -c -DWIN32 -DLINUX |
| 47 | LFLAGS_X86 = -lm |
| 48 | |
| 49 | endif |
| 50 | |
| 51 | # Use software multiplier (don't use mult.vhd) |
| 52 | CFLAGS_SW_MULT = -mno-mul -DUSE_SW_MULT |
| 53 | |
| 54 | # Use 16 fewer registers (make reg_bank.vhd smaller) |
| 55 | CFLAGS_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 | |
| 57 | CFLAGS = -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 |
| 62 | rtos: |
| 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 |
| 77 | rtos_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 |
| 96 | rtos_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 |
| 117 | rtosfull: |
| 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" |
| 146 | dlltest: |
| 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 |
| 153 | testrtos: |
| 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) |
| 163 | testip: |
| 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 | |
| 176 | clean: |
| 177 | -$(RM) *.o *.obj *.axf *.map *.lst *.hex *.txt *.bin *.exe |
| 178 | |
| 179 | # Run a Plasma CPU opcode simulator (can execute rtos target) |
| 180 | run: |
| 181 | @$(TOOLS_DIR)mlite.exe test.bin |
| 182 | |
| 183 | disassemble: |
| 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. |
| 188 | download: |
| 189 | @echo Reset board before downloading code |
| 190 | $(TOOLS_DIR)etermip.exe |
| 191 | |
| 192 | |
| 193 |
Branches:
master
