You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/12 07:16:21 UTC

[nuttx-apps] branch master updated (5a4e9e438 -> dbfe1a33f)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


    from 5a4e9e438 nxrecorder: mode is required when oflags include O_CREAT or O_WRONLY
     new 6e8d83e78 cmake:migrate lely-canopen for cmake build
     new 28a5ecfed cmake:migrate libdronecan for cmake build
     new dbfe1a33f cmake:migrate libopencyphal for cmake build

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 canutils/lely-canopen/CMakeLists.txt               | 235 +++++++++++++++++++++
 .../libdronecan}/CMakeLists.txt                    |  96 ++++-----
 canutils/libopencyphal/CMakeLists.txt              |  75 +++++++
 3 files changed, 355 insertions(+), 51 deletions(-)
 create mode 100644 canutils/lely-canopen/CMakeLists.txt
 copy {benchmarks/coremark => canutils/libdronecan}/CMakeLists.txt (52%)
 create mode 100644 canutils/libopencyphal/CMakeLists.txt


[nuttx-apps] 01/03: cmake:migrate lely-canopen for cmake build

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 6e8d83e7832b59d496c9ba52ae33ad4a518f843f
Author: xuxin19 <xu...@xiaomi.com>
AuthorDate: Fri Aug 11 15:30:58 2023 +0800

    cmake:migrate lely-canopen for cmake build
    
    Signed-off-by: xuxin19 <xu...@xiaomi.com>
---
 canutils/lely-canopen/CMakeLists.txt | 235 +++++++++++++++++++++++++++++++++++
 1 file changed, 235 insertions(+)

diff --git a/canutils/lely-canopen/CMakeLists.txt b/canutils/lely-canopen/CMakeLists.txt
new file mode 100644
index 000000000..ec8ac53c9
--- /dev/null
+++ b/canutils/lely-canopen/CMakeLists.txt
@@ -0,0 +1,235 @@
+# ##############################################################################
+# apps/canutils/lely-canopen/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.  You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# ##############################################################################
+
+if(CONFIG_CANUTILS_LELYCANOPEN)
+
+  # ############################################################################
+  # Config and Fetch lelycanopen lib
+  # ############################################################################
+
+  set(LELYCANOPEN_DIR ${CMAKE_CURRENT_LIST_DIR}/lely-canopen)
+
+  if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/lely-canopen)
+    FetchContent_Declare(
+      lelycanopen_fetch
+      URL ${CONFIG_CANUTILS_LELYCANOPEN_URL}/lely-core-${CONFIG_CANUTILS_LELYCANOPEN_VERSION}.tar.gz
+          SOURCE_DIR
+          ${CMAKE_CURRENT_LIST_DIR}/lely-canopen
+          BINARY_DIR
+          ${CMAKE_BINARY_DIR}/apps/canutils/lely-canopen/lely-canopen
+      DOWNLOAD_NO_PROGRESS true
+      TIMEOUT 30)
+
+    FetchContent_GetProperties(lelycanopen_fetch)
+
+    if(NOT lelycanopen_fetch_POPULATED)
+      FetchContent_Populate(lelycanopen_fetch)
+    endif()
+
+    set(LELYCANOPEN_DIR ${lelycanopen_fetch_SOURCE_DIR})
+
+    if(NOT EXISTS ${LELYCANOPEN_DIR}/.lelycanopen_patch)
+      add_custom_command(
+        OUTPUT ${LELYCANOPEN_DIR}/.lelycanopen_patch
+        COMMAND touch ${LELYCANOPEN_DIR}/.lelycanopen_patch
+        COMMAND
+          patch -p1 -d ${LELYCANOPEN_DIR} <
+          ${CMAKE_CURRENT_LIST_DIR}/0001-NuttX-port.patch > /dev/null || (exit 0
+                                                                         ))
+      add_custom_target(lelycanopen_patch
+                        DEPENDS ${LELYCANOPEN_DIR}/.lelycanopen_patch)
+    endif()
+  endif()
+
+  nuttx_add_library(lelycanopen STATIC)
+
+  # ############################################################################
+  # Flags
+  # ############################################################################
+
+  set(CFLAGS -Wno-shadow -Wno-undef -DHAVE_CONFIG_H=1)
+
+  # ############################################################################
+  # Sources
+  # ############################################################################
+
+  set(CSRCS)
+
+  # CAN network object
+  list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/can/buf.c
+       ${LELYCANOPEN_DIR}/src/can/msg.c ${LELYCANOPEN_DIR}/src/can/vci.c
+       ${LELYCANOPEN_DIR}/src/can/net.c)
+  # CANopen library
+  list(
+    APPEND
+    CSRCS
+    ${LELYCANOPEN_DIR}/src/co/crc.c
+    ${LELYCANOPEN_DIR}/src/co/dev.c
+    ${LELYCANOPEN_DIR}/src/co/nmt.c
+    ${LELYCANOPEN_DIR}/src/co/nmt_hb.c
+    ${LELYCANOPEN_DIR}/src/co/nmt_srv.c
+    ${LELYCANOPEN_DIR}/src/co/obj.c
+    ${LELYCANOPEN_DIR}/src/co/pdo.c
+    ${LELYCANOPEN_DIR}/src/co/sdo.c
+    ${LELYCANOPEN_DIR}/src/co/ssdo.c
+    ${LELYCANOPEN_DIR}/src/co/type.c
+    ${LELYCANOPEN_DIR}/src/co/val.c)
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_TIME)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/time.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_CSDO)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/csdo.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_DCF)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/dcf.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_EMCY)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/emcy.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_GW)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/gw.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_GW_TXT)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/gw_txt.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_LSS)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/lss.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_NMTBOOT)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/nmt_boot.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_NMTCFG)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/nmt_cfg.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_RPDO)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/rpdo.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_SDEV)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/sdev.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_SYNC)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/sync.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_TPDO)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/tpdo.c)
+  endif()
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_WTM)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/co/wtm.c)
+  endif()
+
+  # utils
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_DIAG)
+    list(APPEND CSRCS ${LELYCANOPEN_DIR}/src/util/diag.c)
+  endif()
+
+  list(
+    APPEND
+    CSRCS
+    ${LELYCANOPEN_DIR}/src/util/bits.c
+    ${LELYCANOPEN_DIR}/src/util/bitset.c
+    ${LELYCANOPEN_DIR}/src/util/cmp.c
+    ${LELYCANOPEN_DIR}/src/util/config.c
+    ${LELYCANOPEN_DIR}/src/util/config_ini.c
+    ${LELYCANOPEN_DIR}/src/util/dllist.c
+    ${LELYCANOPEN_DIR}/src/util/endian.c
+    ${LELYCANOPEN_DIR}/src/util/errnum.c
+    ${LELYCANOPEN_DIR}/src/util/frbuf.c
+    ${LELYCANOPEN_DIR}/src/util/fwbuf.c
+    ${LELYCANOPEN_DIR}/src/util/lex.c
+    ${LELYCANOPEN_DIR}/src/util/membuf.c
+    ${LELYCANOPEN_DIR}/src/util/pheap.c
+    ${LELYCANOPEN_DIR}/src/util/print.c
+    ${LELYCANOPEN_DIR}/src/util/rbtree.c
+    ${LELYCANOPEN_DIR}/src/util/stop.c
+    ${LELYCANOPEN_DIR}/src/util/time.c
+    ${LELYCANOPEN_DIR}/src/util/ustring.c)
+
+  # Lely IO lib
+  if(CONFIG_CANUTILS_LELYCANOPEN_IOLIB)
+    list(
+      APPEND
+      CSRCS
+      ${LELYCANOPEN_DIR}/src/io/handle.c
+      ${LELYCANOPEN_DIR}/src/io/io.c
+      ${LELYCANOPEN_DIR}/src/io/pipe.c
+      ${LELYCANOPEN_DIR}/src/io/poll.c
+      ${LELYCANOPEN_DIR}/src/io2/posix/poll.c
+      ${LELYCANOPEN_DIR}/src/io2/ctx.c
+      ${LELYCANOPEN_DIR}/src/io/can.c
+      ${LELYCANOPEN_DIR}/src/can/socket.c)
+  endif()
+
+  # ############################################################################
+  # Include Directory
+  # ############################################################################
+
+  set(INCDIR ${LELYCANOPEN_DIR}/include ${NUTTX_APPS_DIR}/include/canutils/lely)
+
+  # ############################################################################
+  # Applications Configuration
+  # ############################################################################
+
+  if(CONFIG_CANUTILS_LELYCANOPEN_TOOLS_COCTL)
+    nuttx_add_application(
+      NAME
+      coctl
+      PRIORITY
+      ${CONFIG_CANUTILS_LELYCANOPEN_TOOLS_COCTL_PRIORITY}
+      STACKSIZE
+      ${CONFIG_CANUTILS_LELYCANOPEN_TOOLS_COCTL_STACKSIZE}
+      COMPILE_FLAGS
+      ${CFLAGS}
+      SRCS
+      ${LELYCANOPEN_DIR}/tools/coctl.c
+      MODULE
+      ${CONFIG_CANUTILS_LELYCANOPEN}
+      INCLUDE_DIRECTORIES
+      ${INCDIR}
+      DEPENDS
+      lelycanopen)
+  endif()
+
+  # ############################################################################
+  # Library Configuration
+  # ############################################################################
+
+  target_compile_options(lelycanopen PRIVATE ${CFLAGS})
+  target_sources(lelycanopen PRIVATE ${CSRCS})
+  target_include_directories(lelycanopen PRIVATE ${INCDIR})
+  if(TARGET lelycanopen_patch)
+    add_dependencies(lelycanopen lelycanopen_patch)
+  endif()
+
+endif()


[nuttx-apps] 03/03: cmake:migrate libopencyphal for cmake build

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit dbfe1a33f1eb6c29ee5cf2d0ea83d55b3047a6ff
Author: xuxin19 <xu...@xiaomi.com>
AuthorDate: Fri Aug 11 20:03:20 2023 +0800

    cmake:migrate libopencyphal for cmake build
    
    Signed-off-by: xuxin19 <xu...@xiaomi.com>
---
 canutils/libopencyphal/CMakeLists.txt | 75 +++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/canutils/libopencyphal/CMakeLists.txt b/canutils/libopencyphal/CMakeLists.txt
new file mode 100644
index 000000000..41a4bdf6e
--- /dev/null
+++ b/canutils/libopencyphal/CMakeLists.txt
@@ -0,0 +1,75 @@
+# ##############################################################################
+# apps/canutils/libopencyphal/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.  You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# ##############################################################################
+
+if(CONFIG_CANUTILS_LIBOPENCYPHAL)
+
+  # ############################################################################
+  # Config and Fetch libopencyphal o1heap lib
+  # ############################################################################
+
+  set(LIBOPENCYPHAL_DIR ${CMAKE_CURRENT_LIST_DIR}/libcanard)
+  if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcanard)
+    FetchContent_Declare(
+      libcanard_fetch
+      URL ${CONFIG_LIBOPENCYPHAL_URL}/${CONFIG_LIBOPENCYPHAL_VERSION}.zip
+          SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/libcanard BINARY_DIR
+          ${CMAKE_BINARY_DIR}/apps/canutils/libopencyphal/libcanard
+      DOWNLOAD_NO_PROGRESS true
+      TIMEOUT 30)
+    FetchContent_GetProperties(libcanard_fetch)
+    if(NOT libcanard_fetch_POPULATED)
+      FetchContent_Populate(libcanard_fetch)
+    endif()
+    set(LIBOPENCYPHAL_DIR ${libcanard_fetch_SOURCE_DIR})
+  endif()
+
+  set(O1HEAP_DIR ${CMAKE_CURRENT_LIST_DIR}/o1heap)
+  if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/o1heap)
+    FetchContent_Declare(
+      o1heap_fetch
+      URL ${CONFIG_O1HEAP_URL}/${CONFIG_O1HEAP_VERSION}.zip SOURCE_DIR
+          ${CMAKE_CURRENT_LIST_DIR}/o1heap BINARY_DIR
+          ${CMAKE_BINARY_DIR}/apps/canutils/libopencyphal/o1heap
+      DOWNLOAD_NO_PROGRESS true
+      TIMEOUT 30)
+    FetchContent_GetProperties(o1heap_fetch)
+    if(NOT o1heap_fetch_POPULATED)
+      FetchContent_Populate(o1heap_fetch)
+    endif()
+    set(O1HEAP_DIR ${o1heap_fetch_SOURCE_DIR})
+  endif()
+
+  # ############################################################################
+  # Library Configuration
+  # ############################################################################
+
+  nuttx_add_user_library(libopencyphal)
+
+  target_sources(
+    libopencyphal
+    PRIVATE ${LIBOPENCYPHAL_DIR}/libcanard/canard.c
+            ${LIBOPENCYPHAL_DIR}/libcanard/canard_dsdl.c
+            ${O1HEAP_DIR}/o1heap/o1heap.c)
+  target_compile_options(
+    libopencyphal PRIVATE -std=c11 -DCANARD_ASSERT=DEBUGASSERT
+                          -DCANARD_DSDL_CONFIG_LITTLE_ENDIAN=1)
+  target_include_directories(libopencyphal PRIVATE ${O1HEAP_DIR}/o1heap)
+
+endif()


[nuttx-apps] 02/03: cmake:migrate libdronecan for cmake build

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 28a5ecfed1db54de72be1ea77def9d7e41080790
Author: xuxin19 <xu...@xiaomi.com>
AuthorDate: Fri Aug 11 17:07:35 2023 +0800

    cmake:migrate libdronecan for cmake build
    
    Signed-off-by: xuxin19 <xu...@xiaomi.com>
---
 canutils/libdronecan/CMakeLists.txt | 95 +++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/canutils/libdronecan/CMakeLists.txt b/canutils/libdronecan/CMakeLists.txt
new file mode 100644
index 000000000..5aa2afd30
--- /dev/null
+++ b/canutils/libdronecan/CMakeLists.txt
@@ -0,0 +1,95 @@
+# ##############################################################################
+# apps/canutils/libdronecan/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.  You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# ##############################################################################
+
+if(CONFIG_CANUTILS_LIBDRONECAN)
+
+  # ############################################################################
+  # Config and Fetch libdronecan lib
+  # ############################################################################
+
+  set(LIBDRONECAN_DIR ${CMAKE_CURRENT_LIST_DIR}/libcanard)
+
+  if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcanard)
+    FetchContent_Declare(
+      libdronecan_fetch
+      URL ${CONFIG_LIBDRONECAN_URL}/${CONFIG_LIBDRONECAN_VERSION}.zip SOURCE_DIR
+          ${CMAKE_CURRENT_LIST_DIR}/libcanard BINARY_DIR
+          ${CMAKE_BINARY_DIR}/apps/canutils/libdronecan/libcanard
+      DOWNLOAD_NO_PROGRESS true
+      TIMEOUT 30)
+
+    FetchContent_GetProperties(libdronecan_fetch)
+
+    if(NOT libdronecan_fetch_POPULATED)
+      FetchContent_Populate(libdronecan_fetch)
+    endif()
+
+    set(LIBDRONECAN_DIR ${libdronecan_fetch_SOURCE_DIR})
+  endif()
+
+  # ############################################################################
+  # Flags
+  # ############################################################################
+
+  set(CFLAGS -std=c99 -DCANARD_ASSERT=DEBUGASSERT)
+
+  # Conflict with Cyphal's libcanard
+  if(CONFIG_CANUTILS_LIBOPENCYPHAL)
+    list(APPEND CFLAGS -DcanardInit=dronecanardInit)
+  endif()
+
+  if(CONFIG_LIBDRONECAN_CANFD)
+    list(APPEND CFLAGS -DCANARD_ENABLE_CANFD=1)
+  endif()
+
+  # ############################################################################
+  # Sources
+  # ############################################################################
+
+  set(CSRCS ${LIBDRONECAN_DIR}/canard.c)
+
+  if(CONFIG_NET_CAN)
+    list(APPEND CSRCS ${LIBDRONECAN_DIR}/drivers/socketcan/socketcan.c)
+  else()
+    list(APPEND CSRCS ${LIBDRONECAN_DIR}/drivers/nuttx/canard_nuttx.c)
+  endif()
+
+  # ############################################################################
+  # Include Directory
+  # ############################################################################
+
+  set(INCDIR ${NUTTX_APPS_DIR}/canutils/libdronecan/libcanard)
+
+  if(CONFIG_NET_CAN)
+    list(APPEND INCDIR
+         ${NUTTX_APPS_DIR}/canutils/libdronecan/libcanard/drivers/socketcan)
+  endif()
+
+  # ############################################################################
+  # Library Configuration
+  # ############################################################################
+
+  nuttx_add_user_library(libdronecan)
+
+  target_sources(libdronecan PRIVATE ${CSRCS})
+  target_compile_options(libdronecan PRIVATE ${CFLAGS})
+  target_include_directories(libdronecan PRIVATE ${INCDIR})
+
+endif()