From 3d26d4cc87c5baefcb5535786cc1d3a87caf0ed6 Mon Sep 17 00:00:00 2001 From: Sreeram Tatapudi Date: Wed, 23 Apr 2025 13:00:09 -0700 Subject: [PATCH] boards: cyw20829: add custom flashloader with 64k of erase block size Add custom flashloader (for openocd) with 64k of erase block size. Default one has 512, which cause MCUbootloader overwrite during flash primary application. Signed-off-by: Sreeram Tatapudi --- boards/infineon/cyw920829m2evk_02/board.cmake | 13 +++++++++++++ .../infineon/cyw920829m2evk_02/support/openocd.cfg | 1 - .../support/openocd_CYW208xx_SMIF_64K.cfg | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 boards/infineon/cyw920829m2evk_02/support/openocd_CYW208xx_SMIF_64K.cfg diff --git a/boards/infineon/cyw920829m2evk_02/board.cmake b/boards/infineon/cyw920829m2evk_02/board.cmake index be95fa715a3..833f354b9c0 100644 --- a/boards/infineon/cyw920829m2evk_02/board.cmake +++ b/boards/infineon/cyw920829m2evk_02/board.cmake @@ -2,6 +2,19 @@ # SPDX-License-Identifier: Apache-2.0 board_runner_args(openocd "--target-handle=TARGET.cm33") + +# MCUboot requires a flashloader with 64k erase size, please use 'west blobs fetch hal_infineon' to download it. +if(CONFIG_BOOTLOADER_MCUBOOT) + set(flashloader_blobs_path ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/zephyr/blobs/flashloader/TARGET_CYW920829M2EVK-02) + + if(NOT EXISTS ${flashloader_blobs_path}/CYW208xx_SMIF_64K.FLM) + message(WARNING "MCUboot requires a flashloader with 64k erase size, please use 'west blobs fetch hal_infineon' to download it") + else() + board_runner_args(openocd "--openocd-search=${flashloader_blobs_path}") + board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_CYW208xx_SMIF_64K.cfg") + endif() +endif() + include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) board_runner_args(jlink "--device=CYW20829_tm") include (${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/infineon/cyw920829m2evk_02/support/openocd.cfg b/boards/infineon/cyw920829m2evk_02/support/openocd.cfg index fe70fb383a8..d6578e98a03 100644 --- a/boards/infineon/cyw920829m2evk_02/support/openocd.cfg +++ b/boards/infineon/cyw920829m2evk_02/support/openocd.cfg @@ -2,7 +2,6 @@ # Copyright (c) 2018 Linaro Limited. # # SPDX-License-Identifier: Apache-2.0 - source [find interface/kitprog3.cfg] transport select swd diff --git a/boards/infineon/cyw920829m2evk_02/support/openocd_CYW208xx_SMIF_64K.cfg b/boards/infineon/cyw920829m2evk_02/support/openocd_CYW208xx_SMIF_64K.cfg new file mode 100644 index 00000000000..d1f0a09f855 --- /dev/null +++ b/boards/infineon/cyw920829m2evk_02/support/openocd_CYW208xx_SMIF_64K.cfg @@ -0,0 +1,7 @@ +# +# Copyright (c) 2018 Linaro Limited. +# +# SPDX-License-Identifier: Apache-2.0 +set QSPI_FLASHLOADER "CYW208xx_SMIF_64K.FLM" + +source [find openocd.cfg]