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/+/9447

-- gerrit

commit 888a4a3ab74f230fe80b1562d10389bf97000016
Author: Jérôme Pouiller <[email protected]>
Date:   Wed Feb 4 11:36:32 2026 +0100

    flash/nor/efm32: Properly display detected board
    
    We can now properly display the information related to the Series 2 SoCs.
    
    Signed-off-by: Jérôme Pouiller <[email protected]>
    Change-Id: I72f365bfd6109d8705c5eb48f438887f47f2d25f

diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c
index 0663f312ba..88613cac89 100644
--- a/src/flash/nor/efm32.c
+++ b/src/flash/nor/efm32.c
@@ -1054,12 +1054,52 @@ static int efm32_write(struct flash_bank *bank, const 
uint8_t *buffer,
        return efm32_priv_write(bank, buffer, bank->base + offset, count);
 }
 
+static char *efm32_get_str_identifier(struct efm32_info *efm32_mcu_info,
+                                     char *buf, int len)
+{
+       const char *types = "FMBZxP";
+       unsigned int dev_num, dev_family, dev_type;
+       unsigned int dev_num_digits;
+       char dev_num_letter;
+
+       if (efm32_mcu_info->part_info) {
+               dev_num    = FIELD_GET(EFM32_DI_PARTINFO_NUM_MASK,
+                                      efm32_mcu_info->part_info);
+               dev_family = FIELD_GET(EFM32_DI_PARTINFO_FAMILY_MASK,
+                                      efm32_mcu_info->part_info);
+               dev_type   = FIELD_GET(EFM32_DI_PARTINFO_TYPE_MASK,
+                                      efm32_mcu_info->part_info);
+
+               if (dev_type > strlen(types)) {
+                       snprintf(buf, len, "Unknown MCU family %d", dev_type);
+                       return buf;
+               }
+
+               dev_num_letter = 'A' + (dev_num / 1000);
+               dev_num_digits = dev_num % 1000;
+
+               snprintf(buf, len, "%s%cG%d %c%03d, rev %d",
+                       types[dev_type] == 'P' ? "EFM32" : "EFR32",
+                       types[dev_type],
+                       dev_family,
+                       dev_num_letter,
+                       dev_num_digits,
+                       efm32_mcu_info->part_rev);
+       } else {
+               snprintf(buf, len, "%s Gecko, rev %d",
+                       efm32_mcu_info->family_data->name,
+                       efm32_mcu_info->part_rev);
+       }
+       return buf;
+}
+
 static int efm32_probe(struct flash_bank *bank)
 {
        struct efm32_flash_chip *efm32_info = bank->driver_priv;
        struct efm32_info *efm32_mcu_info = &efm32_info->info;
-       int ret;
        int bank_index = efm32_get_bank_index(bank->base);
+       char strbuf[256];
+       int ret;
 
        assert(bank_index >= 0);
 
@@ -1070,8 +1110,8 @@ static int efm32_probe(struct flash_bank *bank)
        if (ret != ERROR_OK)
                return ret;
 
-       LOG_INFO("detected part: %s Gecko, rev %d",
-                efm32_mcu_info->family_data->name, efm32_mcu_info->part_rev);
+       LOG_INFO("detected part: %s",
+                efm32_get_str_identifier(efm32_mcu_info, strbuf, 
sizeof(strbuf)));
        LOG_INFO("flash size = %d KiB", efm32_mcu_info->flash_sz_kib);
        LOG_INFO("flash page size = %d B", efm32_mcu_info->page_size);
 
@@ -1146,6 +1186,7 @@ static int efm32_protect_check(struct flash_bank *bank)
 static int efm32_get_info(struct flash_bank *bank, struct command_invocation 
*cmd)
 {
        struct efm32_flash_chip *efm32_info = bank->driver_priv;
+       char strbuf[256];
        int ret;
 
        ret = efm32_read_info(bank);
@@ -1154,9 +1195,10 @@ static int efm32_get_info(struct flash_bank *bank, 
struct command_invocation *cm
                return ret;
        }
 
-       command_print_sameline(cmd, "%s Gecko, rev %d",
-                              efm32_info->info.family_data->name,
-                              efm32_info->info.part_rev);
+       command_print_sameline(cmd, "%s",
+                              efm32_get_str_identifier(&efm32_info->info,
+                                                       strbuf,
+                                                       sizeof(strbuf)));
        return ERROR_OK;
 }
 
@@ -1212,7 +1254,7 @@ static const struct command_registration 
efm32_command_handlers[] = {
        {
                .name = "efm32",
                .mode = COMMAND_ANY,
-               .help = "efm32 flash command group",
+               .help = "Silicon Labs (EFM32 and EFR32) flash command group",
                .usage = "",
                .chain = efm32_exec_command_handlers,
        },

-- 

Reply via email to