POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>.
On NuttX (and other strict POSIX environments) rcutils/src/strcasecmp.c
only includes <string.h>, causing an implicit-declaration error for
strcasecmp when cross-compiling.
Patch 0003 adds #include <strings.h> guarded by !_WIN32, matching the
existing Windows/POSIX split in the file.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add -D__NuttX__ to CMAKE_C_FLAGS_INIT and CMAKE_CXX_FLAGS_INIT in
toolchain.cmake.in so that all cross-compiled micro-ROS packages see the
NuttX target macro. Without this, rcutils/src/process.c follows the
__linux__ branch and references program_invocation_name, a glibc-only
extension absent from the NuttX C library.
Pair with 0002-rcutils-process-nuttx-compat.patch which additionally
guards the linux branch with !defined(__NuttX__), ensuring the embedded
fallback path is taken on NuttX even if the host compiler defines any
linux-flavoured macros.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Mirror the Makefile build pipeline into CMakeLists.txt using
ExternalProject_Add so that CMake-based NuttX builds (cmake --build)
can also produce libmicroros.a. The external project delegates to the
existing Makefile targets, then exposes the result via an IMPORTED
STATIC library target with correct INTERFACE_INCLUDE_DIRECTORIES.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
NuttX defines DIR as a struct type in dirent.h. The rcutils filesystem
source has a bare typedef int DIR that triggers a redefinition error when
NuttX system headers are on the include path. Guard it with #ifndef DIR
so the typedef is skipped when the type is already defined.
Applied automatically during the micro_ros_src/src fetch step with
patch -p1 --forward --ignore-whitespace ... || true
so the build is idempotent if the upstream ever merges a fix.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
When CONFIG_SYSTEM_MICROROS=y, add the prebuilt libmicroros.a to LDLIBS
and the colcon-installed include/ tree to CFLAGS/CXXFLAGS so that any
application in nuttx-apps can include micro-ROS headers and link against
the library without extra flags.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add toolchain.cmake.in and include_override/assert.h for the colcon
cross-build. Key differences from the old robertobucher port:
- Drop -DCLOCK_MONOTONIC=0: NuttX defines CLOCK_MONOTONIC=1 and
the override broke nanosleep() on newer kernels.
- CMAKE_SYSTEM_PROCESSOR is a placeholder substituted per-arch.
- include_override/assert.h works around the rosidl NDEBUG issue
(https://github.com/ros2/rosidl/pull/739).
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add a colcon.meta.in template that is substituted at build time with
Kconfig values. Key settings:
- Custom transport only (UCLIENT_PROFILE_CUSTOM_TRANSPORT=ON,
UCLIENT_PROFILE_STREAM_FRAMING=ON) -- actual UDP/serial callbacks
are wired in Phase 4.
- RCL_MICROROS=ON (Jazzy/Kilted renamed flag replacing the old
RCL_COMMAND_LINE_ENABLED/RCL_LOGGING_ENABLED pair).
- RCUTILS_NO_FILESYSTEM=OFF -- NuttX provides POSIX filesystem.
- Resource limits use @MAX_NODES@/@MAX_PUBLISHERS@ etc. placeholders
substituted from CONFIG_MICROROS_MAX_* Kconfig values.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add micro_ros_lib/ subdirectory with a .keep sentinel so the directory
is tracked by git before any generated build artifacts appear. All
colcon/fetch outputs land here and are gitignored by the parent .gitignore.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
The settings save path no longer re-enters g_settings.mtx, so the mutex does not need to be initialized as PTHREAD_MUTEX_RECURSIVE.
This keeps the #3105 fix independent of CONFIG_PTHREAD_MUTEX_TYPES and destroys the temporary mutex attribute object after initialization.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Fix#3105 by making the immediate save path write pending settings while the caller still owns g_settings.mtx instead of calling the timer callback, which locks the same mutex again.
The cached-save timer callback still takes the mutex before using the same locked helper, so asynchronous saves keep their existing synchronization while non-cached saves no longer depend on a recursive mutex.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Close the temporary file descriptor when create_files() fails after open(), and release the read buffer before returning from the path-length failure branch.
This is logically separable from the #3205 stale-directory fix: it does not change how existing /sd/stress is handled, but keeps the same failure paths from leaking resources while the stress test exits after an error.
The scope intentionally stays within sd_stress failure cleanup and does not touch SD/MMC transfer behavior or other testing drivers.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Fix#3205 by removing stale sdstress work directories left by previous interrupted or failed runs before starting a new test.
The cleanup only removes entries matching the generated tmpNNN file pattern. If the directory contains any unexpected entry, the test fails instead of deleting user data.
Also make create_dir() and remove_dir() use their path argument instead of the fixed temporary directory names.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Extend the allocation-failure check to httpd_strdup(), the thttpd-local wrapper that has the same failure contract as strdup().
This is logically separable from the direct strdup()/asprintf() fixes: it prevents using hs->hostname before checking whether the wrapped string allocation succeeded, and releases the partially allocated server state on failure.
The scope intentionally does not extend to malloc(), calloc(), or other raw allocators because #1727 specifically calls out strdup()/asprintf(), and covering all allocation APIs would make this PR much broader.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add missing failure handling for direct strdup() and asprintf() calls where the allocated result is consumed locally before any NULL/error check.
This keeps the scope to the functions named in #1727 and avoids changing pass-through return sites where callers already receive NULL on allocation failure.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add Kconfig, build rules, and ignore entries required to build and
package libffi as a standalone system component.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Use the hello_rust_cargo-specific Kconfig symbols for the built-in
application stack size and priority.
Previously, CMake referenced the generic hello example symbols, so the
configured hello_rust_cargo stack size could be ignored.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
Remove refenrences to PULSECOUNT from PWM example.
Pulse count driver will be handled by separate application.
Signed-off-by: raiden00pl <raiden00@railab.me>
Fix the reported typo warnings and ignore the V4L2 parm field name in apps codespell configuration, matching the main NuttX repository.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Open the LP503X device with O_WRONLY because the driver registers the device node with write-only permissions and the example controls it through ioctl().
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Add missing mode arguments to direct open() calls that use O_CREAT.
Also open the lp503x device with explicit read-only flags instead of O_CREAT, matching the device-node usage.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Pass explicit open flags for the NSH script redirect file so the mode argument is used as file creation permissions.
Add the missing mode argument to AIO ostest open() calls that create the test file.
Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Now that time_t is unconditionally 64-bit (signed int64_t) and the
struct timespec fields tv_sec / tv_nsec are wide enough on their own,
the explicit (uint64_t)/(int64_t)/(int) casts that used to guard the
multiplications and subtractions in *_us / *_ms / *_ns helpers are no
longer needed. Drop them to keep the timekeeping math readable.
In the same spirit, this commit also normalises the printf-style format
specifiers and casts used to print tv_sec / tv_nsec / tv_usec values.
The prior code was a mix of "%d"/"%u"/"%ld"/"%lu"/"%lld" with matching
(int)/(unsigned long)/(long long) casts; some formats truncated time_t
on 32-bit hosts, others mismatched signedness or width. Replace all
such cases with the portable POSIX-recommended forms:
- tv_sec (time_t, signed, impl-defined width) -> %jd + (intmax_t)
- tv_nsec (long, signed) -> %ld (no cast)
- tv_usec (suseconds_t / long) -> %ld (no cast)
Also drop two stale `(FAR const time_t *)&ts.tv_sec` casts that are
unnecessary now that ts.tv_sec is plain time_t.
Arithmetic-cleanup files (existing scope):
- benchmarks/cyclictest/cyclictest.c: timediff_us()
- benchmarks/sd_bench/sd_bench_main.c: get_time_delta_us()
- examples/oneshot/oneshot_main.c: maxus computation
- examples/watchdog/watchdog_main.c: current_time_ms (x2)
- industry/nxmodbus/nxmb_internal.h: nxmb_util_clock_ms()
- netutils/ntpclient/ntpclient.c: timespec2ntp()
- netutils/ptpd/ptpd.c: ptp_adjtime()
- system/dd/dd_main.c: elapsed accounting
- testing/drivers/drivertest/drivertest_posix_timer.c:
get_timestamp()
- testing/drivers/sd_stress/sd_stress_main.c:get_time_delta()
- testing/sched/getprime/getprime_main.c: elapsed accounting
- testing/sched/pthread_mutex_perf/pthread_mutex_perf.c:
timespec_avg()
Printf-format-fix files (new in this revision):
- examples/adjtime/adjtime_main.c
- examples/charger/charger_main.c
- examples/netpkt/netpkt_ethercat.c
- fsutils/mkfatfs/mkfatfs.c
- graphics/tiff/tiff_initialize.c
- netutils/ptpd/ptpd.c
- nshlib/nsh_timcmds.c
- system/coredump/coredump.c
- system/ptpd/ptpd_main.c
- testing/drivers/drivertest/drivertest_oneshot.c
- testing/mm/kasantest/kasantest.c
- testing/ostest/semtimed.c
- testing/sched/pthread_mutex_perf/pthread_mutex_perf.c
- testing/sched/timerjitter/timerjitter.c
- testing/testsuites/kernel/time/cases/clock_test_clock01.c
- testing/testsuites/kernel/time/cases/clock_test_smoke.c
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Add CMakeLists.txt file for CMake build system integration.
Enables the micro-ROS library module to be built using NuttX CMake
build system alongside traditional Make-based builds.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add Makefile with standard NuttX build system integration. Follows
the MENUDESC + Directory.mk pattern used throughout nuttx-apps.
Enables the system/microros module to be built as part of the apps
directory build process.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
Add Make.defs with copyright header for the micro-ROS library
build system. This establishes the directory structure for Phase 2,
with actual build logic to follow in subsequent steps.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
When ping only receives an IPv6 DNS response, the current command
reports "ping_gethostip" and exits even though ping6 can still
handle the target.
Keep the existing ping and ping6 netutils interfaces unchanged and
add a one-way fallback in the ping command. If IPv4 name resolution
fails, ping will spawn ping6 with the same arguments and let ping6
report the final result.
Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
Add minimal chmod/chown support to NSH using the
existing libc/VFS syscall interfaces.
Supported forms:
- chmod <octal-mode> <path>
- chown <uid>[:gid] <path>
The chown implementation supports the numeric
ownership forms already handled by the underlying
NuttX chown() implementation, including unchanged
uid/gid semantics via omitted fields.
Only numeric permission modes and numeric uid/gid
forms are supported in this initial implementation.
This adds interactive filesystem permission and
ownership management support to NSH and aligns the
shell more closely with standard POSIX environments.
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
This commit enables using `pip` as a pre-compiled (pyc) built-in
distributed along with cpython.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
* Add Rust target conversion support for `aarch64` on acOS/Linux (and Linux `arm`).
* When a Rust target is unsupported and results in an empty configuration, trigger a CMake `FATAL_ERROR`.
Signed-off-by: Shoji Tokunaga <toku@mac.com>
The LTP open_posix_testsuite header timespec.h has, since 2019:
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
When time_t is 64 bits (the default after sched/remove-system-time64),
the shift reaches the sign bit of the underlying type and toolchains
emit -Wshift-count-overflow, which the LTP build promotes to a hard
error via -Werror. This breaks rv-virt/citest and rv-virt/citest64
on CI.
The diagnostic is benign here (TIME_T_MAX itself is correct) and the
defect is in upstream LTP, so disable the warning alongside the other
'should be removed in the future' relaxations until upstream is fixed.
Signed-off-by: xiaoxiang781216 <xiaoxiang781216@gmail.com>
Refactor netlib_check_ipconnectivity() to use gateway/router ping instead
of DNS server ping for network connectivity checks. Add IPv6 support.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Update the column ruler and field labels in route_ipv6_entry comment
to match the actual output: lowercase to uppercase, remove colons.
Consistent with Nuttx definition
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
github infra is not stable so even "git clone" from github repos can fail with error: 500.
With this commit we try to clone repo few more times.
Signed-off-by: raiden00pl <raiden00@railab.me>
Align with the upstream nuttx change that drops the sclock_t alias now
that clock_t is itself a signed 64-bit type (int64_t). Beyond the pure
sclock_t -> clock_t rename, this commit also removes the
now-unnecessary (time_t)-1 / (time_t)0 / (off_t)-1 casts that were
papering over the previously-unsigned time_t.
Files touched:
- examples/alarm/alarm_main.c: sclock_t -> clock_t
- netutils/dhcpd/dhcpd.c: sclock_t -> clock_t
- netutils/ftpd/ftpd.c: sclock_t -> clock_t
- netutils/thttpd/libhttpd.c,
netutils/thttpd/tdate_parse.c: drop (time_t)-1 / (time_t)0 /
(off_t)-1 sentinel casts
- system/resmonitor/filldisk.c,
system/zmodem/zm_receive.c: sclock_t -> clock_t
- testing/ostest/wdog.c: sclock_t -> clock_t (the bulk
of the rename, 30 sites)
- testing/testsuites/kernel/syscall/cases/{clock_nanosleep_test,
fsync_test,time_test}.c: drop (time_t)-1 casts in the
new signed-time_t world
No behavioural change.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>