3636#include <assert.h>
3737#include <errno.h>
3838
39- #include "kernel_defines.h"
4039#include "xfa.h"
4140#include "shell.h"
4241#include "shell_lock.h"
4746#endif
4847
4948/* define shell command cross file array */
50- XFA_INIT_CONST (shell_command_xfa_t * , shell_commands_xfa );
49+ XFA_INIT_CONST (shell_command_xfa_t , shell_commands_xfa_v2 );
5150
5251#define ETX '\x03' /** ASCII "End-of-Text", or Ctrl-C */
5352#define EOT '\x04' /** ASCII "End-of-Transmission", or Ctrl-D */
@@ -102,10 +101,10 @@ static shell_command_handler_t search_commands(const shell_command_t *entry,
102101
103102static shell_command_handler_t search_commands_xfa (char * command )
104103{
105- unsigned n = XFA_LEN (shell_command_t * , shell_commands_xfa );
104+ unsigned n = XFA_LEN (shell_command_t , shell_commands_xfa_v2 );
106105
107106 for (unsigned i = 0 ; i < n ; i ++ ) {
108- const volatile shell_command_xfa_t * entry = shell_commands_xfa [i ];
107+ const volatile shell_command_xfa_t * entry = & shell_commands_xfa_v2 [i ];
109108 if (flash_strcmp (command , entry -> name ) == 0 ) {
110109 return entry -> handler ;
111110 }
@@ -147,15 +146,15 @@ static void print_commands_json(const shell_command_t *cmd_list)
147146 }
148147 }
149148
150- unsigned n = XFA_LEN (shell_command_xfa_t * , shell_commands_xfa );
149+ unsigned n = XFA_LEN (shell_command_xfa_t , shell_commands_xfa_v2 );
151150 for (unsigned i = 0 ; i < n ; i ++ ) {
152151 if (first ) {
153152 first = false;
154153 }
155154 else {
156155 printf (", " );
157156 }
158- const volatile shell_command_xfa_t * entry = shell_commands_xfa [i ];
157+ const volatile shell_command_xfa_t * entry = & shell_commands_xfa_v2 [i ];
159158 printf ("{\"cmd\": \"%s\", \"desc\": \"%s\"}" , entry -> name , entry -> desc );
160159 }
161160 puts ("]}" );
@@ -170,9 +169,9 @@ static void print_commands(const shell_command_t *entry)
170169
171170static void print_commands_xfa (void )
172171{
173- unsigned n = XFA_LEN (shell_command_xfa_t * , shell_commands_xfa );
172+ unsigned n = XFA_LEN (shell_command_xfa_t , shell_commands_xfa_v2 );
174173 for (unsigned i = 0 ; i < n ; i ++ ) {
175- const volatile shell_command_xfa_t * entry = shell_commands_xfa [i ];
174+ const volatile shell_command_xfa_t * entry = & shell_commands_xfa_v2 [i ];
176175 printf ("%-20" PRIsflash " %" PRIsflash "\n" ,
177176 entry -> name , entry -> desc );
178177 }
0 commit comments