mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
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 <jvlasak@elektroline.cz>
This commit is contained in:
parent
197401975a
commit
72f57fc34e
5 changed files with 161 additions and 0 deletions
22
netutils/bare/Kconfig
Normal file
22
netutils/bare/Kconfig
Normal file
|
|
@ -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
|
||||
27
netutils/bare/Make.defs
Normal file
27
netutils/bare/Make.defs
Normal file
|
|
@ -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
|
||||
58
netutils/bare/Makefile
Normal file
58
netutils/bare/Makefile
Normal file
|
|
@ -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
|
||||
28
netutils/bare/cbare_porting_for_nuttx.patch
Normal file
28
netutils/bare/cbare_porting_for_nuttx.patch
Normal file
|
|
@ -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])
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue