Micro XRCE-DDS expects the application to supply open/close/write/read
callbacks for the wire transport. Add a single dispatcher that
registers the selected backend via rmw_uros_set_custom_transport(),
plus two backends:
transport/microros_transport_udp.c
BSD-socket UDP backend. Opens an AF_INET/SOCK_DGRAM socket,
resolves CONFIG_MICROROS_AGENT_IP/PORT, connect()s it, and uses
send/recv. The socket fd is stashed in uxrCustomTransport->args
so no module-level state is needed.
transport/microros_transport_serial.c
termios serial backend. Opens CONFIG_MICROROS_SERIAL_DEVICE with
O_RDWR|O_NOCTTY|O_CLOEXEC, switches to raw 8N1 at
CONFIG_MICROROS_SERIAL_BAUD, and uses poll/read/write. Fd is
again stashed in uxrCustomTransport->args.
Both backends are mutually exclusive at compile time via Kconfig;
the dispatcher selects which set of callbacks to register. Wired
into both the legacy Make build (CSRCS in system/microros/Makefile)
and the CMake build (separate microros_transport static library
with the transport directory only exposed to its INTERFACE).
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
libmicroros is installed by colcon under include/<pkg>/<pkg>/file.h
for ament-packaged headers (e.g. rcl, rmw, rosidl) and the flat
include/<pkg>/file.h for a few others (e.g. rclc). A single
-I include/ therefore resolves <rclc/rclc.h> but not <rcl/rcl.h>.
Enumerate every immediate subdirectory of include/ in addition to
include/ itself so both layouts resolve.
Switch the library hand-off from LDLIBS to EXTRA_LIBS. The sim
target's final link pulls EXTRA_LIBS, not LDLIBS, so the previous
form left rcl/rclc/rcutils symbols unresolved.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
micro_ros_lib/toolchain.cmake.in initialised C and CXX flags with
-D'__attribute__(x)=' to silence GCC attributes the upstream ament
build is not aware of. The strip also removed __gnu_inline__ and
__always_inline__ from NuttX's libc string.h inlines, so each
micro-ROS translation unit emitted external definitions of strcmp,
strcpy, strlen and friends. Sim final link then failed with ~50
multiple-definition errors.
Drop the define from both flag init lines so the attributes survive
and the inlines collapse as intended.
Signed-off-by: Arjav Patel <arjav1528@gmail.com>
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>
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>