software: put network code in a library

This commit is contained in:
Sebastien Bourdeauducq 2013-05-01 00:12:13 +02:00
parent 8222ee7f46
commit 2e3c2611a6
8 changed files with 34 additions and 8 deletions

View file

@ -1,7 +1,7 @@
M2DIR=../.. M2DIR=../..
include $(M2DIR)/software/common.mak 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 all: bios.bin
@ -19,9 +19,10 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
%.elf: %.elf:
$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \ $(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
-L$(M2DIR)/software/libnet \
-L$(M2DIR)/software/libbase \ -L$(M2DIR)/software/libbase \
-L$(M2DIR)/software/libcompiler-rt \ -L$(M2DIR)/software/libcompiler-rt \
-lbase -lcompiler-rt -lnet -lbase -lcompiler-rt
chmod -x $@ chmod -x $@
main.o: main.c main.o: main.c
@ -36,6 +37,7 @@ main.o: main.c
libs: libs:
make -C $(M2DIR)/software/libcompiler-rt make -C $(M2DIR)/software/libcompiler-rt
make -C $(M2DIR)/software/libbase make -C $(M2DIR)/software/libbase
make -C $(M2DIR)/software/libnet
flash: bios.bin flash: bios.bin
m1nor bios.bin m1nor bios.bin

View file

@ -11,8 +11,8 @@
#include <hw/mem.h> #include <hw/mem.h>
#include "microudp.h" #include <net/microudp.h>
#include "tftp.h" #include <net/tftp.h>
#include "boot.h" #include "boot.h"
extern int rescue; extern int rescue;

View file

@ -11,11 +11,11 @@
#include <timer.h> #include <timer.h>
#include <hw/mem.h> #include <hw/mem.h>
#include <net/microudp.h>
#include "sdram.h" #include "sdram.h"
#include "dataflow.h" #include "dataflow.h"
#include "boot.h" #include "boot.h"
#include "microudp.h"
enum { enum {
CSR_IE = 1, CSR_IM, CSR_IP, CSR_ICC, CSR_DCC, CSR_CC, CSR_CFG, CSR_EBA, CSR_IE = 1, CSR_IM, CSR_IP, CSR_ICC, CSR_DCC, CSR_CC, CSR_CFG, CSR_EBA,

24
software/libnet/Makefile Normal file
View file

@ -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 .*~ *~

View file

@ -6,7 +6,7 @@
#include <hw/flags.h> #include <hw/flags.h>
#include <hw/mem.h> #include <hw/mem.h>
#include "microudp.h" #include <net/microudp.h>
#define ETHERTYPE_ARP 0x0806 #define ETHERTYPE_ARP 0x0806
#define ETHERTYPE_IP 0x0800 #define ETHERTYPE_IP 0x0800

View file

@ -1,8 +1,8 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "microudp.h" #include <net/microudp.h>
#include "tftp.h" #include <net/tftp.h>
#define PORT_OUT 69 #define PORT_OUT 69
#define PORT_IN 7642 #define PORT_IN 7642