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

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


The following commit(s) were added to refs/heads/master by this push:
     new 722f3193c modbus: move freemodbus to a separate directory
722f3193c is described below

commit 722f3193ceb43b11fe7f2d2172402867c48b4f3e
Author: raiden00pl <[email protected]>
AuthorDate: Mon Apr 13 12:07:12 2026 +0200

    modbus: move freemodbus to a separate directory
    
    move freemodbus to modbus/freemodbus so it is possible to add other
    modbus implementations
    
    Signed-off-by: raiden00pl <[email protected]>
---
 modbus/.gitignore                                  |  1 +
 modbus/CMakeLists.txt                              | 80 +---------------------
 modbus/Make.defs                                   |  4 +-
 modbus/Makefile                                    | 24 +------
 modbus/{ => freemodbus}/CMakeLists.txt             |  2 +-
 modbus/{ => freemodbus}/Kconfig                    |  0
 modbus/{ => freemodbus}/Make.defs                  |  4 +-
 modbus/{ => freemodbus}/Makefile                   |  2 +-
 modbus/{ => freemodbus}/ascii/Make.defs            |  4 +-
 modbus/{ => freemodbus}/ascii/mbascii.c            |  0
 modbus/{ => freemodbus}/ascii/mbascii.h            |  0
 modbus/{ => freemodbus}/functions/Make.defs        |  4 +-
 modbus/{ => freemodbus}/functions/mbfunccoils.c    |  0
 modbus/{ => freemodbus}/functions/mbfunccoils_m.c  |  0
 modbus/{ => freemodbus}/functions/mbfuncdiag.c     |  0
 modbus/{ => freemodbus}/functions/mbfuncdisc.c     |  0
 modbus/{ => freemodbus}/functions/mbfuncdisc_m.c   |  0
 modbus/{ => freemodbus}/functions/mbfuncholding.c  |  0
 .../{ => freemodbus}/functions/mbfuncholding_m.c   |  0
 modbus/{ => freemodbus}/functions/mbfuncinput.c    |  0
 modbus/{ => freemodbus}/functions/mbfuncinput_m.c  |  0
 modbus/{ => freemodbus}/functions/mbfuncother.c    |  0
 modbus/{ => freemodbus}/functions/mbutils.c        |  0
 modbus/{ => freemodbus}/mb.c                       |  0
 modbus/{ => freemodbus}/mb_m.c                     |  0
 modbus/{ => freemodbus}/nuttx/Make.defs            |  4 +-
 modbus/{ => freemodbus}/nuttx/port.h               |  0
 modbus/{ => freemodbus}/nuttx/portevent.c          |  0
 modbus/{ => freemodbus}/nuttx/portevent_m.c        |  0
 modbus/{ => freemodbus}/nuttx/portother.c          |  0
 modbus/{ => freemodbus}/nuttx/portother_m.c        |  0
 modbus/{ => freemodbus}/nuttx/portserial.c         |  0
 modbus/{ => freemodbus}/nuttx/portserial_m.c       |  0
 modbus/{ => freemodbus}/nuttx/porttimer.c          |  0
 modbus/{ => freemodbus}/nuttx/porttimer_m.c        |  0
 modbus/{ => freemodbus}/rtu/Make.defs              |  4 +-
 modbus/{ => freemodbus}/rtu/mbcrc.c                |  0
 modbus/{ => freemodbus}/rtu/mbcrc.h                |  0
 modbus/{ => freemodbus}/rtu/mbrtu.c                |  0
 modbus/{ => freemodbus}/rtu/mbrtu.h                |  0
 modbus/{ => freemodbus}/rtu/mbrtu_m.c              |  0
 modbus/{ => freemodbus}/rtu/mbrtu_m.h              |  0
 modbus/{ => freemodbus}/tcp/Make.defs              |  4 +-
 modbus/{ => freemodbus}/tcp/mbtcp.c                |  0
 modbus/{ => freemodbus}/tcp/mbtcp.h                |  0
 45 files changed, 20 insertions(+), 117 deletions(-)

diff --git a/modbus/.gitignore b/modbus/.gitignore
new file mode 100644
index 000000000..9e1d2593e
--- /dev/null
+++ b/modbus/.gitignore
@@ -0,0 +1 @@
+/Kconfig
diff --git a/modbus/CMakeLists.txt b/modbus/CMakeLists.txt
index edba762df..781050084 100644
--- a/modbus/CMakeLists.txt
+++ b/modbus/CMakeLists.txt
@@ -20,82 +20,6 @@
 #
 # 
##############################################################################
 
-if(CONFIG_MODBUS)
+nuttx_add_subdirectory()
 
-  set(CSRCS)
-
-  if(CONFIG_MODBUS_SLAVE)
-    list(APPEND CSRCS mb.c)
-  endif()
-
-  if(CONFIG_MB_RTU_MASTER)
-    list(APPEND CSRCS mb_m.c)
-  endif()
-
-  # ascii/Make.defs
-
-  if(CONFIG_MB_ASCII_ENABLED)
-    list(APPEND CSRCS ascii/mbascii.c)
-  endif()
-
-  # functions/Make.defs
-
-  list(
-    APPEND
-    CSRCS
-    functions/mbfunccoils.c
-    functions/mbfuncdiag.c
-    functions/mbfuncdisc.c
-    functions/mbfuncholding.c
-    functions/mbfuncinput.c
-    functions/mbfuncother.c
-    functions/mbutils.c)
-
-  if(CONFIG_MB_ASCII_MASTER)
-    list(APPEND CSRCS functions/mbfunccoils_m.c functions/mbfuncdisc_m.c
-         functions/mbfuncholding_m.c functions/mbfuncinput_m.c)
-  elseif(CONFIG_MB_RTU_MASTER)
-    list(APPEND CSRCS functions/mbfunccoils_m.c functions/mbfuncdisc_m.c
-         functions/mbfuncholding_m.c functions/mbfuncinput_m.c)
-  endif()
-
-  # nuttx/Make.defs
-
-  list(APPEND CSRCS nuttx/portother.c)
-
-  if(CONFIG_MODBUS_SLAVE)
-    list(APPEND CSRCS nuttx/portevent.c nuttx/portserial.c nuttx/porttimer.c)
-  endif()
-
-  if(CONFIG_MB_RTU_MASTER)
-    list(APPEND CSRCS nuttx/portother_m.c nuttx/portserial_m.c
-         nuttx/porttimer_m.c nuttx/portevent_m.c)
-  endif()
-
-  # rtu/Make.defs
-
-  if(CONFIG_MB_RTU_ENABLED OR CONFIG_MB_RTU_MASTER)
-    list(APPEND CSRCS rtu/mbcrc.c)
-    if(CONFIG_MB_RTU_ENABLED)
-      list(APPEND CSRCS rtu/mbrtu.c)
-    endif()
-
-    if(CONFIG_MB_RTU_MASTER)
-      list(APPEND CSRCS rtu/mbrtu_m.c)
-    endif()
-  endif()
-
-  # tcp/Make.defs
-
-  if(CONFIG_MB_TCP_ENABLED)
-    list(APPEND CSRCS tcp/mbtcp.c)
-  endif()
-
-  # include private headers
-
-  target_include_directories(apps PRIVATE nuttx)
-  target_include_directories(apps PRIVATE rtu)
-
-  target_sources(apps PRIVATE ${CSRCS})
-
-endif()
+nuttx_generate_kconfig(MENUDESC "Modbus")
diff --git a/modbus/Make.defs b/modbus/Make.defs
index 10fd914c3..03e07693a 100644
--- a/modbus/Make.defs
+++ b/modbus/Make.defs
@@ -20,6 +20,4 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_MODBUS),)
-CONFIGURED_APPS += $(APPDIR)/modbus
-endif
+include $(wildcard $(APPDIR)/modbus/*/Make.defs)
diff --git a/modbus/Makefile b/modbus/Makefile
index ce7eac1d5..5858b4b4a 100644
--- a/modbus/Makefile
+++ b/modbus/Makefile
@@ -20,26 +20,6 @@
 #
 ############################################################################
 
-include $(APPDIR)/Make.defs
+MENUDESC = "Modbus"
 
-# FreeModBus Library
-
-ifeq ($(CONFIG_MODBUS),y)
-
-  ifeq ($(CONFIG_MODBUS_SLAVE),y)
-    CSRCS += mb.c
-  endif
-
-  ifeq ($(CONFIG_MB_RTU_MASTER),y)
-    CSRCS += mb_m.c
-  endif
-
-  include ascii/Make.defs
-  include functions/Make.defs
-  include nuttx/Make.defs
-  include rtu/Make.defs
-  include tcp/Make.defs
-
-endif
-
-include $(APPDIR)/Application.mk
+include $(APPDIR)/Directory.mk
diff --git a/modbus/CMakeLists.txt b/modbus/freemodbus/CMakeLists.txt
similarity index 98%
copy from modbus/CMakeLists.txt
copy to modbus/freemodbus/CMakeLists.txt
index edba762df..a9980f597 100644
--- a/modbus/CMakeLists.txt
+++ b/modbus/freemodbus/CMakeLists.txt
@@ -1,5 +1,5 @@
 # 
##############################################################################
-# apps/modbus/CMakeLists.txt
+# apps/modbus/freemodbus/CMakeLists.txt
 #
 # SPDX-License-Identifier: Apache-2.0
 #
diff --git a/modbus/Kconfig b/modbus/freemodbus/Kconfig
similarity index 100%
rename from modbus/Kconfig
rename to modbus/freemodbus/Kconfig
diff --git a/modbus/Make.defs b/modbus/freemodbus/Make.defs
similarity index 92%
copy from modbus/Make.defs
copy to modbus/freemodbus/Make.defs
index 10fd914c3..6eac9db77 100644
--- a/modbus/Make.defs
+++ b/modbus/freemodbus/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/Make.defs
+# apps/modbus/freemodbus/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -21,5 +21,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_MODBUS),)
-CONFIGURED_APPS += $(APPDIR)/modbus
+CONFIGURED_APPS += $(APPDIR)/modbus/freemodbus
 endif
diff --git a/modbus/Makefile b/modbus/freemodbus/Makefile
similarity index 97%
copy from modbus/Makefile
copy to modbus/freemodbus/Makefile
index ce7eac1d5..6d45f7650 100644
--- a/modbus/Makefile
+++ b/modbus/freemodbus/Makefile
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/Makefile
+# apps/modbus/freemodbus/Makefile
 #
 # SPDX-License-Identifier: Apache-2.0
 #
diff --git a/modbus/ascii/Make.defs b/modbus/freemodbus/ascii/Make.defs
similarity index 91%
rename from modbus/ascii/Make.defs
rename to modbus/freemodbus/ascii/Make.defs
index 972cd903f..2f2745828 100644
--- a/modbus/ascii/Make.defs
+++ b/modbus/freemodbus/ascii/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/ascii/Make.defs
+# apps/modbus/freemodbus/ascii/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -26,6 +26,6 @@ CSRCS += mbascii.c
 
 DEPPATH += --dep-path ascii
 VPATH += :ascii
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/ascii
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/freemodbus/ascii
 
 endif
diff --git a/modbus/ascii/mbascii.c b/modbus/freemodbus/ascii/mbascii.c
similarity index 100%
rename from modbus/ascii/mbascii.c
rename to modbus/freemodbus/ascii/mbascii.c
diff --git a/modbus/ascii/mbascii.h b/modbus/freemodbus/ascii/mbascii.h
similarity index 100%
rename from modbus/ascii/mbascii.h
rename to modbus/freemodbus/ascii/mbascii.h
diff --git a/modbus/functions/Make.defs b/modbus/freemodbus/functions/Make.defs
similarity index 92%
rename from modbus/functions/Make.defs
rename to modbus/freemodbus/functions/Make.defs
index a4e6ea90c..c59393a2a 100644
--- a/modbus/functions/Make.defs
+++ b/modbus/freemodbus/functions/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/functions/Make.defs
+# apps/modbus/freemodbus/functions/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -33,4 +33,4 @@ endif
 
 DEPPATH += --dep-path functions
 VPATH += :functions
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/functions
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/freemodbus/functions
diff --git a/modbus/functions/mbfunccoils.c 
b/modbus/freemodbus/functions/mbfunccoils.c
similarity index 100%
rename from modbus/functions/mbfunccoils.c
rename to modbus/freemodbus/functions/mbfunccoils.c
diff --git a/modbus/functions/mbfunccoils_m.c 
b/modbus/freemodbus/functions/mbfunccoils_m.c
similarity index 100%
rename from modbus/functions/mbfunccoils_m.c
rename to modbus/freemodbus/functions/mbfunccoils_m.c
diff --git a/modbus/functions/mbfuncdiag.c 
b/modbus/freemodbus/functions/mbfuncdiag.c
similarity index 100%
rename from modbus/functions/mbfuncdiag.c
rename to modbus/freemodbus/functions/mbfuncdiag.c
diff --git a/modbus/functions/mbfuncdisc.c 
b/modbus/freemodbus/functions/mbfuncdisc.c
similarity index 100%
rename from modbus/functions/mbfuncdisc.c
rename to modbus/freemodbus/functions/mbfuncdisc.c
diff --git a/modbus/functions/mbfuncdisc_m.c 
b/modbus/freemodbus/functions/mbfuncdisc_m.c
similarity index 100%
rename from modbus/functions/mbfuncdisc_m.c
rename to modbus/freemodbus/functions/mbfuncdisc_m.c
diff --git a/modbus/functions/mbfuncholding.c 
b/modbus/freemodbus/functions/mbfuncholding.c
similarity index 100%
rename from modbus/functions/mbfuncholding.c
rename to modbus/freemodbus/functions/mbfuncholding.c
diff --git a/modbus/functions/mbfuncholding_m.c 
b/modbus/freemodbus/functions/mbfuncholding_m.c
similarity index 100%
rename from modbus/functions/mbfuncholding_m.c
rename to modbus/freemodbus/functions/mbfuncholding_m.c
diff --git a/modbus/functions/mbfuncinput.c 
b/modbus/freemodbus/functions/mbfuncinput.c
similarity index 100%
rename from modbus/functions/mbfuncinput.c
rename to modbus/freemodbus/functions/mbfuncinput.c
diff --git a/modbus/functions/mbfuncinput_m.c 
b/modbus/freemodbus/functions/mbfuncinput_m.c
similarity index 100%
rename from modbus/functions/mbfuncinput_m.c
rename to modbus/freemodbus/functions/mbfuncinput_m.c
diff --git a/modbus/functions/mbfuncother.c 
b/modbus/freemodbus/functions/mbfuncother.c
similarity index 100%
rename from modbus/functions/mbfuncother.c
rename to modbus/freemodbus/functions/mbfuncother.c
diff --git a/modbus/functions/mbutils.c b/modbus/freemodbus/functions/mbutils.c
similarity index 100%
rename from modbus/functions/mbutils.c
rename to modbus/freemodbus/functions/mbutils.c
diff --git a/modbus/mb.c b/modbus/freemodbus/mb.c
similarity index 100%
rename from modbus/mb.c
rename to modbus/freemodbus/mb.c
diff --git a/modbus/mb_m.c b/modbus/freemodbus/mb_m.c
similarity index 100%
rename from modbus/mb_m.c
rename to modbus/freemodbus/mb_m.c
diff --git a/modbus/nuttx/Make.defs b/modbus/freemodbus/nuttx/Make.defs
similarity index 92%
rename from modbus/nuttx/Make.defs
rename to modbus/freemodbus/nuttx/Make.defs
index 7960ecee4..723284cc4 100644
--- a/modbus/nuttx/Make.defs
+++ b/modbus/freemodbus/nuttx/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/nuttx/Make.defs
+# apps/modbus/freemodbus/nuttx/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -32,4 +32,4 @@ endif
 
 DEPPATH += --dep-path nuttx
 VPATH += :nuttx
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/nuttx
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/freemodbus/nuttx
diff --git a/modbus/nuttx/port.h b/modbus/freemodbus/nuttx/port.h
similarity index 100%
rename from modbus/nuttx/port.h
rename to modbus/freemodbus/nuttx/port.h
diff --git a/modbus/nuttx/portevent.c b/modbus/freemodbus/nuttx/portevent.c
similarity index 100%
rename from modbus/nuttx/portevent.c
rename to modbus/freemodbus/nuttx/portevent.c
diff --git a/modbus/nuttx/portevent_m.c b/modbus/freemodbus/nuttx/portevent_m.c
similarity index 100%
rename from modbus/nuttx/portevent_m.c
rename to modbus/freemodbus/nuttx/portevent_m.c
diff --git a/modbus/nuttx/portother.c b/modbus/freemodbus/nuttx/portother.c
similarity index 100%
rename from modbus/nuttx/portother.c
rename to modbus/freemodbus/nuttx/portother.c
diff --git a/modbus/nuttx/portother_m.c b/modbus/freemodbus/nuttx/portother_m.c
similarity index 100%
rename from modbus/nuttx/portother_m.c
rename to modbus/freemodbus/nuttx/portother_m.c
diff --git a/modbus/nuttx/portserial.c b/modbus/freemodbus/nuttx/portserial.c
similarity index 100%
rename from modbus/nuttx/portserial.c
rename to modbus/freemodbus/nuttx/portserial.c
diff --git a/modbus/nuttx/portserial_m.c 
b/modbus/freemodbus/nuttx/portserial_m.c
similarity index 100%
rename from modbus/nuttx/portserial_m.c
rename to modbus/freemodbus/nuttx/portserial_m.c
diff --git a/modbus/nuttx/porttimer.c b/modbus/freemodbus/nuttx/porttimer.c
similarity index 100%
rename from modbus/nuttx/porttimer.c
rename to modbus/freemodbus/nuttx/porttimer.c
diff --git a/modbus/nuttx/porttimer_m.c b/modbus/freemodbus/nuttx/porttimer_m.c
similarity index 100%
rename from modbus/nuttx/porttimer_m.c
rename to modbus/freemodbus/nuttx/porttimer_m.c
diff --git a/modbus/rtu/Make.defs b/modbus/freemodbus/rtu/Make.defs
similarity index 93%
rename from modbus/rtu/Make.defs
rename to modbus/freemodbus/rtu/Make.defs
index ac4ab7e2a..43576f993 100644
--- a/modbus/rtu/Make.defs
+++ b/modbus/freemodbus/rtu/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/rtu/Make.defs
+# apps/modbus/freemodbus/rtu/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -40,6 +40,6 @@ endif
 
 DEPPATH += --dep-path rtu
 VPATH += :rtu
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/rtu
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/freemodbus/rtu
 
 endif
diff --git a/modbus/rtu/mbcrc.c b/modbus/freemodbus/rtu/mbcrc.c
similarity index 100%
rename from modbus/rtu/mbcrc.c
rename to modbus/freemodbus/rtu/mbcrc.c
diff --git a/modbus/rtu/mbcrc.h b/modbus/freemodbus/rtu/mbcrc.h
similarity index 100%
rename from modbus/rtu/mbcrc.h
rename to modbus/freemodbus/rtu/mbcrc.h
diff --git a/modbus/rtu/mbrtu.c b/modbus/freemodbus/rtu/mbrtu.c
similarity index 100%
rename from modbus/rtu/mbrtu.c
rename to modbus/freemodbus/rtu/mbrtu.c
diff --git a/modbus/rtu/mbrtu.h b/modbus/freemodbus/rtu/mbrtu.h
similarity index 100%
rename from modbus/rtu/mbrtu.h
rename to modbus/freemodbus/rtu/mbrtu.h
diff --git a/modbus/rtu/mbrtu_m.c b/modbus/freemodbus/rtu/mbrtu_m.c
similarity index 100%
rename from modbus/rtu/mbrtu_m.c
rename to modbus/freemodbus/rtu/mbrtu_m.c
diff --git a/modbus/rtu/mbrtu_m.h b/modbus/freemodbus/rtu/mbrtu_m.h
similarity index 100%
rename from modbus/rtu/mbrtu_m.h
rename to modbus/freemodbus/rtu/mbrtu_m.h
diff --git a/modbus/tcp/Make.defs b/modbus/freemodbus/tcp/Make.defs
similarity index 91%
rename from modbus/tcp/Make.defs
rename to modbus/freemodbus/tcp/Make.defs
index dfd220f41..b9f82c6de 100644
--- a/modbus/tcp/Make.defs
+++ b/modbus/freemodbus/tcp/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/modbus/tcp/Make.defs
+# apps/modbus/freemodbus/tcp/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -26,6 +26,6 @@ CSRCS += mbtcp.c
 
 DEPPATH += --dep-path tcp
 VPATH += :tcp
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/tcp
+CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/modbus/freemodbus/tcp
 
 endif
diff --git a/modbus/tcp/mbtcp.c b/modbus/freemodbus/tcp/mbtcp.c
similarity index 100%
rename from modbus/tcp/mbtcp.c
rename to modbus/freemodbus/tcp/mbtcp.c
diff --git a/modbus/tcp/mbtcp.h b/modbus/freemodbus/tcp/mbtcp.h
similarity index 100%
rename from modbus/tcp/mbtcp.h
rename to modbus/freemodbus/tcp/mbtcp.h

Reply via email to