<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Hey guys,<br /> <br /> I was working on adding user shell commands in RTEMS. Was able to successfully do it. Right now, we want to add few BSP specific shell commands and few application specific shell commands. The BSP shell commands will be added to the BSP, compiled and built. And also give the flexibility to user application to add application specific commands later on. One way to do it:</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">int bsp1(int argc, char **argv){</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">}</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">int bsp2(int argc, char **argv){</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">}</div>
</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">rtems_shell_cmd_t BSP1_Command = {<br />  "test1",                                  /* name */<br />  "test1",                                   /* usage */<br />  "user",                                   /* topic */<br />  bsp1,                                     /* command */<br />  NULL,                                     /* alias */<br />  NULL                                      /* next */<br />};</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">rtems_shell_cmd_t BSP2_Command = {<br />  "test2",                                  /* name */<br />  "test2",                                   /* usage */<br />  "user",                                   /* topic */<br />  bsp2,                                    /* command */<br />  NULL,                                     /* alias */<br />  NULL                                      /* next */<br />};</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">#define SHELL_USER_COMMANDS \<br />&BSP2_Command, \<br />&BSP1_Command</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">and the same in application code for APP1_Command and APP2_Command. And initialize the shell in the application code:</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">#define CONFIGURE_SHELL_USER_COMMANDS \<br />        SHELL_USER_COMMANDS,          \</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">        &APP1_Command,                \</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">        &APP2_Command</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">#define CONFIGURE_SHELL_COMMANDS_INIT</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">...</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">#include <rtems/shellconfig.h></div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Would this be the right way or are there any better ways to do it? Please let me know I didn't make myself clear on this.</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Thanks and Regards,</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Sudarshan Rajagopalan</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><a href="mailto:isaac.gutekunst@vecna.com">sudarshan.rajagopalan@vecna.com</a><br /> <br /> Cambridge Research Laboratory<br /> Vecna Technologies, Inc.<br /> 36 Cambridge Park Drive<br /> Cambridge, MA 02140<br /><a href="http://vecna.com" target="_blank" rel="noreferrer">http://vecna.com</a><br /> <br /> Better Technology, Better World (TM)</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
</body></html>