mirror of
https://gitlab.com/d3tn/ud3tn.git
synced 2026-08-13 12:33:27 +02:00
Add AAP 2.0 component stub with Protobuf support via Nanopb
This adds the Nanopb library as submodule under `external/` and adds corresponding build configuration to the Makefiles. Additionally, a Protobuf stub for AAP 2.0 is included along with a `make` target to build the corresponding C language files (`aap2-proto-headers`). Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This commit is contained in:
parent
dbdb89687f
commit
1dd5961bc4
12 changed files with 140 additions and 5 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -4,3 +4,6 @@
|
|||
[submodule "external/tinycbor"]
|
||||
path = external/tinycbor
|
||||
url = https://github.com/intel/tinycbor.git
|
||||
[submodule "external/nanopb"]
|
||||
path = external/nanopb
|
||||
url = https://github.com/nanopb/nanopb.git
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -38,6 +38,9 @@ run-unittest-posix-with-coverage:
|
|||
gdb-posix: posix
|
||||
$(TOOLCHAIN_POSIX)gdb build/posix/ud3tn
|
||||
|
||||
.PHONY: aap2-proto-headers
|
||||
aap2-proto-headers:
|
||||
python3 external/nanopb/generator/nanopb_generator.py --strip-path --output-dir=generated components/aap2/aap2.proto
|
||||
|
||||
###############################################################################
|
||||
# Tests
|
||||
|
|
@ -93,6 +96,7 @@ update-virtualenv:
|
|||
@echo "Install additional dependencies ..."
|
||||
$(PIP) install -U -r ./test/integration/requirements.txt
|
||||
$(PIP) install -U -r ./tools/analysis/requirements.txt
|
||||
$(PIP) install -U -r ./external/nanopb/extra/requirements.txt
|
||||
|
||||
###############################################################################
|
||||
# Code Quality Tests (and Release Tool)
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ Contributions in any form (e.g., bug reports, feature, or merge requests) are ve
|
|||
├── components C source code
|
||||
├── include C header files
|
||||
├── external 3rd party source code
|
||||
├── generated generated source code (e.g. for Protobuf)
|
||||
├── test various test routines
|
||||
├── doc documentation
|
||||
├── mk make scripts
|
||||
|
|
|
|||
6
components/aap2/aap2.proto
Normal file
6
components/aap2/aap2.proto
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
message AAPMessage {
|
||||
}
|
||||
9
components/aap2/aap2_agent.c
Normal file
9
components/aap2/aap2_agent.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
||||
|
||||
#include "aap2/aap2_agent.h"
|
||||
|
||||
#include "aap2/aap2.pb.h"
|
||||
|
||||
void aap2_agent_setup(void)
|
||||
{
|
||||
}
|
||||
34
external/LICENSE-3RD-PARTY.txt
vendored
34
external/LICENSE-3RD-PARTY.txt
vendored
|
|
@ -1,5 +1,5 @@
|
|||
µD3TN is built with 3rd party software available under one of several free and
|
||||
open source licenses. Those that require any attribution in the case of
|
||||
µD3TN is distributed with 3rd party software available under one of several free
|
||||
and open source licenses. Those that require any attribution in the case of
|
||||
distribution are reproduced below with their applicable files.
|
||||
|
||||
|
||||
|
|
@ -38,6 +38,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
SOFTWARE.
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
zlib License
|
||||
|
||||
applies to the following files, grouped by copyright holder:
|
||||
|
||||
- Copyright (c) 2011 Petteri Aimonen <jpa at nanopb.mail.kapsi.fi>
|
||||
- external/nanopb/*
|
||||
|
||||
This software is provided 'as-is', without any express or
|
||||
implied warranty. In no event will the authors be held liable
|
||||
for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
GNU GPL Version 2.0
|
||||
|
|
|
|||
1
external/nanopb
vendored
Submodule
1
external/nanopb
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8ef41e0ebd45daaf19459a011f67e66224b247cd
|
||||
12
generated/components/aap2/aap2.pb.c
Normal file
12
generated/components/aap2/aap2.pb.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/* Automatically generated nanopb constant definitions */
|
||||
/* Generated by nanopb-0.4.8-dev */
|
||||
|
||||
#include "aap2.pb.h"
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
PB_BIND(AAPMessage, AAPMessage, AUTO)
|
||||
|
||||
|
||||
|
||||
46
generated/components/aap2/aap2.pb.h
Normal file
46
generated/components/aap2/aap2.pb.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* Automatically generated nanopb header */
|
||||
/* Generated by nanopb-0.4.8-dev */
|
||||
|
||||
#ifndef PB_AAP2_PB_H_INCLUDED
|
||||
#define PB_AAP2_PB_H_INCLUDED
|
||||
#include <pb.h>
|
||||
|
||||
#if PB_PROTO_HEADER_VERSION != 40
|
||||
#error Regenerate this file with the current version of nanopb generator.
|
||||
#endif
|
||||
|
||||
/* Struct definitions */
|
||||
typedef struct _AAPMessage {
|
||||
char dummy_field;
|
||||
} AAPMessage;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define AAPMessage_init_default {0}
|
||||
#define AAPMessage_init_zero {0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define AAPMessage_FIELDLIST(X, a) \
|
||||
|
||||
#define AAPMessage_CALLBACK NULL
|
||||
#define AAPMessage_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t AAPMessage_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define AAPMessage_fields &AAPMessage_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define AAPMessage_size 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
11
include/aap2/aap2_agent.h
Normal file
11
include/aap2/aap2_agent.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0
|
||||
#ifndef AAP2_AGENT_H_INCLUDED
|
||||
#define AAP2_AGENT_H_INCLUDED
|
||||
|
||||
#define AAP2_AGENT_TASK_PRIORITY 2
|
||||
|
||||
#define AAP2_AGENT_BACKLOG 2
|
||||
|
||||
void aap2_agent_setup(void);
|
||||
|
||||
#endif /* AAP2_AGENT_H_INCLUDED */
|
||||
16
mk/build.mk
16
mk/build.mk
|
|
@ -2,10 +2,13 @@ include mk/toolchain.mk
|
|||
|
||||
# COMPONENTS
|
||||
|
||||
EXTERNAL_INCLUDES += -Iexternal/tinycbor/src \
|
||||
-Iexternal/util/include
|
||||
EXTERNAL_INCLUDES += -Iexternal/nanopb \
|
||||
-Iexternal/tinycbor/src \
|
||||
-Iexternal/util/include \
|
||||
-Igenerated/components
|
||||
|
||||
$(eval $(call addComponentWithRules,components/aap))
|
||||
$(eval $(call addComponentWithRules,components/aap2))
|
||||
$(eval $(call addComponentWithRules,components/agents))
|
||||
$(eval $(call addComponentWithRules,components/agents/$(PLATFORM)))
|
||||
$(eval $(call addComponentWithRules,components/bundle6))
|
||||
|
|
@ -16,6 +19,13 @@ $(eval $(call addComponentWithRules,components/platform/$(PLATFORM)))
|
|||
$(eval $(call addComponentWithRules,components/spp))
|
||||
$(eval $(call addComponentWithRules,components/ud3tn))
|
||||
|
||||
NANOPB_SOURCES := \
|
||||
pb_common.c \
|
||||
pb_encode.c \
|
||||
pb_decode.c
|
||||
|
||||
$(eval $(call addComponentWithRules,external/nanopb,$(NANOPB_SOURCES)))
|
||||
|
||||
TINYCBOR_SOURCES := \
|
||||
cborerrorstrings.c \
|
||||
cborencoder.c \
|
||||
|
|
@ -29,6 +39,8 @@ TINYCBOR_SOURCES := \
|
|||
$(eval $(call addComponentWithRules,external/tinycbor/src,$(TINYCBOR_SOURCES)))
|
||||
$(eval $(call addComponentWithRules,external/util/src))
|
||||
|
||||
$(eval $(call addComponentWithRules,generated/components/aap2))
|
||||
|
||||
# LIB
|
||||
|
||||
$(eval $(call generateComponentRules,components/daemon))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ SPDX_LICENSE_STR="SPDX-License-Identifier: $(head -n 1 LICENSE)"
|
|||
echo 'Searching for SPDX expression "'"$SPDX_LICENSE_STR"'"'
|
||||
|
||||
DIRS="components doc dockerfiles include mk pyd3tn python-ud3tn-utils tools test"
|
||||
FILES=$(find $DIRS -type f \( -name "*.[ch]" -o -name "*.py" -o -name "*.rs" -o -name "*.sh" \) )
|
||||
FILES=$(find $DIRS -type f \( -name "*.[ch]" -o -name "*.proto" -o -name "*.py" -o -name "*.rs" -o -name "*.sh" \) )
|
||||
declare -a MISSING_SPDX_FILES
|
||||
|
||||
for file in $FILES; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue