Commit graph

2381 commits

Author SHA1 Message Date
hujun5
8aa48c4fb6 examples: foc: Add critical section protection to FOC control loop
Introduce CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC configuration option to enable
critical section protection in the FOC (Field-Oriented Control) motor control
examples. This adds irq-safe critical sections around the main control loop
processing to prevent race conditions and ensure atomic updates of motor
control state and parameters during interrupt handling.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-27 20:48:04 +08:00
hongfengchen
d0e949cb24 testing: add unistd.h and pthread.h headers
Add unistd.h and pthread.h for memorystress_main.c, unistd.h for
dhm.c and cachetest_main.c, and pthread.h for kv_test_019.c to fix
missing declarations.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-01-26 19:32:27 +08:00
mazhuang
5c822ea4d3 rpmsgsocket:add rpmsg socket test cases
Signed-off-by: mazhuang <mazhuang@xiaomi.com>
2026-01-24 17:07:42 +08:00
wangzhi16
f16a45a854 examples/pipe: bugfix testcase of fifo
There are three bug in fifo testcase.

1. line 211 and line 295 should be nbytes not ret.
2. coverity report error:
CID 1667262: (#4 of 11): Double close (USE_AFTER_FREE)
11. double_close: Calling close(int) will close the handle fd that has already been closed. [Note: The source code implementation of this function has been overwritten by the built-in model.]

Double close will ocurr when line 234 is true and goto line 341, close again!
Now, Using the previous code logic, Use a tid and an errout_with_null_thread to avoid uninitialized problems.

3. since line 295 is used ret not nbytes, error not expose before.

When the end of read and write are opened, end of write will write successfully even if end of read not read.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-22 19:53:39 +08:00
yukangzhi
122a4a6f4e apps/examples/popen: Modify kconfig file
This test depends on !DISABLE_POSIX_TIMERS.

arm-none-eabi/bin/ld:
apps/examples/popen/libapps_popen.a(popen_main.c.obj):
in function `popen_main':
apps/examples/popen/popen_main.c:62:(.text.popen_main+0x1c):
undefined reference to `timer_create'

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-22 19:52:02 +08:00
Côme VINCENT
85b1a1c8c1 fix(macro): fix CAPIO_FREQUENCY macro typo
Going from CAPIOC_FREQUENCE to CAPIO_FREQUENCY according to nuttx/pull/16925

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2026-01-21 16:59:08 +01:00
wangchengdong
d9afe2db8c signals: fix build and runtime issues when signals all isabled
Fix build and runtime issues when signals all disabled.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-19 22:55:19 +08:00
guanyi3
a75fa37090 usrsocktest: fix TEST_ASSERT_EQUAL fail for POLLIN
This assertion should be removed because the POLLIN event is now only
raised when there is data pending to be received. Previously, POLLIN
was incorrectly set as soon as the connection was established, even
when no data was available, which was not consistent with the expected
behavior.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-01-19 22:46:45 +08:00
anjiahao
63e2650487 elf:avoid interference between different ELFs generated by symtab
if defined CONFIG_EXAMPLES_ELF and CONFIG_EXAMPLES_MODLUE,
elf will generated BINDIR, so generated symtab will interference.
It supports inputting multiple specified files in mksymtab.sh to
avoid interference.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-16 21:07:56 +08:00
v-tangmeng
6630c08783 examples/elf: add support for CONFIG_DISABLE_SIGNALS
make the example elf can work with SIGNAL disabled

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2026-01-16 21:07:56 +08:00
anjiahao
27e0811312 elf:Delete unnecessary generation, elf does not use kernel api
delete the mod_symtab.c generate procedure

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-16 21:07:56 +08:00
anjiahao
91f55245eb apps:modify examples elf compile method
rearrange the elf test directory, make the sub-testcase in separate
directory

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-16 21:07:56 +08:00
wangchengdong
60d814efa2 sched/signal: Add support to disable partial or all signals
Fix dependency issue when signals are partially or fully enabled

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-15 15:48:54 +08:00
Huang Qi
4e8a0ae4c4 style: Fix coding style violations in nuttx-apps
Fix various coding style issues including:
- Case statement formatting
- Include placement and ordering
- Whitespace issues
- Long line formatting
- Bracket alignment

Affected modules:
- audioutils, examples, include
- netutils, system

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-01-12 00:54:48 +08:00
Felipe MdeO
ca11a7e093 system/smf: Port SMF .c/.h files to NuttX
This commit add state machine framework lib to the NuttX project. Also an example is added to help users understand and use this feature.

Changes: Added some files. No impact in other features are expected.

Adjust SMF macro names

Fix issues requested during MR review

update kconfig

fix ci-cd issue

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-01-05 12:50:04 -05:00
Zhe Weng
4f93ec0a43 pkt: Set sll_protocol for raw socket to ETH_P_ALL
Ref: https://man7.org/linux/man-pages/man7/packet.7.html

We should either set protocal when creating socket or binding, otherwise
we cannot capture any packet.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-01-04 21:41:21 +08:00
dongjiuzhu1
150c5756a0 examples/capture: support monitor edge change by signal
add monitor code about edge change

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-03 23:51:26 +08:00
zhangshuai39
6830e297cf dhcpd: Supports kernel mode compilation
The previous method of terminating the dhcp daemon via a global variable has been removed; instead, the `kill pid` command is used. Also, because the original `dhcp_start` method creates tasks via `task_create`, which is not supported in kernel mode, `dhcp_start` is not compiled in kernel mode. The daemon can be started in kernel mode using `dhcpd xxx &`.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2026-01-02 12:29:42 -03:00
zhangkai25
b2f7ead2dd apps/examples/udp: Update CMAKEList.txt for UDP tests under CMAKE
add Update CMAKEList.txt for UDP tests under CMAKE

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2025-12-29 22:34:52 +08:00
zhangshuai39
09ddb06c9d dhcpd: Align makefile implementation
Improve the CMakeLists.txt to achieve the same compilation results as Makefile.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2025-12-25 11:17:17 -03:00
zhangshuai39
de87836c7a netpkt: Add parameters to support specific network cards
Supports sending and receiving data packets on specified interfaces.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2025-12-25 09:45:30 +08:00
buxiasen
df9fe43cc9 fb: fix no mmap with get_pinfo, kernel build with data abort
When BUILD_KERNEL, will case userspace access the kernel address and
abort.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-12-01 19:09:54 +08:00
xuxingliang
6bd593459c examples/elf: fix cmake build error
CMake Error at cmake/nuttx_parse_function_args.cmake:76 (message):
  : unparsed INCLUDES;/home/neo/projects/nuttx/apps/examples/elf
Call Stack (most recent call first):
  cmake/nuttx_add_application.cmake:77 (nuttx_parse_function_args)
  /home/neo/projects/nuttx/apps/examples/elf/CMakeLists.txt:24 (nuttx_add_application)

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-11-27 22:23:42 +08:00
nuttxs
92269be92a netutils/netlib: support delete the DNS server address by index or address
- Modify the DHCP-client data structure to support multiple DNS addresses
- Enhance DHCP-option parsing to extract all DNS-server addresses
- Set all received DNS-server addresses
- fix some test case build error

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-11-10 18:10:16 +08:00
Huang Qi
847f862fd4 examples/elf: Fix invalid preprocessor directive syntax
Fix invalid preprocessor directive in elf_main.c by changing
`#  Warning "No file system selected"` to `#  warning "No file system selected"`.

The incorrect uppercase "Warning" directive would cause compilation
errors, while the proper lowercase "warning" directive generates
the intended compiler warning when no file system is selected.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-10-19 11:53:23 -04:00
Stepan Pressl
9e83bc2270 examples/shv-nxboot-updater: use downgraded pyshv==0.8.0
The problem probably arises from an incompatibility issue
between the shv-libs4c and pyshv libraries. The fix is to downgrade
the library for now and then revert back.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-10-17 14:40:03 -04:00
Huang Qi
27579eb531 examples/fb: Fix error message formatting and accuracy
Fix two error message issues in the framebuffer example:
* Add missing newline character to fbmem2 error message in fb_init_mem2()
* Correct mmap() error message that incorrectly referenced FBIOGET_PLANEINFO

These changes improve error reporting clarity and consistency for debugging framebuffer initialization issues.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-10-17 14:56:51 +08:00
Stepan Pressl
cf41b01135 netutils/libshvc: add Silicon Heaven integration into NuttX and SHV examples
This commit marks the end of my GSoC 2025 project in the NuttX section.
All changes:

- Silicon Heaven protocol (SHV) implementation:
  The library is cloned from github.com/silicon-heaven/shv-libs4c
  and compiled here. The library has out-of-the-box support
  for NuttX and possibly all posix systems.
  The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define
  set to "nuttx". The library's dependancy is Pavel Pisa's ULUT
  and originates from Michal Lenc's GSoC.

- examples/shv-nxboot-updater:
  An example which constructs a SHV tree with which you can perform
  firmware updates using a SHV "file node". The file node wraps
  around NXBoot's update partition.
  The application also allows for NXBoot confirmation of the images.
  This application is to be meant used as a "background service",
  started before any apps, possibly using rcS. The tree is allocated
  as GAVL (see below).

- examples/shv-test:
  An example which constructs a SHV tree and gives the user
  the ability to choose which type of construction should be used,
  either:
    - GAVL:       dynamic SHV tree allocation encapsulated within
                  an AVL tree.
    - GSA:        dynamic SHV tree allocation encapsulated within
                  a continuous array with binary search
    - GSA_STATIC: SHV tree is defined as static const, this means
                  all the data structures are placed in .rodata.
		  Extremely beneficial for embedded systems,
		  as .rodata is located in flash and embedded
		  systems usually have more flash than sram,
		  thus reducing sram usage. The downside is that
		  the definitions are rather tedious, but can
		  be automated in case of some code generation
		  (like in pysimCoder).
		  All of it is places in a continuous array with
		  binary search.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-09-24 21:43:07 +08:00
Tiago Medicci
61e82925dc examples/i2schar: Implement loopback mode check
This commit implements the loopback mode for the i2schar example
application. This mode - available only when both RX and TX are
enabled - allows the user to test the I2S buses when the TX pin is
connected to the RX pin. This is done by pre-filling a buffer with
known data (additionally, it checks the peripheral's data width to
format the data in the buffer accordingly) and passing it for both
the transmitter and the receiver threads. This buffer is written to
the TX and the received buffer is compared to the known buffer.

Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
2025-08-28 21:58:41 +08:00
Niccolò Maggioni
dfd1eb0672 examples/ads7046: Add new example for ADS7046 ADC
Add a new example that shows how to read a sample from
an ADS7046 ADC sensor registered on the SPI bus.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-20 02:28:15 +08:00
Niccolò Maggioni
14a39ee7ce examples/tmp112: Add new example for TMP112 temperature sensor
Add a new example that shows how to read the temperature from a
TMP112 sensor registered on the I2C bus.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-19 14:27:45 +08:00
George Poulios
caefd0de9f tee/libteec, examples/optee_gp: Fix cmake build
Top level:
 - 'tee' subdirectory added to top-level CMakeLists.txt

tee/libteec:
 - BINARY_PREFIX defined PUBLIC to make it accessible to consumer
   apps
 - added missing DEBUGLEVEL definitions

examples/optee_gp:
 - added missing dependency to libteec

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-08-02 09:59:21 -03:00
jingfei
4ecdb92e61 examples/mtdpart:Register MTD devices using the mtd_register method
1. Due to the automatic wrapping of MTD devices during the open() process,
   the legacy registration methods ftl_initialize() and bchdev_register()
   are no longer required for MTD device registration. The new method is
   now changed to register_mtddriver

2. Some code for space release and deregistration has been added,
   and certain error handling methods have been updated.
2025-07-30 10:10:34 +08:00
RTL
2de49b8b22 examples/xedge_demo: Add Xedge IoT Toolkit with BAS integration
Add support for Xedge, an embedded software toolkit for IoT applications
 using Lua scripting with HTTP(S), WebSockets, MQTT, and device I/O.

* netutils/xedge: Dependency manager that downloads BAS library
  and BAS-Resources, generates XedgeZip.c during build

* examples/xedge_demo: Complete example showing Xedge integration
  with HTTP server, Lua runtime, and SNTP time synchronization

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2025-07-25 09:19:10 -03:00
Filipe Cavalcanti
d27d6e635f examples/mcuboot: add example to update from binary in local storage
This example makes it possible to use a binary from local storage for MCUBoot update.
It copies the binary file to the secondary slot instead of downloading from a remote URL.
Can be used to update from a SD Card, for example.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-07-16 09:49:45 +08:00
Alan Carvalho de Assis
a7e4a2a30e examples/keyboard: Fix compilation warning
Replace %d with %PRIu32 to avoid warning convered in error on CI.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-15 06:12:21 +08:00
SPRESENSE
0037868ff0 examples/nximage: Rename program name to nximage
The original name is nxhello, which duplicates in examples/nxhello.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-07-09 09:28:57 +02:00
Tang Meng
971a7374d6 examples/i2schar: fix spelling mistakes 2025-06-27 21:42:02 +08:00
Alan Carvalho de Assis
63c86438fb apps/can: Replace fprintf with dprint
This modification will remove the dependency on
CONFIG_FILE_STREAM, useful for small devices.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-06-27 09:41:29 +08:00
Tim Hardisty
f0eb00ffd9 examples: add mdnsd example application to accompany netutils/mdns library
This commit adds a new example app to allow the newly added netutils/mdns
library and associated daemon to be exeercised.

Signed-off-by: Tim Hardisty <timh@jti.uk.com>
2025-06-02 23:18:24 +08:00
vrmay23
8ff533beb3 examples/posix_stdio: Fix Kconfig to define default stack size
Fix the Kconfig file for the posix_stdio example by adding
the STACKSIZE symbol and setting it to DEFAULT_TASK_STACKSIZE.

This change ensures that the example builds properly and
respects system-wide stack size configuration.

Signed-off-by: Vinicius May <vmay.sweden@gmail.com>
2025-06-01 09:21:15 -03:00
raiden00pl
94d02aaaf2 examples: unify Private Types banners
unify Private Types banners according to NuttX coding standard

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-28 10:16:50 +08:00
George Poulios
49f6a219f9 examples/optee_gp: Fix Kconfig if/else condition
Previous Kconfig had a mistake guarding optee_gp
Kconfig values based on EXAMPLES_OPTEE instead of
EXAMPLES_OPTEE_GP. Fix that

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-21 00:35:27 +08:00
George Poulios
7b383d0562 examples/optee_gp: Add a OP-TEE GP API client example
Add an example app that opens a session with the devices pseudo-TA
and enumerates the available devices (prints their UUIDs only)
using the GlobalPlatform API and libteec.

The example showcases:
  - initializing the context
  - opening a session
  - invoking a command using NULL references
  - invoking a command using temp shared memory
  - invoking a command using registered shared memory
  - closing the session
  - finalizing the context

Enabled with CONFIG_EXAMPLES_OPTEE_GP.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 21:17:51 +08:00
George Poulios
677089b912 examples/optee: Correct use of shm reg id and flags
Previous version of optee example was using id during
shm registration as input whereas it is an output
variable. It was also specifying flags to dictate the
behaviour whereas the latest implementation of the
driver prohibits their use. This commit addresses
those issues.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 21:17:51 +08:00
vrmay23
77b2e8dfee examples/posix_stdio: New example dedicated to posix stdio library.
This example will help newcomers to port software from Linux to NuttX
in a POSIX compliant fashion using stdio library. It shows how to work with
open(), close() and write() functions over /dev/console.

Signed-off-by: Vinicius May <vmay.sweden@gmail.com>
2025-05-07 20:07:35 +08:00
George Poulios
30ef8ff845 examples/optee: Introduce an OP-TEE client example
Add an example app that opens a session with the devices pseudo-TA
and enumerates the available devices (prints their UUIDs only).

The example showcases:
 - opening the OP-TEE client driver
 - printing its version
 - opening a session
 - allocating shared memory
 - registering shared memory
 - invoking a function to the TA referencing the shared memory
 - closing the session

Enabled with CONFIG_EXAMPLES_OPTEE.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-05 23:58:57 +08:00
Laczen JMS
61194fe6c0 examples/elf: add possibility to create romfs image
Add the possibility to create a romfs image for an "external" file
system. The romfs.img can directly be written to a configurable
mtdblock device.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-04-19 11:30:29 +08:00
Jukka Laitinen
ecbd1e964a examples/camera: Initialize g_nximage semaphore with SEM_INITIALIZER
Use SEM_INITIALIZER macro instead of direct { 0 }

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-04-16 15:18:06 +03:00
chao an
27846ffec7 libc/elf: rename modlib to libelf
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.

CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-04-11 09:43:07 +08:00