From 8a63c9c8c8bb5df8e85947e8b57990ab641c239b Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Tue, 7 Apr 2020 08:08:06 +0200 Subject: [PATCH] shell: Add dedicated section for shell instances Addded dedicated section for shell instances. Signed-off-by: Krzysztof Chruscinski --- include/linker/common-rom.ld | 7 +++++++ include/shell/shell.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index f7e94955f86..ed2ba8c26e8 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -147,6 +147,13 @@ __log_backends_end = .; } GROUP_LINK_IN(ROMABLE_REGION) + SECTION_DATA_PROLOGUE(shell_sections,,) + { + _shell_list_start = .; + KEEP(*(SORT(._shell.static.*))); + _shell_list_end = .; + } GROUP_LINK_IN(ROMABLE_REGION) + SECTION_DATA_PROLOGUE(shell_root_cmds_sections,,) { __shell_root_cmds_start = .; diff --git a/include/shell/shell.h b/include/shell/shell.h index 97dcdd90df2..a1ea0c1d56f 100644 --- a/include/shell/shell.h +++ b/include/shell/shell.h @@ -629,7 +629,7 @@ extern void shell_print_stream(const void *user_ctx, const char *data, SHELL_STATS_DEFINE(_name); \ static K_THREAD_STACK_DEFINE(_name##_stack, CONFIG_SHELL_STACK_SIZE); \ static struct k_thread _name##_thread; \ - static const struct shell _name = { \ + static const Z_STRUCT_SECTION_ITERABLE(shell, _name) = { \ .default_prompt = _prompt, \ .iface = _transport_iface, \ .ctx = &UTIL_CAT(_name, _ctx), \