Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
commit
a8563bf9be
@ -12,7 +12,7 @@
|
||||
<h1><big><font color="#3c34ec">
|
||||
<i>NuttX C Coding Standard</i>
|
||||
</font></big></h1>
|
||||
<p>Last Updated: April 17, 2017</p>
|
||||
<p>Last Updated: April 18, 2017</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -1292,13 +1292,18 @@ typedef int myinteger_t;
|
||||
<b>No un-named structures</b>.
|
||||
All structures must be named, even if they are part of a type definition.
|
||||
That is, a structure name must follow the reserved word <code>struct</code> 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.
|
||||
</li>
|
||||
<li>
|
||||
<b>Structured defined with structures discouraged</b>.
|
||||
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.
|
||||
</li>
|
||||
<li>
|
||||
<b>No un-named structure fields</b>.
|
||||
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.
|
||||
<li>
|
||||
<b>No structure definitions within Type Definition</b>.
|
||||
@ -1409,11 +1414,16 @@ struct abc_s
|
||||
}; /* Un-named structure field */
|
||||
...
|
||||
};
|
||||
|
||||
</ul></pre></font>
|
||||
</td></tr>
|
||||
<tr><td bgcolor="white">
|
||||
<p><font color="green"><b>Correct</b></p>
|
||||
<ul><pre>
|
||||
<ul>
|
||||
<font color="green">
|
||||
<p>
|
||||
<b>Correct</b>
|
||||
</p>
|
||||
<pre>
|
||||
struct xyz_info_s
|
||||
{
|
||||
...
|
||||
@ -1423,10 +1433,20 @@ struct xyz_info_s
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<font color="blue"><pre>
|
||||
<font color="blue">
|
||||
<p>
|
||||
<b>Discouraged</b>
|
||||
</p>
|
||||
<pre>
|
||||
typedef struct xyz_info_s xzy_info_t;
|
||||
</pre>
|
||||
<p>(The use of typedef'ed structures is acceptable but discouraged)</p></font>
|
||||
<p>
|
||||
The use of typedef'ed structures is acceptable but discouraged.
|
||||
</p>
|
||||
</font>
|
||||
<p>
|
||||
<b>Correct</b>
|
||||
</p>
|
||||
<pre>
|
||||
struct xyz_info_s
|
||||
{
|
||||
@ -1436,7 +1456,12 @@ struct xyz_info_s
|
||||
uint8_t bitc : 1, /* Bit C */
|
||||
...
|
||||
};
|
||||
|
||||
</pre>
|
||||
<font color="blue">
|
||||
<p>
|
||||
<b>Discouraged</b>
|
||||
</p>
|
||||
<pre>
|
||||
struct abc_s
|
||||
{
|
||||
...
|
||||
@ -1448,6 +1473,26 @@ struct abc_s
|
||||
} abc;
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
The use of structures defined within other structures is acceptable provided that they define named fields.
|
||||
The general practice of defining a structure within the scope of another structure, however, is still but discouraged in any case.
|
||||
The following is preferred:
|
||||
</p>
|
||||
</font>
|
||||
<p>
|
||||
<b>Preferred</b>
|
||||
</p>
|
||||
<pre>
|
||||
struct abc_s
|
||||
{
|
||||
...
|
||||
int a; /* Value A */
|
||||
int b; /* Value B */
|
||||
int c; /* Value C */
|
||||
...
|
||||
};
|
||||
|
||||
</ul></pre></font>
|
||||
</td></tr>
|
||||
</table></center>
|
||||
@ -1476,7 +1521,7 @@ union xyz_union_u /* All unions must be named */
|
||||
<font color="blue"><pre>
|
||||
typedef union xyz_union_u xzy_union_t;
|
||||
</pre>
|
||||
<p>(The use of typedef'ed unions is acceptable but discouraged)</p></font>
|
||||
<p>The use of typedef'ed unions is acceptable but discouraged.</p></font>
|
||||
<pre>
|
||||
struct xyz_info_s
|
||||
{
|
||||
@ -1489,6 +1534,7 @@ struct xyz_info_s
|
||||
} u; /* All union fields must be named */
|
||||
...
|
||||
};
|
||||
|
||||
</ul></pre></font>
|
||||
</td></tr>
|
||||
</table></center>
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#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
|
||||
|
||||
|
@ -40,12 +40,14 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#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;
|
||||
|
Loading…
Reference in New Issue
Block a user