# Examples
### Selecting Examples
The examples directory contains several sample applications that can be linked
with NuttX. The specific example is selected in the
`boards/<arch-name>/<chip-name>/<board-name>/configs/<config>/defconfig` file
via the `CONFIG_EXAMPLES_xyz` setting where `xyz` is the name of the example.
For example:
```conf
CONFIG_EXAMPLES_HELLO=y
```
Selects the `examples/hello` _Hello, World!_ example.
### Built-In Functions
Some of the examples may be built as _built-in_ functions that can be executed
at run time (rather than as NuttX _main_ programs). These _built-in_ examples
can be also be executed from the NuttShell (NSH) command line. In order to
configure these built-in NSH functions, you have to set up the following:
- `CONFIG_NSH_BUILTIN_APPS` – Enable support for external registered, _named_
applications that can be executed from the NSH command line (see
`apps/README.md` for more information).
## `adc` Read from ADC
A mindlessly simple test of an ADC devices. It simply reads from the ADC device
and dumps the data to the console forever.
This test depends on these specific ADC/NSH configurations settings (your
specific ADC settings might require additional settings).
- `CONFIG_ADC` – Enabled ADC support.
- `CONFIG_NSH_BUILTIN_APPS` – Build the ADC test as an NSH built-in function.
Default: Built as a standalone program.
Specific configuration options for this example include:
- `CONFIG_EXAMPLES_ADC_DEVPATH` – The default path to the ADC device. Default:
`/dev/adc0`.
- `CONFIG_EXAMPLES_ADC_NSAMPLES` – This number of samples is collected and the
program terminates. Default: Samples are collected indefinitely.
- `CONFIG_EXAMPLES_ADC_GROUPSIZE` – The number of samples to read at once.
Default: `4`.
## `ajoystick` Analog Joystick
This is a simple test of the analog joystick driver. See details about this
driver in `nuttx/include/nuttx/input/ajoystick.h`.
Configuration Pre-requisites:
- `CONFIG_AJOYSTICK` – The analog joystick driver.
Example Configuration:
- `CONFIG_EXAMPLES_AJOYSTICK` – Enabled the analog joystick example.
- `CONFIG_EXAMPLES_AJOYSTICK_DEVNAME` – Joystick device name. Default
`/dev/adjoy0`.
- `CONFIG_EXAMPLES_AJOYSTICK_SIGNO` – Signal used to signal the test
application. Default `13`.
## `alarm` RTC Alarm
A simple example that tests the alarm IOCTLs of the RTC driver.
Dependencies:
- `CONFIG_RTC_DRIVER` – RTC driver must be initialized to allow user space
access to the RTC.
- `CONFIG_RTC_ALARM` – Support for RTC alarms must be enabled.
Configuration:
- `CONFIG_EXAMPLES_ALARM` – Enable the RTC driver alarm test.
- `CONFIG_EXAMPLES_ALARM_PROGNAME` – This is the name of the program that will
be used when the NSH ELF program is installed.
- `CONFIG_EXAMPLES_ALARM_PRIORITY` – Alarm daemon priority.
- `CONFIG_EXAMPLES_ALARM_STACKSIZE` – Alarm daemon stack size.
- `CONFIG_EXAMPLES_ALARM_DEVPATH` – RTC device path (`/dev/rtc0`).
- `CONFIG_EXAMPLES_ALARM_SIGNO` – Alarm signal.
## `apa102` Rainbow on `APA102` LED Strip
Rainbow example for `APA102` LED Strip.
## `bastest` Bas BASIC Interpreter
This directory contains a small program that will mount a ROMFS file system
containing the BASIC test files extracted from the Bas `2.4` release. See
`examples/bastest/README.md` for licensing and usage information.
- `CONFIG_EXAMPLES_BASTEST_DEVMINOR` – The minor device number of the ROMFS
block driver. For example, the `N` in `/dev/ramN`. Used for registering the
RAM block driver that will hold the ROMFS file system containing the BASIC
files to be tested. Default: `0`.
- `CONFIG_EXAMPLES_BASTEST_DEVPATH` – The path to the ROMFS block driver device.
This must match `EXAMPLES_BASTEST_DEVMINOR`. Used for registering the RAM
block driver that will hold the ROMFS file system containing the BASIC files
to be tested. Default: `/dev/ram0`.
## `bridge` Network Bridge
A simple test of a system with multiple networks. It simply echoes all UDP
packets received on network `1` and network `2` to network `2` and network `1`,
respectively. Interface `1` and interface may or may not lie on the same
network.
- `CONFIG_EXAMPLES_BRIDGE` – Enables the simple UDP bridge test.
There identical configurations for each of the two networks, `NETn` where `n`
refers to the network being configured `n={1,2}`. Let `m` refer to the other
network.
- `CONFIG_EXAMPLES_BRIDGE_NETn_IFNAME` – The register name of the network `n`
device. Must match the previously registered driver name and must not be the
same as other network device name, `CONFIG_EXAMPLES_BRIDGE_NETm_IFNAME`.
- `CONFIG_EXAMPLES_BRIDGE_NETn_RECVPORT` – Network `n` listen port number.
- `CONFIG_EXAMPLES_BRIDGE_NETn_SNDPORT` – Network `2` send port number.
- `CONFIG_EXAMPLES_BRIDGE_NETn_IOBUFIZE` – Size of the network `n` UDP
send/receive I/O buffer.
- `CONFIG_EXAMPLES_BRIDGE_NETn_STACKSIZE` – Network `n` daemon stacksize.
- `CONFIG_EXAMPLES_BRIDGE_NETn_PRIORITY` – Network `n` daemon task priority.
If used as a NSH add-on, then it is assumed that initialization of both networks
was performed externally prior to the time that this test was started.
Otherwise, the following options are available:
- `CONFIG_EXAMPLES_BRIDGE_NETn_NOMAC` – Select of the network `n` hardware does
not have a built-in MAC address. If selected, the MAC address. provided by
`CONFIG_EXAMPLES_BRIDGE_NETn_MACADDR` will be used to assign the MAC address
to the network n device.
- `CONFIG_EXAMPLES_BRIDGE_NETn_DHCPC` – Use DHCP Client to get the network n IP
address.
- `CONFIG_EXAMPLES_BRIDGE_NETn_IPADDR` – If `CONFIG_EXAMPLES_BRIDGE_NETn_DHCPC`
is not selected, then this is the fixed IP address for network `n`.
- `CONFIG_EXAMPLES_BRIDGE_NETn_DRIPADDR` – Network `n` default router IP address
(Gateway).
- `CONFIG_EXAMPLES_BRIDGE_NETn_NETMASK` – Network `n` mask.
## `buttons` Read GPIO Buttons
To be provided.
## `can` CAN Device Test
If the CAN device is configured in loopback mode, then this example can be used
to test the CAN device in loop back mode. It simple sinces a sequence of CAN
messages and verifies that those messages are returned exactly as sent.
This test depends on these specific CAN/NSH configurations settings (your
specific CAN settings might require additional settings).
- `CONFIG_CAN` – Enables CAN support.
- `CONFIG_CAN_LOOPBACK` – A CAN driver may or may not support a loopback mode
for testing. The STM32 CAN driver does support loopback mode.
- `CONFIG_NSH_BUILTIN_APPS` – Build the CAN test as an NSH built-in function.
Default: Built as a standalone program.
Specific configuration options for this example include:
- `CONFIG_EXAMPLES_CAN_DEVPATH` – The path to the CAN device. Default:
`/dev/can0`.
- `CONFIG_EXAMPLES_CAN_NMSGS` – This number of CAN message is collected and the
program terminates. Default: messages are sent and received indefinitely.
The default behavior assumes loopback mode. Messages are sent, then read and
verified. The behavior can be altered for other kinds of testing where the test
only sends or received (but does not verify) can messages.
- `CONFIG_EXAMPLES_CAN_READONLY` – Only receive messages.
- `CONFIG_EXAMPLES_CAN_WRITEONLY` – Only send messages.
## `canard`
Example application for `canutils/libcarnard`.
## `cctype`
Verifies all possible inputs for all functions defined in the header file
`cctype`.
## `chat` AT over TTY
Demonstrates AT chat functionality over a TTY device. This is useful with AT
modems, for example, to establish a `pppd` connection (see the related `pppd`
example). Moreover, some AT modems – such as ones made by u-blox – have an
internal TCP/IP stack, often with an implementation of TLS/SSL. In such cases
the chat utility can be used to configure the internal TCP/IP stack, establish
socket connections, set up security (e.g., download base64-encoded certificates
to the modem), and perfo
没有合适的资源?快使用搜索试试~ 我知道了~
RISC-V BL602 Book中的Apache NuttX应用程序
共2000个文件
c:954个
h:318个
makefile:133个
0 下载量 54 浏览量
2024-01-02
16:36:02
上传
评论
收藏 5.68MB ZIP 举报
温馨提示
RISC-V BL602 Book”中的Apache NuttX应用程序
资源推荐
资源详情
资源评论
收起资源包目录
RISC-V BL602 Book中的Apache NuttX应用程序 (2000个子文件)
test14.bas 514B
test15.bas 289B
test49.bas 275B
test03.bas 261B
test33.bas 232B
test16.bas 214B
test24.bas 211B
test36.bas 205B
test22.bas 179B
test34.bas 177B
test18.bas 174B
test43.bas 173B
test21.bas 169B
test45.bas 153B
test06.bas 148B
test23.bas 143B
test42.bas 140B
test50.bas 136B
test08.bas 136B
test37.bas 133B
test20.bas 130B
test38.bas 114B
test47.bas 107B
test41.bas 106B
test05.bas 104B
test17.bas 100B
test32.bas 96B
test09.bas 89B
test27.bas 88B
test44.bas 84B
test48.bas 84B
test07.bas 75B
test40.bas 66B
test35.bas 66B
test26.bas 60B
test52.bas 59B
test04.bas 55B
test13.bas 41B
test51.bas 34B
test30.bas 12B
mkkconfig.bat 3KB
Makefile.binfs 2KB
nximage_bitmap.c 311KB
bas_token.c 167KB
vi.c 151KB
bas_statement.c 147KB
ft80x_coprocessor.c 122KB
ftpd.c 117KB
libhttpd.c 92KB
aesxts.c 86KB
basic.c 84KB
webclient.c 76KB
nsh_parse.c 74KB
nxplayer.c 66KB
esp8266.c 65KB
telnetc.c 62KB
bas.c 61KB
mtd_config_fs_test_main.c 61KB
bas_global.c 59KB
zm_send.c 53KB
dhcp6c.c 51KB
usrsocktest_daemon.c 49KB
zm_receive.c 48KB
dhcpd.c 47KB
nsh_fscmds.c 47KB
usrsocktest_wake_with_signal.c 47KB
bas_value.c 43KB
ntpclient.c 41KB
gs2200m_main.c 40KB
tcurses_vt100.c 39KB
nxlooper.c 38KB
usrsock_rpmsg_server.c 36KB
wireless.c 36KB
usrsocktest_remote_disconnect.c 36KB
bas_fs.c 36KB
nsh_netcmds.c 34KB
foc_motor_b16.c 34KB
foc_motor_f32.c 34KB
fboverlay_main.c 32KB
scanftest_main.c 32KB
cle.c 32KB
nsh_command.c 32KB
configfat.c 32KB
wapi.c 31KB
fstest_main.c 31KB
usrsocktest_noblock_connect.c 31KB
pdcdisp.c 30KB
nxrecorder.c 30KB
thttpd_cgi.c 30KB
tiff_initialize.c 29KB
testcurs_main.c 29KB
note_main.c 29KB
pdcscrn.c 28KB
dhcpc.c 27KB
netinit.c 27KB
zm_state.c 27KB
httpd.c 26KB
bas_program.c 26KB
ft80x_primitives.c 25KB
smart_main.c 25KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6758
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功