From a1d92b0aa3c343a5cd310994c739f14ad836a127 Mon Sep 17 00:00:00 2001
From: Jake <jake.read@cba.mit.edu>
Date: Thu, 7 Dec 2017 15:03:19 -0500
Subject: [PATCH] combined build

---
 .../.vs/atsams70-tinyrouter/v14/.atsuo        | Bin 79360 -> 79360 bytes
 .../atsams70-tinyrouter/Debug/Makefile        |  27 +++++++++------
 .../Debug/atsams70-tinyrouter.bin             | Bin 8772 -> 8592 bytes
 .../atsams70-tinyrouter/Debug/makedep.mk      |   2 ++
 .../atsams70-tinyrouter.cproj                 |   9 +++++
 .../atsams70-tinyrouter/src/main.c            |  13 +++++---
 .../atsams70-tinyrouter/src/node.h            |   4 +--
 .../atsams70-tinyrouter/src/packet_handling.c |  31 ++++++++++--------
 .../atsams70-tinyrouter/src/packet_handling.h |  28 ++++++++++++++++
 .../atsams70-tinyrouter/src/tinyport.c        |   2 +-
 .../atsams70-tinyrouter/src/tinyport.h        |   2 +-
 11 files changed, 87 insertions(+), 31 deletions(-)
 create mode 100644 embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h

diff --git a/embedded/atsams70-tinyrouter/.vs/atsams70-tinyrouter/v14/.atsuo b/embedded/atsams70-tinyrouter/.vs/atsams70-tinyrouter/v14/.atsuo
index 49d311941691e1062bf65383cb2dd5b6e74b1d11..b7969d22e345530db6e335273301e2d407f90dc7 100644
GIT binary patch
delta 726
zcmZp8!_x4EWkLX>+QvX>CN_mN4}B-)PcC9=V*I@ME0Zy!pd14O0~-Sa!+$7{oNURW
zoGQV<z@W*%z#zoHz#z@Qz@P|Kq0PX+z{kMAV8Fn@AkV<SAj`nOAj-hNpbnMiVqjqS
z`~UxcK`38~fq_Affq_AXfq}uAfq_ARfq_Alfq_Asfq_A3@<9&u%`aG57}+iy+@?4w
ze{&I2ALAqr6&oG~1_liV1_o9J1_pix1_qF8I2jli{{8>|UxtB!K^SVf7}Pe9ILKs>
z7bYjLSg?W^|0mC75oZChHt%5ZVBEyT!OC)rfq`K%5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Pj*S)!u|tn55wfbKed}{
z%v#tNNq{V9nf&1|*XBNlBKApQ&YTROa94x+X>*B~KjY-X_J-VX3=9lkAlf(o_he+*
zByyN>^5Jw-R<M~91LY^nXn8P-Zw#ExxGAWC3%gSn#j#8ZbLM0O1rI1HK_M`?B+P&E
OVHw*+;f#w?E&%}4sJg5G

diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile
index 1dd8497..23033bf 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile
@@ -80,6 +80,7 @@ SUBDIRS :=  \
 # Add inputs and outputs from these tool invocations to the build variables 
 C_SRCS +=  \
 ../src/packet.c \
+../src/packet_handling.c \
 ../src/pin.c \
 ../src/ringbuffer.c \
 ../src/tinyport.c \
@@ -103,6 +104,7 @@ ASM_SRCS +=
 
 OBJS +=  \
 src/packet.o \
+src/packet_handling.o \
 src/pin.o \
 src/ringbuffer.o \
 src/tinyport.o \
@@ -119,6 +121,7 @@ src/main.o
 
 OBJS_AS_ARGS +=  \
 src/packet.o \
+src/packet_handling.o \
 src/pin.o \
 src/ringbuffer.o \
 src/tinyport.o \
@@ -135,6 +138,7 @@ src/main.o
 
 C_DEPS +=  \
 src/packet.d \
+src/packet_handling.d \
 src/pin.d \
 src/ringbuffer.d \
 src/tinyport.d \
@@ -151,6 +155,7 @@ src/main.d
 
 C_DEPS_AS_ARGS +=  \
 src/packet.d \
+src/packet_handling.d \
 src/pin.d \
 src/ringbuffer.d \
 src/tinyport.d \
@@ -206,68 +211,70 @@ LINKER_SCRIPT_DEP+=  \
 
 
 
+
+
 
 
 
 src/%.o: ../src/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/common/services/delay/sam/%.o: ../src/ASF/common/services/delay/sam/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/common/services/clock/sams70/%.o: ../src/ASF/common/services/clock/sams70/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/sam/drivers/pmc/%.o: ../src/ASF/sam/drivers/pmc/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/common/boards/user_board/%.o: ../src/ASF/common/boards/user_board/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/common/utils/interrupt/%.o: ../src/ASF/common/utils/interrupt/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/sam/utils/cmsis/sams70/source/templates/gcc/%.o: ../src/ASF/sam/utils/cmsis/sams70/source/templates/gcc/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/sam/utils/cmsis/sams70/source/templates/%.o: ../src/ASF/sam/utils/cmsis/sams70/source/templates/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
 
 src/ASF/sam/utils/syscalls/gcc/%.o: ../src/ASF/sam/utils/syscalls/gcc/%.c
 	@echo Building file: $<
-	@echo Invoking: ARM/GNU C Compiler : 6.3.1
+	@echo Invoking: ARM/GNU C Compiler : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE)  -x c -mthumb -D__SAMS70N20__ -DDEBUG -Dscanf=iscanf -DBOARD=USER_BOARD -DARM_MATH_CM7=true -Dprintf=iprintf  -I"../src/ASF/common/boards" -I"../src/ASF/sam/utils" -I"../src/ASF/sam/utils/header_files" -I"../src/ASF/sam/utils/preprocessor" -I"../src/ASF/thirdparty/CMSIS/Include" -I"../src/ASF/thirdparty/CMSIS/Lib/GCC" -I"../src/ASF/sam/utils/fpu" -I"../src/ASF/common/utils" -I"../src/ASF/sam/utils/cmsis/sams70/source/templates" -I"../src/ASF/sam/utils/cmsis/sams70/include" -I"../src/ASF/common/boards/user_board" -I"../src" -I"../src/config" -I"../src/ASF/sam/drivers/pmc" -I"../src/ASF/common/services/clock" -I"../src/ASF/common/services/delay"  -O1 -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m7 -c -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -std=gnu99 -ffunction-sections -fdata-sections -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-declarations -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Wlong-long -Wunreachable-code -Wcast-align --param max-inline-insns-single=500 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"   -o "$@" "$<" 
 	@echo Finished building: $<
 	
@@ -296,7 +303,7 @@ all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
 
 $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
 	@echo Building target: $@
-	@echo Invoking: ARM/GNU Linker : 6.3.1
+	@echo Invoking: ARM/GNU Linker : 6.2.1
 	$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -mthumb -Wl,-Map="atsams70-tinyrouter.map" -Wl,--start-group -larm_cortexM7lfsp_math_softfp -lm  -Wl,--end-group -L"../src/ASF/thirdparty/CMSIS/Lib/GCC"  -Wl,--gc-sections -mcpu=cortex-m7 -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam/utils/linker_scripts/sams70/sams70n20/gcc/flash.ld  
 	@echo Finished building target: $@
 	"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O binary "atsams70-tinyrouter.elf" "atsams70-tinyrouter.bin"
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/atsams70-tinyrouter.bin b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/atsams70-tinyrouter.bin
index 38332778cd43592e78eb58900ce904e14aa06616..2ed84e36c9185051d7b2b2f99cd24f64f6034d26 100644
GIT binary patch
delta 1709
zcmX@&GQqjNLC-<qBdY_$dn}j%4ZzfZgkfxav?iYegD;;0NIBem5C=(*4_E?C5G;nI
z2+Rkmfnkswhz+8V@MJ|P(KsYNSRX4N#B+sEhk*2fFtR!jABK^|VQhrlWIIMF&HxSv
z1(1-#<U~emP6tT`h7b-11&7H?8M~RD@=Z2ks+!EgJcluK@<L|O&BvJC7*!kD9T+lM
z9T@hqIxw7Nbzoq$mr!6}<8!zR;<Gp~u(CQZlx{X;?Pin(83(eUfzLq!L^Hf)c)-Bm
zz%Z51fgy79O}68VoH-m03V;5)Dl}|f$q~)udxytCfq{?D;XI=Q!&OEHhVP6H3|l~A
zB76=m+ztvdybcOF+ztvh+ztvR+ztvnybcN?ybcO~cpMa1cpVh>@Hi-la62e`;c-wn
zGC7djx*nwCIimvu(YkmX6m(yH@L&7MrMBFAhC2-Ve_?Pc^Nva=^Pb^;|3|^3`#%ac
zm3XsFF7alaT;k0#xx|}!a)~$7Wd9Eh$&8czKQI(COlDS&s&^~!<XCb4hsUA|?*3oq
zlxn$gtn_fp@mb)W<Dcu7>&-Sf*PC^6t~bl%TyN&dxgZ0+fDQNpGJsLp$Su>8W5oq`
zkUk5y1@8BMur#H4vrSI(W}Teo%`!R7n|X4YH`8PRWyZ-0${;I^+>+rs9NerIxF`4}
zdb3SV^k$u$=*==Y(VKa4B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TY<Z+*k&!sG!B*qJ_iK=w`n}&

diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/makedep.mk b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/makedep.mk
index 19558e0..af67d53 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/makedep.mk
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/makedep.mk
@@ -4,6 +4,8 @@
 
 src\packet.c
 
+src\packet_handling.c
+
 src\pin.c
 
 src\ringbuffer.c
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
index 8e77277..817f1d0 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj
@@ -472,12 +472,21 @@
     <Folder Include="src\config\" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="src\node.h">
+      <SubType>compile</SubType>
+    </Compile>
     <Compile Include="src\packet.c">
       <SubType>compile</SubType>
     </Compile>
     <Compile Include="src\packet.h">
       <SubType>compile</SubType>
     </Compile>
+    <Compile Include="src\packet_handling.c">
+      <SubType>compile</SubType>
+    </Compile>
+    <Compile Include="src\packet_handling.h">
+      <SubType>compile</SubType>
+    </Compile>
     <Compile Include="src\pin.c">
       <SubType>compile</SubType>
     </Compile>
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
index 5aa8fc3..216b139 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c
@@ -31,6 +31,7 @@
 #include <asf.h>
 #include "pin.h"
 #include "tinyport.h"
+#include "packet_handler.h"
 
 pin_t stlb;
 pin_t stlr;
@@ -64,8 +65,6 @@ pin_t p4lr;
 pin_t p4lg;
 pin_t p4lb;
 
-
-
 void setupperipherals(void){
 
 	PMC->PMC_PCER0 = 1 << ID_PIOA; // Pins
@@ -247,10 +246,11 @@ int main (void)
 		
 		for(int i = 0; i < 4; i++){ // loop over ports and check for packets, add packets to packet buffer
 			if(ports[i].haspacket){
-				packetlooper = ports[i].packet; // pull into buffer
 				
+				packetlooper = ports[i].packet; // pull into buffer
 				packet_clean(&ports[i].packet); // reset packet states
 				ports[i].haspacket = TP_NO_PACKET; 
+				// TODO: update heartbeat / buffer depth
 				
 				pin_clear(ports[i].stlb); // for debugging: we have seen a packet on this port
 				
@@ -258,13 +258,18 @@ int main (void)
 					tp_putchar(&ports[i], packetlooper.raw[c]);
 				}
 				
+				handle_packet();
 				// put data in  block, error if returns 0 b/c overfull ringbuffer
 				/*
 				if(!tp_putdata(&ports[i], packetlooper.raw, packetlooper.size)){
 					pin_clear(ports[i].stlr); 
 				}
 				*/
-			}
+		}
+		
+		// packet handler
+		// pull a packet from the buffer,
+		// handle_packet()
 			/*
 			if(!rb_empty(ports[i].rbrx)){
 				tp_putchar(&ports[i], rb_get(ports[i].rbrx));
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
index b40c692..96c9cc9 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h
@@ -1,5 +1,5 @@
 typedef struct {
 	uint8_t portBufferSizes[4];
-  uint16_t LUT[][4]; // TODO: fix representation
-  uint16_t myAddress;
+	uint16_t LUT[1024][4]; // TODO: fix representation
+	uint16_t myAddress;
 } node_t;
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c
index 4e2ed3c..65cd0bb 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c
@@ -1,5 +1,7 @@
 #include "packet.h"
 #include "node.h"
+#include "packet_handling.h"
+#include <string.h>
 
 int parse_type(packet_t* p) {
   return p->raw[0];
@@ -10,7 +12,7 @@ void update_LUT(node_t* n, uint16_t src, uint8_t hopCount, uint8_t port) {
 }
 
 void send_packet(packet_t* p, uint8_t port) {
-
+ // TODO: 
 }
 
 void broadcast_packet(packet_t* p, uint8_t exclude) {
@@ -20,9 +22,14 @@ void broadcast_packet(packet_t* p, uint8_t exclude) {
   if (exclude != 3) send_packet(p, 3);
 }
 
-packet_t turn_to_standard_flood(node_t n, packet_t* p) {
-  packet_t newPacket = {.raw = p->raw, .destination = p->destination, .source = n->myAddress,
-                        .hopcount = p->hopcount, .size = p->size, .counter = p->counter};
+packet_t* turn_to_standard_flood(node_t* n, packet_t* p) {
+  packet_t* newPacket = (packet_t*)malloc(sizeof(packet_t));
+  memcpy((void*)newPacket->raw, (const void*)p->raw, (size_t)256);
+  newPacket->destination = p->destination;
+  newPacket->source = n->myAddress;
+  newPacket->hopcount = p->hopcount;
+  newPacket->size = p->size;
+  newPacket->counter = p->counter;
   return newPacket;
 }
 
@@ -30,9 +37,9 @@ void handle_packet(node_t* n, packet_t* p, uint8_t port) {
   if (parse_type(p) != BUFFER_UPDATE) {
     update_LUT(n, p->source, p->hopcount, port);
   }
-  switch parse_type(p) {
+  switch (parse_type(p)) {
     case STANDARD:
-      if (p->destination == n.myAddress) {
+      if (p->destination == n->myAddress) {
         //process
         //reply
       } else {
@@ -48,12 +55,12 @@ void handle_packet(node_t* n, packet_t* p, uint8_t port) {
           }
           send_packet(p, bestPort);
         } else {
-          broadcast_packet(turn_to_standard_flood(n, p));
+          broadcast_packet(turn_to_standard_flood(n, p), port);
         }
       }
       break;
     case ACK:
-      if (p->destination == n.myAddress) {
+      if (p->destination == n->myAddress) {
         //process
       } else {
         p->hopcount++;
@@ -68,13 +75,13 @@ void handle_packet(node_t* n, packet_t* p, uint8_t port) {
           }
           send_packet(p, bestPort);
         } else {
-          broadcast_packet(turn_to_standard_flood(n, p));
+          broadcast_packet(turn_to_standard_flood(n, p), port);
         }
       }
       break;
     case STANDARD_FLOOD:
       n->LUT[p->destination][port] = 255;
-      if (p->destination == n.myAddress) {
+      if (p->destination == n->myAddress) {
         //process
         //reply
       } else {
@@ -96,7 +103,7 @@ void handle_packet(node_t* n, packet_t* p, uint8_t port) {
       break;
     case ACK_FLOOD:
     n->LUT[p->destination][port] = 255;
-    if (p->destination == n.myAddress) {
+    if (p->destination == n->myAddress) {
       //process
     } else {
       p->hopcount++;
@@ -118,7 +125,5 @@ void handle_packet(node_t* n, packet_t* p, uint8_t port) {
     case BUFFER_UPDATE:
       n->portBufferSizes[port] = p->raw[0];
       break;
-    default:
-      // not possible
   }
 }
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h
new file mode 100644
index 0000000..7f8c316
--- /dev/null
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h
@@ -0,0 +1,28 @@
+/*
+ * packet_handling.h
+ *
+ * Created: 12/7/2017 2:14:08 PM
+ *  Author: Jake
+ */ 
+
+
+#ifndef PACKET_HANDLING_H_
+#define PACKET_HANDLING_H_
+
+
+
+int parse_type(packet_t* p);
+
+void update_LUT(node_t* n, uint16_t src, uint8_t hopCount, uint8_t port);
+
+void send_packet(packet_t* p, uint8_t port);
+
+void broadcast_packet(packet_t* p, uint8_t exclude);
+
+packet_t* turn_to_standard_flood(node_t* n, packet_t* p);
+
+void handle_packet(node_t* n, packet_t* p, uint8_t port);
+
+
+
+#endif /* PACKET_HANDLING_H_ */
\ No newline at end of file
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
index 1725da8..1138af4 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c
@@ -81,7 +81,7 @@ void tp_packetparser(tinyport_t *tp){
 			case TP_PACKETSTATE_OUTSIDE:
 				// check if start, add 1st byte, change state
 				// if not start, assume buffer depth data, update
-				if(data == TP_DELIMITER_START){
+				if(data == TP_DELIMITER_START){ // TODO: more types, and types, not delimiters
 					tp->packetstate = TP_PACKETSTATE_INSIDE;
 					tp->packet.raw[tp->packet.counter] = data;
 					tp->packet.counter ++;
diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
index 9b96f80..e17f99a 100644
--- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
+++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h
@@ -49,7 +49,7 @@
 #define TP_DELIMITER_START 255
 
 #define UART_BAUD_DIVIDER 81 // 977: 9600 baud, 81: 115200, 10: 921600
-#define RINGBUFFER_SIZE 512 // in bytes, or 4 full length packets, have 384KBytes total in system
+#define RINGBUFFER_SIZE 1024 // in bytes, or 4 full length packets, have 384KBytes total in system
 
 #include "asf.h"
 #include "pin.h"
-- 
GitLab