From 8e1851be0ef7d20563085907460f9bb77ed2ebba Mon Sep 17 00:00:00 2001 From: edolomb Date: Fri, 16 Mar 2018 15:04:01 +0000 Subject: - Updated demos - Minor changes git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11778 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/Makefile | 32 +++--- ...RT-SAMA5D2-XPLAINED-LWIP-WOLFSSL (DDRAM).launch | 116 ++++++++++----------- demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/lwipthread.h | 4 +- demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/readme.txt | 4 +- .../RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/Makefile | 30 +++--- ...AMA5D2-XPLAINED-LWIP-HTTP-CLIENT (DDRAM).launch | 55 ---------- .../readme.txt | 4 +- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/Makefile | 27 +++-- .../RT-SAMA5D2-XPLAINED-LWIP/cfg/mcuconf.h | 2 +- .../RT-SAMA5D2-XPLAINED-NSEC-LWIP/Makefile | 34 +++--- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/Makefile | 28 +++-- .../RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c | 13 ++- .../RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h | 4 +- .../ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipopts.h | 4 +- .../RT-SAMA5D2-XPLAINED-NSEC/lwipthread.h | 6 +- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/main.c | 8 +- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile | 27 +++-- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c | 24 ++++- .../RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c | 4 +- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile | 27 ++--- demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c | 3 - demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/readme.txt | 2 +- 22 files changed, 199 insertions(+), 259 deletions(-) diff --git a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/Makefile b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/Makefile index e30826872..fd58a74c3 100644 --- a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/Makefile @@ -113,6 +113,8 @@ CONFDIR := ./cfg # Imported source files and paths CHIBIOS = ../../.. +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -128,7 +130,6 @@ include $(CHIBIOS)/os/common/ports/ARMCAx-TZ/compilers/GCC/mk/port_generic.mk #include $(CHIBIOS)/test/rt/rt_test.mk #include $(CHIBIOS)/test/oslib/oslib_test.mk include $(CHIBIOS)/os/hal/lib/streams/streams.mk -include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk include cfg/lwip.mk include cfg/wolfssl.mk @@ -138,21 +139,14 @@ LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ - $(LWSRC) \ - $(WOLFSRC) \ +CSRC = $(ALLCSRC) \ + $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ web/web.c web/cert.c lwipthread.c wolfssl_chibios.c main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -175,14 +169,14 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) - -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(LWINC) $(STREAMSINC) \ - $(CHIBIOS)/os/various $(WOLFINC) $(CONFDIR) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) + +INCDIR = $(ALLINC) \ + $(CHIBIOS)/os/various \ + $(WOLFINC) \ + $(LWINC) \ + $(CONFDIR) \ # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/debug/RT-SAMA5D2-XPLAINED-LWIP-WOLFSSL (DDRAM).launch b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/debug/RT-SAMA5D2-XPLAINED-LWIP-WOLFSSL (DDRAM).launch index 0bdea123e..06d5a9ead 100644 --- a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/debug/RT-SAMA5D2-XPLAINED-LWIP-WOLFSSL (DDRAM).launch +++ b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/debug/RT-SAMA5D2-XPLAINED-LWIP-WOLFSSL (DDRAM).launch @@ -1,58 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/lwipthread.h b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/lwipthread.h index f445dba6e..d9c4d5586 100644 --- a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/lwipthread.h +++ b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/lwipthread.h @@ -72,14 +72,14 @@ * @brief IP Address. */ #if !defined(LWIP_IPADDR) || defined(__DOXYGEN__) -#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 0, 5) +#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 21, 11) #endif /** * @brief IP Gateway. */ #if !defined(LWIP_GATEWAY) || defined(__DOXYGEN__) -#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 0, 1) +#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 21, 1) #endif /** diff --git a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/readme.txt b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/readme.txt index a1d3961ac..632bbd6d0 100644 --- a/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/readme.txt +++ b/demos/ATSAMA5D2/RT-SAMA-LWIP-WOLFSSL/readme.txt @@ -11,10 +11,10 @@ The demo runs on SAMA5D2-XPLAINED The demo flashes a LED to indicate that is running properly. An example HTTPS server is implemented to serve "GET /" requests at address -192.168.0.5 on port 443. +192.168.21.11 on port 443. Use curl command line to verify DEMO ->>curl -k https://192.168.0.5 +>>curl -k https://192.168.21.11 SSL certificate and server key that are compiled in are the example keys taken from the wolfSSL repository. To use different keys, regenerate cert.c diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/Makefile index 10808aed7..c236d47fc 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/Makefile @@ -109,9 +109,14 @@ endif # Define project name here PROJECT = ch CONFDIR := ./cfg +BUILDDIR := ./build +DEPDIR := ./.dep # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -134,14 +139,7 @@ LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ - $(STREAMSSRC) \ +CSRC = $(ALLCSRC) \ $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ $(CHIBIOS)/os/various/syscalls.c \ @@ -149,7 +147,7 @@ CSRC = $(STARTUPSRC) \ # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -172,14 +170,12 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) - -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(STREAMSINC) $(LWINC) \ - $(CHIBIOS)/os/various $(CONFDIR) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) + +INCDIR = $(CONFDIR) $(ALLINC) \ + $(LWINC) \ + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/debug/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT (DDRAM).launch b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/debug/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT (DDRAM).launch index ec1446018..e69de29bb 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/debug/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT (DDRAM).launch +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/debug/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT (DDRAM).launch @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/readme.txt b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/readme.txt index 5c0a48980..3e1b0bbae 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/readme.txt +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP-HTTP-CLIENT/readme.txt @@ -8,8 +8,8 @@ The demo runs on an SAMA5D2-XPLAINED board. ** The Demo ** -The demo currently just flashes a LED using a thread and serves HTTP requests -at address 192.168.21.11 on port 80. +The demo currently just flashes a LED using a thread and send HTTP GET +at host defined in web.h on port 80. ** Build Procedure ** diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/Makefile index 0e24eadc7..97e3c3368 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/Makefile @@ -109,9 +109,14 @@ endif # Define project name here PROJECT = ch CONFDIR := ./cfg +BUILDDIR := ./build +DEPDIR := ./.dep # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -129,24 +134,18 @@ include $(CHIBIOS)/os/common/ports/ARMCAx-TZ/compilers/GCC/mk/port_generic.mk include cfg/lwip.mk # Define linker script file here -LDSCRIPT= $(STARTUPLD)/SAMA5D2.ld +LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ web/web.c lwipthread.c main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -169,14 +168,12 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ +INCDIR = $(CONFDIR) $(ALLINC) \ $(LWINC) \ - $(CHIBIOS)/os/various $(CONFDIR) + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/cfg/mcuconf.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/cfg/mcuconf.h index 83e7a7b6b..e9765cf10 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/cfg/mcuconf.h +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-LWIP/cfg/mcuconf.h @@ -23,7 +23,7 @@ * HAL driver system settings. */ #define SAMA_HAL_IS_SECURE TRUE -#define SAMA_NO_INIT FALSE +#define SAMA_NO_INIT TRUE #define SAMA_MOSCRC_ENABLED FALSE #define SAMA_MOSCXT_ENABLED TRUE #define SAMA_MOSC_SEL SAMA_MOSC_MOSCXT diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC-LWIP/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC-LWIP/Makefile index e6fa1ca7e..e506f2249 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC-LWIP/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC-LWIP/Makefile @@ -109,8 +109,14 @@ endif # Define project name here PROJECT = ch CONFDIR := ./cfg +BUILDDIR := ./build +DEPDIR := ./.dep + # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARM/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -125,6 +131,7 @@ include $(CHIBIOS)/os/common/ports/ARM/compilers/GCC/mk/port_generic.mk include $(CHIBIOS)/test/lib/test.mk include $(CHIBIOS)/test/rt/rt_test.mk include $(CHIBIOS)/test/oslib/oslib_test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk include cfg/lwip.mk # Define linker script file here @@ -132,23 +139,16 @@ LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ + $(TESTSRC) \ $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ - $(TESTSRC) \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ tsclient.c \ web/web.c lwipthread.c main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -171,14 +171,12 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) - -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CONFDIR) $(LWINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \ +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) + +INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)\ + $(LWINC) \ + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/Makefile index 9219e1ea1..e353c4ecb 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/Makefile @@ -108,9 +108,14 @@ endif # Define project name here PROJECT = ch +BUILDDIR := ./build +DEPDIR := ./.dep # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARM/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -125,6 +130,7 @@ include $(CHIBIOS)/os/common/ports/ARM/compilers/GCC/mk/port_generic.mk include $(CHIBIOS)/test/lib/test.mk include $(CHIBIOS)/test/rt/rt_test.mk include $(CHIBIOS)/test/oslib/oslib_test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk include lwip.mk # Define linker script file here @@ -132,17 +138,9 @@ LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ - $(LWSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ $(CHIBIOS)/os/various/evtimer.c \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ daemons/tssockskel.c \ tsclient.c \ lwipthread.c \ @@ -150,7 +148,7 @@ CSRC = $(STARTUPSRC) \ # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -173,14 +171,12 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ +INCDIR = $(ALLINC) $(TESTINC) \ $(LWINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c index 8ca60ad59..8c0f45f83 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c @@ -41,7 +41,7 @@ /* Module local variables. */ /*===========================================================================*/ -static ts_service_t tsStubsService; +static ts_service_t tsStubsService = NULL; /*===========================================================================*/ /* Module local functions. */ @@ -159,6 +159,7 @@ static void l_recv(skel_req_t *skreqp) { /* call the api exposed by the TCP/IP stack.*/ result = recv((int)skreqp->stub_op_p[0], mem, len, (int)skreqp->stub_op_p[3]); + skreqp->stub_op_p[1] = (uint32_t)mem; } /* report the result and copy 'out' parameter mem.*/ @@ -254,16 +255,18 @@ static void l_bind(skel_req_t *skreqp) { /*===========================================================================*/ /* Module exported functions. */ /*===========================================================================*/ -THD_WORKING_AREA(waTsSockSkelDaemon, 2048); +THD_WORKING_AREA(waTsSockSkelDaemon0, 2048); +THD_WORKING_AREA(waTsSockSkelDaemon1, 2048); +THD_WORKING_AREA(waTsSockSkelDaemon2, 2048); THD_FUNCTION(TsSockSkelDaemon, arg) { - (void)arg; event_listener_t el; skel_req_t skel_req; msg_t r; - tsStubsService = (ts_service_t)tsInvokeServiceNoYield(TS_HND_DISCOVERY, - (ts_params_area_t)"TsStubsService", sizeof "TsStubsService"); + if (arg != NULL) + tsStubsService = (ts_service_t)tsInvokeServiceNoYield(TS_HND_DISCOVERY, + (ts_params_area_t)"TsStubsService", sizeof "TsStubsService"); chEvtRegisterMaskWithFlags(&stubsEventSource, &el, ALL_EVENTS, EVT_F_SOCK_NEW_OP); for (;/* ever */;) { chEvtWaitAny(ALL_EVENTS); diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h index e7408f908..f0acb3a96 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h @@ -65,7 +65,9 @@ extern "C" { #endif THD_FUNCTION(TsSockSkelDaemon, tsstate); - extern THD_WORKING_AREA(waTsSockSkelDaemon, 2048); + extern THD_WORKING_AREA(waTsSockSkelDaemon0, 2048); + extern THD_WORKING_AREA(waTsSockSkelDaemon1, 2048); + extern THD_WORKING_AREA(waTsSockSkelDaemon2, 2048); #ifdef __cplusplus } #endif diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipopts.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipopts.h index 99a1c1a6a..7848d8a87 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipopts.h +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipopts.h @@ -2113,10 +2113,10 @@ /* Use ChibiOS specific priorities. */ #if !defined(TCPIP_THREAD_PRIO) -#define TCPIP_THREAD_PRIO (LOWPRIO + 1) +#define TCPIP_THREAD_PRIO (NORMALPRIO - 1) #endif #if !defined(LWIP_THREAD_PRIORITY) -#define LWIP_THREAD_PRIORITY (LOWPRIO) +#define LWIP_THREAD_PRIORITY (NORMALPRIO - 2) #endif #endif /* LWIP_HDR_LWIPOPTS_H__ */ diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipthread.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipthread.h index d9c4d5586..5487c2e40 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipthread.h +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/lwipthread.h @@ -58,7 +58,7 @@ * @brief lwIP thread stack size. */ #if !defined(LWIP_THREAD_STACK_SIZE) || defined(__DOXYGEN__) -#define LWIP_THREAD_STACK_SIZE 1400 +#define LWIP_THREAD_STACK_SIZE 4096 #endif /** @@ -72,14 +72,14 @@ * @brief IP Address. */ #if !defined(LWIP_IPADDR) || defined(__DOXYGEN__) -#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 21, 11) +#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 1, 113) #endif /** * @brief IP Gateway. */ #if !defined(LWIP_GATEWAY) || defined(__DOXYGEN__) -#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 21, 1) +#define LWIP_GATEWAY(p) IP4_ADDR(p, 192, 168, 1, 254) #endif /** diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/main.c index 1421a5928..a35e30606 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/main.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/main.c @@ -80,7 +80,13 @@ int main(void) { */ chThdCreateStatic(waThread1, sizeof waThread1, NORMALPRIO-1, Thread1, NULL); - chThdCreateStatic(waTsSockSkelDaemon, sizeof waTsSockSkelDaemon, NORMALPRIO, + /* Creates three sockets skeleton daemon threads to serve up to three + sockets calls simultaneously.*/ + chThdCreateStatic(waTsSockSkelDaemon0, sizeof waTsSockSkelDaemon0, NORMALPRIO, + TsSockSkelDaemon, (void *)1); + chThdCreateStatic(waTsSockSkelDaemon1, sizeof waTsSockSkelDaemon1, NORMALPRIO, + TsSockSkelDaemon, NULL); + chThdCreateStatic(waTsSockSkelDaemon2, sizeof waTsSockSkelDaemon2, NORMALPRIO, TsSockSkelDaemon, NULL); /* diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile index 2a1c0b958..b8e111ffa 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile @@ -108,9 +108,14 @@ endif # Define project name here PROJECT = ch +BUILDDIR := ./build +DEPDIR := ./.dep # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -125,28 +130,22 @@ include $(CHIBIOS)/os/common/ports/ARMCAx-TZ/compilers/GCC/mk/port_generic.mk include $(CHIBIOS)/test/lib/test.mk include $(CHIBIOS)/test/rt/rt_test.mk include $(CHIBIOS)/test/oslib/oslib_test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ tservices.c \ proxies/tssockstub.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -169,13 +168,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(TESTINC) \ + $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c index e432e48c1..51200f054 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c @@ -24,17 +24,19 @@ #include #define SERVER_PORT_NUM 8080 -#define SERVER_IP_ADDRESS "192.136.23.21" +#define SERVER_IP_ADDRESS "192.168.1.76" void tcpexample(void) { int socket_fd; struct sockaddr_in ra; int recv_data; char data_buffer[80]; + struct fd_set rset; + struct timeval tm = {5, 0}; /* - * Creates an TCP socket (SOCK_STREAM) with Internet Protocol Family - * (PF_INET). Protocol family and Address family related. For example + * Creates an TCP socket, i.e. a SOCK_STREAM, with Internet Protocol Family, + * i.e. PF_INET. Protocol family and Address family are related. For example * PF_INET Protocol Family and AF_INET family are coupled. */ socket_fd = socket(PF_INET, SOCK_STREAM, 0); @@ -44,7 +46,9 @@ void tcpexample(void) { return; } - /* Connects to server ip-address. */ + FD_ZERO(&rset); + + /* Connects to server ip-address.*/ memset(&ra, 0, sizeof(struct sockaddr_in)); ra.sin_family = AF_INET; ra.sin_addr.s_addr = inet_addr(SERVER_IP_ADDRESS); @@ -57,11 +61,21 @@ void tcpexample(void) { close(socket_fd); return; } - if (send(socket_fd, "Baba", sizeof "Baba", 0) < 0) { + if (send(socket_fd, "A' sfugliatella e o' babà.\r\n", + sizeof "A' sfugliatella e o' babà.\r\n", 0) < 0) { chprintf((BaseSequentialStream *)&SD1, "send failed \n"); close(socket_fd); return; } + do { + FD_SET(socket_fd, &rset); + recv_data = select(socket_fd+1, &rset, 0, 0, &tm); + if (recv_data < 0) { + chprintf((BaseSequentialStream *)&SD1, "select failed \n"); + close(socket_fd); + return; + } + } while (recv_data == 0); recv_data = recv(socket_fd, data_buffer, sizeof data_buffer, 0); if (recv_data < 0) { chprintf((BaseSequentialStream *)&SD1, "recv failed \n"); diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c index 53056a568..21cc9d28c 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c @@ -87,7 +87,7 @@ static bool isOpValid(stub_op_t *op) * @details It activates the channel between the stubs service and * the skels daemon running in the nsec world. * To do it, it uses an event to signal the skels - * daemon that a new op request is ready to be executed. + * daemons that a new op request is ready to be executed. * The skels daemon will then, behind the scenes, gets the op calling, * via smc, the stubs service. The skel executes it and then calls the * stubs service again to post the result and to wake up the @@ -151,7 +151,7 @@ THD_FUNCTION(TsStubsService, tsstate) { switch (skrp->req) { case SKEL_REQ_GETOP: - /* The nsec skel calls us to get a new op ready to be executed.*/ + /* The nsec skeleton calls us to get a new op ready to be executed.*/ if (chFifoReceiveObjectTimeout(&ops_fifo, (void **)&op, TIME_IMMEDIATE) == MSG_TIMEOUT) { r = SMC_SVC_NHND; diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile index a201e5e4b..6367c1c0b 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/Makefile @@ -111,6 +111,9 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../.. + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk # HAL-OSAL files (optional). @@ -133,19 +136,13 @@ LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CSRC = $(STARTUPSRC) \ - $(KERNSRC) \ - $(PORTSRC) \ - $(OSALSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ +CSRC = $(ALLCSRC) \ $(TESTSRC) \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. -CPPSRC = +CPPSRC = $(ALLCPPSRC) # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler @@ -168,13 +165,11 @@ TCSRC = TCPPSRC = # List ASM source files here -ASMSRC = -ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) +# List ASM source files here +ASMSRC = $(ALLASMSRC) +ASMXSRC = $(ALLXASMSRC) -INCDIR = $(CHIBIOS)/os/license \ - $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/various +INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) # # Project, sources and paths @@ -224,10 +219,10 @@ CPPWARN = -Wall -Wextra -Wundef # # List all user C define here, like -D_DEBUG=1 -UDEFS = -DCH_CFG_USE_MMU +UDEFS = # Define ASM defines here -UADEFS = -DCH_CFG_USE_MMU +UADEFS = # List all user directories here UINCDIR = diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c index 57e6a72dc..3025f1b7f 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c @@ -69,9 +69,6 @@ int main(void) { */ sdStart(&SD1, &sdcfg); - /* Redirecting UART0 RX on PD2 and UART0 TX on PD3. */ - palSetGroupMode(PIOD, PAL_PORT_BIT(2) | PAL_PORT_BIT(3), 0U, - PAL_SAMA_FUNC_PERIPH_A | PAL_MODE_SECURE); /* * Creates the blinker thread. */ diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/readme.txt b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/readme.txt index cc6e568f6..303da320d 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/readme.txt +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/readme.txt @@ -4,7 +4,7 @@ ** TARGET ** -The demo targets a generic ARM Cortex-A5 device without HAL support. +The demo runs on an SAMA5D2-XPLAINED board. ** The Demo ** -- cgit v1.2.3