Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10915371091537 Using the Shell Commands Anchor10953791095379To use shell commands, four files, in addition to the generic file system files, must be included in the build:anchor10953801095380

...

Anchor10915431091543The file fs_shell.h and shell.h must also be #included in any application or header files initialize µC/Shell or handle shell commands. The shell command configuration file (fs_shell_cfg.h) should be copied to your application directory and modified. The following directories must be on the project include path: Anchor10915441091544

...

µC/Shell with the µC/FS shell commands is initialized in Listing F Listing F-1. The file system initialization (FS_Init()) function should have previously been called. Anchor10974301097430  

...

...

Listing F-1 Initializing µC/Shell

...

anchor10922681092268

It’s assumed that the application will create a task to receive input from a terminal; this task should be written as shown in Listing F Listing F-2. Anchor10974451097445  

...

Listing F-2 Executing shell commands & handling shell output

...

LF-2(1) The SHELL_CMD_PARAM structure that will be passed to Shell_Exec() must be initialized. The pcur_working_dir member must be assigned a pointer to a string of at least FS_SHELL_CFG_MAX_PATH_LEN characters. This string must have been initialized to the default working directory path; if the root directory, “\”.

...

LF-2(2) The next command, ending with a newline, should be read from the command line.

...

LF-2(3) The received command should be executed with Shell_Exec(). If the command is a valid command, the appropriate command function will be called. For example, the command

...

fs_

...

lswill result in FSShell_ls() in fs_shell.c being called. FSShell_ls() will then print the entries in the working directory to the command line with the output function App_ShellOut(), passed as the second argument of Shell_Exec().