This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 72f57fc34e543dc91b3b5a5c2a8b6a088479e373 Author: Jiri Vlasak <[email protected]> AuthorDate: Wed Jan 21 10:13:10 2026 +0100 netutils: Add BARE BARE is a simple binary representation for structured application data. cbare, the BARE implementation ported by this commit, is an I/O agnostic C implementation of the BARE message encoding. Signed-off-by: Jiri Vlasak <[email protected]> --- LICENSE | 26 +++++++++++++ netutils/bare/Kconfig | 22 +++++++++++ netutils/bare/Make.defs | 27 ++++++++++++++ netutils/bare/Makefile | 58 +++++++++++++++++++++++++++++ netutils/bare/cbare_porting_for_nuttx.patch | 28 ++++++++++++++ 5 files changed, 161 insertions(+) diff --git a/LICENSE b/LICENSE index 61fb28ab4..429bd3339 100644 --- a/LICENSE +++ b/LICENSE @@ -2248,3 +2248,29 @@ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +netutils/bare/ +============== + +MIT License + +Copyright (c) 2022 Frank Smit + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/netutils/bare/Kconfig b/netutils/bare/Kconfig new file mode 100644 index 000000000..2f0fa3df2 --- /dev/null +++ b/netutils/bare/Kconfig @@ -0,0 +1,22 @@ +config NETUTILS_BARE + bool "Binary Application Record Encoding (BARE)" + default n + depends on ALLOW_MIT_COMPONENTS + ---help--- + BARE is a simple binary representation for structured + application data. + + See https://baremessages.org/ + + cbare is an MIT-licensed I/O agnostic C implementation of the + BARE message encoding that is used when this option is enabled. + +if NETUTILS_BARE + +config NETUTILS_BARE_TEST + bool "Enable baretest" + default n + ---help--- + Enable baretest -- BARE test application. + +endif diff --git a/netutils/bare/Make.defs b/netutils/bare/Make.defs new file mode 100644 index 000000000..9a6b4f538 --- /dev/null +++ b/netutils/bare/Make.defs @@ -0,0 +1,27 @@ +############################################################################ +# apps/netutils/bare/Make.defs +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +############################################################################ + +ifneq ($(CONFIG_NETUTILS_BARE),) +CONFIGURED_APPS += $(APPDIR)/netutils/bare +CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/netutils/bare/cbare/src +CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/netutils/bare/cbare/src +endif diff --git a/netutils/bare/Makefile b/netutils/bare/Makefile new file mode 100644 index 000000000..e851edf15 --- /dev/null +++ b/netutils/bare/Makefile @@ -0,0 +1,58 @@ +############################################################################ +# apps/netutils/bare/Makefile +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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. +# +############################################################################ + +include $(APPDIR)/Make.defs + +BARE_CBARE_DIR = cbare + +DEPPATH += --dep-path $(BARE_CBARE_DIR)$(DELIM)src +VPATH += :$(BARE_CBARE_DIR)$(DELIM)src + +CFLAGS += -I$(BARE_CBARE_DIR)/src + +CSRCS = $(BARE_CBARE_DIR)/src/alloc.c +CSRCS += $(BARE_CBARE_DIR)/src/cbare.c +CSRCS += $(BARE_CBARE_DIR)/src/die.c + +ifneq ($(CONFIG_NETUTILS_BARE_TEST),) + +PROGNAME = baretest +PRIORITY = 100 +STACKSIZE = 2048 +MODULE = y + +MAINSRC = $(BARE_CBARE_DIR)/test/baretest.c + +endif + +$(BARE_CBARE_DIR): + $(Q) echo "Cloning cbare repo..." + $(Q) git clone --depth=1 https://git.sr.ht/~fsx/cbare + $(Q) patch -p1 --directory=cbare < cbare_porting_for_nuttx.patch + $(Q) touch $(BARE_CBARE_DIR) + +context:: $(BARE_CBARE_DIR) + +distclean:: + $(call DELDIR, $(BARE_CBARE_DIR)) + +include $(APPDIR)/Application.mk diff --git a/netutils/bare/cbare_porting_for_nuttx.patch b/netutils/bare/cbare_porting_for_nuttx.patch new file mode 100644 index 000000000..73d16f7fd --- /dev/null +++ b/netutils/bare/cbare_porting_for_nuttx.patch @@ -0,0 +1,28 @@ +diff --git i/src/cbare.c w/src/cbare.c +index 208639f..a3081fb 100644 +--- i/src/cbare.c ++++ w/src/cbare.c +@@ -4,7 +4,9 @@ + #include "cbare.h" + #include "utf8.h" + ++#ifndef UNUSED + #define UNUSED(x) (void)(x) ++#endif + + enum { + U8SZ = 1, +diff --git i/test/baretest.c w/test/baretest.c +index 1561f4c..9df740f 100644 +--- i/test/baretest.c ++++ w/test/baretest.c +@@ -10,7 +10,9 @@ + #include "alloc.h" + #include "die.h" + ++#ifndef UNUSED + #define UNUSED(x) (void)(x) ++#endif + + #define ARRLEN(a) sizeof(a)/sizeof(a[0]) +
