boot/mcuboot: Move MCUboot samples to examples dir

The current examples belongs to 'examples/mcuboot' directory. This
moves related example code and Kconfig entries to their respective
project inside examples/mcuboot directory. It cleans all Kconfig
entries at 'boot/mcuboot', including Kconfig, Makefile and
README.md files.

This not perform any code modification.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
Gerson Fernando Budke 2021-12-20 19:28:02 -03:00 committed by Petro Karashchenko
parent 36cb168077
commit afefa1c308
11 changed files with 156 additions and 56 deletions

View File

@ -100,46 +100,6 @@ config MCUBOOT_DIRECT_XIP_REVERT
depends on MCUBOOT_DIRECT_XIP
default n
config EXAMPLES_MCUBOOT_UPDATE_AGENT
bool "MCUboot update agent example"
default n
depends on NET_TCP
---help---
Example application that implements an update agent that downloads
an application firmware image from a given URL and saves it to the
secondary slot as a pending update.
if EXAMPLES_MCUBOOT_UPDATE_AGENT
config EXAMPLES_MCUBOOT_UPDATE_AGENT_UPDATE_URL
string "URL for update image"
default ""
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_BUFFER_SIZE
int "Download buffer size in bytes"
default 512
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
bool "Calculate MD5 of update image"
default n
depends on CODECS_HASH_MD5
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_MD5_HASH
string "Expected MD5 sum of update image"
default ""
depends on EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
endif # EXAMPLES_MCUBOOT_UPDATE_AGENT
config EXAMPLES_MCUBOOT_SLOT_CONFIRM
tristate "MCUboot slot confirm example"
default n
---help---
Example application for confirming a newly installed application
application firmware image using MCUboot public APIs.
This application should be used as the OTA update package of the
EXAMPLES_MCUBOOT_UPDATE_AGENT example.
config MCUBOOT_WATCHDOG
bool "Watchdog feeding support"
default n

View File

@ -30,22 +30,6 @@ DEPPATH += --dep-path $(MCUBOOT_SRCDIR)
VPATH += :$(MCUBOOT_UNPACK)$(DELIM)src
VPATH += :$(MCUBOOT_SRCDIR)
ifneq ($(CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT),)
MAINSRC += mcuboot_agent_main.c
PROGNAME += mcuboot_agent
PRIORITY += SCHED_PRIORITY_DEFAULT
STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
endif
ifneq ($(CONFIG_EXAMPLES_MCUBOOT_SLOT_CONFIRM),)
MAINSRC += mcuboot_confirm_main.c
PROGNAME += mcuboot_confirm
PRIORITY += SCHED_PRIORITY_DEFAULT
STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
endif
ifneq ($(CONFIG_MCUBOOT_BOOTLOADER),)
MAINSRC += mcuboot/boot/nuttx/main.c

View File

@ -26,6 +26,8 @@ One common use case for MCUboot is to integrate it to a firmware update agent, w
The `CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT` example demonstrates this workflow by downloading an application firmware image from a webserver, installing it and triggering the firmware update process for the next boot after a system reset. There is also the `CONFIG_EXAMPLES_MCUBOOT_SLOT_CONFIRM`, which is a fairly simple example that just calls an MCUboot API for confirming the executing application firmware image as stable.
For more information about all MCUboot examples, see `examples/mcuboot` directory.
## Using MCUboot on NuttX as a secure boot solution
NuttX port for MCUboot also enables the creation of a secure bootloader application requiring minimal platform-specific implementation. The logical implementation for the secure boot is performed at application-level by the MCUboot library. Once MCUboot validates the application firmware image, it delegates the loading and execution of the application firmware image to a platform-specific routine, which is accessed via `boardctl(BOARDIOC_BOOT_IMAGE)` call. Each platform must then provide an implementation for the `board_boot_image()` for executing the required actions in order to boot a new application firmware image (e.g. deinitialize peripherals, load the Program Counter register with the application firmware image entry point address).

View File

@ -0,0 +1,14 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config EXAMPLES_MCUBOOT_SLOT_CONFIRM
tristate "MCUboot slot confirm example"
default n
select BOOT_MCUBOOT
---help---
Example application for confirming a newly installed application
application firmware image using MCUboot public APIs.
This application should be used as the OTA update package of the
EXAMPLES_MCUBOOT_UPDATE_AGENT example.

View File

@ -0,0 +1,23 @@
############################################################################
# apps/examples/mcuboot/slot_confirm/Make.defs
#
# 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.
#
############################################################################
ifneq ($(CONFIG_EXAMPLES_MCUBOOT_SLOT_CONFIRM),)
CONFIGURED_APPS += $(APPDIR)/examples/mcuboot/slot_confirm
endif

View File

@ -0,0 +1,29 @@
############################################################################
# apps/examples/mcuboot/slot_confirm/Makefile
#
# 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
MAINSRC += mcuboot_confirm_main.c
PROGNAME += mcuboot_confirm
PRIORITY += SCHED_PRIORITY_DEFAULT
STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
include $(APPDIR)/Application.mk

View File

@ -0,0 +1,36 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config EXAMPLES_MCUBOOT_UPDATE_AGENT
bool "MCUboot update agent example"
default n
select BOOT_MCUBOOT
depends on NET_TCP
---help---
Example application that implements an update agent that downloads
an application firmware image from a given URL and saves it to the
secondary slot as a pending update.
if EXAMPLES_MCUBOOT_UPDATE_AGENT
config EXAMPLES_MCUBOOT_UPDATE_AGENT_UPDATE_URL
string "URL for update image"
default ""
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_BUFFER_SIZE
int "Download buffer size in bytes"
default 512
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
bool "Calculate MD5 of update image"
default n
depends on CODECS_HASH_MD5
config EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_MD5_HASH
string "Expected MD5 sum of update image"
default ""
depends on EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
endif # EXAMPLES_MCUBOOT_UPDATE_AGENT

View File

@ -0,0 +1,23 @@
############################################################################
# apps/examples/mcuboot/update_agent/Make.defs
#
# 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.
#
############################################################################
ifneq ($(CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT),)
CONFIGURED_APPS += $(APPDIR)/examples/mcuboot/update_agent
endif

View File

@ -0,0 +1,29 @@
############################################################################
# apps/examples/mcuboot/update_agent/Makefile
#
# 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
MAINSRC += mcuboot_agent_main.c
PROGNAME += mcuboot_agent
PRIORITY += SCHED_PRIORITY_DEFAULT
STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
include $(APPDIR)/Application.mk