Files
wlan-ap/feeds/mcu/mcu/Makefile
Piotr Dymacz 560e9f326d mcu: fix host support for multi-slot UART based MCUs
In case of MCU with multiple firmware slots support, change of active
slot requires reset. This obviously results in MCU entering the serial
recovery mode in bootloader, with 5 sec timeout, which in case of UART
based MCUs isn't automatically detected and handled in the same way as
USB based devices (hotplug).

Starting host side support script when the MCU is waiting for MCUmgr
commands during recovery is wrong. This fixes the problem by requesting
UART based MCU to boot the firmware after active slot change followed by
reset. While at it, change also how single slot type MCUs are handled
during upgrade (always request reset after the upgrade).

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-03-23 08:06:42 +01:00

51 lines
1.2 KiB
Makefile

#
# Copyright (C) 2023 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=mcu
PKG_VERSION:=2023-03-22
PKG_RELEASE=1
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
PKG_MAINTAINER:=Piotr Dymacz <pepe2k@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/mcu
TITLE:=Generic OpenWrt/OpenWiFi MCU config and management handler
CATEGORY:=Utilities
DEPENDS:=+umcumgr +libubox
SECTION:=utils
endef
define Package/mcu/conffiles
/etc/config/mcu
endef
define Build/Compile
endef
define Package/mcu/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/hotplug.d/usb $(1)/lib/functions $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/mcu.init $(1)/etc/init.d/mcu
$(INSTALL_DATA) ./files/mcu.hotplug $(1)/etc/hotplug.d/usb/30-mcu
$(INSTALL_DATA) ./files/mcu.sh $(1)/lib/functions
$(if $(wildcard ./files/uci-defaults/$(BOARD)_$(SUBTARGET)), \
$(INSTALL_DATA) ./files/uci-defaults/$(BOARD)_$(SUBTARGET) \
$(1)/etc/uci-defaults/20-mcu, \
$(if $(wildcard ./files/uci-defaults/$(BOARD)), \
$(INSTALL_DATA) ./files/uci-defaults/$(BOARD) \
$(1)/etc/uci-defaults/20-mcu \
) \
)
endef
$(eval $(call BuildPackage,mcu))