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=../..
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

View file

@ -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;

View file

@ -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,

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/mem.h>
#include "microudp.h"
#include <net/microudp.h>
#define ETHERTYPE_ARP 0x0806
#define ETHERTYPE_IP 0x0800

View file

@ -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