diff --git a/.gitmodules b/.gitmodules index f9a2ffb..3e3ca18 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/Makefile b/Makefile index 9fa9abc..ec3b747 100644 --- a/Makefile +++ b/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) diff --git a/README.md b/README.md index 50791b3..bf0e406 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/components/aap2/aap2.proto b/components/aap2/aap2.proto new file mode 100644 index 0000000..748791e --- /dev/null +++ b/components/aap2/aap2.proto @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause OR Apache-2.0 + +syntax = "proto3"; + +message AAPMessage { +} diff --git a/components/aap2/aap2_agent.c b/components/aap2/aap2_agent.c new file mode 100644 index 0000000..501f29d --- /dev/null +++ b/components/aap2/aap2_agent.c @@ -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) +{ +} diff --git a/external/LICENSE-3RD-PARTY.txt b/external/LICENSE-3RD-PARTY.txt index 78dfc96..97c4b51 100644 --- a/external/LICENSE-3RD-PARTY.txt +++ b/external/LICENSE-3RD-PARTY.txt @@ -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 + - 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 diff --git a/external/nanopb b/external/nanopb new file mode 160000 index 0000000..8ef41e0 --- /dev/null +++ b/external/nanopb @@ -0,0 +1 @@ +Subproject commit 8ef41e0ebd45daaf19459a011f67e66224b247cd diff --git a/generated/components/aap2/aap2.pb.c b/generated/components/aap2/aap2.pb.c new file mode 100644 index 0000000..4362a36 --- /dev/null +++ b/generated/components/aap2/aap2.pb.c @@ -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) + + + diff --git a/generated/components/aap2/aap2.pb.h b/generated/components/aap2/aap2.pb.h new file mode 100644 index 0000000..e32e6d0 --- /dev/null +++ b/generated/components/aap2/aap2.pb.h @@ -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 + +#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 diff --git a/include/aap2/aap2_agent.h b/include/aap2/aap2_agent.h new file mode 100644 index 0000000..3bbb8d4 --- /dev/null +++ b/include/aap2/aap2_agent.h @@ -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 */ diff --git a/mk/build.mk b/mk/build.mk index 9eb9ec4..5b3c406 100644 --- a/mk/build.mk +++ b/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)) diff --git a/tools/analysis/license-check.sh b/tools/analysis/license-check.sh index 4a57aad..99e2782 100755 --- a/tools/analysis/license-check.sh +++ b/tools/analysis/license-check.sh @@ -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