Flash map shell bug in SDK

Hi,

I installed nRF Connect SDK version v2.4.0, and the Zephyr RTOS version included with this release has a bug in the flash_map_shell that prevents it from being built.

In flash_map_shell.c, in fa_cb(), a pointer to the shell object is stored in the variable "shell". But in shell_print(), "sh" is referenced as the shell object (but this should be "shell").

In cmd_flash_map_list(), it is the other way around. This function has "sh" as the pointer to a shell object. And in "flash_area_foreach()" the "shell" is referenced instead of "sh".

static void fa_cb(const struct flash_area *fa, void *user_data)
{
	struct shell *shell = user_data;

	shell_print(sh, "%2d   0x%0*"PRIxPTR"   %-26s  0x%-10x 0x%-12x",
		    (int)fa->fa_id, sizeof(uintptr_t) * 2, (uintptr_t)fa->fa_dev, fa->fa_dev->name,
		    (uint32_t) fa->fa_off, fa->fa_size);
}

static int cmd_flash_map_list(const struct shell *sh, size_t argc,
			      char **argv)
{
	shell_print(sh, "ID | Device     | Device Name               "
		    "|   Offset   |   Size");
	shell_print(sh, "-----------------------------------------"
		    "------------------------------");
	flash_area_foreach(fa_cb, (struct shell *)shell);
	return 0;
}

In later versions of the Zephyr SDK (including v3.4.0-rc1), this problem does not persist.

Kind regards,

Tim

Related