This allows NuttX users to configure the NimBLE built-in DIS service
options that are only available at compile-time. Now all the
characteristics can be used if desired. The default Kconfig values match
the original definitions, so there is no change in behaviour.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Port of the Zephyr RTOS zbus (many-to-many message bus with typed
channels and decoupled observers), built entirely on native NuttX
primitives and preserving the original declarative API
(ZBUS_CHAN_DEFINE, ZBUS_LISTENER_DEFINE, ZBUS_SUBSCRIBER_DEFINE, ...).
Features: listeners (synchronous callbacks), subscribers (queue of
channel references), message subscribers (ordered message copies),
async listeners (callback on a dedicated task), runtime observers,
per-observation notification masks, observer enable/disable, message
validators, channel user data, publish statistics, lookup by
name/numeric id and channel/observer iteration.
Mapping to NuttX primitives:
- Channel/observer registration: link-time iterable sections
(include/nuttx/iterable_sections.h); the observers of a channel are
named after their position in the definition, so the linker sorts the
notification order, and the declarative macros are built on
nuttx/macro.h (CONCATENATE, FOREACH_ARG and the FOREACH_IDX_ARG added
in a companion nuttx commit) rather than on a private macro engine.
Notification masks live in .bss with their initial value preserved in
ROM and applied on lazy init.
- Channel lock: sem_t (enable CONFIG_PRIORITY_INHERITANCE instead of
the Zephyr priority-boost/HLP); timeouts are computed with the
clock_timespec_* helpers from nuttx/clock.h.
- Subscriber queues: kernel message queues (file_mq_*) opened lazily
via pthread_once, usable from any task; mq payload copying replaces
the Zephyr net_buf machinery entirely.
- Async listeners: one task per listener (task_create, priority and
stack size configurable) blocking on the listener queue; a task
rather than a pthread so it outlives the first API caller.
- Timeouts: milliseconds with CLOCK_MONOTONIC deadlines
(ZBUS_NO_WAIT/ZBUS_FOREVER).
Includes a runnable example (examples/zbus, CONFIG_EXAMPLES_ZBUS) and a
cmocka test suite (testing/zbus, CONFIG_TESTING_ZBUS) covering the full
API: 17/17 tests passing on linum-stm32h753bi hardware, including
multi-channel index grouping, mask semantics, runtime observer error
paths, notification order (the observers of a channel run in the order
they are listed, and an observation bound with ZBUS_CHAN_ADD_OBS() runs
after all of them), queue overflow/timeout semantics, async listener
bursts,
bit-exact float/double payload delivery across every observer type
(sensor-style messages with a float-math validator) and an
interrupt-driven publisher (kernel timer interrupt -> signal -> sampling
thread -> zbus_chan_pub, the recommended pattern for interrupt sources).
Requirements: FLAT build; CONFIG_MQ_MAXMSGSIZE >= pointer size +
CONFIG_ZBUS_MSG_SUBSCRIBER_MAX_MSG_SIZE for message subscribers; board
linker script including <nuttx/linker/common-rom.ld> or the generic
CONFIG_ITERABLE_SECTIONS_LINKER_INSERT mode.
Not ported: multi-domain proxy agent (experimental upstream); publishing
from interrupt handlers (userspace library: hand the data to a thread).
Documentation lives in the nuttx repository
(Documentation/applications/system/zbus).
Assisted-by: Claude Code
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Add cmocka-based test program for SO_TIMESTAMPING socket option
under testing/nettest/timestamp/. Covers all five test scenarios
from the SO_TIMESTAMPING PR (apache/nuttx#20161):
1. SO_TIMESTAMPING setsockopt/getsockopt
2. SO_TIMESTAMP/SO_TIMESTAMPNS backward compatibility
3. TX timestamping + MSG_ERRQUEUE delivery
4. RX timestamp via SO_TIMESTAMP
5. TX timestamping with poll(POLLPRI) notification
Enable with CONFIG_TESTING_NET_TIMESTAMP=y (requires
CONFIG_NET_TIMESTAMP, CONFIG_NET_PKT, CONFIG_TESTING_CMOCKA).
Tested on sim:dynconns — all 5 tests pass.
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
Every topic's format string is printed through orb_info() or
orb_fprintf(), and both reach the data through "%pB", which is a NuttX
extension rather than a standard conversion. UORB_FORMAT turns that
code on without turning the extension on, so a configuration that
enables the listener but not the debug output builds cleanly, runs, and
prints a pointer where the reading should be:
sensor_voltage(now:4294968998000):0xc0203c98B
The address is the va_format the extension was supposed to expand, and
the trailing B is the conversion character being taken as ordinary
text. Nothing warns, because to the compiler and to printf this is a
valid format string that means something else.
DEBUG_UORB already selects the extension, so the fault is invisible to
anyone who turned that on. The two are independent options and only
one of them declared what it needed. Move the select onto UORB_FORMAT,
which is the option that decides whether the format strings are
compiled in at all.
Signed-off-by: Justin Hammond <justin@dynam.ac>
Each of the ten print helpers opens with a declaration followed
immediately by its printf, which nxstyle reports as an error on every
one of them. The file cannot be checked cleanly until they are fixed,
so a later change to it starts from a failing run and has to sort its
own errors from the existing ones.
Whitespace only. git diff -w is empty.
Signed-off-by: Justin Hammond <justin@dynam.ac>
The three electrical topics exist and publish, but sensortest rejects
their node names before opening them: its table is matched by name and
carries each structure's size, so a type without a row is one the tool
cannot read at all.
All three are a timestamp and a single value, the shape print_valf
already handles.
Signed-off-by: Justin Hammond <justin@dynam.ac>
CONFIG_FSUTILS_TINYCBOR_LIB fails to build on toolchains with their own
<memory.h> (picolibc, newlib): cbortojson.c does "#include <memory.h>"
meaning TinyCBOR's own (where cbor_malloc/cbor_realloc/cbor_free are
declared), but only the parent directory was on the include path, so
the toolchain's own <memory.h> wins instead, leaving those symbols
implicitly declared.
Fix: also put the unpacked tinycbor/ subdirectory (Make.defs' own
TINYCBOR_UNPACKNAME) on the include path.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Assisted-by: Claude:claude-sonnet-5
Issue apache/nuttx#20145 reported a sensor fetch-watchdog lifetime
regression: sensor_poll() arms a per-subscriber watchdog for
fetch-only sensors with a finite interval, but sensor_close()
freed the subscriber without cancelling it, letting
sensor_fetch_expired() run after free.
Fixed by apache/nuttx#20146, which cancels the watchdog on close.
Add regression coverage in drivertest as suggested by the maintainer:
open a sensor device, set a finite fetch interval, enter the poll
path so the watchdog can be armed, then close while the watchdog
state is relevant. Sleep past the interval so any stray timer would
fire, and reopen to prove teardown was clean. The test skips
gracefully when no sensor device is present, so it is safe on sim
without hardware.
The test does not deterministically reproduce the UAF; it verifies
the observable invariant that repeated poll/close/reopen cycles
complete cleanly and the device remains usable. Under KASAN or
stress, a missing wd_cancel in close would be caught here.
Impact:
* Is new feature added? YES (new regression test coverage in
testing/drivers/drivertest, no existing functionality changed).
* Impact on user, build, hardware, documentation, security,
compatibility? NO, test-only change.
Testing:
* Full build and runtime logs are provided in the PR description.
Assisted-by: Muse Spark:muse-spark-1.3
Assisted-by: Claude:claude-opus
Signed-off-by: Arnav Sharma <2006arnavsharma@gmail.com>
candump.c locally defines SOF_TIMESTAMPING_SOFTWARE,
SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_RAW_HARDWARE.
After nuttx added these macros to sys/socket.h, the build fails
with -Werror=redefine. Wrap the local defines with #ifndef guards
so they are only used when the system header does not provide them.
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
Replace the sigqueue + shared-memory IPC mechanism in ptpd_status()
with a file-based approach:
- Daemon side: on SIGUSR1, write a binary ptpd_status_s struct to
a temp file and atomically rename it to the status path.
- Client side: send kill(SIGUSR1), poll for the file to appear,
then read the struct back.
This removes the CONFIG_BUILD_FLAT restriction (the old code returned
-ENOTSUP for Protected and Kernel builds) and avoids passing pointers
across address spaces via sigqueue. The status file path is
configurable via NETUTILS_PTPD_STATUSFILE (default /tmp/ptpd.status).
The atomic temp + rename pattern ensures readers never see a partial
write.
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
The IGMP multicast join (ipmsfilter) was previously called before
the interface address (interface_addr) was populated via SIOCGIFADDR.
This meant the IGMP join had to locate the network device without
a valid local address, which could fail or join on the wrong interface.
Move the multicast group subscription to after the interface address
is queried, and guard it with an AF_INET check since IGMP only applies
to IPv4. This ensures the IGMP join can always locate the correct
network device.
Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
Add a regression test for apache/nuttx#20166 to the configdata
example, which runs automatically in every sim:configdata build.
After the normal configdata test loops, close the long-lived
descriptor and run a full lifetime cycle on /dev/config:
- mtdconfig_unregister() must succeed,
- the unregistered device must no longer be openable (ENOENT),
- the same MTD device must be registerable again and usable,
- a final unregister must succeed, leaving the device unregistered.
Before the driver fix this crashes deterministically: the old
mtdconfig_unregister_by_path() freed the private device structure
before closing its temporary file, so the subsequent open() faults
in mm_malloc on the corrupted heap (SIGSEGV observed on sim right
after unregister returns). With the fix the whole example,
934706/934706 checks included, completes cleanly.
The test uses only generic configdata APIs, so it also passes
unchanged under CONFIG_MTD_CONFIG_NVS, whose open/close callbacks
are no-ops.
Assisted-by: Claude:claude-opus
Signed-off-by: Arnav Sharma <2006arnavsharma@gmail.com>
Since nuttx commit 5a209a853e ("sched/wqueue: restore -ENOENT from
work_cancel() for unqueued work") work_cancel() and work_cancel_wq()
return -ENOENT when the work is not queued. The tester thread queues
work with zero delay, so the worker may already have consumed it by the
time it is cancelled and the ASSERT(ret == OK) fires;
Accept -ENOENT there and expect it when cancelling idle work in
the API validation test.
Signed-off-by: raiden00pl <raiden00@railab.me>
Add missing blank lines after variable declarations and fix
alignment in preprocessor conditionals. These are pre-existing
style issues exposed by the latest nxstyle version.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Add a serial transport alongside the existing USB and TCP backends.
The serial backend reuses the TCP v1 wire framing (FB01 handshake
plus an 8-byte big-endian length prefix) so the host side needs no
new tool: socat bridges the UART to a TCP socket and the standard
fastboot tool connects via tcp:.
The serial port path is configured at build time through Kconfig
SYSTEM_FASTBOOTD_SERIAL_PORT.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Extract fastboot_framed_read() that handles TCP v1 wire framing:
handshake detection (FB01 exchange) and 8-byte big-endian length
prefix parsing. Simplify fastboot_tcp_read() to reuse this helper
for both initial handshake and subsequent data frames.
This prepares for adding a serial transport that shares the same
framed protocol.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Add SYSTEM_FASTBOOTD_USB (default y) and SYSTEM_FASTBOOTD_TCP
(default y) to allow disabling individual transports independently.
Replace direct CONFIG_USBFASTBOOT / CONFIG_NET_TCP guards in the
transport code with the new fastbootd-level Kconfig symbols.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
The read loop was passing the original buf pointer and full length on
every iteration, causing subsequent reads to overwrite previous data
and potentially request more bytes than the remaining buffer space.
Update buf and len after each successful read to advance through the
buffer correctly.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
The preset kvdb service defined in parser.c conflicts with user-defined
kvdb service in board-level init.rc, causing:
Error redefined service 'kvdb'
Add SVC_FALLBACK flag and fallback service option. When a service
is marked as fallback, it will be silently ignored if another
service with the same name already exists. This is the semantic
opposite of override:
- override: new definition replaces old
- fallback: new definition yields to old
- old has fallback + new arrives: old yields to new
If neither flag is set, duplicate service names still produce
EEXIST error as before.
Mark the preset kvdb service as fallback so that board-specific
init.rc can freely define its own kvdb service without conflict.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
RPTUNIOC_START returns the (positive) pid of the rptun kernel thread
in async mode (CONFIG_RPTUN_START_SYNC unset). The action engine
treats any positive builtin return value as the pid of a spawned
child and waitpid()s on it (action.c: "if (ret > 0) pid_running =
ret"). The rptun thread is a detached kthread, never a child of init,
so that wait blocks the whole action queue forever and "on init" /
console never run. Normalize a successful start to 0.
Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
BL uses init framework (not NSH), so the NSH rptun command is not
available. Add rptun as an init builtin command that supports
start and stop subcommands. Also add a generic unlink builtin
command for removing device nodes.
Usage in init.bl.rc:
rptun stop /dev/rptun/corecs
unlink /dev/rptun/corecs
rptun start /dev/rptun/corecs
- rptun start/stop: open device, ioctl(RPTUNIOC_START/STOP), close
- unlink: generic command to unlink any file/device node
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
usbtrace_enable(TRACE_BITSET) was copied from nsh's CONFIG_USBDEV_TRACE
block without also copying nsh's local #define TRACE_BITSET or the
<nuttx/usb/usbdev_trace.h> include it needs. TRACE_BITSET has no
built-in definition; every other CONFIG_USBDEV_TRACE caller in the
tree (nsh, composite, cdcacm, usbmsc) defines its own. This compiled
fine as long as CONFIG_SYSTEM_NXINIT and CONFIG_USBDEV_TRACE were never
both on for the same board; the two combined for the first time and
init.c failed to build with 'TRACE_BITSET' undeclared.
Add the missing include and inline the same error-only bitset those
other callers fall back to when none of their granular trace options
are enabled, since this file has no such granular Kconfig of its own.
Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Add a focused wqueue entry that exercises predefined and dynamically
created work queues without changing the no-argument ostest flow.
Share the semaphore wait and basic worker helpers across configurations.
Flat builds exercise scheduler queues, Protected builds exercise USRWORK,
and pthread-enabled builds additionally cover configurable custom worker
pools. When pthread support is disabled, only predefined USRWORK cases are
compiled.
Cover invalid arguments, priority lookup, immediate and delayed work,
pending replacement and cancellation, periodic requeue, synchronous and
parallel cancellation, concurrent queues, callback self-destruction, and
queue teardown.
Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
Syslog may be output via services such as DFX. When debugging the init
component (e.g., service startup failures, including DFX-related
exceptions), syslog may not be output properly.
Add a debug Kconfig option SYSTEM_NXINIT_STDOUT that redirects all init
log macros (init_debug/info/warn/err) to printf instead of syslog.
This is useful for early boot debugging when syslog is not yet
available or serial console shows no output.
Introduce init_log_output() macro as the common log backend, selected
at compile time between printf (with appended newline) and syslog.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
The nxstyle check on CI flagged three spots in monkey_main.c where a
declaration block runs directly into the following statement. Insert a
blank line after the declarations at each location; no logic change.
Fixes the Check job failure on PR #3784:
https://github.com/apache/nuttx-apps/actions/runs/34935981535/job/104273851956?pr=3784
Before:
```
graphics/input/monkey/monkey_main.c:223:2: error: Missing blank line after declarations
graphics/input/monkey/monkey_main.c:363:2: error: Missing blank line after declarations
graphics/input/monkey/monkey_main.c:526:6: error: Missing blank line after declarations
```
After:
```
nxstyle monkey_main.c -> exit 0
```
Assisted-by: Claude Code (GLM-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
Block SIGTERM at startup and add it to the sigtimedwait() set in
monkey_wait(): a blocked signal is never swallowed by the handler, it
either wakes the in-progress wait or stays pending on the task until
the next sigtimedwait() returns it immediately, so the exit through
the regular monkey_delete() cleanup path is deterministic. Because
the kernel keeps the signal mask and pending queue per task, sibling
monkey instances (e.g. multiple instances started for different
input devices) each stop independently, and no shared state is
involved.
Also add a signal_handler() that logs the received signal and
register it for SIGTSTP/SIGCONT/SIGTERM, so these signals never fall
back to their default actions and stay consumable by sigtimedwait()
/ sigwaitinfo().
Before:
kill -15 <pid> terminates the task via the default SIGTERM action
with no cleanup: no "monkey_delete: OK" is ever printed.
After:
kill -15 <pid> exits within one loop iteration (<= one event period,
100-500ms by default) via monkey_delete(), independently for each
running instance, and restarting monkey works.
Testing:
Built and verified on the NuttX simulator (host: Ubuntu 22.04):
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
# enable in build/.config:
# CONFIG_INPUT=y
# CONFIG_GRAPHICS_INPUT_MONKEY=y
# CONFIG_NSH_MAXARGUMENTS=16
ninja -C build olddefconfig && ninja -C build
./build/nuttx
Run in the nsh prompt (uinput injection mode):
nsh> monkey -t 0x11 -p 100-300 -s 454x454 & (uinput touch)
nsh> monkey -t 0x12 -p 100-300 -s 454x454 -b 0 & (uinput button)
nsh> ps
nsh> kill -15 <pid>
ps with both instances running (each monkey task shows "Waiting
Signal" with SIGMASK 0x8000, i.e. SIGTERM blocked while sitting in
sigtimedwait):
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND
0 0 0 0 FIFO Kthread - Ready 0000000000000000 0069584 Idle_Task
1 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067456 sim_loop_wq 0x71204b2003f0 0x71204b200478
2 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067464 hpwork 0x40188860 0x401888e8
4 4 0 100 FIFO Task - Waiting Semaphore 0000000000000000 0067496 init_main
9 9 4 100 FIFO Task - Running 0000000000000000 0067504 sh
10 10 9 110 FIFO Task - Waiting Signal 0000000000008000 0069472 monkey -t 0x11 -p 100-300 -s 454x454
11 11 9 110 FIFO Task - Waiting Signal 0000000000008000 0069448 monkey -t 0x12 -p 100-300 -s 454x454 -b 0
After "kill -15 10" (touch instance exits, button instance
unaffected):
nsh> kill -15 10
[monkey] monkey_wait: Recv sig: SIGTERM
[monkey] monkey_delete: OK
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND
0 0 0 0 FIFO Kthread - Ready 0000000000000000 0069584 Idle_Task
1 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067456 sim_loop_wq 0x71204b2003f0 0x71204b200478
2 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067464 hpwork 0x40188860 0x401888e8
4 4 0 100 FIFO Task - Waiting Semaphore 0000000000000000 0067496 init_main
9 9 4 100 FIFO Task - Running 0000000000000000 0067504 sh
11 11 9 110 FIFO Task - Waiting Signal 0000000000008000 0069448 monkey -t 0x12 -p 100-300 -s 454x454 -b 0
After "kill -15 11" (second instance exits the same way, no monkey
task left):
nsh> kill -15 11
[monkey] monkey_wait: Recv sig: SIGTERM
[monkey] monkey_delete: OK
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND
0 0 0 0 FIFO Kthread - Ready 0000000000000000 0069584 Idle_Task
1 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067456 sim_loop_wq 0x71204b2003f0 0x71204b200478
2 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067464 hpwork 0x40188860 0x401888e8
4 4 0 100 FIFO Task - Waiting Semaphore 0000000000000000 0067496 init_main
9 9 4 100 FIFO Task - Running 0000000000000000 0067504 sh
A new instance started after both kills (PID 12) runs normally and
is again stopped cleanly by kill -15.
Note: on the simulator the uinput devices register as /dev/utouch
and /dev/ubutton, while monkey opens /dev/input0 and /dev/buttons;
the run above used a local (uncommitted) path patch to work around
this. On a board where the device paths match, no patch is needed.
Assisted-by: Claude Code (glm-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
Add a lightweight Micro XRCE-DDS Client integration with UDP transport support and a publisher example.
Signed-off-by: lljwork2021 <lljwork2021@163.com>
Add ptpinfo()/ptpwarn() calls, gated by the existing
CONFIG_DEBUG_PTP_INFO/_WARN symbols (zero cost when disabled), at
points that previously failed silently: an unrecognized L2 protocol,
a domain mismatch, and a Delay_Resp rejected by the source/requester
identity check. These were essential to diagnosing the drift and
Delay_Req bugs fixed in the two preceding commits on real hardware,
and are kept for future maintainers debugging this path.
Assisted-by: Claude:claude-sonnet-5
Assisted-by: Gemini:gemini-3.8-flash-medium
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
1. On AF_PACKET SOCK_RAW sockets in NuttX, msg_name must be NULL because
the destination MAC address is already contained in the Ethernet header.
Previously, passing sockaddr_in caused sendmsg() to fail immediately
with -EAFNOSUPPORT, completely blocking transmission of Delay_Req.
2. Correct PTP primary multicast MAC address to 01:1b:19:00:00:00
(IEEE 1588 Annex F) and ensure ether_type is in network byte order.
3. Initialize delayreq_interval to 1 second default and guard against 0.
4. Set logmessageinterval to 0x7f (IEEE 1588-2008 Table 23 sentinel for
Delay_Req) instead of inheriting 0 from the announce header template.
5. Update PTP version to 0x12 (2.1, minorVersionPTP=1) to match the
value used by mature implementations such as linuxptp.
Assisted-by: Claude:claude-sonnet-5
Assisted-by: Gemini:gemini-3.8-flash-medium
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
1. Post-jump drift bootstrap: on the first Sync packet following a step
jump, do not compute frequency drift against a synthesized zero delta,
which previously caused the entire residual phase offset (~ms) to be
mistaken for frequency drift (~million ppb) and immediately absorbed.
2. Drift rate formula: normalize the adjustment contribution by the actual
measurement interval instead of the adjtime slew period, and compute
natural delta rate as (delta - last_delta + last_adjtime) / interval.
3. Remove broken last_delta > delta comparison that prevented offsets from
converging and applied inverted corrections on negative overshoots.
4. Correct ptp_adjtime() invocation to always pass adjustment_ns for
CLOCK_REALTIME slewing rather than dropping drift compensation when
delta exceeds threshold. Clamp adjustment_ns to the hardware slew limit
so last_adjtime_ns accurately mirrors the true slew applied.
5. Enable Delay_Req in E2E mode once clock is tracking (not jumping) and
allow software timestamping latency in ptp_process_delay_resp().
6. Propagate initialization return code from ptpd_start() and avoid
unconditional failure print in do_ptpd_start().
Assisted-by: Claude:claude-sonnet-5
Assisted-by: Gemini:gemini-3.8-flash-medium
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
Add a dedicated NSH tool for testing and interacting with analog
comparator devices (/dev/comp*). Supports reading comparator output
state, enabling/disabling via IOCTL, and performing an automated voltage
ramp sweep using a DAC device when available.
Assisted-by: Gemini:gemini-2.5-pro
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
Declare and define the uORB metadata for the resistance, conductivity,
energy and charge types, and register them in g_sensor_list[] so that
orb_get_meta() and uorb_listener can resolve them by name.
Signed-off-by: likun17 <likun17@xiaomi.com>
Declare and define the uORB metadata for the voltage, current and power
types, and register them in g_sensor_list[] so that orb_get_meta() and
uorb_listener can resolve them by name.
Signed-off-by: likun17 <likun17@xiaomi.com>
SENSOR_TYPE_VELOCITY and SENSOR_TYPE_AMBIENT_TEMPERATURE have an
entry in the kernel g_sensor_meta[] table but no ORB_DECLARE/ORB_DEFINE
in user space, so ORB_ID() fails to link, callers must fall back to
orb_open() by name and lose the o_size check, and uorb_listener cannot
monitor them.
Add the missing metadata and register both in g_sensor_list[];
ambient_temp reuses struct sensor_temp the same way sensor_light_uncal
already reuses struct sensor_light.
Signed-off-by: likun17 <likun17@xiaomi.com>
The guard tested the literal string "{NUTTX_APPS_BINDIR}/dummy.c"
instead of the expanded path, so dummy.c was re-touched after each
reconfigure, invalidating its object. Add the missing '$' so the
guard checks the intended path.
Assisted-by: Claude Code (glm-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
The guard tested the literal string "{WAMR_MODULE_DIR}" instead of
the expanded path, so it never short-circuited and
file(MAKE_DIRECTORY) ran on every configure. Add the missing '$' so
the guard checks the intended path.
Assisted-by: Claude Code (glm-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
The guard tested the literal string "{LUAMOD_DIR}" instead of the
expanded path, so it never short-circuited and file(MAKE_DIRECTORY)
ran on every configure. Add the missing '$' so the guard checks the
intended path.
Assisted-by: Claude Code (glm-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
Services started by nxinit (e.g. "sh") do not open a console device on
their own, unlike nsh_main, which explicitly does so via
nsh_consolemain()/nsh_waitusbready() for USB gadget consoles
(CDC-ACM/PL2303). When such a board switches its top-level init from
nsh_main to nxinit, no code path ever registers/connects the USB
console gadget, and a service that just execs a plain "sh" inherits
whatever (invalid, for a USB gadget console not yet opened at the time
the idle task file descriptors are set up) stdio nxinit itself has.
Add a "console [<device>]" service option: a service declared with it
gets the given device (CONFIG_SYSTEM_NXINIT_CONSOLE_DEV, "/dev/console"
by default, if no device is given) opened and dup'd onto its stdin,
stdout and stderr via posix_spawn_file_actions before it is spawned.
This does not depend on nsh being enabled at all.
For a USB gadget console, the device does not exist until the gadget
is actually registered; boards using one are expected to bring it up
themselves before any service using "console" is started (e.g. via an
"exec -- sercon" action in their init.rc, since apps/system/cdcacm
already implements exactly that registration step and does not depend
on nxinit or nsh either).
console_file_actions() runs after the previous commit's time_started
update, so a failure to build the console's file actions is covered by
the same up to date timestamp - no separate clock_gettime() call is
needed on this failure path.
Covered by a new unit test, test_nxinit_service_console_option, that
exercises the option with and without an explicit device, and confirms
services without the option are left untouched.
Assisted-by: Kiro:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
init_service_refresh() ignored the return value of init_service_start().
If spawning a restarting service failed for any reason (e.g.
posix_spawnp() itself failing), the service stayed SVC_RESTARTING
forever with nothing left to re-arm its retry timer: this function's
return value drives the poll timeout in the caller's event loop
(main()), and a failed spawn does not fork a child, so there is no
SIGCHLD either to wake it up some other way. If this service happens
to be the only pending timer, the poll blocks indefinitely and the
service is never attempted again.
Check the return value and, on failure, feed the service restart
period into the poll timeout computed by this function, the same way
a successfully started/still-restarting service already does.
Also move the CLOCK_MONOTONIC read that updates a service's
time_started from after a successful spawn to before the spawn is
even attempted, so that time_started stays current on a failed spawn
too - otherwise, once woken up (by the fix above or by an unrelated
event), a repeatedly failing service would look permanently overdue
(elapsed time computed against a stale timestamp) and get retried
immediately regardless of its restart_period.
Assisted-by: Kiro:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
nxstyle flags a missing blank line between the declaration of "s" and
the first statement in option_reboot_on_failure(); pre-existing,
unrelated to any behavioral change here.
Assisted-by: Kiro:claude-sonnet-5
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Add a CMocka regression test for zero-length checksum fragments.
The test verifies that an empty IOB between fragments does not affect
the checksum calculation or pending odd-byte state.
Assisted by: GitHub Copilot
Signed-off-by: Megha Rajput <i.meghar.2408@gmail.com>
Add a standalone grep application under apps/system/grep/. It uses the
NuttX libc regex library (regcomp/regexec) to support -i, -n, -v, -r,
-H and -h options plus stdin input and recursive directory search.
SYSTEM_GREP depends on LIBC_REGEX, so the regex library must be enabled
first -- CONFIG_SYSTEM_GREP only becomes selectable once LIBC_REGEX is
turned on.
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
Add a small high-level S2OPC server with an anonymous SecurityPolicy None
endpoint and a generated C address space.
Assisted-by: OpenAI Codex:gpt-5
Signed-off-by: raiden00pl <raiden00@railab.me>
MicroMutableOpResolver<8> only registered 8 ops, missing
DEPTHWISE_CONV_2D, required by any depthwise-separable CNN
(MobileNet-style, DS-CNN keyword-spotting models). The kernel
already exists upstream (Register_DEPTHWISE_CONV_2D_INT8() in
tensorflow/lite/micro/kernels/depthwise_conv.h); this wires it
into the resolver and bumps the template size to <9>.
Verified with micro_speech_quantized.tflite on sim:tflm.
Before: Didn't find op for builtin opcode 'DEPTHWISE_CONV_2D'.
After: RESHAPE/DEPTHWISE_CONV_2D/FULLY_CONNECTED/SOFTMAX all execute.
Signed-off-by: Ansh Rai <anshrai331@gmail.com>
This update introduces the following changes in mw:
- Fixed all idetified -Werror warnings in CI.
- Fixed the issue where the backspace key was not working in QEMU
Signed-off-by: Pavel Pisa <ppisa@pikron.com>