diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index 98c878a296..f867fb3782 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -12,7 +12,7 @@

NuttX C Coding Standard

-

Last Updated: April 17, 2017

+

Last Updated: April 18, 2017

@@ -1292,13 +1292,18 @@ typedef int myinteger_t; No un-named structures. All structures must be named, even if they are part of a type definition. That is, a structure name must follow the reserved word struct in all structure definitions. - The exception to this rule is for structures that are defined within another union or structure. In those cases, the structure name should always be omitted. + The exception to this rule is for structures that are defined within another union or structure (discouraged). In those cases, the structure name should always be omitted. + +
  • + Structured defined with structures discouraged. + Fields within a structure may be another structure that is defined only with the scope of the containing structure. + This practice is acceptable, but discouraged.
  • No un-named structure fields. Structure may contain other structures as fields. This this case, the structure field must be named. - C11 permits such un-named structure fields within structure. + C11 permits such un-named structure fields within a structure. NuttX generally follows C89 and all code outside of architecture specific directories must be compatible with C89.
  • No structure definitions within Type Definition. @@ -1409,11 +1414,16 @@ struct abc_s }; /* Un-named structure field */ ... }; + -

    Correct

    - diff --git a/arch/arm/src/kinetis/kinetis_serial.c b/arch/arm/src/kinetis/kinetis_serial.c index 63873ecab5..79f0030b78 100644 --- a/arch/arm/src/kinetis/kinetis_serial.c +++ b/arch/arm/src/kinetis/kinetis_serial.c @@ -592,6 +592,7 @@ static void up_restoreuartint(struct up_dev_s *priv, uint8_t ie) * Name: up_disableuartint ****************************************************************************/ +#ifdef HAVE_UART_CONSOLE static void up_disableuartint(struct up_dev_s *priv, uint8_t *ie) { irqstate_t flags; @@ -605,6 +606,7 @@ static void up_disableuartint(struct up_dev_s *priv, uint8_t *ie) up_restoreuartint(priv, 0); leave_critical_section(flags); } +#endif /**************************************************************************** * Name: up_setup diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index a6a2d07b51..6b6161f0ce 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -2250,7 +2250,9 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev, unsigned int nbuffered, bool upper) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; +#if !(defined(CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS) && defined(CONFIG_STM32_FLOWCONTROL_BROKEN)) uint16_t ie; +#endif #if defined(CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS) && defined(CONFIG_STM32_FLOWCONTROL_BROKEN) if (priv->iflow && (priv->rts_gpio != 0)) diff --git a/configs/nucleo-f072rb/README.txt b/configs/nucleo-f072rb/README.txt index fb35cac2d3..033b7b7560 100644 --- a/configs/nucleo-f072rb/README.txt +++ b/configs/nucleo-f072rb/README.txt @@ -267,18 +267,55 @@ Configurations NOTES: - 1. Support for NSH built-in applications is provided: + 1. This initial release of this configuration was very minimal, but + also very small: - Binary Formats: - CONFIG_BUILTIN=y : Enable support for built-in programs + $ size nuttx + text data bss dec hex filename + 32000 92 1172 33264 81f0 nuttx - Application Configuration: - CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line + The current version, additional features have been enabled: board + bring-up initialization, button support, the procfs file system, + and NSH built-in application support. The size increased as follows: - No built applications are enabled in the base configuration, however. + $ size nuttx + text data bss dec hex filename + 40231 92 1208 41531 a23b nuttx - 2. C++ support for applications is enabled: + Those additional features cost about 8KiB FLASH. I believe that is a + good use of the STM32F072RB's FLASH, but if you interested in the + more minimal configuration, here is what was changed: - CONFIG_HAVE_CXX=y - CONFIG_HAVE_CXXINITIALIZE=y - CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y + Removed + + CONFIG_BINFMT_DISABLE=y + CONFIG_DISABLE_MOUNTPOINT=y + CONFIG_NSH_DISABLE_CD=y + + Added: + + CONFIG_ARCH_BUTTONS=y + CONFIG_ARCH_IRQBUTTONS=y + + CONFIG_BUILTIN=y + CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + + CONFIG_FS_PROCFS=y + CONFIG_NSH_PROC_MOUNTPOINT="/proc" + + CONFIG_LIB_BOARDCTL=y + CONFIG_NSH_ARCHINIT=y + CONFIG_NSH_BUILTIN_APPS=y + + Support for NSH built-in applications is enabled for future use. + However, no built applications are enabled in this base configuration. + + 2. C++ support for applications is NOT enabled. That could be enabled + with the following configuration changes: + + CONFIG_HAVE_CXX=y + CONFIG_HAVE_CXXINITIALIZE=y + CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y + + And also support fo C++ constructors under + apps/platform/nucleo-stm32f072rb. diff --git a/configs/nucleo-f072rb/include/board.h b/configs/nucleo-f072rb/include/board.h index 50493e09da..1b45a24a51 100644 --- a/configs/nucleo-f072rb/include/board.h +++ b/configs/nucleo-f072rb/include/board.h @@ -218,8 +218,8 @@ /* Button definitions ***************************************************************/ /* Buttons * - * B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32 - * microcontroller. + * B1 USER: the user button is connected to the I/O PC13 (pin 2) of the STM32 + * microcontroller. */ #define BUTTON_USER 0 diff --git a/configs/nucleo-f072rb/nsh/defconfig b/configs/nucleo-f072rb/nsh/defconfig index 48868af124..946a2edad2 100644 --- a/configs/nucleo-f072rb/nsh/defconfig +++ b/configs/nucleo-f072rb/nsh/defconfig @@ -407,14 +407,20 @@ CONFIG_ARCH_BOARD="nucleo-f072rb" CONFIG_ARCH_HAVE_LEDS=y CONFIG_ARCH_LEDS=y CONFIG_ARCH_HAVE_BUTTONS=y -# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_BUTTONS=y CONFIG_ARCH_HAVE_IRQBUTTONS=y +CONFIG_ARCH_IRQBUTTONS=y # # Board-Specific Options # # CONFIG_BOARD_CRASHDUMP is not set -# CONFIG_LIB_BOARDCTL is not set +CONFIG_LIB_BOARDCTL=y +# CONFIG_BOARDCTL_RESET is not set +# CONFIG_BOARDCTL_UNIQUEID is not set +# CONFIG_BOARDCTL_TSCTEST is not set +# CONFIG_BOARDCTL_GRAPHICS is not set +# CONFIG_BOARDCTL_IOCTL is not set # # RTOS Features @@ -448,6 +454,7 @@ CONFIG_PREALLOC_TIMERS=0 # CONFIG_SPINLOCK is not set # CONFIG_INIT_NONE is not set CONFIG_INIT_ENTRYPOINT=y +# CONFIG_INIT_FILEPATH is not set CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_RR_INTERVAL=200 # CONFIG_SCHED_SPORADIC is not set @@ -675,13 +682,28 @@ CONFIG_SYSLOG_CONSOLE=y # # File system configuration # -CONFIG_DISABLE_MOUNTPOINT=y +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_FS_AUTOMOUNTER is not set CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y -# CONFIG_FS_READABLE is not set +CONFIG_FS_READABLE=y # CONFIG_FS_WRITABLE is not set # CONFIG_FS_NAMED_SEMAPHORES is not set # CONFIG_FS_RAMMAP is not set -# CONFIG_FS_PROCFS is not set +# CONFIG_FS_FAT is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set +# CONFIG_FS_TMPFS is not set +# CONFIG_FS_SMARTFS is not set +# CONFIG_FS_BINFS is not set +CONFIG_FS_PROCFS=y +# CONFIG_FS_PROCFS_REGISTER is not set + +# +# Exclude individual procfs entries +# +# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set +# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set +# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set # CONFIG_FS_UNIONFS is not set # @@ -709,7 +731,10 @@ CONFIG_MM_REGIONS=1 # # Binary Loader # -CONFIG_BINFMT_DISABLE=y +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +CONFIG_BUILTIN=y # CONFIG_PIC is not set # CONFIG_SYMTAB_ORDEREDBYNAME is not set @@ -762,6 +787,7 @@ CONFIG_LIB_RAND_ORDER=1 # # Program Execution Options # +# CONFIG_LIBC_EXECFUNCS is not set CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536 @@ -801,6 +827,7 @@ CONFIG_ARCH_HAVE_TLS=y # # NETDB Support # +# CONFIG_NETDB_HOSTFILE is not set # CONFIG_LIBC_IOCTL_VARIADIC is not set CONFIG_LIB_SENDFILE_BUFSIZE=512 @@ -822,6 +849,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # Application Configuration # +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + # # CAN Utilities # @@ -867,12 +899,14 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_SERLOOP is not set # CONFIG_EXAMPLES_SLCD is not set # CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_SMART_TEST is not set # CONFIG_EXAMPLES_SMP is not set # CONFIG_EXAMPLES_STAT is not set # CONFIG_EXAMPLES_TCPECHO is not set # CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_WATCHDOG is not set # CONFIG_EXAMPLES_WEBSERVER is not set # CONFIG_EXAMPLES_XBC_TEST is not set @@ -881,6 +915,7 @@ CONFIG_EXAMPLES_NSH=y # File System Utilities # # CONFIG_FSUTILS_INIFILE is not set +# CONFIG_FSUTILS_PASSWD is not set # # GPS Utilities @@ -896,6 +931,7 @@ CONFIG_EXAMPLES_NSH=y # # Interpreters # +# CONFIG_INTERPRETERS_BAS is not set # CONFIG_INTERPRETERS_FICL is not set # CONFIG_INTERPRETERS_MICROPYTHON is not set # CONFIG_INTERPRETERS_MINIBASIC is not set @@ -928,10 +964,12 @@ CONFIG_NSH_READLINE=y # CONFIG_NSH_CLE is not set CONFIG_NSH_LINELEN=64 CONFIG_NSH_DISABLE_SEMICOLON=y +# CONFIG_NSH_CMDPARMS is not set CONFIG_NSH_MAXARGUMENTS=6 # CONFIG_NSH_ARGCAT is not set CONFIG_NSH_NESTDEPTH=3 # CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_BUILTIN_APPS=y # # Disable Individual commands @@ -939,7 +977,7 @@ CONFIG_NSH_NESTDEPTH=3 CONFIG_NSH_DISABLE_ADDROUTE=y CONFIG_NSH_DISABLE_BASENAME=y # CONFIG_NSH_DISABLE_CAT is not set -CONFIG_NSH_DISABLE_CD=y +# CONFIG_NSH_DISABLE_CD is not set CONFIG_NSH_DISABLE_CP=y CONFIG_NSH_DISABLE_CMP=y CONFIG_NSH_DISABLE_DATE=y @@ -991,6 +1029,7 @@ CONFIG_NSH_MMCSDMINOR=0 # CONFIG_NSH_CODECS_BUFSIZE=128 # CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_NSH_PROC_MOUNTPOINT="/proc" CONFIG_NSH_FILEIOSIZE=64 # @@ -1003,7 +1042,7 @@ CONFIG_NSH_DISABLESCRIPT=y # CONFIG_NSH_CONSOLE=y # CONFIG_NSH_ALTCONDEV is not set -# CONFIG_NSH_ARCHINIT is not set +CONFIG_NSH_ARCHINIT=y # CONFIG_NSH_LOGIN is not set # CONFIG_NSH_CONSOLE_LOGIN is not set diff --git a/configs/nucleo-f072rb/src/stm32_bringup.c b/configs/nucleo-f072rb/src/stm32_bringup.c index 0c9c7f89df..137e458e78 100644 --- a/configs/nucleo-f072rb/src/stm32_bringup.c +++ b/configs/nucleo-f072rb/src/stm32_bringup.c @@ -41,6 +41,7 @@ #include #include +#include #include "nucleo-f072rb.h" @@ -72,7 +73,7 @@ int stm32_bringup(void) ret = mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); + ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret); } #endif diff --git a/configs/nucleo-f072rb/src/stm32_buttons.c b/configs/nucleo-f072rb/src/stm32_buttons.c index b4aed6807a..f8574e47b3 100644 --- a/configs/nucleo-f072rb/src/stm32_buttons.c +++ b/configs/nucleo-f072rb/src/stm32_buttons.c @@ -40,12 +40,14 @@ #include #include +#include #include #include #include #include +#include "stm32f0_gpio.h" #include "nucleo-f072rb.h" #ifdef CONFIG_ARCH_BUTTONS @@ -71,7 +73,7 @@ void board_button_initialize(void) * also configured for the pin. */ - stm32_configgpio(GPIO_BTN_USER); + stm32f0_configgpio(GPIO_BTN_USER); } /**************************************************************************** @@ -84,7 +86,7 @@ uint32_t board_buttons(void) * pressed. */ - bool released = stm32_gpioread(GPIO_BTN_USER); + bool released = stm32f0_gpioread(GPIO_BTN_USER); return !released; } @@ -117,7 +119,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) if (id == BUTTON_USER) { - ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg); + ret = stm32f0_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg); } return ret;