mcu-firmware: add support for host side support packages

In case of some of the MCU firmware types, additional setup on the host
side is required before the target application can be used. Example of
such a requirement is a BLE HCI controller on UART bus (firmware type:
'hci_uart') which, before can be registered in system, needs to be
attached to Bluetooth stack (with e.g. 'btattach').

This includes code for generating hidden packages under 'mcu-firmware'
with all the files required for host side support (stored in directory
with the same name as firmware type, under local 'files' directory),
for a selected MCU firmware. For example, below tree:

  ./feeds/mcu/mcu-firmware/files/hci_uart/etc/...

would result in creation of new package 'zephyr-hci_uart-host-support',
included in dependencies lists for all MCU firmware versions of the
'hci_uart' type, with everything from '.../files/hci_uart/'.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz
2023-03-10 21:39:22 +01:00
committed by John Crispin
parent b9d20e083c
commit a3f0fb23b7

View File

@@ -32,6 +32,11 @@ ZEPHYR_VERSIONS := \
ZEPHYR_FW_CI_URL := https://gitlab.com/pepe2k/zephyr/-/jobs/
ZEPHYR_FW_TYPES := \
hello_world \
hci_uart \
hci_usb
# Zephyr 'hello_world' targets
ZEPHYR_HELLO_WORLD_TARGETS := \
cig_wf196_nrf52833 \
@@ -59,6 +64,20 @@ define Download/zephyr-fw
endef
$(foreach FW,$(ZEPHYR_VERSIONS),$(eval $(call Download,zephyr-fw,$(FW))))
# $(1) firmware name (e.g. hci_usb)
define zephyr-fw-host-support
define Package/zephyr-$(1)-host-support
$(call Package/mcu-fw-default)
DEPENDS:=+mcu
TITLE:=Zephyr '$(1)' common host side support
HIDDEN:=1
endef
define Package/zephyr-$(1)-host-support/install
$(CP) ./files/$(1)/* $$(1)/
endef
endef
# $(1) version (e.g zephyr-v3.3.x)
# $(2) firmware name (e.g. hci_usb)
# $(3) target/board name (e.g. nrf52840dongle_nrf52840)
@@ -81,6 +100,7 @@ define zephyr-fw
endef
define zephyr-fw-deps
$(if $(wildcard ./files/$(1)/*),+zephyr-$(1)-host-support) \
$(if $(findstring hci_u,$1),+bluez-daemon +kmod-bluetooth +kmod-crypto-user)
endef
@@ -102,6 +122,15 @@ define Build/Compile
endef
# Generate host side support packages (per firmware type)
$(foreach FW,$(ZEPHYR_FW_TYPES),\
$(if $(wildcard ./files/$(FW)/*),$(eval $(call zephyr-fw-host-support,$(FW)))))
$(foreach FW,$(ZEPHYR_FW_TYPES),\
$(if $(wildcard ./files/$(FW)/*),$(eval $(call BuildPackage,zephyr-$(FW)-host-support))))
# Generate dedicated Zephyr firmware packages (per firmware version, type and board)
$(foreach VER,$(ZEPHYR_VERSIONS),\
$(foreach TARGET,$(ZEPHYR_HELLO_WORLD_TARGETS),\
$(eval $(call zephyr-fw,$(call word-underscore,$(VER),1),hello_world,$(TARGET)))))