Introduction
In embedded systems, Flash memory is commonly used as a storage medium for application code, data, and configuration parameters. Among various types of Flash, NOR Flash stands out due to its simple interface, high performance, and ability to execute code directly from the memory (XIP). This makes it widely adopted in industrial control applications such as power systems and railway automation.
VxWorks, a real-time operating system, offers a Flash-based file system called TrueFFS, which is compatible with the DOSFS file system. It abstracts the Flash memory into a file system, allowing developers to manage Flash as if it were a regular disk. Implementing TrueFFS on specific Flash models requires careful design, especially when supporting features like dynamic updates, simulation, and debugging. This ensures flexibility and reliability in industrial environments.
1. System Basic Functions
The system is deployed in railway traction automation systems to provide protection, measurement, and control for power equipment in electrified rail networks. The core processor is Freescale’s ColdFire MCF5234, a 32-bit microcontroller with integrated peripherals such as UART, SPI, I2C, CAN, and Ethernet. Operating at up to 150 MHz, this system is ideal for industrial control and smart home appliances, particularly in power automation. Communication is handled via a dual Ethernet interface, while a maintenance serial port allows for device diagnostics. Two 16-bit NOR Flash chips are used for storing application code and critical parameters. Analog and digital inputs/outputs collect sensor data, which is processed by protection algorithms to control field devices.
In traditional embedded systems, applications are typically programmed directly into the Flash using tools like BDM debuggers. Upon boot, the CPU jumps to the Flash start address and executes the code. However, this approach is less flexible in VxWorks, where frequent software updates and debugging require a more dynamic setup. To support TrueFFS on two Flash chips and enable remote program updates via FTP, the system must implement several key features: TrueFFS on both Flash modules, FTP loading during boot, and modified bootrom to support both VxWorks and debug versions through TrueFFS and TFTP.
2. TrueFFS Implementation and Loading
2.1 TrueFFS Hierarchy
As shown in Figure 2, TrueFFS in VxWorks is structured into layers: kernel, translation, socket, and MTD. VxWorks provides a well-designed abstraction, so most users don’t need to modify the core code. The MTD layer handles basic Flash operations like read, write, and erase. For supported Flash types, no additional code is needed. For custom types, the MTD layer can be extended using provided examples. This modular design simplifies integration and maintenance.
2.2 MTD Layer Code Implementation
The system uses Spansion S29AL032D Flash chips, requiring custom driver development. The MTD layer provides essential functions like Flash recognition, sector erasing, and data writing. Instead of a separate mirror function, the system uses an internal default solution. Each Flash chip acts as a partition, so the driver must handle two separate memories. Writing operations depend on the Flash type and bus width, making the single-byte or word write function crucial. The flow of the write operation is illustrated in Figure 3, highlighting the steps required for reliable data storage and retrieval.
Jilin Nengxing Electrical Equipment Co. Ltd. , https://www.nengxingelectric.com