From 0b539b26b0221e70ac4db0541f92239a8cf3909d Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Sat, 10 Mar 2018 15:34:41 +0100 Subject: Simplified a makefile by using the new variables Also disabled FPU, added license makefile and added -Wundef to C and C++ warnings. --- demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile index 7c0ab70..104f62e 100644 --- a/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile +++ b/demos/TIVA/RT-TM4C123G-LAUNCHPAD/Makefile @@ -71,7 +71,7 @@ endif # Enables the use of FPU on Cortex-M4 (no, softfp, hard). ifeq ($(USE_FPU),) - USE_FPU = hard + USE_FPU = no endif # @@ -88,6 +88,9 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c123x.mk # HAL-OSAL files (optional). @@ -108,19 +111,13 @@ LDSCRIPT= $(STARTUPLD)/TM4C123xH6.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 @@ -143,13 +140,10 @@ 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/various +INCDIR = $(ALLINC) $(TESTINC) # # Project, sources and paths @@ -185,10 +179,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wextra -Wstrict-prototypes +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall -Wextra +CPPWARN = -Wall -Wextra -Wundef # # Compiler settings -- cgit v1.2.3 From e38bf6044796eb56d79d887ccc7c1c1bedc6d4b7 Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Mon, 12 Mar 2018 19:18:39 +0100 Subject: Aligned Tiva Makefiles --- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile | 28 ++++++++++--------------- demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile | 29 +++++++++++--------------- 2 files changed, 23 insertions(+), 34 deletions(-) (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile index add92f1..6598fd8 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile @@ -71,7 +71,7 @@ endif # Enables the use of FPU on Cortex-M4 (no, softfp, hard). ifeq ($(USE_FPU),) - USE_FPU = hard + USE_FPU = no endif # @@ -88,6 +88,9 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk # HAL-OSAL files (optional). @@ -106,13 +109,7 @@ LDSCRIPT= $(STARTUPLD)/TM4C129xNC.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 \ @@ -121,7 +118,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 @@ -144,13 +141,10 @@ 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/various $(LWINC) +INCDIR = $(ALLINC) $(TESTINC) # # Project, sources and paths @@ -186,10 +180,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wextra -Wstrict-prototypes +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall -Wextra +CPPWARN = -Wall -Wextra -Wundef # # Compiler settings diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile index da83f36..11f28f6 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD/Makefile @@ -71,7 +71,7 @@ endif # Enables the use of FPU on Cortex-M4 (no, softfp, hard). ifeq ($(USE_FPU),) - USE_FPU = hard + USE_FPU = no endif # @@ -88,6 +88,9 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../../../ChibiOS-RT CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib + +# Licensing files. +include $(CHIBIOS)/os/license/license.mk # Startup files. include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_tm4c129x.mk # HAL-OSAL files (optional). @@ -108,19 +111,13 @@ LDSCRIPT= $(STARTUPLD)/TM4C129xNC.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 @@ -143,13 +140,10 @@ 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/various +INCDIR = $(ALLINC) $(TESTINC) # # Project, sources and paths @@ -161,6 +155,7 @@ INCDIR = $(CHIBIOS)/os/license \ MCU = cortex-m4 +#TRGT = arm-elf- TRGT = arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ @@ -184,10 +179,10 @@ AOPT = TOPT = -mthumb -DTHUMB # Define C warning options here -CWARN = -Wall -Wextra -Wstrict-prototypes +CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes # Define C++ warning options here -CPPWARN = -Wall -Wextra +CPPWARN = -Wall -Wextra -Wundef # # Compiler settings -- cgit v1.2.3 From 73402af8bd37c370554ccbfb568b0d887d4f5b46 Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Tue, 13 Mar 2018 20:26:06 +0100 Subject: Fixed problem in LwIP demo makefile --- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile index 6598fd8..6dd75df 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile @@ -110,7 +110,6 @@ LDSCRIPT= $(STARTUPLD)/TM4C129xNC.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. CSRC = $(ALLCSRC) \ - $(TESTSRC) \ $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ main.c \ @@ -144,7 +143,7 @@ TCPPSRC = ASMSRC = $(ALLASMSRC) ASMXSRC = $(ALLXASMSRC) -INCDIR = $(ALLINC) $(TESTINC) +INCDIR = $(ALLINC) $(LWINC) $(CHIBIOS)/os/various # # Project, sources and paths -- cgit v1.2.3 From 48ad58ccbf9fc7ecc55e994305b8dd73c7e0d2ac Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Wed, 14 Mar 2018 08:16:24 +0100 Subject: Removed LWSRC and LWINC from makefile and added httpd_opts.h file. --- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile | 3 +- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/httpd_opts.h | 323 +++++++++++++++++++++ 2 files changed, 324 insertions(+), 2 deletions(-) create mode 100644 demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/httpd_opts.h (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile index 6dd75df..0d30f91 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile @@ -110,7 +110,6 @@ LDSCRIPT= $(STARTUPLD)/TM4C129xNC.ld # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. CSRC = $(ALLCSRC) \ - $(LWSRC) \ $(CHIBIOS)/os/various/evtimer.c \ main.c \ web/web.c \ @@ -143,7 +142,7 @@ TCPPSRC = ASMSRC = $(ALLASMSRC) ASMXSRC = $(ALLXASMSRC) -INCDIR = $(ALLINC) $(LWINC) $(CHIBIOS)/os/various +INCDIR = $(ALLINC) $(CHIBIOS)/os/various # # Project, sources and paths diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/httpd_opts.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/httpd_opts.h new file mode 100644 index 0000000..340db15 --- /dev/null +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/httpd_opts.h @@ -0,0 +1,323 @@ +/** + * @file + * HTTP server options list + */ + +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * This version of the file has been modified by Texas Instruments to offer + * simple server-side-include (SSI) and Common Gateway Interface (CGI) + * capability. + */ + +#ifndef LWIP_HDR_APPS_HTTPD_OPTS_H +#define LWIP_HDR_APPS_HTTPD_OPTS_H + +#include "lwip/opt.h" + +/** + * @defgroup httpd_opts Options + * @ingroup httpd + * @{ + */ + +/** Set this to 1 to support CGI (old style) */ +#if !defined LWIP_HTTPD_CGI || defined __DOXYGEN__ +#define LWIP_HTTPD_CGI 0 +#endif + +/** Set this to 1 to support CGI (new style) */ +#if !defined LWIP_HTTPD_CGI_SSI || defined __DOXYGEN__ +#define LWIP_HTTPD_CGI_SSI 0 +#endif + +/** Set this to 1 to support SSI (Server-Side-Includes) */ +#if !defined LWIP_HTTPD_SSI || defined __DOXYGEN__ +#define LWIP_HTTPD_SSI 0 +#endif + +/** Set this to 1 to implement an SSI tag handler callback that gets a const char* + * to the tag (instead of an index into a pre-registered array of known tags) */ +#if !defined LWIP_HTTPD_SSI_RAW || defined __DOXYGEN__ +#define LWIP_HTTPD_SSI_RAW 0 +#endif + +/** Set this to 1 to support HTTP POST */ +#if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__ +#define LWIP_HTTPD_SUPPORT_POST 0 +#endif + +/* The maximum number of parameters that the CGI handler can be sent. */ +#if !defined LWIP_HTTPD_MAX_CGI_PARAMETERS || defined __DOXYGEN__ +#define LWIP_HTTPD_MAX_CGI_PARAMETERS 16 +#endif + +/** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more + * arguments indicating a counter for insert string that are too long to be + * inserted at once: the SSI handler function must then set 'next_tag_part' + * which will be passed back to it in the next call. */ +#if !defined LWIP_HTTPD_SSI_MULTIPART || defined __DOXYGEN__ +#define LWIP_HTTPD_SSI_MULTIPART 0 +#endif + +/* The maximum length of the string comprising the tag name */ +#if !defined LWIP_HTTPD_MAX_TAG_NAME_LEN || defined __DOXYGEN__ +#define LWIP_HTTPD_MAX_TAG_NAME_LEN 8 +#endif + +/* The maximum length of string that can be returned to replace any given tag */ +#if !defined LWIP_HTTPD_MAX_TAG_INSERT_LEN || defined __DOXYGEN__ +#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192 +#endif + +#if !defined LWIP_HTTPD_POST_MANUAL_WND || defined __DOXYGEN__ +#define LWIP_HTTPD_POST_MANUAL_WND 0 +#endif + +/** This string is passed in the HTTP header as "Server: " */ +#if !defined HTTPD_SERVER_AGENT || defined __DOXYGEN__ +#define HTTPD_SERVER_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)" +#endif + +/** Set this to 1 if you want to include code that creates HTTP headers + * at runtime. Default is off: HTTP headers are then created statically + * by the makefsdata tool. Static headers mean smaller code size, but + * the (readonly) fsdata will grow a bit as every file includes the HTTP + * header. */ +#if !defined LWIP_HTTPD_DYNAMIC_HEADERS || defined __DOXYGEN__ +#define LWIP_HTTPD_DYNAMIC_HEADERS 0 +#endif + +#if !defined HTTPD_DEBUG || defined __DOXYGEN__ +#define HTTPD_DEBUG LWIP_DBG_OFF +#endif + +/** Set this to 1 to use a memp pool for allocating + * struct http_state instead of the heap. + */ +#if !defined HTTPD_USE_MEM_POOL || defined __DOXYGEN__ +#define HTTPD_USE_MEM_POOL 0 +#endif + +/** The server port for HTTPD to use */ +#if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__ +#define HTTPD_SERVER_PORT 80 +#endif + +/** Maximum retries before the connection is aborted/closed. + * - number of times pcb->poll is called -> default is 4*500ms = 2s; + * - reset when pcb->sent is called + */ +#if !defined HTTPD_MAX_RETRIES || defined __DOXYGEN__ +#define HTTPD_MAX_RETRIES 4 +#endif + +/** The poll delay is X*500ms */ +#if !defined HTTPD_POLL_INTERVAL || defined __DOXYGEN__ +#define HTTPD_POLL_INTERVAL 4 +#endif + +/** Priority for tcp pcbs created by HTTPD (very low by default). + * Lower priorities get killed first when running out of memory. + */ +#if !defined HTTPD_TCP_PRIO || defined __DOXYGEN__ +#define HTTPD_TCP_PRIO TCP_PRIO_MIN +#endif + +/** Set this to 1 to enable timing each file sent */ +#if !defined LWIP_HTTPD_TIMING || defined __DOXYGEN__ +#define LWIP_HTTPD_TIMING 0 +#endif +/** Set this to 1 to enable timing each file sent */ +#if !defined HTTPD_DEBUG_TIMING || defined __DOXYGEN__ +#define HTTPD_DEBUG_TIMING LWIP_DBG_OFF +#endif + +/** Set this to one to show error pages when parsing a request fails instead + of simply closing the connection. */ +#if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__ +#define LWIP_HTTPD_SUPPORT_EXTSTATUS 0 +#endif + +/** Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes) */ +#if !defined LWIP_HTTPD_SUPPORT_V09 || defined __DOXYGEN__ +#define LWIP_HTTPD_SUPPORT_V09 1 +#endif + +/** Set this to 1 to enable HTTP/1.1 persistent connections. + * ATTENTION: If the generated file system includes HTTP headers, these must + * include the "Connection: keep-alive" header (pass argument "-11" to makefsdata). + */ +#if !defined LWIP_HTTPD_SUPPORT_11_KEEPALIVE || defined __DOXYGEN__ +#define LWIP_HTTPD_SUPPORT_11_KEEPALIVE 0 +#endif + +/** Set this to 1 to support HTTP request coming in in multiple packets/pbufs */ +#if !defined LWIP_HTTPD_SUPPORT_REQUESTLIST || defined __DOXYGEN__ +#define LWIP_HTTPD_SUPPORT_REQUESTLIST 1 +#endif + +#if LWIP_HTTPD_SUPPORT_REQUESTLIST +/** Number of rx pbufs to enqueue to parse an incoming request (up to the first + newline) */ +#if !defined LWIP_HTTPD_REQ_QUEUELEN || defined __DOXYGEN__ +#define LWIP_HTTPD_REQ_QUEUELEN 5 +#endif + +/** Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming + request (up to the first double-newline) */ +#if !defined LWIP_HTTPD_REQ_BUFSIZE || defined __DOXYGEN__ +#define LWIP_HTTPD_REQ_BUFSIZE LWIP_HTTPD_MAX_REQ_LENGTH +#endif + +/** Defines the maximum length of a HTTP request line (up to the first CRLF, + copied from pbuf into this a global buffer when pbuf- or packet-queues + are received - otherwise the input pbuf is used directly) */ +#if !defined LWIP_HTTPD_MAX_REQ_LENGTH || defined __DOXYGEN__ +#define LWIP_HTTPD_MAX_REQ_LENGTH LWIP_MIN(1023, (LWIP_HTTPD_REQ_QUEUELEN * PBUF_POOL_BUFSIZE)) +#endif +#endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ + +/** This is the size of a static buffer used when URIs end with '/'. + * In this buffer, the directory requested is concatenated with all the + * configured default file names. + * Set to 0 to disable checking default filenames on non-root directories. + */ +#if !defined LWIP_HTTPD_MAX_REQUEST_URI_LEN || defined __DOXYGEN__ +#define LWIP_HTTPD_MAX_REQUEST_URI_LEN 63 +#endif + +/** Maximum length of the filename to send as response to a POST request, + * filled in by the application when a POST is finished. + */ +#if !defined LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN || defined __DOXYGEN__ +#define LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN 63 +#endif + +/** Set this to 0 to not send the SSI tag (default is on, so the tag will + * be sent in the HTML page */ +#if !defined LWIP_HTTPD_SSI_INCLUDE_TAG || defined __DOXYGEN__ +#define LWIP_HTTPD_SSI_INCLUDE_TAG 1 +#endif + +/** Set this to 1 to call tcp_abort when tcp_close fails with memory error. + * This can be used to prevent consuming all memory in situations where the + * HTTP server has low priority compared to other communication. */ +#if !defined LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR || defined __DOXYGEN__ +#define LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR 0 +#endif + +/** Set this to 1 to kill the oldest connection when running out of + * memory for 'struct http_state' or 'struct http_ssi_state'. + * ATTENTION: This puts all connections on a linked list, so may be kind of slow. + */ +#if !defined LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED || defined __DOXYGEN__ +#define LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED 0 +#endif + +/** Set this to 1 to send URIs without extension without headers + * (who uses this at all??) */ +#if !defined LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI || defined __DOXYGEN__ +#define LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI 0 +#endif + +/** Default: Tags are sent from struct http_state and are therefore volatile */ +#if !defined HTTP_IS_TAG_VOLATILE || defined __DOXYGEN__ +#define HTTP_IS_TAG_VOLATILE(ptr) TCP_WRITE_FLAG_COPY +#endif + +/* By default, the httpd is limited to send 2*pcb->mss to keep resource usage low + when http is not an important protocol in the device. */ +#if !defined HTTPD_LIMIT_SENDING_TO_2MSS || defined __DOXYGEN__ +#define HTTPD_LIMIT_SENDING_TO_2MSS 1 +#endif + +/* Define this to a function that returns the maximum amount of data to enqueue. + The function have this signature: u16_t fn(struct tcp_pcb* pcb); */ +#if !defined HTTPD_MAX_WRITE_LEN || defined __DOXYGEN__ +#if HTTPD_LIMIT_SENDING_TO_2MSS +#define HTTPD_MAX_WRITE_LEN(pcb) (2 * tcp_mss(pcb)) +#endif +#endif + +/*------------------- FS OPTIONS -------------------*/ + +/** Set this to 1 and provide the functions: + * - "int fs_open_custom(struct fs_file *file, const char *name)" + * Called first for every opened file to allow opening files + * that are not included in fsdata(_custom).c + * - "void fs_close_custom(struct fs_file *file)" + * Called to free resources allocated by fs_open_custom(). + */ +#if !defined LWIP_HTTPD_CUSTOM_FILES || defined __DOXYGEN__ +#define LWIP_HTTPD_CUSTOM_FILES 0 +#endif + +/** Set this to 1 to support fs_read() to dynamically read file data. + * Without this (default=off), only one-block files are supported, + * and the contents must be ready after fs_open(). + */ +#if !defined LWIP_HTTPD_DYNAMIC_FILE_READ || defined __DOXYGEN__ +#define LWIP_HTTPD_DYNAMIC_FILE_READ 0 +#endif + +/** Set this to 1 to include an application state argument per file + * that is opened. This allows to keep a state per connection/file. + */ +#if !defined LWIP_HTTPD_FILE_STATE || defined __DOXYGEN__ +#define LWIP_HTTPD_FILE_STATE 0 +#endif + +/** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for + * predefined (MSS-sized) chunks of the files to prevent having to calculate + * the checksums at runtime. */ +#if !defined HTTPD_PRECALCULATED_CHECKSUM || defined __DOXYGEN__ +#define HTTPD_PRECALCULATED_CHECKSUM 0 +#endif + +/** LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations + * (fs_read_async returns FS_READ_DELAYED and calls a callback when finished). + */ +#if !defined LWIP_HTTPD_FS_ASYNC_READ || defined __DOXYGEN__ +#define LWIP_HTTPD_FS_ASYNC_READ 0 +#endif + +/** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the + * file system (to prevent changing the file included in CVS) */ +#if !defined HTTPD_USE_CUSTOM_FSDATA || defined __DOXYGEN__ +#define HTTPD_USE_CUSTOM_FSDATA 0 +#endif + +/** + * @} + */ + +#endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */ -- cgit v1.2.3 From 424c7a2717fb6b2a847cec5c0060e3236f25e97f Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Wed, 14 Mar 2018 20:15:13 +0100 Subject: Fixed most testhal examples for STM32, updated configs using script. Fixed deprecated MS2ST calls. --- demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/.cproject | 203 +++++++++++++++------ demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c | 4 +- demos/various/RT-Win32-TriBuf/main.c | 2 +- 3 files changed, 150 insertions(+), 59 deletions(-) (limited to 'demos') diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/.cproject b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/.cproject index 916c7ab..a2a9791 100644 --- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/.cproject +++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/.cproject @@ -1,56 +1,147 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/* + ChibiOS/RT - Copyright (C) 2014 Uladzimir Pylinsky aka barthess + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * FSMC driver system settings. + */ +#define STM32_FSMC_USE_FSMC1 FALSE +#define STM32_FSMC_FSMC1_IRQ_PRIORITY 10 + +/* + * FSMC NAND driver system settings. + */ +#define STM32_NAND_USE_FSMC_NAND1 FALSE +#define STM32_NAND_USE_FSMC_NAND2 FALSE +#define STM32_NAND_USE_EXT_INT FALSE +#define STM32_NAND_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) +#define STM32_NAND_DMA_PRIORITY 0 +#define STM32_NAND_DMA_ERROR_HOOK(nandp) osalSysHalt("DMA failure") + +/* + * FSMC SRAM driver system settings. + */ +#define STM32_USE_FSMC_SRAM FALSE +#define STM32_SRAM_USE_FSMC_SRAM1 FALSE +#define STM32_SRAM_USE_FSMC_SRAM2 FALSE +#define STM32_SRAM_USE_FSMC_SRAM3 FALSE +#define STM32_SRAM_USE_FSMC_SRAM4 FALSE + +/* + * FSMC SDRAM driver system settings. + */ +#define STM32_USE_FSMC_SDRAM FALSE + +/* + * TIMCAP driver system settings. + */ +#define STM32_TIMCAP_USE_TIM1 FALSE +#define STM32_TIMCAP_USE_TIM2 FALSE +#define STM32_TIMCAP_USE_TIM3 FALSE +#define STM32_TIMCAP_USE_TIM4 FALSE +#define STM32_TIMCAP_USE_TIM5 FALSE +#define STM32_TIMCAP_USE_TIM8 FALSE +#define STM32_TIMCAP_USE_TIM9 FALSE +#define STM32_TIMCAP_TIM1_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM2_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM3_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM4_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM5_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM8_IRQ_PRIORITY 3 +#define STM32_TIMCAP_TIM9_IRQ_PRIORITY 3 + +/* + * COMP driver system settings. + */ +#define STM32_COMP_USE_COMP1 FALSE +#define STM32_COMP_USE_COMP2 FALSE +#define STM32_COMP_USE_COMP3 FALSE +#define STM32_COMP_USE_COMP4 FALSE +#define STM32_COMP_USE_COMP5 FALSE +#define STM32_COMP_USE_COMP6 FALSE +#define STM32_COMP_USE_COMP7 FALSE + +#define STM32_COMP_USE_INTERRUPTS TRUE +#define STM32_COMP_1_2_3_IRQ_PRIORITY 5 +#define STM32_COMP_4_5_6_IRQ_PRIORITY 5 +#define STM32_COMP_7_IRQ_PRIORITY 5 + +#if STM32_COMP_USE_INTERRUPTS +#define STM32_DISABLE_EXTI21_22_29_HANDLER +#define STM32_DISABLE_EXTI30_32_HANDLER +#define STM32_DISABLE_EXTI33_HANDLER +#endif + +/* + * USBH driver system settings. + */ +#define STM32_OTG1_CHANNELS_NUMBER 8 +#define STM32_OTG2_CHANNELS_NUMBER 12 + +#define STM32_USBH_USE_OTG1 1 +#define STM32_OTG1_RXFIFO_SIZE 1024 +#define STM32_OTG1_PTXFIFO_SIZE 128 +#define STM32_OTG1_NPTXFIFO_SIZE 128 + +#define STM32_USBH_USE_OTG2 0 +#define STM32_OTG2_RXFIFO_SIZE 2048 +#define STM32_OTG2_PTXFIFO_SIZE 1024 +#define STM32_OTG2_NPTXFIFO_SIZE 1024 + +#define STM32_USBH_MIN_QSPACE 4 +#define STM32_USBH_CHANNELS_NP 4 + +/* + * CRC driver system settings. + */ +#define STM32_CRC_USE_CRC1 TRUE +#define STM32_CRC_CRC1_DMA_IRQ_PRIORITY 1 +#define STM32_CRC_CRC1_DMA_PRIORITY 2 +#define STM32_CRC_CRC1_DMA_STREAM STM32_DMA1_STREAM2 + +#define CRCSW_USE_CRC1 FALSE +#define CRCSW_CRC32_TABLE TRUE +#define CRCSW_CRC16_TABLE TRUE +#define CRCSW_PROGRAMMABLE TRUE + +/* + * EICU driver system settings. + */ +#define STM32_EICU_USE_TIM1 FALSE +#define STM32_EICU_USE_TIM2 FALSE +#define STM32_EICU_USE_TIM3 TRUE +#define STM32_EICU_USE_TIM4 FALSE +#define STM32_EICU_USE_TIM5 FALSE +#define STM32_EICU_USE_TIM8 FALSE +#define STM32_EICU_USE_TIM9 FALSE +#define STM32_EICU_USE_TIM10 FALSE +#define STM32_EICU_USE_TIM11 FALSE +#define STM32_EICU_USE_TIM12 FALSE +#define STM32_EICU_USE_TIM13 FALSE +#define STM32_EICU_USE_TIM14 FALSE +#define STM32_EICU_TIM1_IRQ_PRIORITY 7 +#define STM32_EICU_TIM2_IRQ_PRIORITY 7 +#define STM32_EICU_TIM3_IRQ_PRIORITY 7 +#define STM32_EICU_TIM4_IRQ_PRIORITY 7 +#define STM32_EICU_TIM5_IRQ_PRIORITY 7 +#define STM32_EICU_TIM8_IRQ_PRIORITY 7 +#define STM32_EICU_TIM9_IRQ_PRIORITY 7 +#define STM32_EICU_TIM10_IRQ_PRIORITY 7 +#define STM32_EICU_TIM11_IRQ_PRIORITY 7 +#define STM32_EICU_TIM12_IRQ_PRIORITY 7 +#define STM32_EICU_TIM13_IRQ_PRIORITY 7 +#define STM32_EICU_TIM14_IRQ_PRIORITY 7 + + diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c index a7a33f6..c8f1af3 100644 --- a/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c +++ b/demos/STM32/RT-STM32F429-DISCOVERY-TRIBUF/main.c @@ -141,7 +141,7 @@ static THD_FUNCTION(reader_thread, arg) { osalThreadSuspendS(&thread_ref); reader_suspend = false; } else { - osalThreadSleepS(MS2ST(reader_delay)); + osalThreadSleepS(TIME_MS2I(reader_delay)); } old_priority = chThdGetPriorityX(); osalSysUnlock(); @@ -180,7 +180,7 @@ static THD_FUNCTION(writer_thread, arg) { osalThreadSuspendS(&thread_ref); writer_suspend = false; } else { - osalThreadSleepS(MS2ST(writer_delay)); + osalThreadSleepS(TIME_MS2I(writer_delay)); } osalSysUnlock(); } diff --git a/demos/various/RT-Win32-TriBuf/main.c b/demos/various/RT-Win32-TriBuf/main.c index bab25cd..e2b2265 100644 --- a/demos/various/RT-Win32-TriBuf/main.c +++ b/demos/various/RT-Win32-TriBuf/main.c @@ -51,7 +51,7 @@ static char read_front(void) { msg_t error; /* Wait until a new front buffer gets available with prepared data */ - error = tribufWaitReadyTimeout(&tribuf, MS2ST(1000)); + error = tribufWaitReadyTimeout(&tribuf, TIME_MS2I(1000)); if (error == MSG_TIMEOUT) chSysHalt("ERROR: read_front() timed out"); -- cgit v1.2.3 From 7a9ddb8ada6195cf7f869502b9cc197766027ad2 Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Thu, 15 Mar 2018 08:02:32 +0100 Subject: Removed custom web server and use LwIP httpd in demo --- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile | 3 +- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/main.c | 7 +- demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c | 120 ------------------------ demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h | 51 ---------- 4 files changed, 4 insertions(+), 177 deletions(-) delete mode 100644 demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c delete mode 100644 demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h (limited to 'demos') diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile index 0d30f91..4584bdf 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/Makefile @@ -111,8 +111,7 @@ LDSCRIPT= $(STARTUPLD)/TM4C129xNC.ld # setting. CSRC = $(ALLCSRC) \ $(CHIBIOS)/os/various/evtimer.c \ - main.c \ - web/web.c \ + main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/main.c b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/main.c index ac9c3f4..0f88419 100644 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/main.c +++ b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/main.c @@ -17,7 +17,7 @@ #include "ch.h" #include "hal.h" #include "lwipthread.h" -#include "web/web.h" +#include "lwip/apps/httpd.h" /* * Application entry point. @@ -43,10 +43,9 @@ int main(void) sdStart(&SD1, NULL); /* - * Creates the HTTP thread (it changes priority internally). + * Creates the LwIP HTTP server. */ - chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1, - http_server, NULL); + httpd_init(); while (1) { osalThreadSleepMilliseconds(500); diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c deleted file mode 100644 index 8d0d281..0000000 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * This file is a modified version of the lwIP web server demo. The original - * author is unknown because the file didn't contain any license information. - */ - -/** - * @file web.c - * @brief HTTP server wrapper thread code. - * @addtogroup WEB_THREAD - * @{ - */ - -#include "ch.h" - -#include "lwip/opt.h" -#include "lwip/arch.h" -#include "lwip/api.h" - -#include "web.h" - -#if LWIP_NETCONN - -static const char http_html_hdr[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n"; -static const char http_index_html[] = "Congrats!

Welcome to our lwIP HTTP server!

This is a small test page."; - -static void http_server_serve(struct netconn *conn) { - struct netbuf *inbuf; - char *buf; - u16_t buflen; - err_t err; - - /* Read the data from the port, blocking if nothing yet there. - We assume the request (the part we care about) is in one netbuf */ - err = netconn_recv(conn, &inbuf); - - if (err == ERR_OK) { - netbuf_data(inbuf, (void **)&buf, &buflen); - - /* Is this an HTTP GET command? (only check the first 5 chars, since - there are other formats for GET, and we're keeping it very simple )*/ - if (buflen>=5 && - buf[0]=='G' && - buf[1]=='E' && - buf[2]=='T' && - buf[3]==' ' && - buf[4]=='/' ) { - - /* Send the HTML header - * subtract 1 from the size, since we dont send the \0 in the string - * NETCONN_NOCOPY: our data is const static, so no need to copy it - */ - netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY); - - /* Send our HTML page */ - netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY); - } - } - /* Close the connection (server closes in HTTP) */ - netconn_close(conn); - - /* Delete the buffer (netconn_recv gives us ownership, - so we have to make sure to deallocate the buffer) */ - netbuf_delete(inbuf); -} - -/** - * Stack area for the http thread. - */ -THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE); - -/** - * HTTP server thread. - */ -THD_FUNCTION(http_server, p) { - struct netconn *conn, *newconn; - err_t err; - - (void)p; - - /* Create a new TCP connection handle */ - conn = netconn_new(NETCONN_TCP); - LWIP_ERROR("http_server: invalid conn", (conn != NULL), return;); - - /* Bind to port 80 (HTTP) with default IP address */ - netconn_bind(conn, NULL, WEB_THREAD_PORT); - - /* Put the connection into LISTEN state */ - netconn_listen(conn); - - /* Goes to the final priority after initialization.*/ - chThdSetPriority(WEB_THREAD_PRIORITY); - - while(1) { - err = netconn_accept(conn, &newconn); - if (err != ERR_OK) - continue; - http_server_serve(newconn); - netconn_delete(newconn); - } -} - -#endif /* LWIP_NETCONN */ - -/** @} */ diff --git a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h b/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h deleted file mode 100644 index 106dc26..0000000 --- a/demos/TIVA/RT-TM4C1294-LAUNCHPAD-LWIP/web/web.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/** - * @file web.h - * @brief HTTP server wrapper thread macros and structures. - * @addtogroup WEB_THREAD - * @{ - */ - -#ifndef _WEB_H_ -#define _WEB_H_ - -#ifndef WEB_THREAD_STACK_SIZE -#define WEB_THREAD_STACK_SIZE 1024 -#endif - -#ifndef WEB_THREAD_PORT -#define WEB_THREAD_PORT 80 -#endif - -#ifndef WEB_THREAD_PRIORITY -#define WEB_THREAD_PRIORITY (LOWPRIO + 2) -#endif - -extern THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE); - -#ifdef __cplusplus -extern "C" { -#endif - THD_FUNCTION(http_server, p); -#ifdef __cplusplus -} -#endif - -#endif /* _WEB_H_ */ - -/** @} */ -- cgit v1.2.3