่ทณ่ฟ‡ๆญฃๆ–‡

Build Self-Booting VxWorks Images with Archive Libraries (.a)

·602 ๅญ—·3 ๅˆ†้’Ÿ
VxWorks RTOS Embedded Systems U-Boot BSP Static Linking Archive Library Tornado Powerpc
็›ฎๅฝ•

Build Self-Booting VxWorks Images with Archive Libraries (.a)

๐Ÿ” Overview
#

Modern embedded systems increasingly require autonomous operation without manual intervention. A common production requirement is a self-booting VxWorks image that integrates both the operating system and user applications into a single binary, enabling automatic execution at power-on.

This article presents a practical and scalable approach for building self-booting VxWorks images. It compares traditional static linking methods with a more maintainable and optimized approach using archive libraries (.a), including concrete build examples and integration techniques.


โš™๏ธ VxWorks System Composition
#

A typical VxWorks-based system consists of three core components:

  • bootrom: Initializes hardware and loads the OS
  • VxWorks kernel: Provides RTOS services
  • User applications: Implement system functionality

Development vs Deployment Model
#

Phase Component Description
Development bootrom Hardware-specific initialization, stored in ROM
VxWorks Kernel image, downloaded or loaded
User Programs Developed and debugged independently
Deployment bootrom Fixed in ROM
VxWorks + User Applications Integrated and stored in Flash

A self-booting image combines VxWorks and user applications into a single executable that runs automatically after system startup.


๐Ÿš€ Self-Booting Image Creation Methods
#

Static Linking Overview
#

Static linking embeds user code directly into the VxWorks image. Two approaches are commonly used:


๐Ÿงฉ Method 1: Linking Source Files (.c)
#

Integration Example
#

/* usrConfig.c */

#include "usrAPI/myApp.c"

void usrRoot(char *pMemPoolStart, unsigned memPoolSize)
{
    /* VxWorks initialization */
    
    myAppInit();  /* Start user application */
}

Characteristics
#

  • Simple integration
  • Requires direct source inclusion
  • Poor portability across BSPs
  • Exposes source code

๐Ÿงฉ Method 2: Linking Object Files (.o)
#

Makefile Integration
#

# Makefile

LIB_EXTRA = \
    usrAPI/app1.o \
    usrAPI/app2.o

Header Declaration
#

/* usrAPI.h */

#ifndef __USR_API_H__
#define __USR_API_H__

void app1Init(void);
void app2Init(void);

#endif

Usage in usrRoot
#

#include "usrAPI/usrAPI.h"

void usrRoot(char *pMemPoolStart, unsigned memPoolSize)
{
    app1Init();
    app2Init();
}

Characteristics
#

  • Keeps BSP and application code separate
  • Protects source code (binary distribution)
  • Maintains clean project structure

๐Ÿ“ฆ Archive Library Method (.a) โ€” Recommended #

Why Use Archive Libraries
#

Using .a libraries provides:

  • Automatic inclusion of only referenced symbols
  • Reduced final image size
  • Clean separation of modules
  • Simplified portability across BSPs

๐Ÿ› ๏ธ Step 1: Create Archive Library
#

Build Script (makea.bat)
#

@echo off

set WIND_HOST_TYPE=x86-win32
set WIND_BASE=C:\Tornado
set PATH=%WIND_BASE%\host\%WIND_HOST_TYPE%\bin;%PATH%

rem Create archive library for PowerPC
arppc -crusv usrAPI.a app1.o app2.o utils.o

๐Ÿ› ๏ธ Step 2: Integrate Library into VxWorks
#

Makefile Configuration
#

# Makefile

LIB_EXTRA = usrAPI/usrAPI.a

๐Ÿ› ๏ธ Step 3: Header Interface
#

/* usrAPI.h */

#ifndef __USR_API_H__
#define __USR_API_H__

void app1Init(void);
void app2Init(void);
void utilsInit(void);

#endif

๐Ÿ› ๏ธ Step 4: Application Entry Hook
#

#include "usrAPI/usrAPI.h"

void usrRoot(char *pMemPoolStart, unsigned memPoolSize)
{
    app1Init();
    app2Init();
}

๐Ÿ› ๏ธ Step 5: Full Build Process
#

makeclean
makeall

๐Ÿ”„ Updating User Applications
#

To update application logic without restructuring:

  1. Recompile .o files
  2. Rebuild archive:
arppc -crusv usrAPI.a *.o
  1. Force rebuild:
makeclean
makeall

โš–๏ธ Method Comparison
#

Method Pros Cons
.c Linking Simple, no Makefile changes Poor portability, exposes source
.o Linking Clean structure, protects IP Includes all symbols
.a Linking Optimized size, modular, portable Slightly more setup

๐Ÿ”ง BSP Integration Notes
#

  • Place usrAPI under BSP directory
  • Modify config.h for feature inclusion
  • Customize boot behavior via bootconfig.c

Example: Auto-Boot Configuration
#

/* bootconfig.c */

void autoboot(void)
{
    sysClkRateSet(100);
    printf("Auto booting VxWorks with user app...\n");
}

โœ… Conclusion
#

Creating a self-booting VxWorks image is essential for production-grade embedded systems. While traditional static linking methods remain viable, the archive library (.a) approach offers clear advantages:

  • Smaller and optimized binaries
  • Better code organization
  • Easier cross-platform portability
  • Improved maintainability

For modern embedded workflows, especially in large-scale or multi-platform deployments, the .a-based integration method provides the most robust and scalable solution.

็›ธๅ…ณๆ–‡็ซ 

VxWorks 7 on T2080: BSP, U-Boot, and Kernel Adaptation Guide
·615 ๅญ—·3 ๅˆ†้’Ÿ
VxWorks 7 T2080 U-Boot BSP Device-Tree Embedded Systems RTOS Powerpc VxBus
Adapting VxWorks 7 to the T2080 PowerPC Processor
·823 ๅญ—·4 ๅˆ†้’Ÿ
VxWorks RTOS Powerpc Embedded Systems BSP
Synergy Microsystems VxWorks BSP Guide for PowerPC CPU Boards
·1247 ๅญ—·6 ๅˆ†้’Ÿ
VxWorks Powerpc Board Support Package BSP Tornado Embedded Systems VMEbus CompactPCI Real-Time-Operating-System