VxWorks is a real-time operating system (RTOS) developed by Wind River. While Wind River provides its Workbench Eclipse-based IDE for VxWorks development, many developers prefer the speed and flexibility of Emacs. This guide outlines how to configure Emacs for building and navigating VxWorks code-specifically VxWorks 7-though most instructions also apply to earlier versions (6.x, 653, and Tornado).
By using Emacs, you benefit from a more responsive, keyboard-driven development workflow and a rich ecosystem of tools like Semantic, GNU Global, and auto-complete—all contributing to faster development and reduced costs.
1. Prerequisites #
This guide assumes familiarity with:
- VxWorks development and the Wind River Workbench.
- VSB (VxWorks Source Build), VIP (VxWorks Image Project), and DKM (Downloadable Kernel Module).
- Emacs and basic Emacs Lisp customization (editing
.emacs
orinit.el
).
Note: This is a living document. Additional features (like GDB integration) may be added in future versions.
Portions of this document were inspired by Bernt Hansen’s excellent org-mode reference.
2. License #
© 2025 Kontronn
This document is licensed under the GNU Free Documentation License v1.3 or later. All code examples and CSS are released under the GNU General Public License v3 or later.
3. What’s New #
v0.01 – Initial release.
4. Getting Started: Emacs and VxWorks on Windows #
This setup has been tested on Windows hosts. While not tested on Linux, most of the steps should be portable.
VxWorks 7 builds require a native Windows command shell (not Cygwin). To integrate Emacs with VxWorks:
4.1 Install GNU Global #
Download a Windows build of GNU Global and install it (e.g., under Program Files (x86)
), making sure the binary is available in your system PATH
.
4.2 Generate GTAGS #
Create a batch file generate-gtags.bat
to scan your VxWorks source files:
REM Generate list of source files for GTAGS
dir /S /A-D /B vxworks-7*.c > gtags-files.txt
dir /S /A-D /B vxworks-7*.h >> gtags-files.txt
dir /S /A-D /B vxworks-7*.cdf >> gtags-files.txt
dir /S /A-D /B vxworks-7*.vsbl >> gtags-files.txt
dir /S /A-D /B vxworks-7*.s >> gtags-files.txt
dir /S /A-D /B workspace*.c >> gtags-files.txt
dir /S /A-D /B workspace*.h >> gtags-files.txt
dir /S /A-D /B workspace*.cdf >> gtags-files.txt
gtags -v -f gtags-files.txt
Run this from your WINDBASE
(Wind River base installation directory).
4.3 Configuring Emacs #
4.3.1 Emacs Build #
Download a 64-bit Windows build of Emacs from:
https://emacsbinw64.sourceforge.net/
4.3.2 Emacs Code Browser (ECB) #
Install ECB for structured code navigation:
(add-to-list 'load-path "~/.emacs.d/lisp/ecb-master")
(require 'ecb)
(Manual install recommended from https://github.com/alexott/ecb/)
4.3.3 gtags Support #
Enable gtags
for fast source navigation:
(setq gtags-suggested-key-mapping t)
(setq load-path (cons "~/.emacs.d/lisp" load-path))
(autoload 'gtags-mode "gtags" "" t)
(add-hook 'c-mode-hook (lambda () (gtags-mode 1)))
(global-set-key "M-]" 'gtags-find-tag-from-here)
(global-set-key "M-[" 'gtags-pop-stack)
(global-set-key "M-#" 'gtags-find-rtag)
Optional: auto-update GTAGS on file save:
(defun gtags-root-dir () ...)
(defun gtags-update-single(filename) ...)
(defun gtags-update-current-file() ...)
(defun gtags-update-hook() ...)
(add-hook 'after-save-hook 'gtags-update-hook)
TODO: Update this section to use
ggtags
for better robustness.
4.3.4 Semantic & Auto-complete #
Enable Semantic and IntelliSense-like features:
(semantic-mode 1)
(global-ede-mode 1)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-idle-completions-mode 1)
(defun ed-add-semantic-to-autocomplete ()
(add-to-list 'ac-sources 'ac-source-semantic))
(add-hook 'c-mode-common-hook 'ed-add-semantic-to-autocomplete)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
(defvar semantic-tags-location-ring (make-ring 20))
(defun semantic-goto-definition (point) ...)
(defun semantic-pop-tag-mark () ...)
(global-set-key "M-." 'semantic-goto-definition)
(global-set-key "M-," 'semantic-pop-tag-mark)
(global-set-key "M-/" 'semantic-ia-show-doc)
(global-set-key "C-c/" 'semantic-ia-show-summary)
(ac-config-default)
4.3.5 Wind River Code Style #
Apply Wind River formatting:
(defconst wrs-c-style '((c-tab-always-indent . t) ...))
(defun my-c-mode-common-hook ()
(c-add-style "WRS" wrs-c-style t)
(setq tab-width 4
indent-tabs-mode nil)
(define-key c-mode-base-map "C-m" 'c-context-line-break))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
5. vxworks.el
: Automating VSB and VIP Builds
#
5.1 Setup #
Two Lisp files are needed:
vxworks.el
: General build helpers.vxworks7env.el
: Your local environment setup.
Run wrenv -p vxworks-7 -o print_env
in a VxWorks shell and ensure your environment matches vxworks7env.el
.
5.2 .emacs
Setup
#
(load-file "~/.emacs.d/lisp/vxworks.el")
(setq vxworks-install-dir "C:/WindRiver_vxw7.0/")
(setq vxworks-workspace-dir "C:/WindRiver_vxw7.0/workspace/")
(setup-vxworks-7-env)
Note: If vxworks-install-dir
is not set, Emacs will prompt you at startup.