Skip to content

Commit 826e61c

Browse files
committed
[nrf mergeup] Merge upstream up to commit 13f6397
Regular upmerge. Signed-off-by: Andrzej Głąbek <[email protected]>
2 parents bff226a + 13f6397 commit 826e61c

25 files changed

+148
-91
lines changed

.github/workflows/zephyr_build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
runs-on: ubuntu-latest
4141
# Docker image from the zephyr upstream. Includes SDK and other required tools
4242
container:
43-
image: zephyrprojectrtos/ci:v0.21.0
43+
image: zephyrprojectrtos/ci:v0.24.2
4444
options: '--entrypoint /bin/bash'
4545
volumes:
4646
- /home/runners/zephyrproject:/github/cache/zephyrproject
4747
env:
48-
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.2
48+
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.15.0
4949

5050
steps:
5151
- name: Set versions when workflow_dispatch

boot/boot_serial/src/boot_serial.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ static off_t erase_range(const struct flash_area *fap, off_t start, off_t end)
318318
}
319319

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

323324
rc = flash_area_erase(fap, start, size);
324325
if (rc != 0) {
@@ -848,7 +849,14 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
848849

849850
off = 0;
850851
while (timeout_in_ms > 0 || bs_entry) {
852+
/*
853+
* Don't enter CPU idle state here if timeout based serial recovery is
854+
* used as otherwise the boot process hangs forever, waiting for input
855+
* from serial console (if single-thread mode is used).
856+
*/
857+
#ifndef MCUBOOT_SERIAL_WAIT_FOR_DFU
851858
MCUBOOT_CPU_IDLE();
859+
#endif
852860
MCUBOOT_WATCHDOG_FEED();
853861
#ifdef MCUBOOT_SERIAL_WAIT_FOR_DFU
854862
uint32_t start = k_uptime_get_32();

boot/bootutil/src/loader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,6 +2936,7 @@ boot_remove_image_from_flash(struct boot_loader_state *state, uint32_t slot)
29362936
rc = flash_area_open(area_id, &fap);
29372937
if (rc == 0) {
29382938
flash_area_erase(fap, 0, flash_area_get_size(fap));
2939+
flash_area_close(fap);
29392940
}
29402941

29412942
return rc;

boot/bootutil/zephyr/CMakeLists.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,12 @@ zephyr_library_sources(
1717
../src/bootutil_public.c
1818
)
1919

20-
if(CONFIG_BOOT_IMAGE_ACCESS_HOOKS)
21-
if(NOT CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE STREQUAL "")
22-
if(IS_ABSOLUTE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
23-
if(EXISTS ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
24-
set(HOOKS_FILE ${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
25-
endif()
26-
elseif((DEFINED CONF_DIR) AND
27-
(EXISTS ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE}))
28-
set(HOOKS_FILE ${CONF_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
29-
else(EXISTS ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
30-
set(HOOKS_FILE ${APPLICATION_SOURCE_DIR}/${CONFIG_BOOT_IMAGE_ACCESS_HOOKS_FILE})
31-
endif()
32-
endif()
33-
34-
if(DEFINED HOOKS_FILE)
35-
zephyr_library_sources(
36-
${HOOKS_FILE}
37-
)
38-
else()
39-
message(STATUS "No hooks implementation file.")
40-
endif()
20+
# Sensitivity to the TEST_BOOT_IMAGE_ACCESS_HOOKS define is implemented for
21+
# allowing the test-build with the hooks feature enabled.
22+
if(TEST_BOOT_IMAGE_ACCESS_HOOKS)
23+
zephyr_library_sources(
24+
${APPLICATION_SOURCE_DIR}/hooks_sample.c
25+
)
4126
endif()
4227

4328
zephyr_library_link_libraries(MCUBOOT_BOOTUTIL)

boot/nuttx/include/flash_map_backend/flash_map_backend.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include <inttypes.h>
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
/****************************************************************************
3034
* Public Types
3135
****************************************************************************/
@@ -419,4 +423,8 @@ int flash_area_id_to_multi_image_slot(int image_index, int area_id);
419423

420424
int flash_area_id_from_image_offset(uint32_t offset);
421425

426+
#ifdef __cplusplus
427+
}
428+
#endif
429+
422430
#endif /* __BOOT_NUTTX_INCLUDE_FLASH_MAP_BACKEND_FLASH_MAP_BACKEND_H */

boot/nuttx/main.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@
3232

3333
#include "flash_map_backend/flash_map_backend.h"
3434

35+
/****************************************************************************
36+
* Pre-processor Definitions
37+
****************************************************************************/
38+
39+
/* Should we perform board-specific driver initialization? There are two
40+
* ways that board initialization can occur: 1) automatically via
41+
* board_late_initialize() during bootupif CONFIG_BOARD_LATE_INITIALIZE
42+
* or 2).
43+
* via a call to boardctl() if the interface is enabled
44+
* (CONFIG_BOARDCTL=y).
45+
* If this task is running as an NSH built-in application, then that
46+
* initialization has probably already been performed otherwise we do it
47+
* here.
48+
*/
49+
50+
#undef NEED_BOARDINIT
51+
52+
#if defined(CONFIG_BOARDCTL) && !defined(CONFIG_NSH_ARCHINIT)
53+
# define NEED_BOARDINIT 1
54+
#endif
55+
3556
/****************************************************************************
3657
* Private Functions
3758
****************************************************************************/
@@ -79,6 +100,18 @@ int main(int argc, FAR char *argv[])
79100
struct boot_rsp rsp;
80101
fih_int fih_rc = FIH_FAILURE;
81102

103+
#ifdef NEED_BOARDINIT
104+
/* Perform architecture-specific initialization (if configured) */
105+
106+
boardctl(BOARDIOC_INIT, 0);
107+
108+
#ifdef CONFIG_BOARDCTL_FINALINIT
109+
/* Perform architecture-specific final-initialization (if configured) */
110+
111+
boardctl(BOARDIOC_FINALINIT, 0);
112+
#endif
113+
#endif
114+
82115
syslog(LOG_INFO, "*** Booting MCUboot build %s ***\n", CONFIG_MCUBOOT_VERSION);
83116

84117
FIH_CALL(boot_go, fih_rc, &rsp);

boot/zephyr/Kconfig

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ config BOOT_USB_DFU_DETECT_PIN
450450
default 13 if BOARD_NRF52DK_NRF52832
451451
default 23 if BOARD_NRF5340_DK_NRF5340_CPUAPP || BOARD_NRF5340_DK_NRF5340_CPUAPP_NS
452452
default 43 if BOARD_BL5340_DVK_CPUAPP || BOARD_BL5340_DVK_CPUAPP_NS
453+
default -1
453454
help
454455
Pin on the DFU detect port that triggers DFU mode.
455456

@@ -558,10 +559,12 @@ endchoice
558559

559560
config BOOT_WATCHDOG_FEED
560561
bool "Feed the watchdog while doing swap"
562+
default y if WATCHDOG
561563
default y if SOC_FAMILY_NRF
562-
imply NRFX_WDT
563-
imply NRFX_WDT0
564-
imply NRFX_WDT1
564+
# for nRF nrfx based implementation is available
565+
imply NRFX_WDT if SOC_FAMILY_NRF
566+
imply NRFX_WDT0 if SOC_FAMILY_NRF
567+
imply NRFX_WDT1 if SOC_FAMILY_NRF
565568
help
566569
Enables implementation of MCUBOOT_WATCHDOG_FEED() macro which is
567570
used to feed watchdog while doing time consuming operations.
@@ -571,18 +574,8 @@ config BOOT_IMAGE_ACCESS_HOOKS
571574
help
572575
Allow to provide procedures for override or extend native
573576
MCUboot's routines required for access the image data and the image
574-
update.
575-
576-
config BOOT_IMAGE_ACCESS_HOOKS_FILE
577-
string "Hooks implementation file path"
578-
depends on BOOT_IMAGE_ACCESS_HOOKS
579-
help
580-
Path to the file which implements hooks.
581-
You can use either absolute or relative path.
582-
In case relative path is used, the build system assumes that it starts
583-
from the directory where the MCUBoot KConfig configuration file is
584-
located. If the key file is not there, the build system uses relative
585-
path that starts from the zephyr port cmake directory (boot/zephyr/).
577+
update. It is up to the project customization to add required source
578+
files to the build.
586579

587580
config MCUBOOT_ACTION_HOOKS
588581
bool "Enable hooks for responding to MCUboot status changes"

boot/zephyr/Kconfig.serial_recovery

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ config BOOT_SERIAL_DETECT_PIN
7070
default 13 if BOARD_NRF52DK_NRF52832 || BOARD_NRF52833DK_NRF52833
7171
default 23 if BOARD_NRF5340PDK_NRF5340_CPUAPP || BOARD_NRF5340PDK_NRF5340_CPUAPP_NS || \
7272
BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF5340DK_NRF5340_CPUAPP_NS
73+
default -1
7374
help
7475
Pin on the serial detect port that triggers serial recovery mode.
7576

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CONFIG_BOOT_MAX_IMG_SECTORS=256
2-
2+
CONFIG_WATCHDOG=y

boot/zephyr/boards/frdm_k64f.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_WATCHDOG=y

0 commit comments

Comments
 (0)