Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

software: put network code in a library

  • Loading branch information...
commit 2e3c2611a660daf5a846f5eba844ab65f688f7cf 1 parent 8222ee7
Sébastien Bourdeauducq authored May 01, 2013
6  software/bios/Makefile
... ...
@@ -1,7 +1,7 @@
1 1
 M2DIR=../..
2 2
 include $(M2DIR)/software/common.mak
3 3
 
4  
-OBJECTS=crt0.o isr.o sdram.o main.o microudp.o tftp.o boot-helper.o boot.o dataflow.o
  4
+OBJECTS=crt0.o isr.o sdram.o main.o boot-helper.o boot.o dataflow.o
5 5
 
6 6
 all: bios.bin
7 7
 
@@ -19,9 +19,10 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
19 19
 
20 20
 %.elf:
21 21
 	$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
  22
+		-L$(M2DIR)/software/libnet \
22 23
 		-L$(M2DIR)/software/libbase \
23 24
 		-L$(M2DIR)/software/libcompiler-rt \
24  
-		-lbase -lcompiler-rt
  25
+		-lnet -lbase -lcompiler-rt
25 26
 	chmod -x $@
26 27
 
27 28
 main.o: main.c
@@ -36,6 +37,7 @@ main.o: main.c
36 37
 libs:
37 38
 	make -C $(M2DIR)/software/libcompiler-rt
38 39
 	make -C $(M2DIR)/software/libbase
  40
+	make -C $(M2DIR)/software/libnet
39 41
 
40 42
 flash: bios.bin
41 43
 	m1nor bios.bin
4  software/bios/boot.c
@@ -11,8 +11,8 @@
11 11
 
12 12
 #include <hw/mem.h>
13 13
 
14  
-#include "microudp.h"
15  
-#include "tftp.h"
  14
+#include <net/microudp.h>
  15
+#include <net/tftp.h>
16 16
 #include "boot.h"
17 17
 
18 18
 extern int rescue;
2  software/bios/main.c
@@ -11,11 +11,11 @@
11 11
 #include <timer.h>
12 12
 
13 13
 #include <hw/mem.h>
  14
+#include <net/microudp.h>
14 15
 
15 16
 #include "sdram.h"
16 17
 #include "dataflow.h"
17 18
 #include "boot.h"
18  
-#include "microudp.h"
19 19
 
20 20
 enum {
21 21
 	CSR_IE = 1, CSR_IM, CSR_IP, CSR_ICC, CSR_DCC, CSR_CC, CSR_CFG, CSR_EBA,
0  software/bios/microudp.h → software/include/net/microudp.h
File renamed without changes
0  software/bios/tftp.h → software/include/net/tftp.h
File renamed without changes
24  software/libnet/Makefile
... ...
@@ -0,0 +1,24 @@
  1
+M2DIR=../..
  2
+include $(M2DIR)/software/common.mak
  3
+
  4
+OBJECTS=microudp.o tftp.o
  5
+
  6
+all: libnet.a
  7
+
  8
+# pull in dependency info for *existing* .o files
  9
+-include $(OBJECTS:.o=.d)
  10
+
  11
+libnet.a: $(OBJECTS)
  12
+	$(AR) clr libnet.a $(OBJECTS)
  13
+	$(RANLIB) libnet.a
  14
+
  15
+%.o: %.c
  16
+	$(compile-dep)
  17
+
  18
+%.o: %.S
  19
+	$(assemble)
  20
+
  21
+.PHONY: clean
  22
+
  23
+clean:
  24
+	rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libnet.a .*~ *~
2  software/bios/microudp.c → software/libnet/microudp.c
@@ -6,7 +6,7 @@
6 6
 #include <hw/flags.h>
7 7
 #include <hw/mem.h>
8 8
 
9  
-#include "microudp.h"
  9
+#include <net/microudp.h>
10 10
 
11 11
 #define ETHERTYPE_ARP 0x0806
12 12
 #define ETHERTYPE_IP  0x0800
4  software/bios/tftp.c → software/libnet/tftp.c
... ...
@@ -1,8 +1,8 @@
1 1
 #include <stdint.h>
2 2
 #include <string.h>
3 3
 
4  
-#include "microudp.h"
5  
-#include "tftp.h"
  4
+#include <net/microudp.h>
  5
+#include <net/tftp.h>
6 6
 
7 7
 #define PORT_OUT	69
8 8
 #define PORT_IN		7642

0 notes on commit 2e3c261

Please sign in to comment.
Something went wrong with that request. Please try again.