From e8172f8399c203677ed6e15cbd96257e5ba70311 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Mon, 27 Jun 2016 13:43:39 +0200 Subject: [PATCH 01/23] Add platform files for Olimex STM32 E407 --- platform/olimex-stm32-e407/Kconfig | 8 ++ platform/olimex-stm32-e407/Make.defs | 40 ++++++ .../olimex-stm32-e407/stm32_cxxinitialize.c | 134 ++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 platform/olimex-stm32-e407/Kconfig create mode 100644 platform/olimex-stm32-e407/Make.defs create mode 100644 platform/olimex-stm32-e407/stm32_cxxinitialize.c diff --git a/platform/olimex-stm32-e407/Kconfig b/platform/olimex-stm32-e407/Kconfig new file mode 100644 index 000000000..7e553c543 --- /dev/null +++ b/platform/olimex-stm32-e407/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_OLIMEX_STM32E407 + +endif diff --git a/platform/olimex-stm32-e407/Make.defs b/platform/olimex-stm32-e407/Make.defs new file mode 100644 index 000000000..a4f408467 --- /dev/null +++ b/platform/olimex-stm32-e407/Make.defs @@ -0,0 +1,40 @@ +############################################################################ +# apps/platform/olimex-stm32-e407/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "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 +# COPYRIGHT OWNER OR CONTRIBUTORS 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. +# +############################################################################ + +# Add platform specific sources to ASRCS and CSRCS + +ifeq ($(CONFIG_HAVE_CXX),y) +CSRCS += stm32_cxxinitialize.c +endif diff --git a/platform/olimex-stm32-e407/stm32_cxxinitialize.c b/platform/olimex-stm32-e407/stm32_cxxinitialize.c new file mode 100644 index 000000000..e83449a05 --- /dev/null +++ b/platform/olimex-stm32-e407/stm32_cxxinitialize.c @@ -0,0 +1,134 @@ +/**************************************************************************** + * apps/platform/olimex-stm32-e407/src/stm32_cxxinitialize.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 + * COPYRIGHT OWNER OR CONTRIBUTORS 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Debug ********************************************************************/ +/* Non-standard debug that may be enabled just for testing the static + * constructors. + */ + +#ifdef CONFIG_DEBUG_CXX +# define cxxinfo _info +#else +# define cxxinfo(x...) +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ +/* This type defines one entry in initialization array */ + +typedef void (*initializer_t)(void); + +/**************************************************************************** + * External References + ****************************************************************************/ +/* _sinit and _einit are symbols exported by the linker script that mark the + * beginning and the end of the C++ initialization section. + */ + +extern initializer_t _sinit; +extern initializer_t _einit; + +/* _stext and _etext are symbols exported by the linker script that mark the + * beginning and the end of text. + */ + +extern uint32_t _stext; +extern uint32_t _etext; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_cxxinitialize + * + * Description: + * If C++ and C++ static constructors are supported, then this function + * must be provided by board-specific logic in order to perform + * initialization of the static C++ class instances. + * + * This function should then be called in the application-specific + * user_start logic in order to perform the C++ initialization. NOTE + * that no component of the core NuttX RTOS logic is involved; this + * function definition only provides the 'contract' between application + * specific C++ code and platform-specific toolchain support. + * + ****************************************************************************/ + +void up_cxxinitialize(void) +{ + initializer_t *initp; + + cxxinfo("_sinit: %p _einit: %p _stext: %p _etext: %p\n", + &_sinit, &_einit, &_stext, &_etext); + + /* Visit each entry in the initialization table */ + + for (initp = &_sinit; initp != &_einit; initp++) + { + initializer_t initializer = *initp; + cxxinfo("initp: %p initializer: %p\n", initp, initializer); + + /* Make sure that the address is non-NULL and lies in the text region + * defined by the linker script. Some toolchains may put NULL values + * or counts in the initialization table. + */ + + if ((void *)initializer > (void *)&_stext && + (void *)initializer < (void *)&_etext) + { + cxxinfo("Calling %p\n", initializer); + initializer(); + } + } +} + +#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */ From d93e8e5c173d1179a85b5d06abcedd1429b6d929 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Mon, 27 Jun 2016 18:39:55 +0200 Subject: [PATCH 02/23] Remove references to CONFIG_SYSLOG --- nshlib/nsh.h | 2 +- nshlib/nsh_command.c | 2 +- nshlib/nsh_fscmds.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nshlib/nsh.h b/nshlib/nsh.h index 48166ea58..9883c6ce4 100644 --- a/nshlib/nsh.h +++ b/nshlib/nsh.h @@ -1008,7 +1008,7 @@ int cmd_lsmod(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # ifndef CONFIG_NSH_DISABLE_LS int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# if defined(CONFIG_SYSLOG) && defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) +# if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index d8a26ab11..9de6b6600 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -177,7 +177,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SYSLOG) && \ +#if CONFIG_NFILE_DESCRIPTORS > 0 && \ defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) { "dmesg", cmd_dmesg, 1, 1, NULL }, #endif diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c index fe814bb19..6d8cb31f7 100644 --- a/nshlib/nsh_fscmds.c +++ b/nshlib/nsh_fscmds.c @@ -425,7 +425,7 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_dmesg ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SYSLOG) && \ +#if CONFIG_NFILE_DESCRIPTORS > 0 && \ defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { From 3dc17f54ffde87ddcd909be09b68f98b7c62e4eb Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Jun 2016 11:20:38 -0600 Subject: [PATCH 03/23] apps/system/hex2bin: Move the portable library portion of hex2bin to nuttx/libc/hex2bin where it can be shared with the OS internals. --- include/hex2bin.h | 272 ------------- system/hex2bin/Kconfig | 8 +- system/hex2bin/Makefile | 7 +- system/hex2bin/fhex2mem.c | 115 ------ system/hex2bin/hex2bin.c | 715 ---------------------------------- system/hex2bin/hex2bin_main.c | 4 +- system/hex2bin/hex2mem.c | 115 ------ system/hex2bin/hex2mem_main.c | 12 +- 8 files changed, 9 insertions(+), 1239 deletions(-) delete mode 100644 include/hex2bin.h delete mode 100644 system/hex2bin/fhex2mem.c delete mode 100644 system/hex2bin/hex2bin.c delete mode 100644 system/hex2bin/hex2mem.c diff --git a/include/hex2bin.h b/include/hex2bin.h deleted file mode 100644 index af7bce697..000000000 --- a/include/hex2bin.h +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** - * apps/include/hex2bin.h - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -#ifndef __APPS_INCLUDE_INIFILE_H -#define __APPS_INCLUDE_INIFILE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include - -#ifdef CONFIG_SYSTEM_HEX2BIN - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_SYSTEM_HEX2BIN_BASEADDR -# define CONFIG_SYSTEM_HEX2BIN_BASEADDR 0x00000000 -#endif - -#ifndef CONFIG_SYSTEM_HEX2BIN_ENDPADDR -# define CONFIG_SYSTEM_HEX2BIN_ENDPADDR 0x00000000 -#endif - -#ifndef CONFIG_SYSTEM_HEX2BIN_SWAP -# define CONFIG_SYSTEM_HEX2BIN_SWAP 0 -#endif - -/* Some environments may return CR as end-of-line, others LF, and others - * both. If not specified, the logic here assumes either (but not both) as - * the default. - */ - -#if defined(CONFIG_EOL_IS_CR) -# undef CONFIG_EOL_IS_LF -# undef CONFIG_EOL_IS_BOTH_CRLF -# undef CONFIG_EOL_IS_EITHER_CRLF -#elif defined(CONFIG_EOL_IS_LF) -# undef CONFIG_EOL_IS_CR -# undef CONFIG_EOL_IS_BOTH_CRLF -# undef CONFIG_EOL_IS_EITHER_CRLF -#elif defined(CONFIG_EOL_IS_BOTH_CRLF) -# undef CONFIG_EOL_IS_CR -# undef CONFIG_EOL_IS_LF -# undef CONFIG_EOL_IS_EITHER_CRLF -#elif defined(CONFIG_EOL_IS_EITHER_CRLF) -# undef CONFIG_EOL_IS_CR -# undef CONFIG_EOL_IS_LF -# undef CONFIG_EOL_IS_BOTH_CRLF -#else -# undef CONFIG_EOL_IS_CR -# undef CONFIG_EOL_IS_LF -# undef CONFIG_EOL_IS_BOTH_CRLF -# define CONFIG_EOL_IS_EITHER_CRLF 1 -#endif - -/* Debug from hex2bin code */ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_SYSTEM_HEX2BIN_DEBUG -# define hex2bin_debug(format, ...) fprintf(stderr, format, ##__VA_ARGS__) -# else -# define hex2bin_debug(x...) -# endif -#else -# ifdef CONFIG_SYSTEM_HEX2BIN_DEBUG -# define hex2bin_debug printf -# else -# define hex2bin_debug (void) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ -/* Intel HEX data steams are normally in big endian order. The following - * enumeration selects other ordering. - */ - -enum hex2bin_swap_e -{ - HEX2BIN_NOSWAP = 0, /* No swap, stream is in the correct byte order */ - HEX2BIN_SWAP16 = 1, /* Swap bytes in 16-bit values */ - HEX2BIN_SWAP32 = 2 /* Swap bytes in 32-bit values */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: hex2bin - * - * Description: - * Read the Intel HEX ASCII data provided on the serial IN stream and write - * the binary to the seek-able serial OUT stream. - * - * These streams may be files or, in another usage example, the IN stream - * could be a serial port and the OUT stream could be a memory stream. This - * would decode and write the serial input to memory. - * - * Input Parameters: - * instream - The incoming stream from which Intel HEX data will be - * received. - * outstream - The outgoing stream in which binary data will be written. - * baseaddr - The base address of the outgoing stream. Seeking in the - * output stream will be relative to this address. - * endpaddr - The end address (plus 1) of the outgoing stream. This - * value is used only for range checking. endpaddr must - * be larger than baseaddr. A zero value for endpaddr - * disables range checking. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -struct lib_instream_s; -struct lib_sostream_s; -int hex2bin(FAR struct lib_instream_s *instream, - FAR struct lib_sostream_s *outstream, uint32_t baseaddr, - uint32_t endpaddr, enum hex2bin_swap_e swap); - -/**************************************************************************** - * Name hex2mem - * - * Description: - * Read the Intel HEX ASCII data provided on the file descriptor 'fd' and - * write the binary to memory. - * - * If, for example, fd is zero (corresponding to stdin), then the HEX - * ASCII data would be taken from the console and written to memory. - * - * Input Parameters: - * fd - The file descriptor from which Intel HEX data will be - * received. - * baseaddr - The base address of the memory region stream. - * endpaddr - The end address (plus 1) of the memory region. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -int hex2mem(int fd, uint32_t baseaddr, uint32_t endpaddr, - enum hex2bin_swap_e swap); - -/**************************************************************************** - * Name fhex2mem - * - * Description: - * Read the Intel HEX ASCII data provided on the standard stream - * 'instream' and write the binary to memory. - * - * If, for example, instream is stdin, then the HEX ASCII data would be - * taken from the console and written to memory. - * - * Input Parameters: - * instream - The incoming standard stream from which Intel HEX data - * will be received. - * baseaddr - The base address of the memory region stream. - * endpaddr - The end address (plus 1) of the memory region. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -int fhex2mem(FAR FILE *instream, uint32_t baseaddr, uint32_t endpaddr, - enum hex2bin_swap_e swap); - -/**************************************************************************** - * Name: hex2bin_main - * - * Description: - * Main entry point when hex2bin is built as an NSH built-in task. - * - * Input Parameters: - * Standard task inputs - * - * Returned Value - * EXIT_SUCESS on success; EXIT_FAILURE on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SYSTEM_HEX2BIN_BUILTIN -int hex2bin_main(int argc, char **argv); -#endif /* CONFIG_SYSTEM_HEX2BIN_BUILTIN */ - -/**************************************************************************** - * Name: hex2mem_main - * - * Description: - * Main entry point when hex2mem is built as an NSH built-in task. - * - * Input Parameters: - * Standard task inputs - * - * Returned Value - * EXIT_SUCESS on success; EXIT_FAILURE on failure - * - ****************************************************************************/ - -#ifdef CONFIG_SYSTEM_HEX2MEM_BUILTIN -int hex2mem_main(int argc, char **argv); -#endif /* CONFIG_SYSTEM_HEX2MEM_BUILTIN */ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_SYSTEM_HEX2BIN */ -#endif /* __APPS_INCLUDE_INIFILE_H */ diff --git a/system/hex2bin/Kconfig b/system/hex2bin/Kconfig index 0401dd26c..be9663bda 100644 --- a/system/hex2bin/Kconfig +++ b/system/hex2bin/Kconfig @@ -6,6 +6,7 @@ menuconfig SYSTEM_HEX2BIN bool "Intel HEX to binary conversion" default n + select LIB_HEX2BIN ---help--- Enable support for a logic to convert Intel HEX format to binary. @@ -114,11 +115,4 @@ config SYSTEM_HEX2MEM_USAGE instructions. endif # SYSTEM_HEX2MEM_BUILTIN - -config SYSTEM_HEX2BIN_DEBUG - bool "Hex2bin detailed error output" - default n - ---help--- - Enable extended error output. - endif # SYSTEM_HEX2BIN diff --git a/system/hex2bin/Makefile b/system/hex2bin/Makefile index 390fa2c5b..4aea7d153 100644 --- a/system/hex2bin/Makefile +++ b/system/hex2bin/Makefile @@ -37,10 +37,10 @@ -include $(TOPDIR)/Make.defs include $(APPDIR)/Make.defs -# I2C tool +# Hex2bin utility ASRCS = -CSRCS = hex2bin.c hex2mem.c fhex2mem.c +CSRCS = ifeq ($(CONFIG_BUILD_KERNEL),y) @@ -66,9 +66,10 @@ HEX2MEM_MAINOBJ = $(HEX2MEM_MAINSRC:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) +MAINOBJ = $(HEX2BIN_MAINOBJ) $(HEX2MEM_MAINOBJ) ifneq ($(CONFIG_BUILD_KERNEL),y) - OBJS += $(HEX2BIN_MAINOBJ) $(HEX2MEM_MAINOBJ) + OBJS += $(MAINOBJ) endif ifeq ($(CONFIG_WINDOWS_NATIVE),y) diff --git a/system/hex2bin/fhex2mem.c b/system/hex2bin/fhex2mem.c deleted file mode 100644 index 061d63e97..000000000 --- a/system/hex2bin/fhex2mem.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * apps/system/fhex2mem.c - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include - -#ifdef CONFIG_SYSTEM_HEX2BIN - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name fhex2mem - * - * Description: - * Read the Intel HEX ASCII data provided on the standard stream - * 'instream' and write the binary to memory. - * - * If, for example, instream is stdin, then the HEX ASCII data would be - * taken from the console and written to memory. - * - * Input Parameters: - * instream - The incoming standard stream from which Intel HEX data - * will be received. - * baseaddr - The base address of the memory region stream. - * endpaddr - The end address (plus 1) of the memory region. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -int fhex2mem(FAR FILE *instream, uint32_t baseaddr, uint32_t endpaddr, - enum hex2bin_swap_e swap) -{ - struct lib_stdinstream_s stdinstream; - struct lib_memsostream_s memoutstream; - - /* Check memory addresses */ - - DEBUGASSERT(instream && endpaddr > baseaddr); - - /* Wrap the file descriptor as raw stream; wrap the memory as a memory - * stream. - */ - - lib_stdinstream(&stdinstream, instream); - lib_memsostream(&memoutstream, (FAR char *)baseaddr, - (int)(endpaddr - baseaddr)); - - /* And do the deed */ - - return hex2bin(&stdinstream.public, &memoutstream.public, - (uint32_t)baseaddr, (uint32_t)endpaddr, - (enum hex2bin_swap_e)swap); -} - -#endif /* CONFIG_SYSTEM_HEX2BIN */ diff --git a/system/hex2bin/hex2bin.c b/system/hex2bin/hex2bin.c deleted file mode 100644 index 5bbe89d5f..000000000 --- a/system/hex2bin/hex2bin.c +++ /dev/null @@ -1,715 +0,0 @@ -/**************************************************************************** - * apps/system/hex2bin.c - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * References: - * - http://en.wikipedia.org/wiki/Intel_HEX - * - Hexadecimal Object File Format Specification, Revision A January 6, - * 1988, Intel - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_SYSTEM_HEX2BIN - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* ASCII record sizes */ - -#define BYTECOUNT_ASCSIZE 2 -#define ADDRESS_ASCSIZE 4 -#define RECTYPE_ASCSIZE 2 - -#define BYTECOUNT_LINENDX (0) -#define ADDRESS_LINENDX (BYTECOUNT_LINENDX + BYTECOUNT_ASCSIZE) -#define RECTYPE_LINENDX (ADDRESS_LINENDX + ADDRESS_ASCSIZE) -#define DATA_LINENDX (RECTYPE_LINENDX + RECTYPE_ASCSIZE) -#define HEADER_ASCSIZE DATA_LINENDX - -#define CHECKSUM_ASCSIZE 2 -#define TRAILER_SIZE (CHECKSUM_ASCSIZE) - -#define MAXDATA_BINSIZE 255 -#define RECORD_ASCSIZE(n) (HEADER_ASCSIZE + TRAILER_SIZE + 2*(n)) -#define MAXRECORD_ASCSIZE RECORD_ASCSIZE(MAXDATA_BINSIZE) -#define MINRECORD_ASCSIZE RECORD_ASCSIZE(0) -#define LINE_ALLOC MAXRECORD_ASCSIZE - -/* Binary record sizes */ - -#define BYTECOUNT_BINSIZE 1 -#define ADDRESS_BINSIZE 2 -#define RECTYPE_BINSIZE 1 - -#define BYTECOUNT_BINNDX (0) -#define ADDRESS_BINNDX (BYTECOUNT_BINNDX + BYTECOUNT_BINSIZE) -#define RECTYPE_BINNDX (ADDRESS_BINNDX + ADDRESS_BINSIZE) -#define DATA_BINNDX (RECTYPE_BINNDX + RECTYPE_BINSIZE) -#define HEADER_BINSIZE DATA_BINNDX - -#define CHECKSUM_BINSIZE 1 -#define TRAILER_BINSIZE CHECKSUM_BINSIZE - -#define RECORD_BINSIZE(n) (HEADER_BINSIZE + TRAILER_BINSIZE + (n)) -#define MAXRECORD_BINSIZE RECORD_BINSIZE(MAXDATA_BINSIZE) -#define MINRECORD_BKINSIZE RECORD_BINSIZE(0) -#define BIN_ALLOC MAXRECORD_BINSIZE - -/* Record start code */ - -#define RECORD_STARTCODE ':' - -/* Record Types */ - -#define RECORD_DATA 0 /* Data */ -#define RECORD_EOF 1 /* End of file */ -#define RECORD_EXT_SEGADDR 2 /* Extended segment address record */ -#define RECORD_START_SEGADDR 3 /* Start segment address record */ -#define RECORD_EXT_LINADDR 4 /* Extended linear address record */ -#define RECORD_START_LINADDR 5 /* Start linear address record */ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nibble2bin - ****************************************************************************/ - -static int nibble2bin(uint8_t ascii) -{ - if (ascii >= '0' && ascii <= '9') - { - return (ascii - 0x30); - } - else if (ascii >= 'a' && ascii <= 'f') - { - return (ascii - 'a' + 10); - } - else if (ascii >= 'A' && ascii <= 'F') - { - return (ascii - 'A' + 10); - } - - return -EINVAL; -} - -/**************************************************************************** - * Name: byte2bin - ****************************************************************************/ - -static int byte2bin(FAR const uint8_t *ascii) -{ - int nibble; - int byte; - - /* Get the MS nibble (big endian order) */ - - nibble = nibble2bin(*ascii++); - if (nibble < 0) - { - return nibble; - } - - byte = (nibble << 4); - - /* Get the MS nibble */ - - nibble = nibble2bin(*ascii); - if (nibble < 0) - { - return nibble; - } - - byte |= nibble; - return byte; -} - -/**************************************************************************** - * Name: word2bin - ****************************************************************************/ - -#if 0 /* Not used */ -static int word2bin(FAR const char *ascii) -{ - int byte; - int word; - - /* Get the MS byte (big endian order) */ - - byte = word2bin(ascii); - if (byte < 0) - { - return byte; - } - - word = (byte << 8); - - /* Get the MS byte */ - - byte = word2bin(ascii + 2); - if (byte < 0) - { - return byte; - } - - word |= byte; - return word; -} -#endif - -/**************************************************************************** - * Name: data2bin - ****************************************************************************/ - -int data2bin(FAR uint8_t* dest, FAR const uint8_t *src, int nsrcbytes) -{ - int byte; - - /* An even number of source bytes is expected */ - - if ((nsrcbytes & 1) != 0) - { - return -EINVAL; - } - - /* Convert src bytes in groups of 2, writing one byte to the output on each - * pass through the loop. */ - - while (nsrcbytes > 0) - { - /* Get the MS nibble (big endian order) */ - - byte = byte2bin(src); - if (byte < 0) - { - return byte; - } - - src += 2; - - /* And write the byte to the destination */ - - *dest++ = byte; - nsrcbytes -= 2; - } - - return OK; -} - -/**************************************************************************** - * Name: readstream - ****************************************************************************/ - -static int readstream(FAR struct lib_instream_s *instream, - FAR uint8_t *line, unsigned int lineno) -{ - int nbytes = 0; - int ch; - - /* Skip until the beginning of line start code is encountered */ - - ch = instream->get(instream); - while (ch != RECORD_STARTCODE && ch != EOF) - { - ch = instream->get(instream); - } - - /* Skip over the startcode */ - - if (ch != EOF) - { - ch = instream->get(instream); - } - - /* Then read, verify, and buffer until the end of line is encountered */ - - while (ch != EOF && nbytes < (MAXRECORD_ASCSIZE-1)) - { -#if defined(CONFIG_EOL_IS_LF) - if (ch == '\n') - { - *line = '\0'; - return nbytes; - } - -#elif defined(CONFIG_EOL_IS_BOTH_CRLF) - if (ch == '\r') - { - continue; - } - else if (ch == '\n') - { - *line = '\0'; - return nbytes; - } -#elif defined(CONFIG_EOL_IS_CR) - if (ch == '\r') - { - *line = '\0'; - return nbytes; - } -#elif defined(CONFIG_EOL_IS_EITHER_CRLF) - if (ch == '\n' || ch == '\r') - { - *line = '\0'; - return nbytes; - } -#endif - /* Only hex data goes into the line buffer */ - - else if (isxdigit(ch)) - { - *line++ = ch; - nbytes++; - } - else if (!isspace(ch)) /* Not expected */ - { - hex2bin_debug("Line %u ERROR: Unexpected character %c[%02x] in stream\n", - lineno, isprint(ch) ? ch : '.', ch); - break; - } - - /* Read the next character from the input stream */ - - ch = instream->get(instream); - } - - /* Some error occurred: Unexpected EOF, line too long, or bad character in - * stream - */ - - hex2bin_debug("Line %u ERROR: Failed to read line. %d characters read\n", - lineno, nbytes); - return EOF; -} - -/**************************************************************************** - * Name: hex2bin_swap16 and hex2bin_swap32 - ****************************************************************************/ - -static inline void hex2bin_swap16(FAR uint8_t *data, int bytecount) -{ - for (; bytecount > 0; bytecount -= 2) - { - uint8_t b0 = data[0]; - uint8_t b1 = data[1]; - - *data++ = b1; - *data++ = b0; - } -} - -static inline void hex2bin_swap32(FAR uint8_t *data, int bytecount) -{ - for (; bytecount > 0; bytecount -= 4) - { - uint8_t b0 = data[0]; - uint8_t b1 = data[1]; - uint8_t b2 = data[2]; - uint8_t b3 = data[3]; - - *data++ = b3; - *data++ = b2; - *data++ = b1; - *data++ = b0; - } -} - -/**************************************************************************** - * Name: writedata - ****************************************************************************/ - -static inline void writedata(FAR struct lib_sostream_s *outstream, - FAR uint8_t *data, int bytecount) -{ - for (; bytecount > 0; bytecount--) - { - outstream->put(outstream, *data++); - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: hex2bin - * - * Description: - * Read the Intel HEX ASCII data provided on the serial IN stream and write - * the binary to the seek-able serial OUT stream. - * - * These streams may be files or, in another usage example, the IN stream - * could be a serial port and the OUT stream could be a memory stream. This - * would decode and write the serial input to memory. - * - * Input Parameters: - * instream - The incoming stream from which Intel HEX data will be - * received. - * outstream - The outgoing stream in which binary data will be written. - * baseaddr - The base address of the outgoing stream. Seeking in the - * output stream will be relative to this address. - * endpaddr - The end address (plus 1) of the outgoing stream. This - * value is used only for range checking. endpaddr must - * be larger than baseaddr. A zero value for endpaddr - * disables range checking. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -int hex2bin(FAR struct lib_instream_s *instream, - FAR struct lib_sostream_s *outstream, uint32_t baseaddr, - uint32_t endpaddr, enum hex2bin_swap_e swap) -{ - FAR uint8_t *alloc; - FAR uint8_t *line; - FAR uint8_t *bin; - int nbytes; - int bytecount; - uint32_t address; - uint32_t endaddr; - uint32_t expected; - uint16_t extension; - uint16_t address16; - uint8_t checksum; - unsigned int lineno; - int i; - int ret = OK; - - /* Allocate buffer memory */ - - alloc = (FAR uint8_t *)malloc(LINE_ALLOC + BIN_ALLOC); - if (alloc == NULL) - { - hex2bin_debug("ERROR: Failed to allocate memory\n"); - return -ENOMEM; - } - - line = alloc; - bin = &alloc[LINE_ALLOC]; - - extension = 0; - expected = 0; - lineno = 0; - - while ((nbytes = readstream(instream, line, lineno)) != EOF) - { - /* Increment the line number */ - - lineno++; - - /* Did we read enough data to do anything? */ - - if (nbytes < MINRECORD_ASCSIZE) - { - hex2bin_debug("Line %u ERROR: Record too short: %d\n", - lineno, nbytes); - goto errout_with_einval; - } - - /* We should always read an even number of bytes */ - - if ((nbytes & 1) != 0) - { - hex2bin_debug("Line %u ERROR: Record length is odd: %d\n", - lineno, nbytes); - goto errout_with_einval; - } - - /* Get the data byte count */ - - bytecount = byte2bin(&line[BYTECOUNT_LINENDX]); - if (bytecount < 0) - { - hex2bin_debug("Line %u ERROR: Failed to read bytecount: %d\n", - lineno, bytecount); - ret = bytecount; - goto errout_with_buffers; - } - - /* Verify that the bytecount matches the length of the record */ - - if (RECORD_ASCSIZE(bytecount) != nbytes) - { - hex2bin_debug("Line %u ERROR: Expected %d bytes, read %d\n", - lineno, RECORD_ASCSIZE(bytecount), nbytes); - goto errout_with_einval; - } - - /* Convert the entire line to binary. We need to do this for - * checksum calculation which includes the entire line (minus - * the start code and the checksum at the end of the line itself) - */ - - ret = data2bin(bin, line, nbytes); - if (ret < 0) - { - hex2bin_debug("Line %u ERROR: Failed to convert line to binary: %d\n", - lineno, ret); - goto errout_with_buffers; - } - - /* Calculate and verify the checksum over all of the data */ - - nbytes >>= 1; /* Number of bytes in bin[] */ - checksum = 0; - - for (i = 0; i < nbytes; i++) - { - checksum += bin[i]; - } - - if (checksum != 0) - { - hex2bin_debug("Line %u ERROR: Bad checksum %02x\n", - lineno, checksum); - goto errout_with_einval; - } - - /* Get the 16-bit (unextended) address from the record */ - - address16 = (uint16_t)bin[ADDRESS_BINNDX] << 8 | - (uint16_t)bin[ADDRESS_BINNDX+1]; - - /* Handle the record by its record type */ - - switch (bin[RECTYPE_BINNDX]) - { - case RECORD_DATA: /* Data */ - { - /* Swap data in place in the binary buffer as required */ - - switch (swap) - { - case HEX2BIN_NOSWAP: /* No swap, stream is the correct byte order */ - break; - - case HEX2BIN_SWAP16: /* Swap bytes in 16-bit values */ - { - if ((bytecount & 1) != 0) - { - hex2bin_debug("Line %d ERROR: Byte count %d is not a multiple of 2\n", - lineno, bytecount); - goto errout_with_einval; - } - - /* Do the byte swap */ - - hex2bin_swap16(&bin[DATA_BINNDX], bytecount); - } - break; - - case HEX2BIN_SWAP32: /* Swap bytes in 32-bit values */ - { - if ((bytecount & 3) != 0) - { - hex2bin_debug("Line %d ERROR: Byte count %d is not a multiple of 4\n", - lineno, bytecount); - goto errout_with_einval; - } - - /* Do the byte swap */ - - hex2bin_swap32(&bin[DATA_BINNDX], bytecount); - } - break; - - default: - { - hex2bin_debug("ERROR: Invalid swap argument: %d\n", swap); - goto errout_with_einval; - } - } - - /* Get and verify the full 32-bit address */ - - address = ((uint32_t)extension << 16) | (uint32_t)address16; - endaddr = address + bytecount; - - if (address < baseaddr || (endpaddr != 0 && endaddr >= endpaddr)) - { - hex2bin_debug("Line %d ERROR: Extended address %08lx is out of range\n", - lineno, (unsigned long)address); - goto errout_with_einval; - } - - /* Seek to the correct position in the OUT stream if we have - * made an unexpected jump in the data address. - */ - - if (address != expected) - { - off_t pos = outstream->seek(outstream, address - baseaddr, SEEK_SET); - if (pos == (off_t)-1) - { - hex2bin_debug("Line %u ERROR: Seek to address %08lu failed\n", - lineno, (unsigned long)address); - ret = -ESPIPE; - goto errout_with_buffers; - } - } - - /* Transfer data to the OUT stream */ - - writedata(outstream, &bin[DATA_BINNDX], bytecount); - - /* This is the next data address that we expect to see */ - - expected = address + bytecount; - } - break; - - case RECORD_EOF: /* End of file */ - /* End Of File record. Must occur exactly once per file in the - * last line of the file. The byte count is 00 and the data field - * is empty. Usually the address field is also 0000. - */ - - if (bytecount == 0) - { - ret = OK; - goto exit_with_buffers; - } - - hex2bin_debug("Line %u ERROR: Nonzero bytecount %d in EOF\n", - lineno, bytecount); - goto errout_with_einval; - - case RECORD_EXT_SEGADDR: /* Extended segment address record */ - /* The address specified by the data field is multiplied by 16 - * (shifted 4 bits left) and added to the subsequent data record - * addresses. This allows addressing of up to a megabyte of - * address space. The address field of this record has to be - * 0000, the byte count is 02 (the segment is 16-bit). The - * least significant hex digit of the segment address is always - * 0. - */ - - if (bytecount != 2 || address16 != 0 || bin[DATA_BINNDX+1] != 0) - { - hex2bin_debug("Line %u ERROR: Invalid segment address\n", - lineno); - hex2bin_debug(" bytecount=%d address=%04x segment=%02x%02x\n", - bytecount, address16, bin[DATA_BINNDX], - bin[DATA_BINNDX+1]); - goto errout_with_einval; - } - - extension = (uint16_t)bin[DATA_BINNDX]; - break; - - case RECORD_START_SEGADDR: /* Start segment address record */ - /* For 80x86 processors, it specifies the initial content of - * the CS:IP registers. The address field is 0000, the byte - * count is 04, the first two bytes are the CS value, the - * latter two are the IP value. - */ - - break; - - case RECORD_EXT_LINADDR: /* Extended linear address record */ - /* The address field is 0000, the byte count is 02. The two - * data bytes (two hex digit pairs in big endian order) - * represent the upper 16 bits of the 32 bit address for - * all subsequent 00 type records until the next 04 type - * record comes. If there is not a 04 type record, the - * upper 16 bits default to 0000. To get the absolute - * address for subsequent 00 type records, the address - * specified by the data field of the most recent 04 record - * is added to the 00 record addresses. - */ - - if (bytecount != 2 || address16 != 0) - { - hex2bin_debug("Line %u ERROR: Invalid linear address\n", - lineno); - hex2bin_debug(" bytecount=%d address=%04x\n", - bytecount, address16); - goto errout_with_einval; - } - - extension = (uint16_t)bin[DATA_BINNDX] << 8 | - (uint16_t)bin[DATA_BINNDX+1]; - break; - - case RECORD_START_LINADDR: /* Start linear address record */ - /* The address field is 0000, the byte count is 04. The 4 - * data bytes represent the 32-bit value loaded into the EIP - * register of the 80386 and higher CPU. - */ - - break; - - default: - break; - } - } - - hex2bin_debug("ERROR: No EOF record found\n"); - -errout_with_einval: - ret = -EINVAL; - -errout_with_buffers: -exit_with_buffers: - free(alloc); - return ret; -} - -#endif /* CONFIG_SYSTEM_HEX2BIN */ diff --git a/system/hex2bin/hex2bin_main.c b/system/hex2bin/hex2bin_main.c index 762491e27..e6ff8194a 100644 --- a/system/hex2bin/hex2bin_main.c +++ b/system/hex2bin/hex2bin_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/system/hex2bin_main.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,9 +43,9 @@ #include #include #include +#include #include -#include #ifdef CONFIG_SYSTEM_HEX2BIN_BUILTIN diff --git a/system/hex2bin/hex2mem.c b/system/hex2bin/hex2mem.c deleted file mode 100644 index 723bea6b0..000000000 --- a/system/hex2bin/hex2mem.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * apps/system/hex2mem.c - * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include - -#ifdef CONFIG_SYSTEM_HEX2BIN - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name hex2mem - * - * Description: - * Read the Intel HEX ASCII data provided on the file descriptor 'fd' and - * write the binary to memory. - * - * If, for example, fd is zero (stdin), then the HEX ASCII data would be - * taken from the console and written to memory. - * - * Input Parameters: - * fd - The file descriptor from which Intel HEX data will be - * received. - * baseaddr - The base address of the memory region stream. - * endpaddr - The end address (plus 1) of the memory region. - * swap - Controls byte ordering. See enum hex2bin_swap_e for - * description of the values. - * - * Returned Value - * Zero (OK) is returned on success; a negated errno value is returned on - * failure. - * - ****************************************************************************/ - -int hex2mem(int fd, uint32_t baseaddr, uint32_t endpaddr, - enum hex2bin_swap_e swap) -{ - struct lib_rawinstream_s rawinstream; - struct lib_memsostream_s memoutstream; - - /* Check memory addresses */ - - DEBUGASSERT(fd >= 0 && endpaddr > baseaddr); - - /* Wrap the file descriptor as raw stream; wrap the memory as a memory - * stream. - */ - - lib_rawinstream(&rawinstream, fd); - lib_memsostream(&memoutstream, (FAR char *)baseaddr, - (int)(endpaddr - baseaddr)); - - /* And do the deed */ - - return hex2bin(&rawinstream.public, &memoutstream.public, - (uint32_t)baseaddr, (uint32_t)endpaddr, - (enum hex2bin_swap_e)swap); -} - -#endif /* CONFIG_SYSTEM_HEX2BIN */ diff --git a/system/hex2bin/hex2mem_main.c b/system/hex2bin/hex2mem_main.c index 8f82f273b..70b589674 100644 --- a/system/hex2bin/hex2mem_main.c +++ b/system/hex2bin/hex2mem_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/system/hex2mem_main.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,20 +43,12 @@ #include #include #include +#include #include -#include #ifdef CONFIG_SYSTEM_HEX2MEM_BUILTIN -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ From 0559581b9143103ec07ed0fe097cea73d31ae746 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Jun 2016 11:36:34 -0600 Subject: [PATCH 04/23] Trivial changes after review of PR --- nshlib/nsh_command.c | 4 ++-- nshlib/nsh_fscmds.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 9de6b6600..ad90b6b78 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -177,8 +177,8 @@ static const struct cmdmap_s g_cmdmap[] = #endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) +#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \ + !defined(CONFIG_NSH_DISABLE_DMESG) { "dmesg", cmd_dmesg, 1, 1, NULL }, #endif diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c index 6d8cb31f7..826f8b161 100644 --- a/nshlib/nsh_fscmds.c +++ b/nshlib/nsh_fscmds.c @@ -425,8 +425,8 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_dmesg ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) +#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \ + !defined(CONFIG_NSH_DISABLE_DMESG) int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { return nsh_catfile(vtbl, argv[0], CONFIG_SYSLOG_DEVPATH); From ac24acf69ef248e25a9379ed74aef7559f659640 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 27 Jun 2016 12:58:07 -0600 Subject: [PATCH 05/23] Update ChangeLog --- ChangeLog.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 81a5843aa..544f92e1b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1655,3 +1655,9 @@ (2016-06-24). * apps/nshlib/Kconfig: Move NSH stuff out of nuttx/configs/Kconfig to here. Why was it in the NuttX tree in the first place? (2016-06-24). + * apps/nshlib/Kconfig: Move some NSH settings out of nuttx/configs/Kconfig + to here. Why was it in the NuttX tree (2016-06-24). + * apps/platform/olimex-stm32-e407: Add platform files for Olimex STM32 + E407. From Mateusz Szafoni (2016-06-27). + * apps/system/hex2bin: Move the portable library portion of hex2bin to + nuttx/libc/hex2bin where it can be shared with the OS internals (2016-06-27). From 65e050dbfbce7e0cfa607168bd502275565f6c83 Mon Sep 17 00:00:00 2001 From: Frank Benkert Date: Thu, 30 Jun 2016 07:28:42 -0600 Subject: [PATCH 06/23] NSH: PS-Command: print out the stack usage if stack coloration is enabled. --- nshlib/nsh_proccmds.c | 101 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 7a1122a83..11330e0ef 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -130,12 +130,17 @@ static const char g_scheduler[] = "Scheduler:"; static const char g_sigmask[] = "SigMask:"; #endif +#ifdef CONFIG_STACK_COLORATION +static const char g_stacksize[] = "StackSize:"; +static const char g_stackused[] = "StackUsed:"; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ /**************************************************************************** - * Name: ps_callback + * Name: nsh_parse_statusline ****************************************************************************/ #ifndef CONFIG_NSH_DISABLE_PS @@ -261,9 +266,14 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR char *nextline; int ret; int i; +#ifdef CONFIG_STACK_COLORATION + int stack_size; + int stack_used; + float stack_filled; +#endif - /* Task/thread entries in the /proc directory will all be (1) directories with - * (2) all numeric names. + /* Task/thread entries in the /proc directory will all be (1) directories + * with (2) all numeric names. */ if (!DIRENT_ISDIRECTORY(entryp->d_type)) @@ -377,6 +387,85 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%-8s ", status.td_sigmask); #endif +#ifdef CONFIG_STACK_COLORATION + /* Get the StackSize and StackUsed */ + + stack_size = 0; + stack_used = 0; + filepath = NULL; + + ret = asprintf(&filepath, "%s/%s/stack", dirpath, entryp->d_name); + if (ret < 0 || filepath == NULL) + { + nsh_output(vtbl, g_fmtcmdfailed, "ps", "asprintf", NSH_ERRNO); + vtbl->iobuffer[0] = '\0'; + } + else + { + ret = nsh_readfile(vtbl, "ps", filepath, vtbl->iobuffer, IOBUFFERSIZE); + free(filepath); + + if (ret >= 0) + { + nextline = vtbl->iobuffer; + do + { + /* Find the beginning of the next line and NUL-terminate the + * current line. + */ + + line = nextline; + for (nextline++; + *nextline != '\n' && *nextline != '\0'; + nextline++); + + if (*nextline == '\n') + { + *nextline++ = '\0'; + } + else + { + nextline = NULL; + } + + /* Parse the current line + * + * Format: + * + * 111111111122222222223 + * 123456789012345678901234567890 + * StackBase: xxxxxxxxxx + * StackSize: xxxx + * StackUsed: xxxx + */ + + if (strncmp(line, g_stacksize, strlen(g_stacksize)) == 0) + { + stack_size = atoi(&line[12]); + } + else if (strncmp(line, g_stackused, strlen(g_stackused)) == 0) + { + stack_used = atoi(&line[12]); + } + } + while (nextline != NULL); + } + } + + nsh_output(vtbl, "%6.6d ", stack_size); + nsh_output(vtbl, "%6.6d ", stack_used); + + stack_filled = 0.0; + if (stack_size && stack_used) + { + stack_filled = (100.0 / stack_size * stack_used); + } + + /* Additionally print a "!" if the stack is filled more than 80% */ + + nsh_output(vtbl, "%5.1f%%%s ", stack_filled, (stack_filled >= 80 ? "!" : " ")); +#endif + #ifdef NSH_HAVE_CPULOAD /* Get the CPU load */ @@ -478,6 +567,11 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif +#ifdef CONFIG_STACK_COLORATION + nsh_output(vtbl, "%6s ", "STACK"); + nsh_output(vtbl, "%6s ", "USED"); + nsh_output(vtbl, "%7s ", "FILLED"); +#endif #ifdef NSH_HAVE_CPULOAD nsh_output(vtbl, "%6s ", "CPU"); #endif @@ -603,6 +697,7 @@ int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) nsh_output(vtbl, g_fmtarginvalid, argv[0]); return ERROR; } + usleep(usecs); return OK; } From ebd1cc18b2a8288dbb25dfabbed641fb1d39c78a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 30 Jun 2016 07:34:39 -0600 Subject: [PATCH 07/23] Update ChangeLog --- ChangeLog.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 544f92e1b..18b16e55a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1660,4 +1660,7 @@ * apps/platform/olimex-stm32-e407: Add platform files for Olimex STM32 E407. From Mateusz Szafoni (2016-06-27). * apps/system/hex2bin: Move the portable library portion of hex2bin to - nuttx/libc/hex2bin where it can be shared with the OS internals (2016-06-27). + nuttx/libc/hex2bin where it can be shared with the OS internals + (2016-06-27). + * apps/nshlib: 'ps' command now prints out the stack usage if stack + coloration is enabled. From Frank Benkert (2016-06-30). From c7c50395190ce5cf3ca938d880191018c6e77ed0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 30 Jun 2016 11:29:13 -0600 Subject: [PATCH 08/23] add apps/interpreters/pcode/.gitignore --- interpreters/pcode/.gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 interpreters/pcode/.gitignore diff --git a/interpreters/pcode/.gitignore b/interpreters/pcode/.gitignore new file mode 100644 index 000000000..5922d5d8b --- /dev/null +++ b/interpreters/pcode/.gitignore @@ -0,0 +1,6 @@ +/Makefile +/include +/insn +/libpas +/libpoff + From 8a03660c726211e31aa843181604428ec69ac212 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 30 Jun 2016 13:13:05 -0600 Subject: [PATCH 09/23] Remove apps/system/usbmonitor. It has been moved to nuttx/drivers/usbmonitor. --- include/usbmonitor.h | 96 ------------ nshlib/Kconfig | 2 +- system/usbmonitor/.gitignore | 11 -- system/usbmonitor/Kconfig | 70 --------- system/usbmonitor/Make.defs | 40 ----- system/usbmonitor/Makefile | 121 --------------- system/usbmonitor/usbmonitor.c | 265 --------------------------------- 7 files changed, 1 insertion(+), 604 deletions(-) delete mode 100644 include/usbmonitor.h delete mode 100644 system/usbmonitor/.gitignore delete mode 100644 system/usbmonitor/Kconfig delete mode 100644 system/usbmonitor/Make.defs delete mode 100644 system/usbmonitor/Makefile delete mode 100644 system/usbmonitor/usbmonitor.c diff --git a/include/usbmonitor.h b/include/usbmonitor.h deleted file mode 100644 index 909b630e9..000000000 --- a/include/usbmonitor.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** - * apps/include/usbmonitor.h - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -#ifndef __APPS_INCLUDE_USBMONITOR_H -#define __APPS_INCLUDE_USBMONITOR_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifdef CONFIG_SYSTEM_USBMONITOR - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: usbmon_start and usbmon_stop - * - * Start and top the USB monitor daemon. These are normally controlled - * from the USB command line, but the ability to control these - * programmatically is also helpful (for example, so that the daemon is - * running before NSH starts). - * - * Input Parameters: - * Standard task parameters. These can be called or spawned. Since the - * return almost immediately, it is fine to just call the functions. The - * parameters are not used so you can pass 0 and NULL, respectivley; this - * is done this way so that these functions can be NSH builtin - * applications. - * - * Returned values: - * Standard task return values (zero meaning success). - * - ****************************************************************************/ - -int usbmonitor_start(int argc, char **argv); -int usbmonitor_stop(int argc, char **argv); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_SYSTEM_USBMONITOR */ -#endif /* __APPS_INCLUDE_USBMONITOR_H */ diff --git a/nshlib/Kconfig b/nshlib/Kconfig index 9443feae0..d6c014a2f 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -920,7 +920,7 @@ config NSH_USBDEV_TRACE data will go to the SYSLOG device. If not enabled, the USB trace support can be provided by external - logic such as apps/system/usbmonitor. + logic such as nuttx/drivers/usbmonitor. if NSH_USBDEV_TRACE diff --git a/system/usbmonitor/.gitignore b/system/usbmonitor/.gitignore deleted file mode 100644 index 83bd7b811..000000000 --- a/system/usbmonitor/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/Make.dep -/.depend -/.built -/*.asm -/*.rel -/*.lst -/*.sym -/*.adb -/*.lib -/*.src -/*.obj diff --git a/system/usbmonitor/Kconfig b/system/usbmonitor/Kconfig deleted file mode 100644 index c91c302e3..000000000 --- a/system/usbmonitor/Kconfig +++ /dev/null @@ -1,70 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -menuconfig SYSTEM_USBMONITOR - bool "USB Monitor" - default n - depends on (USBDEV && USBDEV_TRACE) || (USBHOST && USBHOST_TRACE) - ---help--- - If USB device tracing (USBDEV_TRACE) AND/OR USB host tracing - (USBHOST_TRACE) are enabled then this option will select the USB - monitor. The USB monitor is a daemon that will periodically collect - the buffered USB trace data and dump it to the SYSLOG device. - -if SYSTEM_USBMONITOR - -config SYSTEM_USBMONITOR_STACKSIZE - int "USB Monitor daemon stack size" - default 2048 - ---help--- - The stack size to use the the USB monitor daemon. Default: 2048 - -config SYSTEM_USBMONITOR_PRIORITY - int "USB Monitor daemon priority" - default 50 - ---help--- - The priority to use the the USB monitor daemon. Default: 50 - -config SYSTEM_USBMONITOR_INTERVAL - int "USB Monitor dump frequency" - default 2 - ---help--- - The rate in seconds that the USB monitor will wait before dumping - the next set of buffered USB trace data. Default: 2 seconds. - -if USBDEV && USBDEV_TRACE -config SYSTEM_USBMONITOR_TRACEINIT - bool "Show USB device initialization events" - default n - ---help--- - Show initialization events - -config SYSTEM_USBMONITOR_TRACECLASS - bool "Show USB device class driver events" - default n - ---help--- - Show class driver events - -config SYSTEM_USBMONITOR_TRACETRANSFERS - bool "Show USB device data transfer events" - default n - ---help--- - Show data transfer events - -config SYSTEM_USBMONITOR_TRACECONTROLLER - bool "Show USB device controller events" - default n - ---help--- - Show controller events - -config SYSTEM_USBMONITOR_TRACEINTERRUPTS - bool "Show USB device interrupt-related events" - default n - ---help--- - Show interrupt-related events - -endif -endif - diff --git a/system/usbmonitor/Make.defs b/system/usbmonitor/Make.defs deleted file mode 100644 index fe2eecd6b..000000000 --- a/system/usbmonitor/Make.defs +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# apps/system/usbmonitor/Make.defs -# Adds selected applications to apps/ build -# -# Copyright (C) 2016 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "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 -# COPYRIGHT OWNER OR CONTRIBUTORS 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. -# -############################################################################ - -ifeq ($(CONFIG_SYSTEM_USBMONITOR),y) -CONFIGURED_APPS += system/usbmonitor -endif - diff --git a/system/usbmonitor/Makefile b/system/usbmonitor/Makefile deleted file mode 100644 index 9bb0c8534..000000000 --- a/system/usbmonitor/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -############################################################################ -# apps/system/usbmonitor/Makefile -# -# Copyright (C) 2013 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "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 -# COPYRIGHT OWNER OR CONTRIBUTORS 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -ifeq ($(WINTOOL),y) -INCDIROPT = -w -endif - -# USB Monitor Application - -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 768 - -ASRCS = -CSRCS = usbmonitor.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: context depend clean distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built - -install: - -# Register application - -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat: $(DEPCONFIG) Makefile - $(call REGISTER,"usbmon_start",$(PRIORITY),$(STACKSIZE),usbmonitor_start) - -$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat: $(DEPCONFIG) Makefile - $(call REGISTER,"usbmon_stop",$(PRIORITY),$(STACKSIZE),usbmonitor_stop) - -context: $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat -else -context: -endif - -# Create dependencies - -.depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep -.PHONY: preconfig -preconfig: diff --git a/system/usbmonitor/usbmonitor.c b/system/usbmonitor/usbmonitor.c deleted file mode 100644 index fa61c221f..000000000 --- a/system/usbmonitor/usbmonitor.c +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** - * apps/system/usbmonitor/usbmonitor.c - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_SYSTEM_USBMONITOR - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define USBMON_PREFIX "USB Monitor: " - -/* Configuration ************************************************************/ - -#ifndef CONFIG_SYSTEM_USBMONITOR_STACKSIZE -# define CONFIG_SYSTEM_USBMONITOR_STACKSIZE 2048 -#endif - -#ifndef CONFIG_SYSTEM_USBMONITOR_PRIORITY -# define CONFIG_SYSTEM_USBMONITOR_PRIORITY 50 -#endif - -#ifndef CONFIG_SYSTEM_USBMONITOR_INTERVAL -# define CONFIG_SYSTEM_USBMONITOR_INTERVAL 2 -#endif - -/* USB device trace selection */ - -#ifdef CONFIG_USBDEV_TRACE -# ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINIT -# define TRACE_INIT_BITS (TRACE_INIT_BIT) -# else -# define TRACE_INIT_BITS (0) -# endif - -# define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) - -# ifdef CONFIG_SYSTEM_USBMONITOR_TRACECLASS -# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|\ - TRACE_CLASSSTATE_BIT) -# else -# define TRACE_CLASS_BITS (0) -# endif - -# ifdef CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS -# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|\ - TRACE_READ_BIT|TRACE_WRITE_BIT|\ - TRACE_COMPLETE_BIT) -# else -# define TRACE_TRANSFER_BITS (0) -# endif - -# ifdef CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER -# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) -# else -# define TRACE_CONTROLLER_BITS (0) -# endif - -# ifdef CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS -# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|\ - TRACE_INTEXIT_BIT) -# else -# define TRACE_INTERRUPT_BITS (0) -# endif - -# define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|\ - TRACE_CLASS_BITS|TRACE_TRANSFER_BITS|\ - TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct usbmon_state_s -{ - volatile bool started; - volatile bool stop; - pid_t pid; -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct usbmon_state_s g_usbmonitor; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int usbtrace_syslog(FAR const char *fmt, ...) -{ - va_list ap; - int ret; - - /* Let vsyslog do the real work */ - - va_start(ap, fmt); - ret = vsyslog(LOG_INFO, fmt, ap); - va_end(ap); - return ret; -} - -static int usbmonitor_tracecallback(struct usbtrace_s *trace, void *arg) -{ - usbtrace_trprintf(usbtrace_syslog, trace->event, trace->value); - return 0; -} -#endif - -static int usbmonitor_daemon(int argc, char **argv) -{ - syslog(LOG_INFO, USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid); - - /* Loop until we detect that there is a request to stop. */ - - while (!g_usbmonitor.stop) - { - sleep(CONFIG_SYSTEM_USBMONITOR_INTERVAL); -#ifdef CONFIG_USBDEV_TRACE - (void)usbtrace_enumerate(usbmonitor_tracecallback, NULL); -#endif -#ifdef CONFIG_USBHOST_TRACE - (void)usbhost_trdump(); -#endif - } - - /* Stopped */ - - g_usbmonitor.stop = false; - g_usbmonitor.started = false; - syslog(LOG_INFO, USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid); - - return 0; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int usbmonitor_start(int argc, char **argv) -{ - /* Has the monitor already started? */ - - sched_lock(); - if (!g_usbmonitor.started) - { - int ret; - - /* No.. start it now */ - -#ifdef CONFIG_USBDEV_TRACE - /* First, initialize any USB tracing options that were requested */ - - usbtrace_enable(TRACE_BITSET); -#endif - - /* Then start the USB monitoring daemon */ - - g_usbmonitor.started = true; - g_usbmonitor.stop = false; - - ret = task_create("USB Monitor", CONFIG_SYSTEM_USBMONITOR_PRIORITY, - CONFIG_SYSTEM_USBMONITOR_STACKSIZE, - (main_t)usbmonitor_daemon, (FAR char * const *)NULL); - if (ret < 0) - { - int errcode = errno; - syslog(LOG_INFO, USBMON_PREFIX - "ERROR: Failed to start the USB monitor: %d\n", - errcode); - } - else - { - g_usbmonitor.pid = ret; - syslog(LOG_INFO, USBMON_PREFIX "Started: %d\n", - g_usbmonitor.pid); - } - - sched_unlock(); - return 0; - } - - sched_unlock(); - syslog(LOG_INFO, USBMON_PREFIX "%s: %d\n", - g_usbmonitor.stop ? "Stopping" : "Running", g_usbmonitor.pid); - return 0; -} - -int usbmonitor_stop(int argc, char **argv) -{ - /* Has the monitor already started? */ - - if (g_usbmonitor.started) - { - /* Stop the USB monitor. The next time the monitor wakes up, - * it will see the the stop indication and will exist. - */ - - syslog(LOG_INFO, USBMON_PREFIX "Stopping: %d\n", g_usbmonitor.pid); - g_usbmonitor.stop = true; - -#ifdef CONFIG_USBDEV_TRACE - /* We may as well disable tracing since there is no listener */ - - usbtrace_enable(0); -#endif - } - - syslog(LOG_INFO, USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid); - return 0; -} - -#endif /* CONFIG_SYSTEM_USBMONITOR */ From 7304927448473c5735f6c0929d8bba77550801a3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 30 Jun 2016 15:47:41 -0600 Subject: [PATCH 10/23] Move the TZ/Olson zoneinfo data set from apps/system/zoneinfo to libc/zoneinfo --- include/zoneinfo.h | 83 ----------------- system/zoneinfo/.gitignore | 17 ---- system/zoneinfo/Kconfig | 22 ----- system/zoneinfo/Make.defs | 40 --------- system/zoneinfo/Makefile | 175 ------------------------------------ system/zoneinfo/README.txt | 180 ------------------------------------- system/zoneinfo/tzromfs.c | 51 ----------- 7 files changed, 568 deletions(-) delete mode 100644 include/zoneinfo.h delete mode 100644 system/zoneinfo/.gitignore delete mode 100644 system/zoneinfo/Kconfig delete mode 100644 system/zoneinfo/Make.defs delete mode 100755 system/zoneinfo/Makefile delete mode 100644 system/zoneinfo/README.txt delete mode 100644 system/zoneinfo/tzromfs.c diff --git a/include/zoneinfo.h b/include/zoneinfo.h deleted file mode 100644 index db271ce7f..000000000 --- a/include/zoneinfo.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * apps/include/zoneinfo.h - * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -#ifndef __APPS_INCLUDE_ZONEINFO_H -#define __APPS_INCLUDE_ZONEINFO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#ifdef CONFIG_SYSTEM_ZONEINFO_ROMFS - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/* If the TZ database is built as a ROMFS file system, then these variables - * provide (1) the address of the array in FLASH/ROM that contains the - * ROMFS file system image, and (2) the size of the ROMFS file system image - * in bytes. This is sufficient information to permit external logic to - * mount the ROMF file system. - */ - -EXTERN unsigned char romfs_zoneinfo_img[]; -EXTERN unsigned int romfs_zoneinfo_img_len; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_SYSTEM_ZONEINFO_ROMFS */ -#endif /* __APPS_INCLUDE_ZONEINFO_H */ diff --git a/system/zoneinfo/.gitignore b/system/zoneinfo/.gitignore deleted file mode 100644 index cf64977cb..000000000 --- a/system/zoneinfo/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/Make.dep -/.depend -/.built -/.tzbuilt -/.tzunpack -/tzbin -/tzcode -/tz*-latest.tar.gz -/romfs_zoneinfo.* -/*.asm -/*.rel -/*.lst -/*.sym -/*.adb -/*.lib -/*.src -/*.obj diff --git a/system/zoneinfo/Kconfig b/system/zoneinfo/Kconfig deleted file mode 100644 index 9724f5469..000000000 --- a/system/zoneinfo/Kconfig +++ /dev/null @@ -1,22 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -config SYSTEM_ZONEINFO - bool "TZ database" - default n - depends on LIBC_LOCALTIME - ---help--- - Build the TZ/Olson database. - -if SYSTEM_ZONEINFO - -config SYSTEM_ZONEINFO_ROMFS - bool "Build ROMFS filesystem" - default n - depends on FS_ROMFS - ---help--- - Build a mountable ROMFS filesystem containing the TZ database - -endif # SYSTEM_ZONEINFO diff --git a/system/zoneinfo/Make.defs b/system/zoneinfo/Make.defs deleted file mode 100644 index a3732808a..000000000 --- a/system/zoneinfo/Make.defs +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# apps/system/zoneinfo/Make.defs -# Adds selected applications to apps/ build -# -# Copyright (C) 2016 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "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 -# COPYRIGHT OWNER OR CONTRIBUTORS 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. -# -############################################################################ - -ifeq ($(CONFIG_SYSTEM_ZONEINFO),y) -CONFIGURED_APPS += system/zoneinfo -endif - diff --git a/system/zoneinfo/Makefile b/system/zoneinfo/Makefile deleted file mode 100755 index ae8b5c05e..000000000 --- a/system/zoneinfo/Makefile +++ /dev/null @@ -1,175 +0,0 @@ -############################################################################ -# apps/system/zoneinfo/Makefile -# -# Copyright (C) 2015, Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "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 -# COPYRIGHT OWNER OR CONTRIBUTORS 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -ifeq ($(WINTOOL),y) -INCDIROPT = -w -endif - -# Zoneinfo database - -ASRCS = -CSRCS = - -ifeq ($(CONFIG_SYSTEM_ZONEINFO_ROMFS),y) -CSRCS += tzromfs.c -endif - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ZONEINFO_PATH = $(APPDIR)/system/zoneinfo -TZBIN_PATH = $(ZONEINFO_PATH)/tzbin -TZCODE_PATH = $(ZONEINFO_PATH)/tzcode - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: romfs register context depend clean distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: .tzbuilt romfs $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - $(Q) touch .built - -# ROMFS file system containing the TZ database - -ifeq ($(CONFIG_SYSTEM_ZONEINFO_ROMFS),y) - -checkgenromfs: - @genromfs -h 1>/dev/null 2>&1 || { \ - echo "Host executable genromfs not available in PATH"; \ - echo "You may need to download in from http://romfs.sourceforge.net/"; \ - exit 1; \ - } - -romfs_zoneinfo.img : checkgenromfs .tzbuilt - @genromfs -f $@ -d $(TZBIN_PATH)/etc/zoneinfo -V "TZDatbase" || { echo "genromfs failed" ; exit 1 ; } - -romfs_zoneinfo.h : romfs_zoneinfo.img - @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } - -romfs: romfs_zoneinfo.h - -else - -romfs: - -endif # CONFIG_SYSTEM_ZONEINFO_ROMFS - -# Build TZ database - -tzcode: - mkdir tzcode - -tzbin: - mkdir tzbin - -tzcode-latest.tar.gz: - $(Q) wget --retr-symlinks ftp://ftp.iana.org/tz/tzcode-latest.tar.gz - -tzdata-latest.tar.gz: - $(Q) wget --retr-symlinks ftp://ftp.iana.org/tz/tzdata-latest.tar.gz - -.tzunpack: tzcode tzcode-latest.tar.gz tzdata-latest.tar.gz - $(Q) tar zx -C tzcode -f tzcode-latest.tar.gz - $(Q) tar zx -C tzcode -f tzdata-latest.tar.gz - $(Q) touch .tzunpack - -.tzbuilt: tzcode tzbin .tzunpack - $(Q) $(MAKE) -C tzcode TOPDIR=$(TZBIN_PATH) install - $(Q) touch .tzbuilt - -# Create initial context - -context: .tzbuilt romfs - -# Install application - -install: - -# Create dependencies - -.depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - $(Q) touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, .tzunpack) - $(call DELFILE, .tzbuilt) - $(call DELFILE, romfs_zoneinfo.img) - $(call DELFILE, romfs_zoneinfo.h) - $(call DELFILE, tzdata-latest.tar.gz) - $(call DELFILE, tzcode-latest.tar.gz) - $(call DELDIR, tzbin) - $(call DELDIR, tzcode) - --include Make.dep -.PHONY:preconfig -preconfig: - diff --git a/system/zoneinfo/README.txt b/system/zoneinfo/README.txt deleted file mode 100644 index 9c3aab611..000000000 --- a/system/zoneinfo/README.txt +++ /dev/null @@ -1,180 +0,0 @@ -apps/system/zoninfo/README.txt -Author: Gregory Nutt - -Directory Contents -================== - -This directory contains logic to create a version of the TZ/Olson database. -This database is required if localtime() support is selected via -CONFIG_LIBC_LOCALTIME. This logic in this directory does the following: - - - It downloads the current TZ database from the IANA website - - It downloads the current timezone tools from the same location - - It builds the tools and constructs the binary TZ database - - It will then, optionally, build a ROMFS filesystem image containing - the data base. - -Creating and Mounting a ROMFS TZ Database -========================================= - -The ROMFS filesystem image can that be mounted during the boot-up sequence -so that it is available for the localtime() logic. There are two steps to -doing this: - - - First, a ROM disk device must be created. This is done by calling - the function romdisk_register() as described in - nuttx/include/nuttx/fs/ramdisk.h. This is an OS level operation - and must be done in the board-level logic before your application - starts. - - romdisk_register() will create a block driver at /dev/ramN where N - is the device minor number that was provided to romdisk_regsiter. - - - The second step is to mount the file system. This step can be - performed either in your board configuration logic or by your - application using the mount() interface described in - nuttx/include/sys/mount.h. - - These steps, however, must be done very early in initialization, - before there is any need for time-related services. - -Both of these steps are shown together in the following code sample at the -end of this README file. - -Example Configuration -===================== - -I have tested this using the sim/nsh configuration. Here are the -modifications to the configuration that I used for testing: - - CONFIG_BOARD_INITIALIZE=y - - CONFIG_LIBC_LOCALTIME=y - CONFIG_LIBC_TZDIR="/share/zoneinfo" - CONFIG_LIBC_TZ_MAX_TIMES=370 - CONFIG_LIBC_TZ_MAX_TYPES=20 - - CONFIG_SYSTEM_ZONEINFO=y - CONFIG_SYSTEM_ZONEINFO_ROMFS=y - -NOTE: The full TZ database is quite large. To create a reasonable sized -ROMFS image, I had to trim some of the files like this: - - cd nuttx - cd tools - ./configure.sh sim/nsh - cd .. - make menuconfig - -Select the above localtime() and apps/system/zoneinfo configuration settings. -Then: - - make context - cd ../apps/system/zoneinfo/tzbin/etc/zoneinfo - -Remove as many timezone files as you can. Do not remove the GMT, localtime, -or posixrules files. Those might be needed in any event. Then you can -force rebuilding of the ROMFS filesystem be removing some files: - - cd ../../.. - rm romfs_zoneinfo.* - rm *.o - cd ../../nuttx - make - -If you have problems building the simulator on your platform, check out -nuttx/configs/sim/README.txt. You might find some help there. - -Here is a sample run. I have not seen any errors in single stepping through -the logic but neither am I certain that everything is working properly: - - NuttShell (NSH) - nsh> date - Jul 01 00:00:02 2008 - nsh> set TZ US/Mountain - nsh> date -s "Apr 11 11:53:00 2015" - nsh> date - Apr 11 17:53:00 2015 - -NOTE: Because of daylight savings time, US/Mountain is GMT-6 on Apr 11. The -above suggests that perhaps the NSH data command may be setting local time, -but printing GMT time? - -Sample Code to Mount the ROMFS Filesystem -========================================= - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include -#include - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifndef CONFIG_LIBC_TZDIR -# errror CONFIG_LIBC_TZDIR is not defined -#endif - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# error "Mountpoint support is disabled" -#endif - -#if CONFIG_NFILE_DESCRIPTORS < 4 -# error "Not enough file descriptors" -#endif - -#ifndef CONFIG_FS_ROMFS -# error "ROMFS support not enabled" -#endif - -#define SECTORSIZE 64 -#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int mount_zoneinfo(int minor) -{ - char devname[32]; - int ret; - - /* Create a RAM disk for the test */ - - ret = romdisk_register(minor, romfs_zoneinfo_img, - NSECTORS(romfs_zoneinfo_img_len), SECTORSIZE); - if (ret < 0) - { - printf("ERROR: Failed to create RAM disk\n"); - return ret; - } - - /* Use the minor number to create a name for the ROM disk block device */ - - snprintf(devname, 32, "/dev/ram%d", minor); - - /* Mount the ROMFS file system */ - - printf("Mounting ROMFS filesystem at target=%s with source=%s\n", - CONFIG_LIBC_TZDIR, devname); - - ret = mount(devname, CONFIG_LIBC_TZDIR, "romfs", MS_RDONLY, NULL); - if (ret < 0) - { - printf("ERROR: Mount failed: %d\n", errno); - return ret; - } - - printf("TZ database mounted at %s\n", CONFIG_LIBC_TZDIR); - return OK; -} diff --git a/system/zoneinfo/tzromfs.c b/system/zoneinfo/tzromfs.c deleted file mode 100644 index 8cf382db9..000000000 --- a/system/zoneinfo/tzromfs.c +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** - * apps/system/zoneinfo/tzromfs.c - * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#include "romfs_zoneinfo.h" From 4343a6ef8bc073952251cb859f41d89e13eb816b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 06:36:07 -0600 Subject: [PATCH 11/23] Move apps/include/ftpc.h to apps/include/netutils/ftpc.h --- examples/ftpc/ftpc.h | 2 +- examples/ftpc/ftpc_cmds.c | 2 +- examples/ftpc/ftpc_main.c | 2 +- include/{ => netutils}/ftpc.h | 8 ++++---- netutils/ftpc/ftpc_cdup.c | 2 +- netutils/ftpc/ftpc_chdir.c | 2 +- netutils/ftpc/ftpc_chmod.c | 2 +- netutils/ftpc/ftpc_connect.c | 2 +- netutils/ftpc/ftpc_disconnect.c | 2 +- netutils/ftpc/ftpc_filesize.c | 2 +- netutils/ftpc/ftpc_filetime.c | 2 +- netutils/ftpc/ftpc_getfile.c | 2 +- netutils/ftpc/ftpc_help.c | 2 +- netutils/ftpc/ftpc_idle.c | 2 +- netutils/ftpc/ftpc_internal.h | 2 +- netutils/ftpc/ftpc_listdir.c | 2 +- netutils/ftpc/ftpc_login.c | 2 +- netutils/ftpc/ftpc_mkdir.c | 2 +- netutils/ftpc/ftpc_noop.c | 2 +- netutils/ftpc/ftpc_putfile.c | 2 +- netutils/ftpc/ftpc_quit.c | 2 +- netutils/ftpc/ftpc_rename.c | 2 +- netutils/ftpc/ftpc_response.c | 2 +- netutils/ftpc/ftpc_rmdir.c | 2 +- netutils/ftpc/ftpc_rpwd.c | 2 +- netutils/ftpc/ftpc_transfer.c | 2 +- netutils/ftpc/ftpc_unlink.c | 2 +- 27 files changed, 30 insertions(+), 30 deletions(-) rename include/{ => netutils}/ftpc.h (97%) diff --git a/examples/ftpc/ftpc.h b/examples/ftpc/ftpc.h index e4f729b08..0ebb4dd53 100644 --- a/examples/ftpc/ftpc.h +++ b/examples/ftpc/ftpc.h @@ -49,7 +49,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/examples/ftpc/ftpc_cmds.c b/examples/ftpc/ftpc_cmds.c index 1a51867d3..ae24757bf 100644 --- a/examples/ftpc/ftpc_cmds.c +++ b/examples/ftpc/ftpc_cmds.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include "ftpc.h" diff --git a/examples/ftpc/ftpc_main.c b/examples/ftpc/ftpc_main.c index aab37944e..915087d0e 100644 --- a/examples/ftpc/ftpc_main.c +++ b/examples/ftpc/ftpc_main.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include diff --git a/include/ftpc.h b/include/netutils/ftpc.h similarity index 97% rename from include/ftpc.h rename to include/netutils/ftpc.h index 5319145eb..759857820 100644 --- a/include/ftpc.h +++ b/include/netutils/ftpc.h @@ -1,7 +1,7 @@ /**************************************************************************** * apps/include/ftpc.h * - * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_FTPC_H -#define __APPS_INCLUDE_FTPC_H +#ifndef __APPS_INCLUDE_NETUTILS_FTPC_H +#define __APPS_INCLUDE_NETUTILS_FTPC_H /**************************************************************************** * Included Files @@ -223,4 +223,4 @@ FAR char *ftpc_response(SESSION handle); } #endif -#endif /* __APPS_INCLUDE_FTPC_H */ +#endif /* __APPS_INCLUDE_NETUTILS_FTPC_H */ diff --git a/netutils/ftpc/ftpc_cdup.c b/netutils/ftpc/ftpc_cdup.c index 47e9620d9..8856ee455 100644 --- a/netutils/ftpc/ftpc_cdup.c +++ b/netutils/ftpc/ftpc_cdup.c @@ -39,7 +39,7 @@ #include "ftpc_config.h" -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_chdir.c b/netutils/ftpc/ftpc_chdir.c index 1b95ddad4..83f0a1818 100644 --- a/netutils/ftpc/ftpc_chdir.c +++ b/netutils/ftpc/ftpc_chdir.c @@ -39,7 +39,7 @@ #include "ftpc_config.h" -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_chmod.c b/netutils/ftpc/ftpc_chmod.c index b3e651fc0..9f9625d53 100644 --- a/netutils/ftpc/ftpc_chmod.c +++ b/netutils/ftpc/ftpc_chmod.c @@ -40,7 +40,7 @@ #include "ftpc_config.h" #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_connect.c b/netutils/ftpc/ftpc_connect.c index 96f920503..fd19d93d5 100644 --- a/netutils/ftpc/ftpc_connect.c +++ b/netutils/ftpc/ftpc_connect.c @@ -47,7 +47,7 @@ #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_disconnect.c b/netutils/ftpc/ftpc_disconnect.c index ce345a890..6129716b6 100644 --- a/netutils/ftpc/ftpc_disconnect.c +++ b/netutils/ftpc/ftpc_disconnect.c @@ -41,7 +41,7 @@ #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_filesize.c b/netutils/ftpc/ftpc_filesize.c index 69578d66c..1cb856c1a 100644 --- a/netutils/ftpc/ftpc_filesize.c +++ b/netutils/ftpc/ftpc_filesize.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_filetime.c b/netutils/ftpc/ftpc_filetime.c index 14ce81a61..011ccd2cb 100644 --- a/netutils/ftpc/ftpc_filetime.c +++ b/netutils/ftpc/ftpc_filetime.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_getfile.c b/netutils/ftpc/ftpc_getfile.c index 138a8b1e5..c9eaed6f2 100644 --- a/netutils/ftpc/ftpc_getfile.c +++ b/netutils/ftpc/ftpc_getfile.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_help.c b/netutils/ftpc/ftpc_help.c index 4c630b441..5faa751d1 100644 --- a/netutils/ftpc/ftpc_help.c +++ b/netutils/ftpc/ftpc_help.c @@ -39,7 +39,7 @@ #include "ftpc_config.h" -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_idle.c b/netutils/ftpc/ftpc_idle.c index 900357853..01bc904af 100644 --- a/netutils/ftpc/ftpc_idle.c +++ b/netutils/ftpc/ftpc_idle.c @@ -40,7 +40,7 @@ #include "ftpc_config.h" #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_internal.h b/netutils/ftpc/ftpc_internal.h index a79b981ab..1f15c64ff 100644 --- a/netutils/ftpc/ftpc_internal.h +++ b/netutils/ftpc/ftpc_internal.h @@ -54,7 +54,7 @@ #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/netutils/ftpc/ftpc_listdir.c b/netutils/ftpc/ftpc_listdir.c index d330dbabb..ad004ddaf 100644 --- a/netutils/ftpc/ftpc_listdir.c +++ b/netutils/ftpc/ftpc_listdir.c @@ -47,7 +47,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_login.c b/netutils/ftpc/ftpc_login.c index 5e6e6c6ed..83e9e565c 100644 --- a/netutils/ftpc/ftpc_login.c +++ b/netutils/ftpc/ftpc_login.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_mkdir.c b/netutils/ftpc/ftpc_mkdir.c index 32c782396..fa2d3bbbd 100644 --- a/netutils/ftpc/ftpc_mkdir.c +++ b/netutils/ftpc/ftpc_mkdir.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_noop.c b/netutils/ftpc/ftpc_noop.c index 5682400dc..6058022f8 100644 --- a/netutils/ftpc/ftpc_noop.c +++ b/netutils/ftpc/ftpc_noop.c @@ -39,7 +39,7 @@ #include "ftpc_config.h" -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_putfile.c b/netutils/ftpc/ftpc_putfile.c index 2a29a75b8..81aa9f528 100644 --- a/netutils/ftpc/ftpc_putfile.c +++ b/netutils/ftpc/ftpc_putfile.c @@ -47,7 +47,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_quit.c b/netutils/ftpc/ftpc_quit.c index 7a4c2533d..985d82934 100644 --- a/netutils/ftpc/ftpc_quit.c +++ b/netutils/ftpc/ftpc_quit.c @@ -40,7 +40,7 @@ #include "ftpc_config.h" #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_rename.c b/netutils/ftpc/ftpc_rename.c index 34c067a62..b4d3fbfd6 100644 --- a/netutils/ftpc/ftpc_rename.c +++ b/netutils/ftpc/ftpc_rename.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_response.c b/netutils/ftpc/ftpc_response.c index b2dcb9ae1..209688af9 100644 --- a/netutils/ftpc/ftpc_response.c +++ b/netutils/ftpc/ftpc_response.c @@ -40,7 +40,7 @@ #include "ftpc_config.h" #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_rmdir.c b/netutils/ftpc/ftpc_rmdir.c index b83946878..d332d2108 100644 --- a/netutils/ftpc/ftpc_rmdir.c +++ b/netutils/ftpc/ftpc_rmdir.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_rpwd.c b/netutils/ftpc/ftpc_rpwd.c index 62c5ed3eb..d62e4ff03 100644 --- a/netutils/ftpc/ftpc_rpwd.c +++ b/netutils/ftpc/ftpc_rpwd.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_transfer.c b/netutils/ftpc/ftpc_transfer.c index bbacc198e..f0e31bcc3 100644 --- a/netutils/ftpc/ftpc_transfer.c +++ b/netutils/ftpc/ftpc_transfer.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include "ftpc_internal.h" diff --git a/netutils/ftpc/ftpc_unlink.c b/netutils/ftpc/ftpc_unlink.c index 17401c280..e0cca450f 100644 --- a/netutils/ftpc/ftpc_unlink.c +++ b/netutils/ftpc/ftpc_unlink.c @@ -39,7 +39,7 @@ #include "ftpc_config.h" -#include +#include #include "ftpc_internal.h" From cd741c82cf409b99b5986d6f8f748cd3706c6820 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 06:48:22 -0600 Subject: [PATCH 12/23] apps/include: Move all header files associated with modules in apps/system to apps/include/system --- examples/ftpc/ftpc_main.c | 2 +- examples/nrf24l01_term/nrf24l01_term.c | 2 +- examples/usbterm/usbterm_main.c | 2 +- include/netutils/ftpc.h | 2 +- include/{ => system}/cle.h | 10 +++++----- include/{ => system}/nxplayer.h | 8 ++++---- include/{ => system}/prun.h | 10 +++++----- include/{ => system}/readline.h | 10 +++++----- include/{ => system}/symtab.h | 10 +++++----- include/{ => system}/zmodem.h | 10 +++++----- nshlib/nsh_command.c | 2 +- nshlib/nsh_init.c | 2 +- nshlib/nsh_login.c | 4 ++-- nshlib/nsh_session.c | 4 ++-- nshlib/nsh_stdlogin.c | 4 ++-- nshlib/nsh_stdsession.c | 4 ++-- system/cle/cle.c | 2 +- system/cu/cu_main.c | 2 +- system/nxplayer/nxplayer.c | 2 +- system/nxplayer/nxplayer_main.c | 4 ++-- system/prun/Kconfig | 2 +- system/prun/pexec_main.c | 2 +- system/prun/prun.c | 2 +- system/readline/readline.c | 2 +- system/readline/readline_common.c | 2 +- system/readline/std_readline.c | 2 +- system/sudoku/sudoku.c | 2 +- system/symtab/README.txt | 2 +- system/symtab/symtab.c | 2 +- system/zmodem/rz_main.c | 2 +- system/zmodem/sz_main.c | 2 +- system/zmodem/zm.h | 2 +- system/zmodem/zm_receive.c | 2 +- system/zmodem/zm_send.c | 2 +- 34 files changed, 62 insertions(+), 62 deletions(-) rename include/{ => system}/cle.h (93%) rename include/{ => system}/nxplayer.h (99%) rename include/{ => system}/prun.h (94%) rename include/{ => system}/readline.h (97%) rename include/{ => system}/symtab.h (94%) rename include/{ => system}/zmodem.h (98%) diff --git a/examples/ftpc/ftpc_main.c b/examples/ftpc/ftpc_main.c index 915087d0e..489af9206 100644 --- a/examples/ftpc/ftpc_main.c +++ b/examples/ftpc/ftpc_main.c @@ -46,7 +46,7 @@ #include #include -#include +#include #include "ftpc.h" diff --git a/examples/nrf24l01_term/nrf24l01_term.c b/examples/nrf24l01_term/nrf24l01_term.c index cae95ed0b..78972bb8a 100644 --- a/examples/nrf24l01_term/nrf24l01_term.c +++ b/examples/nrf24l01_term/nrf24l01_term.c @@ -57,7 +57,7 @@ #include -#include +#include #ifdef CONFIG_DISABLE_POLL # error The poll interface is required for the nRF24L01 terminal example. You must disable config option DISABLE_POLL. diff --git a/examples/usbterm/usbterm_main.c b/examples/usbterm/usbterm_main.c index 12a3dcee6..9d40045b8 100644 --- a/examples/usbterm/usbterm_main.c +++ b/examples/usbterm/usbterm_main.c @@ -51,7 +51,7 @@ #include #include -#include +#include #include #include diff --git a/include/netutils/ftpc.h b/include/netutils/ftpc.h index 759857820..1f8836ca4 100644 --- a/include/netutils/ftpc.h +++ b/include/netutils/ftpc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/include/ftpc.h + * apps/include/system/ftpc.h * * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/include/cle.h b/include/system/cle.h similarity index 93% rename from include/cle.h rename to include/system/cle.h index 4218b29e6..82ec1c6e2 100644 --- a/include/cle.h +++ b/include/system/cle.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/cle.h + * apps/include/system/cle.h * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_CLE_H -#define __APPS_INCLUDE_CLE_H +#ifndef __APPS_INCLUDE_SYSTEM_CLE_H +#define __APPS_INCLUDE_SYSTEM_CLE_H /**************************************************************************** * Included Files @@ -84,4 +84,4 @@ int cle(FAR char *line, uint16_t linelen, FILE *instream, FILE *outstream); #endif #endif /* CONFIG_SYSTEM_CLE */ -#endif /* __APPS_INCLUDE_CLE_H */ +#endif /* __APPS_INCLUDE_SYSTEM_CLE_H */ diff --git a/include/nxplayer.h b/include/system/nxplayer.h similarity index 99% rename from include/nxplayer.h rename to include/system/nxplayer.h index 4487cfab5..e77cb16fb 100644 --- a/include/nxplayer.h +++ b/include/system/nxplayer.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/nxplayer/nxplayer.h + * apps/include/system/nxplayer.h * * Copyright (C) 2013 Ken Pettit. All rights reserved. * Author: Ken Pettit @@ -37,8 +37,8 @@ * ****************************************************************************/ -#ifndef __APPS_SYSTEM_NXPLAYER_NXPLAYER_H -#define __APPS_SYSTEM_NXPLAYER_NXPLAYER_H 1 +#ifndef __APPS_INCLUDE_SYSTEM_NXPLAYER_H +#define __APPS_INCLUDE_SYSTEM_NXPLAYER_H 1 /**************************************************************************** * Included Files @@ -474,4 +474,4 @@ int nxplayer_systemreset(FAR struct nxplayer_s *pPlayer); } #endif -#endif /* __APPS_SYSTEM_NXPLAYER_NXPLAYER_H */ +#endif /* __APPS_INCLUDE_SYSTEM_NXPLAYER_H */ diff --git a/include/prun.h b/include/system/prun.h similarity index 94% rename from include/prun.h rename to include/system/prun.h index 1f12028b2..9c83de6ba 100644 --- a/include/prun.h +++ b/include/system/prun.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/prun.h + * apps/include/system/prun.h * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_PRUN_H -#define __APPS_INCLUDE_PRUN_H +#ifndef __APPS_INCLUDE_SYSTEM_PRUN_H +#define __APPS_INCLUDE_SYSTEM_PRUN_H /**************************************************************************** * Included Files @@ -89,4 +89,4 @@ int prun(FAR char *exepath, size_t varsize, size_t strsize); } #endif -#endif /* __APPS_INCLUDE_PRUN_H */ +#endif /* __APPS_INCLUDE_SYSTEM_PRUN_H */ diff --git a/include/readline.h b/include/system/readline.h similarity index 97% rename from include/readline.h rename to include/system/readline.h index 5993c3be8..8020cf2c9 100644 --- a/include/readline.h +++ b/include/system/readline.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/readline.h + * apps/include/system/readline.h * - * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_READLINE_H -#define __APPS_INCLUDE_READLINE_H +#ifndef __APPS_INCLUDE_SYSTEM_READLINE_H +#define __APPS_INCLUDE_SYSTEM_READLINE_H /**************************************************************************** * Included Files @@ -228,4 +228,4 @@ ssize_t std_readline(FAR char *buf, int buflen); #endif #endif /* CONFIG_SYSTEM_READLINE */ -#endif /* __APPS_INCLUDE_READLINE_H */ +#endif /* __APPS_INCLUDE_SYSTEM_READLINE_H */ diff --git a/include/symtab.h b/include/system/symtab.h similarity index 94% rename from include/symtab.h rename to include/system/symtab.h index c1d59c51d..a1cb8b2dc 100644 --- a/include/symtab.h +++ b/include/system/symtab.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/symtab.h + * apps/include/system/symtab.h * - * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_SYMTAB_H -#define __APPS_INCLUDE_SYMTAB_H +#ifndef __APPS_INCLUDE_SYSTEM_SYMTAB_H +#define __APPS_INCLUDE_SYSTEM_SYMTAB_H /**************************************************************************** * Included Files @@ -98,5 +98,5 @@ void symtab_initialize(void); } #endif -#endif /* __APPS_INCLUDE_SYMTAB_H */ +#endif /* __APPS_INCLUDE_SYSTEM_SYMTAB_H */ diff --git a/include/zmodem.h b/include/system/zmodem.h similarity index 98% rename from include/zmodem.h rename to include/system/zmodem.h index 98eedcb2a..9987495d2 100644 --- a/include/zmodem.h +++ b/include/system/zmodem.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/zmodem.h + * apps/include/system/zmodem.h * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -37,8 +37,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_ZMODEM_H -#define __APPS_INCLUDE_ZMODEM_H +#ifndef __APPS_INCLUDE_SYSTEM_ZMODEM_H +#define __APPS_INCLUDE_SYSTEM_ZMODEM_H /**************************************************************************** * Included Files @@ -345,4 +345,4 @@ int zms_release(ZMSHANDLE handle); } #endif -#endif /* __APPS_INCLUDE_ZMODEM_H */ +#endif /* __APPS_INCLUDE_SYSTEM_ZMODEM_H */ diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index ad90b6b78..11c177ca4 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -46,7 +46,7 @@ #endif #if defined(CONFIG_SYSTEM_READLINE) && defined(CONFIG_READLINE_HAVE_EXTMATCH) -# include +# include #endif #include "nsh.h" diff --git a/nshlib/nsh_init.c b/nshlib/nsh_init.c index 24f3fce07..6c475f61c 100644 --- a/nshlib/nsh_init.c +++ b/nshlib/nsh_init.c @@ -41,7 +41,7 @@ #include -#include +#include #include #include "nsh.h" diff --git a/nshlib/nsh_login.c b/nshlib/nsh_login.c index 675f7a5f5..f814f210e 100644 --- a/nshlib/nsh_login.c +++ b/nshlib/nsh_login.c @@ -45,9 +45,9 @@ #include #ifdef CONFIG_NSH_CLE -# include +# include #else -# include +# include #endif #include "nsh.h" diff --git a/nshlib/nsh_session.c b/nshlib/nsh_session.c index 8c017d527..1632cac08 100644 --- a/nshlib/nsh_session.c +++ b/nshlib/nsh_session.c @@ -43,9 +43,9 @@ #include #ifdef CONFIG_NSH_CLE -# include +# include #else -# include +# include #endif #include "nsh.h" diff --git a/nshlib/nsh_stdlogin.c b/nshlib/nsh_stdlogin.c index 099994531..de0be90a6 100644 --- a/nshlib/nsh_stdlogin.c +++ b/nshlib/nsh_stdlogin.c @@ -45,9 +45,9 @@ #include #ifdef CONFIG_NSH_CLE -# include +# include #else -# include +# include #endif #include "nsh.h" diff --git a/nshlib/nsh_stdsession.c b/nshlib/nsh_stdsession.c index ebf76a687..23846b60e 100644 --- a/nshlib/nsh_stdsession.c +++ b/nshlib/nsh_stdsession.c @@ -43,9 +43,9 @@ #include #ifdef CONFIG_NSH_CLE -# include +# include #else -# include +# include #endif #include "nsh.h" diff --git a/system/cle/cle.c b/system/cle/cle.c index da8b79bf8..65ecd5f6a 100644 --- a/system/cle/cle.c +++ b/system/cle/cle.c @@ -53,7 +53,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 877c57d00..30d624d53 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -53,7 +53,7 @@ #include #include -#include +#include #include "cu.h" diff --git a/system/nxplayer/nxplayer.c b/system/nxplayer/nxplayer.c index fb16b1fdf..0ec150dd7 100644 --- a/system/nxplayer/nxplayer.c +++ b/system/nxplayer/nxplayer.c @@ -60,7 +60,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/nxplayer/nxplayer_main.c b/system/nxplayer/nxplayer_main.c index a6dd76ccc..ff820db25 100644 --- a/system/nxplayer/nxplayer_main.c +++ b/system/nxplayer/nxplayer_main.c @@ -49,8 +49,8 @@ #include #include -#include -#include +#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/prun/Kconfig b/system/prun/Kconfig index dd0fb12e8..1fa76a791 100644 --- a/system/prun/Kconfig +++ b/system/prun/Kconfig @@ -10,7 +10,7 @@ menuconfig SYSTEM_PRUN ---help--- Build the Pascal P-Code interpreter / Virtual machine. This selection just builds a library of P-Code-related functions as described in - include/apps/prun.h. This selection is also necessary to enable other + include/apps/system/prun.h. This selection is also necessary to enable other P-Code related features. if SYSTEM_PRUN diff --git a/system/prun/pexec_main.c b/system/prun/pexec_main.c index f981af6a1..8a053c6ab 100644 --- a/system/prun/pexec_main.c +++ b/system/prun/pexec_main.c @@ -45,7 +45,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/prun/prun.c b/system/prun/prun.c index 0495954ee..e9c2f82fe 100644 --- a/system/prun/prun.c +++ b/system/prun/prun.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include "pexec.h" #include "pedefs.h" diff --git a/system/readline/readline.c b/system/readline/readline.c index 611f04364..92fb4f925 100644 --- a/system/readline/readline.c +++ b/system/readline/readline.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include "readline.h" /**************************************************************************** diff --git a/system/readline/readline_common.c b/system/readline/readline_common.c index 140372a7c..ba6704f78 100644 --- a/system/readline/readline_common.c +++ b/system/readline/readline_common.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include "readline.h" /**************************************************************************** diff --git a/system/readline/std_readline.c b/system/readline/std_readline.c index ba064abaf..691cb3225 100644 --- a/system/readline/std_readline.c +++ b/system/readline/std_readline.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include "readline.h" diff --git a/system/sudoku/sudoku.c b/system/sudoku/sudoku.c index 7c04d7557..da5a373c3 100644 --- a/system/sudoku/sudoku.c +++ b/system/sudoku/sudoku.c @@ -41,7 +41,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/symtab/README.txt b/system/symtab/README.txt index 8de5e98ac..0070a008f 100644 --- a/system/symtab/README.txt +++ b/system/symtab/README.txt @@ -45,7 +45,7 @@ call traps. Your board-level start up code code then needs to select the symbol table by calling the function symtab_initialize(): - #include + #include ... symtab_initialize(); diff --git a/system/symtab/symtab.c b/system/symtab/symtab.c index d1142e67e..29c51a0ca 100644 --- a/system/symtab/symtab.c +++ b/system/symtab/symtab.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include "symtab.inc" diff --git a/system/zmodem/rz_main.c b/system/zmodem/rz_main.c index 99866a96b..354a15d28 100644 --- a/system/zmodem/rz_main.c +++ b/system/zmodem/rz_main.c @@ -49,7 +49,7 @@ #include #include -#include +#include /**************************************************************************** * Private Functions diff --git a/system/zmodem/sz_main.c b/system/zmodem/sz_main.c index d531df582..4bfe1db49 100644 --- a/system/zmodem/sz_main.c +++ b/system/zmodem/sz_main.c @@ -49,7 +49,7 @@ #include #include -#include +#include /**************************************************************************** * Private Functions diff --git a/system/zmodem/zm.h b/system/zmodem/zm.h index 88c46a269..a50fe99da 100644 --- a/system/zmodem/zm.h +++ b/system/zmodem/zm.h @@ -53,7 +53,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/system/zmodem/zm_receive.c b/system/zmodem/zm_receive.c index 32066eee6..eb10bdc64 100644 --- a/system/zmodem/zm_receive.c +++ b/system/zmodem/zm_receive.c @@ -59,7 +59,7 @@ #include #include -#include +#include #include "zm.h" diff --git a/system/zmodem/zm_send.c b/system/zmodem/zm_send.c index 89d1663eb..80dbfb263 100644 --- a/system/zmodem/zm_send.c +++ b/system/zmodem/zm_send.c @@ -63,7 +63,7 @@ #include #include -#include +#include #include "zm.h" From 0e76ca7474c380baa74f09500dfffcddb02217d1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 06:59:23 -0600 Subject: [PATCH 13/23] Move apps/include/nsh.h to apps/include/nshlib/nshlib.h --- examples/cc3000/shell.c | 2 +- examples/nsh/nsh_main.c | 2 +- examples/nxterm/nxterm_main.c | 2 +- include/{nsh.h => nshlib/nshlib.h} | 10 +++++----- netutils/README.txt | 2 +- netutils/ftpd/ftpd.h | 2 +- nshlib/Kconfig | 10 +++++----- nshlib/nsh_init.c | 2 +- nshlib/nsh_parse.c | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) rename include/{nsh.h => nshlib/nshlib.h} (96%) diff --git a/examples/cc3000/shell.c b/examples/cc3000/shell.c index 9df6814fd..8e2521b3c 100644 --- a/examples/cc3000/shell.c +++ b/examples/cc3000/shell.c @@ -51,7 +51,7 @@ #include #include "shell.h" -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/examples/nsh/nsh_main.c b/examples/nsh/nsh_main.c index 5d063700d..235a86fa5 100644 --- a/examples/nsh/nsh_main.c +++ b/examples/nsh/nsh_main.c @@ -55,7 +55,7 @@ # include #endif -#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/examples/nxterm/nxterm_main.c b/examples/nxterm/nxterm_main.c index 34b773914..a62326d39 100644 --- a/examples/nxterm/nxterm_main.c +++ b/examples/nxterm/nxterm_main.c @@ -66,7 +66,7 @@ #include #include -#include +#include #include "nxterm_internal.h" diff --git a/include/nsh.h b/include/nshlib/nshlib.h similarity index 96% rename from include/nsh.h rename to include/nshlib/nshlib.h index 9620cbd26..3976d669a 100644 --- a/include/nsh.h +++ b/include/nshlib/nshlib.h @@ -1,7 +1,7 @@ /**************************************************************************** - * apps/include/nsh.h + * apps/include/nshlib/nshlib.h * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_NSH_H -#define __APPS_INCLUDE_NSH_H +#ifndef __APPS_INCLUDE_NSHLIB_NSHLIB_H +#define __APPS_INCLUDE_NSHLIB_NSHLIB_H /**************************************************************************** * Included Files @@ -206,4 +206,4 @@ int platform_user_verify(FAR const char *username, FAR const char *password); } #endif -#endif /* __APPS_INCLUDE_NSH_H */ +#endif /* __APPS_INCLUDE_NSHLIB_NSHLIB_H */ diff --git a/netutils/README.txt b/netutils/README.txt index 50ea2d189..c2f3c4391 100644 --- a/netutils/README.txt +++ b/netutils/README.txt @@ -61,7 +61,7 @@ highly influenced by uIP) include: "wrapped" as character devices and mapped to stdin, stdout, and stderr. Now the telnet session can be inherited by spawned tasks. - ftpc - FTP client. See apps/include/ftpc.h for interface + ftpc - FTP client. See apps/include/netutils/ftpc.h for interface information. ftpd - FTP server. See apps/include/netutils/ftpd.h for interface information. diff --git a/netutils/ftpd/ftpd.h b/netutils/ftpd/ftpd.h index 4ec40e7b7..13efcaca0 100644 --- a/netutils/ftpd/ftpd.h +++ b/netutils/ftpd/ftpd.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/include/ftpd.h + * apps/netutils/ftpd/ftpd.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nshlib/Kconfig b/nshlib/Kconfig index d6c014a2f..e6a8055d5 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -43,10 +43,10 @@ config NSH_PLATFORM_MOTD One newline will be inserted after the platform-supplied message. - platform_motd() is prototyped and described in apps/include/nsh.h + platform_motd() is prototyped and described in apps/include/nshlib/nshlib.h which may be included like: - #include + #include config NSH_MOTD_STRING string "MOTD String" @@ -1538,10 +1538,10 @@ config NSH_LOGIN_PLATFORM int platform_user_verify(FAR const char *username, FAR const char *password); - which is prototyped an described in apps/include/nsh.h and which may - be included like: + which is prototyped an described in apps/include/nshlib/nshlib.h and + which may be included like: - #include + #include An appropriate place to implement this function might be in the directory apps/platform/. diff --git a/nshlib/nsh_init.c b/nshlib/nsh_init.c index 6c475f61c..0b947e1af 100644 --- a/nshlib/nsh_init.c +++ b/nshlib/nsh_init.c @@ -42,7 +42,7 @@ #include #include -#include +#include #include "nsh.h" diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index 9e2a09cd0..48e92e640 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -50,7 +50,7 @@ #endif #include -#include +#include #include "nsh.h" #include "nsh_console.h" From 0f1e86b2fd31b5afe406318edcc52f0e4d10ac46 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 07:03:26 -0600 Subject: [PATCH 14/23] apps/include/tiff.h moved to apps/include/graphics/tiff.h --- examples/tiff/tiff_main.c | 2 +- graphics/screenshot/screenshot_main.c | 2 +- graphics/tiff/tiff_addstrip.c | 2 +- graphics/tiff/tiff_finalize.c | 2 +- graphics/tiff/tiff_initialize.c | 2 +- graphics/tiff/tiff_internal.h | 2 +- graphics/tiff/tiff_utils.c | 2 +- include/{ => graphics}/tiff.h | 10 +++++----- 8 files changed, 12 insertions(+), 12 deletions(-) rename include/{ => graphics}/tiff.h (99%) diff --git a/examples/tiff/tiff_main.c b/examples/tiff/tiff_main.c index 3666343a0..73606a266 100644 --- a/examples/tiff/tiff_main.c +++ b/examples/tiff/tiff_main.c @@ -43,7 +43,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-Processor Definitions diff --git a/graphics/screenshot/screenshot_main.c b/graphics/screenshot/screenshot_main.c index a910cd707..1f2f7080f 100644 --- a/graphics/screenshot/screenshot_main.c +++ b/graphics/screenshot/screenshot_main.c @@ -48,7 +48,7 @@ #include #include -#include +#include #include diff --git a/graphics/tiff/tiff_addstrip.c b/graphics/tiff/tiff_addstrip.c index 2abd25120..014457866 100644 --- a/graphics/tiff/tiff_addstrip.c +++ b/graphics/tiff/tiff_addstrip.c @@ -43,7 +43,7 @@ #include #include -#include +#include #include "tiff_internal.h" diff --git a/graphics/tiff/tiff_finalize.c b/graphics/tiff/tiff_finalize.c index d2c6b9c19..1255df2c3 100644 --- a/graphics/tiff/tiff_finalize.c +++ b/graphics/tiff/tiff_finalize.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include "tiff_internal.h" diff --git a/graphics/tiff/tiff_initialize.c b/graphics/tiff/tiff_initialize.c index e8a9e839c..725b85294 100644 --- a/graphics/tiff/tiff_initialize.c +++ b/graphics/tiff/tiff_initialize.c @@ -47,7 +47,7 @@ #include #include -#include +#include #include "tiff_internal.h" diff --git a/graphics/tiff/tiff_internal.h b/graphics/tiff/tiff_internal.h index f03ba5aae..a7bc32a69 100644 --- a/graphics/tiff/tiff_internal.h +++ b/graphics/tiff/tiff_internal.h @@ -46,7 +46,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-Processor Definitions diff --git a/graphics/tiff/tiff_utils.c b/graphics/tiff/tiff_utils.c index 499be096d..43be47a6a 100644 --- a/graphics/tiff/tiff_utils.c +++ b/graphics/tiff/tiff_utils.c @@ -45,7 +45,7 @@ #include #include -#include +#include #include "tiff_internal.h" diff --git a/include/tiff.h b/include/graphics/tiff.h similarity index 99% rename from include/tiff.h rename to include/graphics/tiff.h index d073d4222..516bd67d8 100644 --- a/include/tiff.h +++ b/include/graphics/tiff.h @@ -1,7 +1,7 @@ /************************************************************************************ - * apps/include/tiff.h + * apps/include/graphics/tiff.h * - * Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Reference: @@ -36,8 +36,8 @@ * ************************************************************************************/ -#ifndef __APPS_INCLUDE_TIFF_H -#define __APPS_INCLUDE_TIFF_H +#ifndef __APPS_INCLUDE_GRAPHICS_TIFF_H +#define __APPS_INCLUDE_GRAPHICS_TIFF_H /************************************************************************************ * Included Files @@ -463,4 +463,4 @@ uint32_t tiff_get32(FAR uint8_t *dest); } #endif -#endif /* __APPS_INCLUDE_TIFF_H */ +#endif /* __APPS_INCLUDE_GRAPHICS_TIFF_H */ From f48a813e0e61d9effecd05cf870ac1a03ef8e83d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 07:08:03 -0600 Subject: [PATCH 15/23] Move apps/include/builtin.h to apps/include/builtin/builtin.h --- README.txt | 2 +- builtin/exec_builtin.c | 31 +------------------------------ include/{ => builtin}/builtin.h | 10 +++++----- nshlib/nsh_builtin.c | 2 +- 4 files changed, 8 insertions(+), 37 deletions(-) rename include/{ => builtin}/builtin.h (94%) diff --git a/README.txt b/README.txt index 4f481cefb..0f3a56b7e 100644 --- a/README.txt +++ b/README.txt @@ -61,7 +61,7 @@ collected during the make context build phase. To execute an application function: - exec_builtin() is defined in the nuttx/include/apps/builtin.h + exec_builtin() is defined in the nuttx/include/apps/builtin/builtin.h NuttShell (NSH) Built-In Commands --------------------------------- diff --git a/builtin/exec_builtin.c b/builtin/exec_builtin.c index f12316d45..36ea5a656 100644 --- a/builtin/exec_builtin.c +++ b/builtin/exec_builtin.c @@ -51,36 +51,7 @@ #include #include -#if 0 -#include -#include -#include -#include - -#include -#endif - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ +#include /**************************************************************************** * Public Functions diff --git a/include/builtin.h b/include/builtin/builtin.h similarity index 94% rename from include/builtin.h rename to include/builtin/builtin.h index 0820f522f..96aeb86a7 100644 --- a/include/builtin.h +++ b/include/builtin/builtin.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/include/builtin.h + * apps/include/builtin/builtin.h * * Originally by: * @@ -8,7 +8,7 @@ * * With subsequent updates, modifications, and general maintenance by: * - * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -40,8 +40,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_BUILTIN_H -#define __APPS_INCLUDE_BUILTIN_H +#ifndef __APPS_INCLUDE_BUILTIN_BUILTIN_H +#define __APPS_INCLUDE_BUILTIN_BUILTIN_H /**************************************************************************** * Included Files @@ -109,4 +109,4 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, } #endif -#endif /* __APPS_INCLUDE_BUILTIN_H */ +#endif /* __APPS_INCLUDE_BUILTIN_BUILTIN_H */ diff --git a/nshlib/nsh_builtin.c b/nshlib/nsh_builtin.c index 5141273a9..046fab414 100644 --- a/nshlib/nsh_builtin.c +++ b/nshlib/nsh_builtin.c @@ -55,7 +55,7 @@ #include #include -#include +#include #include "nsh.h" #include "nsh_console.h" From cbe1d3378699700f07c66f23d560dfe2b96f32ad Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 1 Jul 2016 08:59:46 -1000 Subject: [PATCH 16/23] Allow stack usage to be disabled on contrained systems --- nshlib/Kconfig | 7 +++++++ nshlib/nsh_proccmds.c | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/nshlib/Kconfig b/nshlib/Kconfig index e6a8055d5..f9083b65f 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -403,6 +403,13 @@ config NSH_DISABLE_PS default y if !FS_PROCFS || FS_PROCFS_EXCLUDE_PROCESS default n if FS_PROCFS && !FS_PROCFS_EXCLUDE_PROCESS +config NSH_DISABLE_PSSTACKUSAGE + bool "Disable ps stack usage" + depends on !NSH_DISABLE_PS + default n + ---help--- + Disable to save space and not pull in floating point routines + config NSH_DISABLE_PING bool "Disable ping" default n diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 11330e0ef..4d36f65f7 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -71,6 +71,9 @@ # undef HAVE_GROUPID #endif +#if defined(CONFIG_STACK_COLORATION) && !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) +# define PS_HAVE_STACKUSAGE +#endif /**************************************************************************** * Private Types ****************************************************************************/ @@ -266,7 +269,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR char *nextline; int ret; int i; -#ifdef CONFIG_STACK_COLORATION +#ifdef PS_HAVE_STACKUSAGE int stack_size; int stack_used; float stack_filled; @@ -387,7 +390,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%-8s ", status.td_sigmask); #endif -#ifdef CONFIG_STACK_COLORATION +#ifdef PS_HAVE_STACKUSAGE /* Get the StackSize and StackUsed */ stack_size = 0; @@ -463,7 +466,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, /* Additionally print a "!" if the stack is filled more than 80% */ - nsh_output(vtbl, "%5.1f%%%s ", stack_filled, (stack_filled >= 80 ? "!" : " ")); + nsh_output(vtbl, "%5.1f%%%s ", (double)stack_filled, (stack_filled >= 80 ? "!" : " ")); #endif #ifdef NSH_HAVE_CPULOAD @@ -567,7 +570,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif -#ifdef CONFIG_STACK_COLORATION +#ifdef PS_HAVE_STACKUSAGE nsh_output(vtbl, "%6s ", "STACK"); nsh_output(vtbl, "%6s ", "USED"); nsh_output(vtbl, "%7s ", "FILLED"); From 0e4c247e1da6275205b86cda7560a7f26cc5f698 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 13:22:36 -0600 Subject: [PATCH 17/23] Review of last PR --- nshlib/Kconfig | 2 +- nshlib/nsh_proccmds.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nshlib/Kconfig b/nshlib/Kconfig index f9083b65f..ea0ae46c8 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -405,7 +405,7 @@ config NSH_DISABLE_PS config NSH_DISABLE_PSSTACKUSAGE bool "Disable ps stack usage" - depends on !NSH_DISABLE_PS + depends on STACK_COLORATION && !NSH_DISABLE_PS default n ---help--- Disable to save space and not pull in floating point routines diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 4d36f65f7..7085ce0ea 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -71,9 +71,6 @@ # undef HAVE_GROUPID #endif -#if defined(CONFIG_STACK_COLORATION) && !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) -# define PS_HAVE_STACKUSAGE -#endif /**************************************************************************** * Private Types ****************************************************************************/ @@ -269,7 +266,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR char *nextline; int ret; int i; -#ifdef PS_HAVE_STACKUSAGE +#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE int stack_size; int stack_used; float stack_filled; @@ -390,7 +387,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%-8s ", status.td_sigmask); #endif -#ifdef PS_HAVE_STACKUSAGE +#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE /* Get the StackSize and StackUsed */ stack_size = 0; @@ -570,7 +567,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif -#ifdef PS_HAVE_STACKUSAGE +#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE nsh_output(vtbl, "%6s ", "STACK"); nsh_output(vtbl, "%6s ", "USED"); nsh_output(vtbl, "%7s ", "FILLED"); From 57a0f887285bc8fe1533ca8b8841963a99fac734 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 13:26:34 -0600 Subject: [PATCH 18/23] Revert "Review of last PR" This reverts commit 0e4c247e1da6275205b86cda7560a7f26cc5f698. --- nshlib/Kconfig | 2 +- nshlib/nsh_proccmds.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/nshlib/Kconfig b/nshlib/Kconfig index ea0ae46c8..f9083b65f 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -405,7 +405,7 @@ config NSH_DISABLE_PS config NSH_DISABLE_PSSTACKUSAGE bool "Disable ps stack usage" - depends on STACK_COLORATION && !NSH_DISABLE_PS + depends on !NSH_DISABLE_PS default n ---help--- Disable to save space and not pull in floating point routines diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 7085ce0ea..4d36f65f7 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -71,6 +71,9 @@ # undef HAVE_GROUPID #endif +#if defined(CONFIG_STACK_COLORATION) && !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) +# define PS_HAVE_STACKUSAGE +#endif /**************************************************************************** * Private Types ****************************************************************************/ @@ -266,7 +269,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR char *nextline; int ret; int i; -#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE +#ifdef PS_HAVE_STACKUSAGE int stack_size; int stack_used; float stack_filled; @@ -387,7 +390,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%-8s ", status.td_sigmask); #endif -#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE +#ifdef PS_HAVE_STACKUSAGE /* Get the StackSize and StackUsed */ stack_size = 0; @@ -567,7 +570,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif -#ifndef CONFIG_NSH_DISABLE_PSSTACKUSAGE +#ifdef PS_HAVE_STACKUSAGE nsh_output(vtbl, "%6s ", "STACK"); nsh_output(vtbl, "%6s ", "USED"); nsh_output(vtbl, "%7s ", "FILLED"); From 97e41cdcc5bd00dea084a972d66577ba62520b2e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 1 Jul 2016 13:27:15 -0600 Subject: [PATCH 19/23] Add a missing blank line --- nshlib/nsh_proccmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 4d36f65f7..1728e12c9 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -74,6 +74,7 @@ #if defined(CONFIG_STACK_COLORATION) && !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) # define PS_HAVE_STACKUSAGE #endif + /**************************************************************************** * Private Types ****************************************************************************/ From 6eab2b7811adbbd512c2c7930ed0891c0ed0f150 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 1 Jul 2016 09:45:00 -1000 Subject: [PATCH 20/23] Take 2 --- nshlib/Kconfig | 2 +- nshlib/nsh_proccmds.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nshlib/Kconfig b/nshlib/Kconfig index f9083b65f..ea0ae46c8 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -405,7 +405,7 @@ config NSH_DISABLE_PS config NSH_DISABLE_PSSTACKUSAGE bool "Disable ps stack usage" - depends on !NSH_DISABLE_PS + depends on STACK_COLORATION && !NSH_DISABLE_PS default n ---help--- Disable to save space and not pull in floating point routines diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c index 1728e12c9..5a7dd93e5 100644 --- a/nshlib/nsh_proccmds.c +++ b/nshlib/nsh_proccmds.c @@ -71,10 +71,6 @@ # undef HAVE_GROUPID #endif -#if defined(CONFIG_STACK_COLORATION) && !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) -# define PS_HAVE_STACKUSAGE -#endif - /**************************************************************************** * Private Types ****************************************************************************/ @@ -134,7 +130,7 @@ static const char g_scheduler[] = "Scheduler:"; static const char g_sigmask[] = "SigMask:"; #endif -#ifdef CONFIG_STACK_COLORATION +#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) static const char g_stacksize[] = "StackSize:"; static const char g_stackused[] = "StackUsed:"; #endif @@ -270,7 +266,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR char *nextline; int ret; int i; -#ifdef PS_HAVE_STACKUSAGE +#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) int stack_size; int stack_used; float stack_filled; @@ -391,7 +387,7 @@ static int ps_callback(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, nsh_output(vtbl, "%-8s ", status.td_sigmask); #endif -#ifdef PS_HAVE_STACKUSAGE +#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) /* Get the StackSize and StackUsed */ stack_size = 0; @@ -571,7 +567,7 @@ int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_DISABLE_SIGNALS nsh_output(vtbl, "%-8s ", "SIGMASK"); #endif -#ifdef PS_HAVE_STACKUSAGE +#if !defined(CONFIG_NSH_DISABLE_PSSTACKUSAGE) nsh_output(vtbl, "%6s ", "STACK"); nsh_output(vtbl, "%6s ", "USED"); nsh_output(vtbl, "%7s ", "FILLED"); From a461a415ab161340001df273aa738f05248ee4be Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 4 Jul 2016 09:54:32 -0600 Subject: [PATCH 21/23] Update ChangeLog --- ChangeLog.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 18b16e55a..13042327b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1664,3 +1664,15 @@ (2016-06-27). * apps/nshlib: 'ps' command now prints out the stack usage if stack coloration is enabled. From Frank Benkert (2016-06-30). + * All inclusion of apps/ header files were removed from the nuttx/ + repository. This caused a lot of reshuffling of logic: binfmt pcode + support, usbmonitor is now a kernel thread, TZ/Olson database moved to + libc/zoneinfo (2016-06-29). + * apps/include directory structure reorganized. There are no longer any + header files in the apps/include/. directory. Rather, sub-directories + were added to match the partitioning of apps/ sub-directories and the + header files were moved into the appropriate sub-directory. This + change is intended to help with some changes be considered by + Sébastien Lorquet (2016-07-01). + * apps/nshlib: Allow stack usage to be disabled on constrained systems. + From David Sidrane (2016-07-01). From 0fd0e5ab403930057b421dc29d4ff860dc5703ef Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Tue, 5 Jul 2016 08:52:00 -0400 Subject: [PATCH 22/23] apps/canutils/libcanard: Update version --- canutils/libcanard/Kconfig | 2 +- canutils/libcanard/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/canutils/libcanard/Kconfig b/canutils/libcanard/Kconfig index 1b61d4ad9..aec812525 100644 --- a/canutils/libcanard/Kconfig +++ b/canutils/libcanard/Kconfig @@ -20,7 +20,7 @@ config LIBCANARD_URL config LIBCANARD_VERSION string "libcanard Version" - default "a7a6d4c6b105976cccac36e05c42abee566b70c4" + default "b28bf6ac337e55d49037fd9904d4b951760c4690" ---help--- libcanard version. diff --git a/canutils/libcanard/Makefile b/canutils/libcanard/Makefile index a19dd99e5..b21a57e28 100644 --- a/canutils/libcanard/Makefile +++ b/canutils/libcanard/Makefile @@ -49,9 +49,9 @@ LIBCANARD_DRVDIR = $(LIBCANARD_SRCDIR)$(DELIM)drivers$(DELIM)nuttx APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils -CFLAGS += -I$(APPS_INCDIR) +CFLAGS += -std=c99 -I$(APPS_INCDIR) -CSRCS = $(LIBCANARD_SRCDIR)$(DELIM)canard.c $(LIBCANARD_DRVDIR)$(DELIM)nuttx.c +CSRCS = $(LIBCANARD_SRCDIR)$(DELIM)canard.c $(LIBCANARD_DRVDIR)$(DELIM)canard_nuttx.c COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(CSRCS) From dcdf701ecf55cf3baf5f4f172d04d36f1a9495e2 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Wed, 6 Jul 2016 10:02:25 -0400 Subject: [PATCH 23/23] apps/canutils/libcanard: Define CANARD_ASSERT as DEBUGASSERT --- canutils/libcanard/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canutils/libcanard/Makefile b/canutils/libcanard/Makefile index b21a57e28..35756c3f2 100644 --- a/canutils/libcanard/Makefile +++ b/canutils/libcanard/Makefile @@ -49,7 +49,7 @@ LIBCANARD_DRVDIR = $(LIBCANARD_SRCDIR)$(DELIM)drivers$(DELIM)nuttx APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils -CFLAGS += -std=c99 -I$(APPS_INCDIR) +CFLAGS += -std=c99 -I$(APPS_INCDIR) -DCANARD_ASSERT=DEBUGASSERT CSRCS = $(LIBCANARD_SRCDIR)$(DELIM)canard.c $(LIBCANARD_DRVDIR)$(DELIM)canard_nuttx.c COBJS = $(CSRCS:.c=$(OBJEXT))