Unverified Commit 9c737361 authored by Andrzej Puzdrowski's avatar Andrzej Puzdrowski Committed by GitHub
Browse files
parents 1d440411 b03c0985
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -318,7 +318,8 @@ static off_t erase_range(const struct flash_area *fap, off_t start, off_t end)
    }

    size = flash_sector_get_off(&sect) + flash_sector_get_size(&sect) - start;
    BOOT_LOG_INF("Erasing range 0x%x:0x%x", start, start + size - 1);
    BOOT_LOG_INF("Erasing range 0x%jx:0x%jx", (intmax_t)start,
		 (intmax_t)(start + size - 1));

    rc = flash_area_erase(fap, start, size);
    if (rc != 0) {
+6 −21
Original line number Diff line number Diff line
@@ -17,27 +17,12 @@ zephyr_library_sources(
  ../src/bootutil_public.c
    )

if(CONFIG_BOOT_IMAGE_ACCESS_HOOKS)
  if(NOT CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE STREQUAL "")
    if(IS_ABSOLUTE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
      if(EXISTS ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
        set(HOOKS_FILE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
      endif()
    elseif((DEFINED CONF_DIR) AND
           (EXISTS ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE}))
      set(HOOKS_FILE ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
    else(EXISTS ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
      set(HOOKS_FILE ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
    endif()
  endif()

  if(DEFINED HOOKS_FILE)
# Sensitivity to the TEST_BOOT_IMAGE_ACCESS_HOOKS define is implemented for
# allowing the test-build with the hooks feature enabled.
if(TEST_BOOT_IMAGE_ACCESS_HOOKS)
  zephyr_library_sources(
        ${HOOKS_FILE}
    ${APPLICATION_SOURCE_DIR}/hooks_sample.c
  )
  else()
    message(STATUS "No hooks implementation file.")
  endif()
endif()

zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)
+2 −12
Original line number Diff line number Diff line
@@ -569,18 +569,8 @@ config BOOT_IMAGE_ACCESS_HOOKS
	help
	  Allow to provide procedures for override or extend native
	  MCUboot's routines required for access the image data and the image
	  update.

config BOOT_IMAGE_ACCESS_HOOKS_FILE
	string "Hooks implementation file path"
	depends on BOOT_IMAGE_ACCESS_HOOKS
	help
	  Path to the file which implements hooks.
	  You can use either absolute or relative path.
	  In case relative path is used, the build system assumes that it starts
	  from the directory where the MCUBoot KConfig configuration file is
	  located. If the key file is not there, the build system uses relative
	  path that starts from the zephyr port cmake directory (boot/zephyr/).
	  update. It is up to the project customization to add required source
	  files to the build.

config MCUBOOT_ACTION_HOOKS
	bool "Enable hooks for responding to MCUboot status changes"
+0 −1
Original line number Diff line number Diff line
@@ -4,4 +4,3 @@ CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_UNALIGNED_READ=y

CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y
CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE="hooks_sample.c"
+20 −5
Original line number Diff line number Diff line
@@ -232,6 +232,7 @@
#endif

#if CONFIG_BOOT_WATCHDOG_FEED
#include <zephyr/devicetree.h>
#if CONFIG_NRFX_WDT
#include <nrfx_wdt.h>

@@ -258,17 +259,31 @@
#endif /* defined(CONFIG_NRFX_WDT0) && defined(CONFIG_NRFX_WDT1) */

#elif CONFIG_IWDG_STM32 /* CONFIG_NRFX_WDT */
#include <zephyr/device.h>
#include <zephyr/drivers/watchdog.h>

#define MCUBOOT_WATCHDOG_FEED() \
    do {                        \
        const struct device* wdt =                            \
            device_get_binding(                             \
                DT_LABEL(DT_INST(0, st_stm32_watchdog)));   \
        wdt_feed(wdt, 0);                                   \
            DEVICE_DT_GET(DT_INST(0, st_stm32_watchdog));     \
        if (device_is_ready(wdt)) {                           \
                wdt_feed(wtd, 0);                             \
        }                                                     \
    } while (0)

#else /* CONFIG_IWDG_STM32 */
#elif DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) /* CONFIG_IWDG_STM32 */
#include <zephyr/device.h>
#include <zephyr/drivers/watchdog.h>

#define MCUBOOT_WATCHDOG_FEED()                               \
    do {                                                      \
        const struct device* wdt =                            \
            DEVICE_DT_GET(DT_ALIAS(watchdog0));               \
        if (device_is_ready(wdt)) {                           \
                wdt_feed(wtd, 0);                             \
        }                                                     \
    } while (0)
#else /* DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) */
#warning "MCUBOOT_WATCHDOG_FEED() is no-op"
/* No vendor implementation, no-op for historical reasons */
#define MCUBOOT_WATCHDOG_FEED()         \
Loading