feat(drivers): upgrade NuttX to 12.12.0

sitl: fix NuttX 11.12.0 upgrade regressions

drivers: uavcan: fix TFLM c library conflict

With NuttX 12.12.0 the TFLM c library causes a conflict
This commit is contained in:
Peter van der Perk
2026-02-24 11:53:53 +01:00
parent d984305aae
commit 386b241423
26 changed files with 79 additions and 32 deletions
@@ -393,7 +393,7 @@ int AuterionAutostarter::start(const char *start_command, const char **start_arg
int status = PX4_ERROR;
if (start_command != nullptr) {
int pid = exec_builtin(start_command, (char **)start_argv, NULL, 0);
int pid = exec_builtin(start_command, (char **)start_argv, NULL);
if (pid != -1) {
waitpid(pid, &status, WUNTRACED);
@@ -166,7 +166,7 @@ void CdcAcmAutostart::state_connected()
sched_lock();
static const char app[] {"mavlink"};
static const char *stop_argv[] {"mavlink", "stop", "-d", USB_DEVICE_PATH, NULL};
exec_builtin(app, (char **)stop_argv, NULL, 0);
exec_builtin(app, (char **)stop_argv, NULL);
sched_unlock();
_state = UsbAutoStartState::disconnecting;
}
@@ -546,7 +546,7 @@ int CdcAcmAutostart::execute_process(char **argv)
int pid = -1;
sched_lock();
pid = exec_builtin(argv[0], argv, nullptr, 0);
pid = exec_builtin(argv[0], argv, nullptr);
sched_unlock();
return pid;
-1
View File
@@ -44,7 +44,6 @@
#include <sys/socket.h>
#include <nuttx/can.h>
#include <netpacket/can.h>
#include <canard.h>
+1 -1
View File
@@ -41,7 +41,7 @@
#define PNP_UNIQUE_ID_SIZE 16 // 128 bit unique id
#include <crc64.h>
#include <nuttx/crc64.h>
#include "NodeClient.hpp"
void NodeClient::callback(const CanardRxTransfer &receive)
+1 -1
View File
@@ -45,7 +45,7 @@
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <px4_platform_common/sem.hpp>
#include <crc32.h>
#include <nuttx/crc32.h>
#include <drivers/device/device.h>
#include <drivers/drv_hrt.h>
+1 -1
View File
@@ -55,7 +55,7 @@
#include <sys/stat.h>
#include <nuttx/arch.h>
#include <crc32.h>
#include <nuttx/crc32.h>
#include "uploader.h"
+1 -1
View File
@@ -58,7 +58,7 @@
#include <termios.h>
#include <sys/stat.h>
#include <nuttx/arch.h>
#include <crc32.h>
#include <nuttx/crc32.h>
#include <drivers/drv_hrt.h>
#include <sys/ioctl.h>
+7 -1
View File
@@ -71,6 +71,12 @@ if(NOT config_uavcan_num_ifaces)
message(FATAL_ERROR "config_uavcan_num_ifaces not set")
endif()
if(CONFIG_LIB_TFLM)
set(UAVCAN_IMPLEMENT_PLACEMENT_NEW 0)
else()
set(UAVCAN_IMPLEMENT_PLACEMENT_NEW 1)
endif()
string(TOUPPER "${PX4_PLATFORM}" OS_UPPER)
string(TOUPPER "${UAVCAN_DRIVER}" UAVCAN_DRIVER_UPPER)
add_definitions(
@@ -80,7 +86,7 @@ add_definitions(
-DUAVCAN_NUM_IFACES=${config_uavcan_num_ifaces}
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
-DUAVCAN_DRIVER=uavcan_${UAVCAN_DRIVER}
-DUAVCAN_IMPLEMENT_PLACEMENT_NEW=1
-DUAVCAN_IMPLEMENT_PLACEMENT_NEW=${UAVCAN_IMPLEMENT_PLACEMENT_NEW}
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
-DUAVCAN_NO_ASSERTIONS
-DUAVCAN_PLATFORM=${UAVCAN_PLATFORM}
@@ -51,7 +51,9 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
void BusEvent::signalFromInterrupt()
{
if (sem_.semcount <= 0) {
int semcount;
if (sem_getvalue(&sem_, &semcount) == 0 && semcount <= 0) {
(void)sem_post(&sem_);
}
@@ -42,7 +42,6 @@
#include <sys/socket.h>
#include <nuttx/can.h>
#include <netpacket/can.h>
namespace uavcan_socketcan
{
@@ -49,7 +49,6 @@
#include <string.h>
#include <nuttx/can.h>
#include <netpacket/can.h>
#define MODULE_NAME "UAVCAN_SOCKETCAN"
@@ -79,7 +79,9 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
void BusEvent::signalFromInterrupt()
{
if (sem_.semcount <= 0) {
int semcount;
if (sem_getvalue(&sem_, &semcount) == 0 && semcount <= 0) {
(void)sem_post(&sem_);
}
@@ -53,7 +53,9 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
void BusEvent::signalFromInterrupt()
{
if (sem_.semcount <= 0) {
int semcount;
if (sem_getvalue(&sem_, &semcount) == 0 && semcount <= 0) {
(void)sem_post(&sem_);
}
@@ -53,7 +53,9 @@ bool BusEvent::wait(uavcan::MonotonicDuration duration)
void BusEvent::signalFromInterrupt()
{
if (sem_.semcount <= 0) {
int semcount;
if (sem_getvalue(&sem_, &semcount) == 0 && semcount <= 0) {
(void)sem_post(&sem_);
}
+21 -1
View File
@@ -287,11 +287,21 @@ CDev::poll(file_t *filep, px4_pollfd_struct_t *fds, bool setup)
*/
fds->revents |= fds->events & poll_state(filep);
/* yes? post the notification */
/* yes? invoke the callback */
#ifdef __PX4_NUTTX
if (fds->revents != 0 && fds->cb != nullptr) {
fds->cb(fds);
}
#else
if (fds->revents != 0) {
px4_sem_post(fds->sem);
}
#endif
}
ATOMIC_LEAVE;
@@ -335,9 +345,19 @@ CDev::poll_notify_one(px4_pollfd_struct_t *fds, px4_pollevent_t events)
PX4_DEBUG(" Events fds=%p %0x %0x %0x", fds, fds->revents, fds->events, events);
#ifdef __PX4_NUTTX
if (fds->revents != 0 && fds->cb != nullptr) {
fds->cb(fds);
}
#else
if (fds->revents != 0) {
px4_sem_post(fds->sem);
}
#endif
}
int
+6 -10
View File
@@ -87,10 +87,6 @@ unlink : nullptr
static int
cdev_open(file_t *filp)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
return -ENODEV;
}
cdev::CDev *cdev = (cdev::CDev *)(filp->f_inode->i_private);
return cdev->open(filp);
@@ -99,7 +95,7 @@ cdev_open(file_t *filp)
static int
cdev_close(file_t *filp)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
@@ -111,7 +107,7 @@ cdev_close(file_t *filp)
static ssize_t
cdev_read(file_t *filp, char *buffer, size_t buflen)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
@@ -123,7 +119,7 @@ cdev_read(file_t *filp, char *buffer, size_t buflen)
static ssize_t
cdev_write(file_t *filp, const char *buffer, size_t buflen)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
@@ -135,7 +131,7 @@ cdev_write(file_t *filp, const char *buffer, size_t buflen)
static off_t
cdev_seek(file_t *filp, off_t offset, int whence)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
@@ -147,7 +143,7 @@ cdev_seek(file_t *filp, off_t offset, int whence)
static int
cdev_ioctl(file_t *filp, int cmd, unsigned long arg)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
@@ -159,7 +155,7 @@ cdev_ioctl(file_t *filp, int cmd, unsigned long arg)
static int
cdev_poll(file_t *filp, px4_pollfd_struct_t *fds, bool setup)
{
if ((filp->f_inode->i_flags & FSNODEFLAG_DELETED) != 0) {
if ((filp->f_inode->i_crefs) == 0) {
return -ENODEV;
}
+1 -1
View File
@@ -44,7 +44,7 @@
#include <px4_platform_common/defines.h>
#include <px4_platform_common/posix.h>
#include <crc32.h>
#include <nuttx/crc32.h>
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
+1 -1
View File
@@ -48,7 +48,7 @@
#include <px4_platform_common/defines.h>
#include <px4_platform_common/posix.h>
#include <crc32.h>
#include <nuttx/crc32.h>
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
+4
View File
@@ -47,7 +47,11 @@
#include <parameters/px4_parameters.hpp>
#include <lib/tinybson/tinybson.h>
#if defined(__PX4_NUTTX)
#include <nuttx/crc32.h>
#else
#include <crc32.h>
#endif
#include <float.h>
#include <math.h>
+2 -2
View File
@@ -258,7 +258,7 @@ typedef struct {
_stack_s interrupt;
#endif
} stack_t;
} px4_stack_t;
/* Not Used for reference only */
@@ -371,7 +371,7 @@ typedef struct {
int pid; /* Process ID */
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
fault_regs_s fault_regs; /* NVIC status */
stack_t stacks; /* Stack info */
px4_stack_t stacks; /* Stack info */
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
* terminator) */
+4
View File
@@ -34,7 +34,11 @@
/// @file mavlink_ftp.cpp
/// @author px4dev, Don Gagne <don@thegagnes.com>
#if defined(__PX4_NUTTX)
#include <nuttx/crc32.h>
#else
#include <crc32.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
+1 -1
View File
@@ -37,7 +37,7 @@
/// @author px4dev, Don Gagne <don@thegagnes.com>
#include <dirent.h>
#include <queue.h>
#include <sys/queue.h>
#include <px4_platform_common/defines.h>
#include <systemlib/err.h>
+4
View File
@@ -53,7 +53,11 @@
#include <navigator/navigation.h>
#include <uORB/topics/mission.h>
#include <uORB/topics/mission_result.h>
#if defined(__PX4_NUTTX)
#include <nuttx/crc32.h>
#else
#include <crc32.h>
#endif
using matrix::wrap_2pi;
+4
View File
@@ -43,7 +43,11 @@
#include "navigation.h"
#include <ctype.h>
#if defined(__PX4_NUTTX)
#include <nuttx/crc32.h>
#else
#include <crc32.h>
#endif
#include <dataman_client/DatamanClient.hpp>
#include <drivers/drv_hrt.h>
+1 -1
View File
@@ -48,7 +48,7 @@
#include <malloc.h>
#include <poll.h>
#include <signal.h>
#include <crc32.h>
#include <nuttx/crc32.h>
#include <syslog.h>
#include <drivers/drv_pwm_output.h>
@@ -62,6 +62,10 @@ else()
set(lib_dir "lib")
endif()
if(PX4_PLATFORM STREQUAL "nuttx")
set(c_flags_with_includes "${c_flags_with_includes} -Wno-cast-align -D__PX4_NUTTX")
endif()
include(ExternalProject)
ExternalProject_Add(
libmicroxrceddsclient_project