Skip to main content

Command Line Editing and Object-Module Loader in VxWorks

·399 words·2 mins
VxWorks Shell Object-Module Loader VI Emacs
Table of Contents
Free Training - This article is part of a series.
Part 15: This Article

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 buffer
  • j - Move forward through history buffer
  • h - Move cursor left
  • l - Move cursor right
  • a - Append after cursor
  • A - Append at end of line
  • i - Insert before cursor
  • I - Insert at beginning of line
  • rc - Replace current character with character c
  • x - Delete current character
  • dd - Delete entire line
  • nG - Go to history line or search for string

Command-Line Completion
#

The shell supports command and file autocompletion:

  • CTRL+D - List symbols
  • CTRL+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
#

Command Line History

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.

To use the loader, configure your VIP to include the component: INCLUDE_LOADER. The loader requires access to the symbol table.

Target Loader

After configuration, two primary functions become available:

  • ld() – Load object modules into the C interpreter
  • unld() – 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.

Do not unload an object-module while its tasks are still running; doing so may cause unexpected behavior.
Free Training - This article is part of a series.
Part 15: This Article

Related

Introduction to the VxWorks Kernel Shell
·320 words·2 mins
VxWorks Shell Kernel Development Debugging
Configuring and Building VxWorks Projects: VSB, VIP, and Applications
·651 words·4 mins
VxWorks VSB VIP Workbench RTP DKM
VxWorks ROMFS: Read-Only Memory File System Explained
·330 words·2 mins
VxWorks ROMFS File System Workbench