Questions about the shell
Moderators: RoccoMarco, lbednarz, tfAteba
Questions about the shell
Are there any examples of complete feature use for the shell? I've not found any.
I only see the examples of the main() function starting the shell thread and then basically letting it spin.
Functions as described in the Shell Enhancements post: http://www.chibios.com/forum/viewtopic.php?f=24&t=3293
look to be useful, but I cannot get any of the them to function as intended simply by enabling them in shell.h
These functions require various other structs of various kinds. Does anyone have a full example code snippet showing some of these structures initalized or declared?
Most of the examples online are from older shell versions. Functions that no longer exist in the trunk are always used in them.
I only see the examples of the main() function starting the shell thread and then basically letting it spin.
Functions as described in the Shell Enhancements post: http://www.chibios.com/forum/viewtopic.php?f=24&t=3293
look to be useful, but I cannot get any of the them to function as intended simply by enabling them in shell.h
These functions require various other structs of various kinds. Does anyone have a full example code snippet showing some of these structures initalized or declared?
Most of the examples online are from older shell versions. Functions that no longer exist in the trunk are always used in them.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Questions about the shell
Hi,
Shell demos in trunk do not use completion by default, you just need to enable it and add the extra info (a buffer) into the shell configuration structure.
Giovanni
Shell demos in trunk do not use completion by default, you just need to enable it and add the extra info (a buffer) into the shell configuration structure.
Code: Select all
/**
* @brief Shell descriptor type.
*/
typedef struct {
BaseSequentialStream *sc_channel; /**< @brief I/O channel associated
to the shell. */
const ShellCommand *sc_commands; /**< @brief Shell extra commands
table. */
#if (SHELL_USE_HISTORY == TRUE) || defined(__DOXYGEN__)
char *sc_histbuf; /**< @brief Shell command history
buffer. */
const int sc_histsize; /**< @brief Shell history buffer
size. */
#endif
#if (SHELL_USE_COMPLETION == TRUE) || defined(__DOXYGEN__)
char **sc_completion; /**< @brief Shell command completion
buffer. */
#endif
} ShellConfig;
Giovanni
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Questions about the shell
You need to set SHELL_USE_COMPLETION, SHELL_USE_ESC_SEQ and SHELL_USE_HISTORY to TRUE.
Try CTRL-N and CTRL-P for history too.
Giovanni
Try CTRL-N and CTRL-P for history too.
Giovanni
Re: Questions about the shell
Giovanni
I used shell in my previous design and definitely want to use it again.
I included shell.h in my main.c and compiler has no objection about that.
However, when I add call of shellInit(); it gives me the error message
What do I do wrong? Should I copy shell.c and shell.h inside my project or keeping them in os/various directory is ok.
And, BTW, it is the same whether I try in it ChibiStudio or in SW4STM32.
Even on favorite path C:\ChibiOS the same story
I used shell in my previous design and definitely want to use it again.
I included shell.h in my main.c and compiler has no objection about that.
However, when I add call of shellInit(); it gives me the error message
D:\TMP\cconOoqt.ltrans0.ltrans.o: In function `main':
D:\Designs\Firmware\CH_M3DisplayEval/main.c:49: undefined reference to `shellInit'
collect2.exe: error: ld returned 1 exit status
make: *** [build/ch_m3displayeval.elf] Error 1
What do I do wrong? Should I copy shell.c and shell.h inside my project or keeping them in os/various directory is ok.
And, BTW, it is the same whether I try in it ChibiStudio or in SW4STM32.
Even on favorite path C:\ChibiOS the same story
C:\ChibiStudio\chibios161\demos\STM32\RT-STM32L152RE-NUCLEO/main.c:58: undefined reference to `shellInit'
collect2.exe: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Questions about the shell
No 
I thought including shell.h would be enough for the compiler to find shell.c as well
Added to Makefile
Created shell.mk
Did not help
I thought including shell.h would be enough for the compiler to find shell.c as well
Added to Makefile
Code: Select all
include ${CHIBIOS}/os/various/shell.mkCreated shell.mk
Code: Select all
# List of all the ChibiOS/RT shell files.
SHELLSRC = ${CHIBIOS}/os/various/shell.c
# Required include directories
SHELLINC = ${CHIBIOS}/os/various/Did not help
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Questions about the shell
Look at the makefile of any demo using the shell and make sure to do the same, you are forgetting to expand those variables probably.
Giovanni
Giovanni