From 2599f770d01ed067ce8d5ddfc596994e3f4d3bb8 Mon Sep 17 00:00:00 2001 From: Jake <jake.read@cba.mit.edu> Date: Fri, 8 Dec 2017 13:29:39 -0500 Subject: [PATCH] packet handling integrated --- embedded/README.md | 6 +- .../atsams70-tinyrouter/Debug/Makefile | 38 +++--- .../atsams70-tinyrouter.cproj | 5 +- .../atsams70-tinyrouter/src/main.c | 71 +++-------- .../atsams70-tinyrouter/src/node.h | 10 +- .../atsams70-tinyrouter/src/packet.h | 9 +- .../atsams70-tinyrouter/src/packet_handling.c | 118 +++++++++--------- .../atsams70-tinyrouter/src/packet_handling.h | 6 +- .../atsams70-tinyrouter/src/ports.h | 52 ++++++++ .../atsams70-tinyrouter/src/tinyport.c | 15 ++- .../atsams70-tinyrouter/src/tinyport.h | 2 +- js/serialterminal.js | 4 +- 12 files changed, 182 insertions(+), 154 deletions(-) create mode 100644 embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h diff --git a/embedded/README.md b/embedded/README.md index ce67d76..6b9a314 100644 --- a/embedded/README.md +++ b/embedded/README.md @@ -1,6 +1,10 @@ # 'API' -[start][destination][destination][hopcount][source][source][#bytestotal][byte_7][byte_6]...[byte_n] 0-255 bytes +// to echo with new system + - do packet handler fills in packet data: addresses, hop counts, etc ... use raw[] as often as possible +// to seeing flood on all ports + +[0:start][1:destination-msb:9][2:destination-8:lsb][3:hopcount][4:source][5:source][6:#bytestotal][byte_7][byte_6]...[byte_n] 0-255 bytes Packet Loops ... diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile index a975b35..00140d2 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/Debug/Makefile @@ -218,64 +218,64 @@ LINKER_SCRIPT_DEP+= \ src/%.o: ../src/%.c @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : 6.3.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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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 - $(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 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" -O0 -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: $< @@ -303,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/atsams70-tinyrouter.cproj b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj index 817f1d0..e93edb6 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/atsams70-tinyrouter.cproj @@ -362,7 +362,6 @@ <Value>../src/ASF/common/services/delay</Value> </ListValues> </armgcc.compiler.directories.IncludePaths> - <armgcc.compiler.optimization.level>Optimize (-O1)</armgcc.compiler.optimization.level> <armgcc.compiler.optimization.OtherFlags>-fdata-sections</armgcc.compiler.optimization.OtherFlags> <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection> <armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel> @@ -380,6 +379,7 @@ </ListValues> </armgcc.linker.libraries.LibrarySearchPaths> <armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections> + <armgcc.linker.memorysettings.ExternalRAM /> <armgcc.linker.miscellaneous.LinkerFlags>-Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam/utils/linker_scripts/sams70/sams70n20/gcc/flash.ld</armgcc.linker.miscellaneous.LinkerFlags> <armgcc.assembler.general.IncludePaths> <ListValues> @@ -493,6 +493,9 @@ <Compile Include="src\pin.h"> <SubType>compile</SubType> </Compile> + <Compile Include="src\ports.h"> + <SubType>compile</SubType> + </Compile> <Compile Include="src\ringbuffer.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 91ee4d1..479ebfc 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/main.c @@ -32,40 +32,9 @@ #include "pin.h" #include "tinyport.h" #include "packet_handling.h" +#include "ports.h" #include "node.h" -pin_t stlb; -pin_t stlr; -pin_t button; - -tinyport_t tp1; -ringbuffer_t p1rbrx; -ringbuffer_t p1rbtx; -pin_t p1lr; -pin_t p1lg; -pin_t p1lb; - -tinyport_t tp2; -ringbuffer_t p2rbrx; -ringbuffer_t p2rbtx; -pin_t p2lr; -pin_t p2lg; -pin_t p2lb; - -tinyport_t tp3; -ringbuffer_t p3rbrx; -ringbuffer_t p3rbtx; -pin_t p3lr; -pin_t p3lg; -pin_t p3lb; - -tinyport_t tp4; -ringbuffer_t p4rbrx; -ringbuffer_t p4rbtx; -pin_t p4lr; -pin_t p4lg; -pin_t p4lb; - void setupperipherals(void){ PMC->PMC_PCER0 = 1 << ID_PIOA; // Pins @@ -226,29 +195,25 @@ int main (void){ setallstatus(); // lights off pin_set(&stlr); - pin_clear(&stlb); + pin_set(&stlb); tp_testlights(&tp1); // fancy tp_testlights(&tp3); tp_testlights(&tp2); tp_testlights(&tp4); - tinyport_t ports[4] = {tp1, tp2, tp3, tp4}; + ports[0] = &tp1; + ports[1] = &tp2; + ports[2] = &tp3; + ports[3] = &tp4; + + myAddress = MYADDRESS; - /* - node_t* n;// = (node_t*)malloc(sizeof(node_t)); - n->myAddress = ADDRESS; - n->portBufferSizes = (uint8_t*)malloc(32); - for (int port = 0; port < 4; port++) { - n->portBufferSizes[port] = 0; - } - n->LUT = (uint8_t**)malloc(4096); for (int i = 0; i < 1024; i++) { for (int port = 0; port < 4; port++) { - n->LUT[i][port] = 255; // MD w/ malloc ? we want [1024][4], no? + LUT[i][port] = 255; } } - */ packet_t packetlooper; @@ -256,23 +221,23 @@ int main (void){ // loop over ports to run packet deciphering... allows quick handling of RXINT w/ simpler rxhandler // each returns one packet at a time for(int i = 0; i < 4; i++){ - tp_packetparser(&ports[i]); + tp_packetparser(ports[i]); } for(int i = 0; i < 4; i++){ // loop over ports and check for packets, add packets to packet buffer - if(ports[i].haspacket){ + if(ports[i]->haspacket){ // TODO: update heartbeat / buffer depth - packetlooper = ports[i].packet; - packet_clean(&ports[i].packet); // reset packet states - ports[i].haspacket = TP_NO_PACKET; + packetlooper = ports[i]->packet; + packet_clean(&ports[i]->packet); // reset packet states + ports[i]->haspacket = TP_NO_PACKET; - //handle_packet(n, &packetlooper, i); - tp_putdata(&ports[i], packetlooper.raw, packetlooper.size); // non-blocking put + handle_packet(&packetlooper, i); - packet_clean(&packetlooper); - pin_set(ports[i].stlb); + //tp_putdata(ports[i], packetlooper.raw, packetlooper.size); // non-blocking put + packet_clean(&packetlooper); + pin_set(ports[i]->stlb); } } } // end while diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h index dd7b828..7f8f5f6 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/node.h @@ -1,12 +1,10 @@ #ifndef NODE_H_ #define NODE_H_ -#define ADDRESS 0 +#define MAX_HOPCOUNT 6 +#define MYADDRESS 2; -typedef struct { - uint8_t* portBufferSizes; - uint8_t** LUT; // 1024 x 4 - uint16_t myAddress; -} node_t; +uint8_t LUT[1024][4]; +uint16_t myAddress; #endif \ No newline at end of file diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet.h index a57def3..c368071 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet.h +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet.h @@ -9,7 +9,12 @@ #ifndef PACKET_H_ #define PACKET_H_ -//#include "asf.h" +#define P_STANDARD 255 +#define P_ACK 254 +#define P_STANDARD_FLOOD 253 +#define P_ACK_FLOOD 252 + +#include "asf.h" #include <stdint.h> typedef struct{ @@ -22,8 +27,6 @@ typedef struct{ uint8_t counter; }packet_t; -enum packetType {STANDARD, ACK, STANDARD_FLOOD, ACK_FLOOD, BUFFER_UPDATE}; - packet_t packet_new(void); void packet_clean(packet_t *packet); diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c index 45502be..edaf347 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.c @@ -1,21 +1,22 @@ #include "packet.h" #include "node.h" +#include "ports.h" +#include "tinyport.h" #include "packet_handling.h" #include <string.h> #include <stdlib.h> -#define MAX_HOPCOUNT 6 - int parse_type(packet_t* p) { return p->raw[0]; } -void update_LUT(node_t* n, uint16_t src, uint8_t hopCount, uint8_t port) { - n->LUT[src][port] = n->LUT[src][port] > hopCount ? hopCount : n->LUT[src][port]; +void update_LUT(uint16_t src, uint8_t hopCount, uint8_t port) { + LUT[src][port] = LUT[src][port] > hopCount ? hopCount : LUT[src][port]; } void send_packet(packet_t* p, uint8_t port) { - //tp_putdata() // need global ports[]; + tp_putdata(ports[port], p->raw, p->size); + //free((void*)p); // need rethink packet passing ? } void broadcast_packet(packet_t* p, uint8_t exclude) { @@ -25,112 +26,111 @@ void broadcast_packet(packet_t* p, uint8_t exclude) { if (exclude != 3) send_packet(p, 3); } -int in_table(node_t* n, uint8_t dest) { - return !(n->LUT[dest][0] != MAX_HOPCOUNT && n->LUT[dest][1] != MAX_HOPCOUNT && - n->LUT[dest][2] != MAX_HOPCOUNT && n->LUT[dest][3] != MAX_HOPCOUNT); +int in_table( uint8_t dest) { + return !(LUT[dest][0] != MAX_HOPCOUNT && LUT[dest][1] != MAX_HOPCOUNT && + LUT[dest][2] != MAX_HOPCOUNT && LUT[dest][3] != MAX_HOPCOUNT); } -void handle_packet(node_t* n, packet_t* p, uint8_t port) { - if (p->hopcount > MAX_HOPCOUNT) { +void handle_packet(packet_t* p, uint8_t port) { + + if (p->hopcount > MAX_HOPCOUNT && p->destination != myAddress) { free((void*)p); return; + } else { + p->hopcount ++; } - - if (parse_type(p) != BUFFER_UPDATE) { - update_LUT(n, p->source, p->hopcount, port); - } - + + update_LUT(p->source, p->hopcount, port); + switch (parse_type(p)) { - case STANDARD: - if (p->destination == n->myAddress) { - //process - //reply + case P_STANDARD: + if (p->destination == myAddress) { + pin_clear(&stlr); + // TODO: process? send to application layer? } else { - p->hopcount++; - if (in_table(n, p->destination)) { + if (in_table(p->destination)) { int bestPort = 0; - int bestHopCount = n->LUT[p->destination][0]; + int bestHopCount = LUT[p->destination][0]; for (int i = 0; i < 4; i++) { - if (n->LUT[p->destination][i] < bestHopCount) { + if (LUT[p->destination][i] < bestHopCount) { bestPort = i; - bestHopCount = n->LUT[p->destination][i]; + bestHopCount = LUT[p->destination][i]; } } send_packet(p, bestPort); } else { - p->raw[0] = STANDARD_FLOOD; - broadcast_packet(p, 4); + p->raw[0] = P_STANDARD_FLOOD; + broadcast_packet(p, port); } } break; - case ACK: - if (p->destination == n->myAddress) { - //process + case P_ACK: + if (p->destination == myAddress) { + pin_clear(&stlb); + // TODO: process, window? } else { - p->hopcount++; - if (in_table(n, p->destination)) { + if (in_table(p->destination)) { int bestPort = 0; - int bestHopCount = n->LUT[p->destination][0]; + int bestHopCount = LUT[p->destination][0]; for (int i = 0; i < 4; i++) { - if (n->LUT[p->destination][i] < bestHopCount) { + if (LUT[p->destination][i] < bestHopCount) { bestPort = i; - bestHopCount = n->LUT[p->destination][i]; + bestHopCount = LUT[p->destination][i]; } } send_packet(p, bestPort); } else { - p->raw[0] = STANDARD_FLOOD; + p->raw[0] = P_STANDARD_FLOOD; broadcast_packet(p, 4); } } break; - case STANDARD_FLOOD: - n->LUT[p->destination][port] = MAX_HOPCOUNT; - if (p->destination == n->myAddress) { - //process - //reply + case P_STANDARD_FLOOD: + if (p->destination == myAddress) { + //TODO: + // process, reply } else { - p->hopcount++; - if (n->LUT[p->destination]) { + LUT[p->destination][port] = MAX_HOPCOUNT; + if (LUT[p->destination]) { int bestPort = 0; - int bestHopCount = n->LUT[p->destination][0]; + int bestHopCount = LUT[p->destination][0]; for (int i = 0; i < 4; i++) { - if (n->LUT[p->destination][i] < bestHopCount) { + if (LUT[p->destination][i] < bestHopCount) { bestPort = i; - bestHopCount = n->LUT[p->destination][i]; + bestHopCount = LUT[p->destination][i]; } } send_packet(p, bestPort); } else { - p->raw[0] = STANDARD_FLOOD; + // Dougie: I removed this: p->raw[0] = P_STANDARD_FLOOD; broadcast_packet(p, port); } } break; - case ACK_FLOOD: - n->LUT[p->destination][port] = MAX_HOPCOUNT; - if (p->destination == n->myAddress) { - //process + case P_ACK_FLOOD: + if (p->destination == myAddress) { + //TODO: + // process } else { - p->hopcount++; - if (n->LUT[p->destination]) { + LUT[p->destination][port] = MAX_HOPCOUNT; + if (LUT[p->destination]) { int bestPort = 0; - int bestHopCount = n->LUT[p->destination][0]; + int bestHopCount = LUT[p->destination][0]; for (int i = 0; i < 4; i++) { - if (n->LUT[p->destination][i] < bestHopCount) { + if (LUT[p->destination][i] < bestHopCount) { bestPort = i; - bestHopCount = n->LUT[p->destination][i]; + bestHopCount = LUT[p->destination][i]; } } send_packet(p, bestPort); } else { - p->raw[0] = STANDARD_FLOOD; + // Dougie: I removed this: p->raw[0] = P_STANDARD_FLOOD; broadcast_packet(p, port); } } break; - case BUFFER_UPDATE: - n->portBufferSizes[port] = p->raw[0]; - break; + default: + pin_clear(&stlr); // err indicator + break; } } diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h index 993837a..927725b 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/packet_handling.h @@ -13,14 +13,14 @@ int parse_type(packet_t* p); -void update_LUT(node_t* n, uint16_t src, uint8_t hopCount, uint8_t port); +void update_LUT(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); -void handle_packet(node_t* n, packet_t* p, uint8_t port); +void handle_packet(packet_t* p, uint8_t port); -int in_table(node_t* n, uint8_t dest); +int in_table(uint8_t dest); #endif /* PACKET_HANDLING_H_ */ diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h new file mode 100644 index 0000000..1c976b7 --- /dev/null +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/ports.h @@ -0,0 +1,52 @@ +/* + * ports.h + * + * Created: 12/8/2017 11:30:49 AM + * Author: Jake + */ + + +#ifndef PORTS_H_ +#define PORTS_H_ + + +#include "tinyport.h" +#include "ringbuffer.h" +#include "pin.h" + +pin_t stlb; +pin_t stlr; +pin_t button; + +tinyport_t tp1; +ringbuffer_t p1rbrx; +ringbuffer_t p1rbtx; +pin_t p1lr; +pin_t p1lg; +pin_t p1lb; + +tinyport_t tp2; +ringbuffer_t p2rbrx; +ringbuffer_t p2rbtx; +pin_t p2lr; +pin_t p2lg; +pin_t p2lb; + +tinyport_t tp3; +ringbuffer_t p3rbrx; +ringbuffer_t p3rbtx; +pin_t p3lr; +pin_t p3lg; +pin_t p3lb; + +tinyport_t tp4; +ringbuffer_t p4rbrx; +ringbuffer_t p4rbtx; +pin_t p4lr; +pin_t p4lg; +pin_t p4lb; + +tinyport_t* ports[4]; + + +#endif /* PORTS_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 5238793..8fa0065 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.c @@ -46,7 +46,7 @@ void tp_init(tinyport_t *tp){ tp->packetstate = TP_PACKETSTATE_OUTSIDE; tp->haspacket = TP_NO_PACKET; - tp->bufferdepth = 255; + tp->buffersize = 0; tp->packet = packet_new(); } @@ -60,6 +60,7 @@ int tp_putdata(tinyport_t *tp, uint8_t *data, uint8_t size){ // drops block of mems into ringbuffer (need to update rb for this) rb_putdata(tp->rbtx, data, size); tp->uart->UART_IER |= UART_IER_TXRDY; + return 1; } void tp_rxhandler(tinyport_t *tp){ @@ -69,9 +70,6 @@ void tp_rxhandler(tinyport_t *tp){ void tp_packetparser(tinyport_t *tp){ - // probably run in a while(!(rb_empty()) and break when completing a packet, so we return max. 1 packet at a time to top level - // critically, this must run when packets are half-rx'd - while(!rb_empty(tp->rbrx) && !tp->haspacket){ // while the ringbuffer contains data and we don't have a packet yet uint8_t data = rb_get(tp->rbrx); // grab a byte from the ringbuffer @@ -86,15 +84,20 @@ void tp_packetparser(tinyport_t *tp){ tp->packet.raw[tp->packet.counter] = data; tp->packet.counter ++; } else { - tp->bufferdepth = data; + tp->buffersize = data; } break; case TP_PACKETSTATE_INSIDE: // writing to packet // check for size byte - // check for end of packet w/ counter (counter is _current_ byte, is incremented at end of handle) + // check for end of packet w/ counter + // (counter is _current_ byte, is incremented at end of handle) + // when done, fill in fields for easy access in handling if(tp->packet.counter >= tp->packet.size - 1){ // check counter against packet size to see if @ end of packet + tp->packet.hopcount = tp->packet.raw[3]; + tp->packet.destination = ((uint16_t)tp->packet.raw[1] << 8) | tp->packet.raw[2]; + tp->packet.source = ((uint16_t)tp->packet.raw[4] << 8) | tp->packet.raw[5]; tp->haspacket = TP_HAS_PACKET; // this data is final byte, we have packet, this will be last tick in loop tp->packetstate = TP_PACKETSTATE_OUTSIDE; // and we're outside again pin_clear(tp->stlb); diff --git a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h index e17f99a..98809d3 100644 --- a/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h +++ b/embedded/atsams70-tinyrouter/atsams70-tinyrouter/src/tinyport.h @@ -80,7 +80,7 @@ typedef struct{ uint8_t packetstate; uint8_t packetcounter; packet_t packet; - uint8_t bufferdepth; // depth of buffer on the other side, updated on heartbeats + uint8_t buffersize; // depth of buffer on the other side, updated on heartbeats }tinyport_t; diff --git a/js/serialterminal.js b/js/serialterminal.js index 445afd2..386edc1 100644 --- a/js/serialterminal.js +++ b/js/serialterminal.js @@ -17,7 +17,7 @@ const rl = readline.createInterface({ rl.on('line', parseLineIn); // [type][destination][destination][hopcount][source][source][#bytestotal][byte_7][byte_6]...[byte_n] -var buf = Buffer.from([255,2,3,4,5,6,12,8,9,10,11,12]) +var buf = Buffer.from([255,0,3,1,3,3,12,8,9,10,11,12]) function parseLineIn(data) { if (debug) { @@ -37,7 +37,7 @@ var SerialPort = require('serialport'); var ByteLength = SerialPort.parsers.ByteLength; -var port = new SerialPort('COM15', { +var port = new SerialPort('COM4', { baudRate: 115200, dataBits: 8, parity: 'none', -- GitLab