c2b040193a777c09bdc595c95492b57a2521db87
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

1) # MIPS I system
2) # Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info>
3) # Copyleft GNU public license V2 or later
4) #          http://www.gnu.org/copyleft/gpl.html
5) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

6) SRCS=$(wildcard *.c)
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

7) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

8) PERL=perl
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

9) CC=mipsel-elf-gcc
10) LD=mipsel-elf-ld
11) OBJCOPY=mipsel-elf-objcopy
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

12) CFLAGS=-Wall -Wextra -fno-builtin -mips1 -mno-abicalls -Os
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

13) LFLAGS=-mips1
14) 
15) BASES=$(patsubst %.c,%,$(SRCS))
16) DEPS=$(addsuffix .d,$(BASES))
17) OBJS=$(addsuffix .o,$(BASES))
18) 
19) .PHONY: all clean
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

20) .SUFFIXES:
21) .SECONDARY:
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

22) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

23) all: rom.vhd ram.0.vhd ram.1.vhd ram.2.vhd ram.3.vhd
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

24) 
25) ifneq ($(MAKECMDGOALS),clean)
26)   include deps
27) endif
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

28) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

29) deps: $(DEPS)
30) 	cat /dev/null $^ >$@
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

31) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

32) %.d: %.c Makefile
33) 	$(CC) $(CFLAGS) -M -o $@ $<
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

34) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

35) %.o: %.c Makefile
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

36) 	$(CC) $(CFLAGS) -c -o $@ $<
37) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

38) %.o: %.s Makefile
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

39) 	$(CC) $(CFLAGS) -c -o $@ $<
40) 
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

41) fw.o: $(OBJS)
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

42) 	$(LD) $(LFLAGS) -r -o $@ $^
43) 
44) fw: lnk.cmd boot.o fw.o
45) 	$(LD) $(LFLAGS) -T lnk.cmd -o $@ boot.o fw.o
46) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

47) %.bin: fw
48) 	$(OBJCOPY) -j .$(basename $@) -O binary $< $@
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

49) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

50) rom.vhd: rom.pl rom.bin
51) 	$(PERL) rom.pl rom.bin >$@
52) 
53) ram.%.vhd: ram.pl ram.bin
54) 	$(PERL) ram.pl ram.bin $(patsubst ram.%.vhd,%,$@) >$@
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

55) 
56) clean:
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

57) 	rm -f $(DEPS) $(OBJS)
58) 	rm -f boot.o fw.o fw
59) 	rm -f rom.bin rom.vhd
60) 	rm -f ram.bin ram.[0-3].vhd