diff --git a/LICENSE b/LICENSE index 61fb28ab423..84b5055daa6 100644 --- a/LICENSE +++ b/LICENSE @@ -1282,7 +1282,7 @@ apps/system/telnet/telnet_client.c Copyright (C) 2017 Gregory Nutt. All rights reserved. Author: Gregory Nutt - The original authors of libtelnet are listed below. Per their licesne, + The original authors of libtelnet are listed below. Per their license, "The author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and @@ -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 00000000000..2f0fa3df22e --- /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 00000000000..9a6b4f538a1 --- /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 00000000000..e851edf15f7 --- /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 00000000000..73d16f7fd3d --- /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]) +