Learning Objectives #
After completing this section, you will be able to:
- Use the VI editor for command-line editing
- Enable and use Emacs mode
- Describe and implement the object-module loader
The VxWorks kernel shell leverages command-line editors to improve development efficiency. It also provides an object-module loader to dynamically load and unload code at runtime.
Command Line Editing #
The kernel shell supports VI as the primary editor and Emacs as a secondary editor. Commands entered in the shell are stored in a history buffer, with a default maximum length of 20 commands. The shell also supports command-line completion.
Navigating in VI #
To work in the VI editor, press ESC
to enter line-editing mode. Key commands include:
k
- Move backward through history bufferj
- Move forward through history bufferh
- Move cursor leftl
- Move cursor righta
- Append after cursorA
- Append at end of linei
- Insert before cursorI
- Insert at beginning of linerc
- Replace current character with characterc
x
- Delete current characterdd
- Delete entire linenG
- Go to history line or search for string
Command-Line Completion #
The shell supports command and file autocompletion:
CTRL+D
- List symbolsCTRL+D, TAB
- Autocomplete symbols or file names
Enabling Emacs Mode #
Emacs can be enabled with the following command:
shConfig "LINE_EDIT_MODE=emacs"
Note: Emacs provides more features than VI but has higher overhead, which is why VI is the default editor.
Command History Limit #
You can modify the history buffer size using the h()
function. For example, h 500
increases the buffer size to 500 commands.
Object-Module Loader #
The object-module loader allows the kernel to dynamically load and unload code at runtime. This enables iterative development without rebuilding the VIP or rebooting the target for every code change.
INCLUDE_LOADER
.
The loader requires access to the symbol table.
After configuration, two primary functions become available:
ld()
– Load object modules into the C interpreterunld()
– Unload object modules
The object-module loader seamlessly integrates new code with the existing VxWorks image, allowing for dynamic expansion. It also manages memory allocation, either dynamically for downloaded modules or with pre-specified addresses for fine-grained control.