This is an automated email from Gerrit. "Jérôme Pouiller <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9455
-- gerrit commit af7edf4bce265d32851178801943e38c9f1faa99 Author: Jérôme Pouiller <[email protected]> Date: Fri Feb 6 21:35:53 2026 +0100 flash/nor/efm32: Don't read lock bank on Series 2 Series-2 don't support lock bank. So, just return an error. In addition, drop efm32_read_lock_data() from efm32_probe(). It seems it mainly used to provide a sanity check about lock bank access. However, it makes more sense to call it from efm32_protect() rather than from efm32_probe(). Signed-off-by: Jérôme Pouiller <[email protected]> Change-Id: Ide910a33e54586c00dc083e1e825e17a76507baa diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c index b282b5ffa3..c0775d63ec 100644 --- a/src/flash/nor/efm32.c +++ b/src/flash/nor/efm32.c @@ -722,14 +722,24 @@ static int efm32_set_page_lock(struct flash_bank *bank, size_t page, int set) static int efm32_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last) { + struct efm32_flash_chip *efm32_info = bank->driver_priv; struct target *target = bank->target; int ret = 0; + if (efm32_info->info.family_data->series == 2) + return ERROR_FLASH_OPER_UNSUPPORTED; + if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; } + ret = efm32_read_lock_data(bank); + if (ret != ERROR_OK) { + LOG_ERROR("Failed to read LB data"); + return ret; + } + for (unsigned int i = first; i <= last; i++) { ret = efm32_set_page_lock(bank, i, set); if (ret != ERROR_OK) { @@ -1129,12 +1139,6 @@ static int efm32_probe(struct flash_bank *bank) if (bank->base == EFM32_FLASH_BASE) { bank->num_sectors = efm32_mcu_info->flash_sz_kib * 1024 / efm32_mcu_info->page_size; assert(bank->num_sectors > 0); - - ret = efm32_read_lock_data(bank); - if (ret != ERROR_OK) { - LOG_ERROR("Failed to read LB data"); - return ret; - } } else { bank->num_sectors = 1; } @@ -1164,9 +1168,13 @@ static int efm32_auto_probe(struct flash_bank *bank) static int efm32_protect_check(struct flash_bank *bank) { + struct efm32_flash_chip *efm32_info = bank->driver_priv; struct target *target = bank->target; int ret = 0; + if (efm32_info->info.family_data->series == 2) + return ERROR_FLASH_OPER_UNSUPPORTED; + if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; --
