As you know the size of fw_commands (which can be declared as const btw) at built time, you will be able to loop directly on that count, thus you could remove this last entry.
===================
Memory consumption
===================
File: include/misc/shell.h
This file is the shell header file.
The following code already exists in its current Zephyr version:
typedef int (*shell_cmd_function_t)(int argc, char *argv[]);
struct shell_cmd {
const char *cmd_name;
shell_cmd_function_t cb;
const char *help;
};
• Note: Currently, “help” string’s length is not limited.
However, limitation on the length of each command’s help string should be
added.
And supporting such help could be Kconfig based. You may want to build the commands without their help string.
Shell Section
-----------------
1. Architecture dependency:
For all supported architectures – appropriate section prolog should be
declared.
Example- X86 arch:
File: include/arch/x86/linker-common-sections.h
SECTION_PROLOGUE(initshell, (OPTIONAL),)
{
SHELL_INIT_SECTIONS()
KEXEC_PGALIGN_PAD(MMU_PAGE_SIZE)
} GROUP_LINK_IN(RAM)
I don't see any blocker not to put it in romable region or?
===========
Open issues
===========
• Improve search:
Search (of the entity and then of the command) can be improved, for
example, by using hash tables.
This improvement has a conflict between Performance issue and Memory
consumption.
The improvement may be different between nanokernel and microkernel.
This improvement is currently out of this proposal scope.
Indeed there would be a lot to try here, from a very basic alphabet index to an hash table or search tree etc...