summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--driver/e1000.h2
-rw-r--r--driver/keyboard.c2
-rw-r--r--net/Makefile92
-rw-r--r--net/eth.c2
-rw-r--r--net/icmp.c6
-rw-r--r--net/net_sys.h7
-rw-r--r--net/udp.h2
8 files changed, 105 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 7a0f2d8..2758bcc 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,6 @@ AS=i686-elf-as
############ compiler flags ############
-
#https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
CFLAGS=
diff --git a/driver/e1000.h b/driver/e1000.h
index 7eee572..ba988bc 100644
--- a/driver/e1000.h
+++ b/driver/e1000.h
@@ -1,5 +1,5 @@
#include <stdint.h>
-#include "netdev.h"
+#include "net/netdev.h"
struct netdev e1000_init(uint32_t base);
int e1000_sendPacket(const void * p_data, uint16_t p_len);
void e1000_irq (int irq);
diff --git a/driver/keyboard.c b/driver/keyboard.c
index f667396..efbcc53 100644
--- a/driver/keyboard.c
+++ b/driver/keyboard.c
@@ -8,7 +8,7 @@
#include <stdbool.h>
-#include "inet.h"
+#include "net/inet.h"
ringbuffer kb_in;
diff --git a/net/Makefile b/net/Makefile
new file mode 100644
index 0000000..b8ab2b6
--- /dev/null
+++ b/net/Makefile
@@ -0,0 +1,92 @@
+
+ ##############
+ # Fool Stack #
+ ##############
+
+############ compiler ############
+
+#use our cross compiler
+CC=i686-foolos-gcc
+AS=i686-foolos-as
+
+#sorry just this
+CC=i686-elf-gcc
+AS=i686-elf-as
+
+############ compiler flags ############
+
+
+#https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
+
+CFLAGS=
+#CFLAGS+=-fvar-tracking
+#CFLAGS+=-DGIT_REVISION=\"$(GIT_REVISION)\"
+CFLAGS+=-ffreestanding # do we need this if using own compiler?
+CFLAGS+=-nostdlib
+#CFLAGS+=-Og
+CFLAGS+=-O0
+#CFLAGS+=-I.
+#CFLAGS+=-I/home/miguel/temp/foolos/usr/i686-foolos/include/
+#CFLAGS+=-I./asm
+#CFLAGS+=-I./kernel
+#CFLAGS+=-I./driver
+#CFLAGS+=-I./fs
+CFLAGS+=-gstabs
+
+#CFLAGS+=-fstack-protector-all
+#CFLAGS+=-fno-zero-initialized-in-bss
+#CFLAGS+=-fdata-sections -ffunction-sections
+
+#CFLAGS+= -w # disable all warnings
+#CFLAGS+= -Wimplicit-function-declaration
+CFLAGS+= -Wall
+#CFLAGS+= -Wextra
+#CFLAGS+= -pedantic
+CFLAGS+= -Werror
+CFLAGS+= -Werror=implicit-function-declaration
+
+CFLAGS+= -Wno-unused-variable
+CFLAGS+= -Wno-unused-function
+CFLAGS+= -Wno-int-conversion
+CFLAGS+= -Wno-implicit-int
+CFLAGS+= -Wno-incompatible-pointer-types
+CFLAGS+= -Wno-discarded-qualifiers
+CFLAGS+= -Wno-unused-but-set-variable
+
+#CFLAGS+ = -Wall -Wextra -std=c89 -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
+
+######## linker flags ####################
+LDFLAGS=
+LDLIBS+=-lgcc
+
+########## assembler flags #################
+ASFLAGS=
+ASFLAGS+=-gstabs
+
+########## verbosity ##################3
+#V = 0
+#CC = @echo "Compiling (i686-elf-gcc) $<..."; i686-elf-gcc
+#AS = @echo "Assembling (i686-elf-as) $<..."; i686-elf-as
+#CC_1 = $(CCC)
+#CC = $(CC_$(V))
+
+############ source and object files and their deps ############
+
+#source files
+SOURCES=
+SOURCES+=$(wildcard *.c)
+
+#derive object files
+OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
+
+#derive and include deps
+DEPS=$(patsubst %.c, %.d, $(SOURCES))
+
+-include $(DEPS)
+
+tags:
+ @echo "Generating ctags..."; ctags --recurse=yes .
+
+clean:
+ @echo "Cleaning..."; rm -f *.d *.o tags
+
diff --git a/net/eth.c b/net/eth.c
index 780a89a..fedcda5 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -1,7 +1,7 @@
+#include "net_sys.h"
#include "inet.h"
#include "eth.h"
#include "netdev.h"
-#include "lib/string/string.h"
uint32_t eth_generic(struct netdev *dev, uint32_t ip, uint16_t type, uint8_t* pos,uint32_t *end)
{
diff --git a/net/icmp.c b/net/icmp.c
index d2e4de2..3c071dd 100644
--- a/net/icmp.c
+++ b/net/icmp.c
@@ -1,10 +1,8 @@
+#include "net_sys.h"
+
#include "inet.h"
#include "icmp.h"
#include "ipv4.h"
-#include "log.h"
-#include "kmalloc.h"
-
-#include "lib/string/string.h"
uint32_t icmp_generic(struct netdev *dev, uint32_t ip, uint8_t type, uint8_t* pos,uint8_t *end)
{
diff --git a/net/net_sys.h b/net/net_sys.h
new file mode 100644
index 0000000..a296b41
--- /dev/null
+++ b/net/net_sys.h
@@ -0,0 +1,7 @@
+/**
+ * @file
+ *
+ * this has to be provided and linked against the fool stack
+ */
+
+void* memcpy(void* restrict dstptr, const void* restrict srcptr, int size);
diff --git a/net/udp.h b/net/udp.h
index 2c30804..85aa248 100644
--- a/net/udp.h
+++ b/net/udp.h
@@ -1,5 +1,5 @@
-#include "netdev.h"
#include <stdint.h>
+#include "netdev.h"
struct udp_v4{
uint16_t src_port;