diff --git a/sys/include/shell.h b/sys/include/shell.h index 848c3ecb6315..8a6f256ea679 100644 --- a/sys/include/shell.h +++ b/sys/include/shell.h @@ -283,15 +283,14 @@ int shell_parse_file(const shell_command_t *commands, * ``` */ #define SHELL_COMMAND(cmd, help, func) \ - XFA_USE_CONST(shell_command_xfa_t*, shell_commands_xfa); \ + XFA_USE_CONST(shell_command_xfa_t, shell_commands_xfa); \ static FLASH_ATTR const char _xfa_ ## cmd ## _cmd_name[] = #cmd; \ static FLASH_ATTR const char _xfa_ ## cmd ## _cmd_desc[] = help; \ - static const shell_command_xfa_t _xfa_ ## cmd ## _cmd = { \ + XFA_CONST(shell_command_xfa_t, shell_commands_xfa, 0) _xfa_ ## cmd ## _cmd = { \ .name = _xfa_ ## cmd ## _cmd_name, \ .desc = _xfa_ ## cmd ## _cmd_desc, \ .handler = &func \ - }; \ - XFA_ADD_PTR(shell_commands_xfa, cmd, cmd, &_xfa_ ## cmd ## _cmd) + }; #endif /* __cplusplus */ #ifdef __cplusplus diff --git a/sys/shell/shell.c b/sys/shell/shell.c index 90dcaceb4888..1c974f63f7d5 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -47,7 +47,7 @@ #endif /* define shell command cross file array */ -XFA_INIT_CONST(shell_command_xfa_t*, shell_commands_xfa); +XFA_INIT_CONST(shell_command_xfa_t, shell_commands_xfa); #define ETX '\x03' /** ASCII "End-of-Text", or Ctrl-C */ #define EOT '\x04' /** ASCII "End-of-Transmission", or Ctrl-D */ @@ -102,10 +102,10 @@ static shell_command_handler_t search_commands(const shell_command_t *entry, static shell_command_handler_t search_commands_xfa(char *command) { - unsigned n = XFA_LEN(shell_command_t*, shell_commands_xfa); + unsigned n = XFA_LEN(shell_command_t, shell_commands_xfa); for (unsigned i = 0; i < n; i++) { - const volatile shell_command_xfa_t *entry = shell_commands_xfa[i]; + const volatile shell_command_xfa_t *entry = &shell_commands_xfa[i]; if (flash_strcmp(command, entry->name) == 0) { return entry->handler; } @@ -138,9 +138,9 @@ static void print_commands(const shell_command_t *entry) static void print_commands_xfa(void) { - unsigned n = XFA_LEN(shell_command_xfa_t*, shell_commands_xfa); + unsigned n = XFA_LEN(shell_command_xfa_t, shell_commands_xfa); for (unsigned i = 0; i < n; i++) { - const volatile shell_command_xfa_t *entry = shell_commands_xfa[i]; + const volatile shell_command_xfa_t *entry = &shell_commands_xfa[i]; printf("%-20" PRIsflash " %" PRIsflash "\n", entry->name, entry->desc); }