nuttx-apps/netutils/libshvc/Makefile

91 lines
2.8 KiB
Makefile
Raw Normal View History

netutils/libshvc: add Silicon Heaven integration into NuttX and SHV examples This commit marks the end of my GSoC 2025 project in the NuttX section. All changes: - Silicon Heaven protocol (SHV) implementation: The library is cloned from github.com/silicon-heaven/shv-libs4c and compiled here. The library has out-of-the-box support for NuttX and possibly all posix systems. The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define set to "nuttx". The library's dependancy is Pavel Pisa's ULUT and originates from Michal Lenc's GSoC. - examples/shv-nxboot-updater: An example which constructs a SHV tree with which you can perform firmware updates using a SHV "file node". The file node wraps around NXBoot's update partition. The application also allows for NXBoot confirmation of the images. This application is to be meant used as a "background service", started before any apps, possibly using rcS. The tree is allocated as GAVL (see below). - examples/shv-test: An example which constructs a SHV tree and gives the user the ability to choose which type of construction should be used, either: - GAVL: dynamic SHV tree allocation encapsulated within an AVL tree. - GSA: dynamic SHV tree allocation encapsulated within a continuous array with binary search - GSA_STATIC: SHV tree is defined as static const, this means all the data structures are placed in .rodata. Extremely beneficial for embedded systems, as .rodata is located in flash and embedded systems usually have more flash than sram, thus reducing sram usage. The downside is that the definitions are rather tedious, but can be automated in case of some code generation (like in pysimCoder). All of it is places in a continuous array with binary search. Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-08-31 17:40:34 +02:00
#############################################################################
# apps/netutils/libshvc/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
SHVDIR := shv-libs4c
# Commit hash of the supported shv-libs4c revision
netutils/libshvc: implement headers export and update shv-libs4c The uLUt and libshvc declare headers intended for make export by EXPORTED_INCLUDES mechanism implemented during 2026 Micowindows GSoC. The shv-libs4c has been updated as well to support newer pyshv versions and that way firmware updates when shv-nxboot-updater is used through pyshv based shvflasher.py and related GUI. For pyshv see https://github.com/silicon-heaven/pyshv New commits from shv-libs4c project https://github.com/silicon-heaven/shv-libs4c - shv_com_common: shv_unpack_discard and shv_unpack_skip required to skip additional parameters and query requests introduced introduced by newer silicon-heaven protocol and pyshv. Incorrect skipping was a bug even against previous protocol version but did not present itself because older pyshv did not send additional requests which need to be ignored. - shv_file_node: small, but crucial unpack change Ignore any other messages than PARAM in file node's write unpack function. Other different states should be handled, too. - shv_file_node: fix the CRC unpack method too Any other messages than PARAM are ignored. - shv_com: add a method to close a connection only - shv_dotdevice_node.c: close the conn with the other side when resetted - shv_com.h: use array designators for error strings - libshvtree: move shv_con_errno_strs to the C file to not waste space by copies - shvtree/shv_clayer_posix: provide alternative socketpair notification support This allows to use shv-libs4c and related pysimCoder support on RTEMS system which does not provide functional pipe directive/system call but BSD networking supported local/UNIX socket pair is fully supported. Signed-off-by: Pavel Pisa <ppisa@pikron.com>
2026-08-25 09:14:17 +02:00
SHV_LIBS4C_COMMIT_HASH := cbb2c0ed57d3ec0396b6ce4d1b17ac054999b299
netutils/libshvc: add Silicon Heaven integration into NuttX and SHV examples This commit marks the end of my GSoC 2025 project in the NuttX section. All changes: - Silicon Heaven protocol (SHV) implementation: The library is cloned from github.com/silicon-heaven/shv-libs4c and compiled here. The library has out-of-the-box support for NuttX and possibly all posix systems. The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define set to "nuttx". The library's dependancy is Pavel Pisa's ULUT and originates from Michal Lenc's GSoC. - examples/shv-nxboot-updater: An example which constructs a SHV tree with which you can perform firmware updates using a SHV "file node". The file node wraps around NXBoot's update partition. The application also allows for NXBoot confirmation of the images. This application is to be meant used as a "background service", started before any apps, possibly using rcS. The tree is allocated as GAVL (see below). - examples/shv-test: An example which constructs a SHV tree and gives the user the ability to choose which type of construction should be used, either: - GAVL: dynamic SHV tree allocation encapsulated within an AVL tree. - GSA: dynamic SHV tree allocation encapsulated within a continuous array with binary search - GSA_STATIC: SHV tree is defined as static const, this means all the data structures are placed in .rodata. Extremely beneficial for embedded systems, as .rodata is located in flash and embedded systems usually have more flash than sram, thus reducing sram usage. The downside is that the definitions are rather tedious, but can be automated in case of some code generation (like in pysimCoder). All of it is places in a continuous array with binary search. Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-08-31 17:40:34 +02:00
SHV_LIBS4C_TARGZ := shv-libs4c-$(SHV_LIBS4C_COMMIT_HASH).tar.gz
SHV_LIBS4C_URL := https://codeload.github.com/silicon-heaven/shv-libs4c/tar.gz/$(SHV_LIBS4C_COMMIT_HASH)
.PHONY: shv-build-library
define RUN_OMK_MAKE
$(1):: $(SHVDIR)
make -C $(SHVDIR) \
CONFIG_SHV_LIBS4C_PLATFORM="nuttx" $(2) \
CONFIG_OC_ULUT_INCDIRONLY=y \
EXPORT_LIB_OBJS_EARLY=y \
CC="$$(CC)" \
CXX="$$(CXX)" \
CFLAGS="$$(CFLAGS)" \
CXXFLAGS="$$(CXXFLAGS)" \
LD="$$(LD)" \
LDFLAGS="$$(LDFLAGS)" \
CONFIG_OC_ULUT_TESTS=n
endef
define IMPORT_OMK_DEPEND
$(1) : $$(foreach omk_d,$$(wildcard $(1).d),\
$$(shell sed -n -e 's/^ \([^\]*\)[\]*$$$$/ \1/p' $$(omk_d)))
endef
ifneq ($(wildcard $(SHVDIR)/_build),)
-include $(shell true; find $(SHVDIR)/_build -name 'lib*.a.omkvar') # `true' is a hack for MinGW
SHVOBJS = $(sort $(foreach lib,$(static_libs),$($(lib)_objsar)))
endif
EXTOBJS += $(SHVOBJS)
$(SHVOBJS) : shv-build-library
$(SHV_LIBS4C_TARGZ):
@echo "Downloading SHV from $(SHV_LIBS4C_URL)"
$(Q) curl -L $(SHV_LIBS4C_URL) -o $(SHV_LIBS4C_TARGZ)
$(SHVDIR): $(SHV_LIBS4C_TARGZ)
@echo "Unpacking $(SHV_LIBS4C_TARGZ) -> $(SHVDIR)"
$(Q) tar xzf $(SHV_LIBS4C_TARGZ)
$(Q) mv shv-libs4c-$(SHV_LIBS4C_COMMIT_HASH) $(SHVDIR)
$(Q) touch $(SHVDIR)
$(eval $(call RUN_OMK_MAKE, shv-build-library, library-pass))
$(foreach omk_o,$(SHVOBJS),$(eval $(call IMPORT_OMK_DEPEND,$(omk_o))))
ifeq ($(wildcard $(SHVDIR)/.git),)
$(eval $(call RUN_OMK_MAKE, context, default-config include-pass))
distclean::
if [ -d $(SHVDIR) ]; then make -C $(SHVDIR) distclean; fi
netutils/libshvc: add Silicon Heaven integration into NuttX and SHV examples This commit marks the end of my GSoC 2025 project in the NuttX section. All changes: - Silicon Heaven protocol (SHV) implementation: The library is cloned from github.com/silicon-heaven/shv-libs4c and compiled here. The library has out-of-the-box support for NuttX and possibly all posix systems. The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define set to "nuttx". The library's dependancy is Pavel Pisa's ULUT and originates from Michal Lenc's GSoC. - examples/shv-nxboot-updater: An example which constructs a SHV tree with which you can perform firmware updates using a SHV "file node". The file node wraps around NXBoot's update partition. The application also allows for NXBoot confirmation of the images. This application is to be meant used as a "background service", started before any apps, possibly using rcS. The tree is allocated as GAVL (see below). - examples/shv-test: An example which constructs a SHV tree and gives the user the ability to choose which type of construction should be used, either: - GAVL: dynamic SHV tree allocation encapsulated within an AVL tree. - GSA: dynamic SHV tree allocation encapsulated within a continuous array with binary search - GSA_STATIC: SHV tree is defined as static const, this means all the data structures are placed in .rodata. Extremely beneficial for embedded systems, as .rodata is located in flash and embedded systems usually have more flash than sram, thus reducing sram usage. The downside is that the definitions are rather tedious, but can be automated in case of some code generation (like in pysimCoder). All of it is places in a continuous array with binary search. Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-08-31 17:40:34 +02:00
$(call DELDIR, $(SHVDIR))
$(call DELFILE, $(SHV_LIBS4C_TARGZ))
endif
include $(APPDIR)/Application.mk