Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

software: put network code in a library

  • Loading branch information...
commit 2e3c2611a660daf5a846f5eba844ab65f688f7cf 1 parent 8222ee7
Sébastien Bourdeauducq sbourdeauducq authored
6 software/bios/Makefile
View
@@ -1,7 +1,7 @@
M2DIR=../..
include $(M2DIR)/software/common.mak
-OBJECTS=crt0.o isr.o sdram.o main.o microudp.o tftp.o boot-helper.o boot.o dataflow.o
+OBJECTS=crt0.o isr.o sdram.o main.o boot-helper.o boot.o dataflow.o
all: bios.bin
@@ -19,9 +19,10 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
%.elf:
$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
+ -L$(M2DIR)/software/libnet \
-L$(M2DIR)/software/libbase \
-L$(M2DIR)/software/libcompiler-rt \
- -lbase -lcompiler-rt
+ -lnet -lbase -lcompiler-rt
chmod -x $@
main.o: main.c
@@ -36,6 +37,7 @@ main.o: main.c
libs:
make -C $(M2DIR)/software/libcompiler-rt
make -C $(M2DIR)/software/libbase
+ make -C $(M2DIR)/software/libnet
flash: bios.bin
m1nor bios.bin
4 software/bios/boot.c
View
@@ -11,8 +11,8 @@
#include <hw/mem.h>
-#include "microudp.h"
-#include "tftp.h"
+#include <net/microudp.h>
+#include <net/tftp.h>
#include "boot.h"
extern int rescue;
2  software/bios/main.c
View
@@ -11,11 +11,11 @@
#include <timer.h>
#include <hw/mem.h>
+#include <net/microudp.h>
#include "sdram.h"
#include "dataflow.h"
#include "boot.h"
-#include "microudp.h"
enum {
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
View
File renamed without changes
0  software/bios/tftp.h → software/include/net/tftp.h
View
File renamed without changes
24 software/libnet/Makefile
View
@@ -0,0 +1,24 @@
+M2DIR=../..
+include $(M2DIR)/software/common.mak
+
+OBJECTS=microudp.o tftp.o
+
+all: libnet.a
+
+# pull in dependency info for *existing* .o files
+-include $(OBJECTS:.o=.d)
+
+libnet.a: $(OBJECTS)
+ $(AR) clr libnet.a $(OBJECTS)
+ $(RANLIB) libnet.a
+
+%.o: %.c
+ $(compile-dep)
+
+%.o: %.S
+ $(assemble)
+
+.PHONY: clean
+
+clean:
+ rm -f $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libnet.a .*~ *~
2  software/bios/microudp.c → software/libnet/microudp.c
View
@@ -6,7 +6,7 @@
#include <hw/flags.h>
#include <hw/mem.h>
-#include "microudp.h"
+#include <net/microudp.h>
#define ETHERTYPE_ARP 0x0806
#define ETHERTYPE_IP 0x0800
4 software/bios/tftp.c → software/libnet/tftp.c
View
@@ -1,8 +1,8 @@
#include <stdint.h>
#include <string.h>
-#include "microudp.h"
-#include "tftp.h"
+#include <net/microudp.h>
+#include <net/tftp.h>
#define PORT_OUT 69
#define PORT_IN 7642
Please sign in to comment.
Something went wrong with that request. Please try again.