shell: rename module sections
Prepare for supporting stand-alone commands. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
fa7f13ef00
commit
8d1931504a
3 changed files with 16 additions and 12 deletions
|
@ -99,10 +99,10 @@
|
|||
* their shell commands are automatically initialized by the kernel.
|
||||
*/
|
||||
|
||||
#define SHELL_INIT_SECTIONS() \
|
||||
__shell_cmd_start = .; \
|
||||
KEEP(*(".shell_*")); \
|
||||
__shell_cmd_end = .;
|
||||
#define SHELL_INIT_SECTIONS() \
|
||||
__shell_module_start = .; \
|
||||
KEEP(*(".shell_module_*")); \
|
||||
__shell_module_end = .;
|
||||
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ struct shell_module {
|
|||
#define SHELL_REGISTER_WITH_PROMPT(_name, _commands, _prompt) \
|
||||
\
|
||||
static struct shell_module (__shell__name) __used \
|
||||
__attribute__((__section__(".shell_"))) = { \
|
||||
__attribute__((__section__(".shell_module_"))) = { \
|
||||
.module_name = _name, \
|
||||
.commands = _commands, \
|
||||
.prompt = _prompt \
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
#define PROMPT_MAX_LEN (MODULE_NAME_MAX_LEN + PROMPT_SUFFIX)
|
||||
|
||||
/* command table is located in the dedicated memory segment (.shell_) */
|
||||
extern struct shell_module __shell_cmd_start[];
|
||||
extern struct shell_module __shell_cmd_end[];
|
||||
#define NUM_OF_SHELL_ENTITIES (__shell_cmd_end - __shell_cmd_start)
|
||||
extern struct shell_module __shell_module_start[];
|
||||
extern struct shell_module __shell_module_end[];
|
||||
#define NUM_OF_SHELL_ENTITIES (__shell_module_end - __shell_module_start)
|
||||
|
||||
static const char *prompt;
|
||||
static char default_module_prompt[PROMPT_MAX_LEN];
|
||||
|
@ -142,9 +142,9 @@ static struct shell_module *get_destination_module(const char *module_str)
|
|||
|
||||
for (i = 0; i < NUM_OF_SHELL_ENTITIES; i++) {
|
||||
if (!strncmp(module_str,
|
||||
__shell_cmd_start[i].module_name,
|
||||
__shell_module_start[i].module_name,
|
||||
MODULE_NAME_MAX_LEN)) {
|
||||
return &__shell_cmd_start[i];
|
||||
return &__shell_module_start[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,9 +239,13 @@ module_help:
|
|||
} else { /* help for all entities */
|
||||
int i;
|
||||
|
||||
printk("Available modules:\n");
|
||||
if (NUM_OF_SHELL_ENTITIES == 0) {
|
||||
printk("No registered modules.\n");
|
||||
} else {
|
||||
printk("Available modules:\n");
|
||||
}
|
||||
for (i = 0; i < NUM_OF_SHELL_ENTITIES; i++) {
|
||||
printk("%s\n", __shell_cmd_start[i].module_name);
|
||||
printk("%s\n", __shell_module_start[i].module_name);
|
||||
}
|
||||
|
||||
printk("\nTo select a module, enter 'select <module name>'.\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue