Firmware Modernization for Legacy Industrial Control Systems

Project Overview
EmbedCrest worked with an industrial controls manufacturer to modernize legacy PLC firmware across its product variants. The work drew on our core strengths in bare metal programming and MCU firmware, migrating 15 year old PIC assembly firmware to an ARM Cortex M4 platform running FreeRTOS with code following MISRA C 2012 guidelines. Our embedded engineers reverse engineered the undocumented legacy codebase, designed a pin compatible hardware migration to STM32F4 microcontrollers, and implemented a modern feature set including Modbus TCP and EtherNet/IP connectivity, IEC 61131 Part 3 programming language support, TLS 1.3 encrypted communications and secure OTA firmware updates. Our test engineers built a hardware in the loop validation framework that checks cycle for cycle equivalence with the legacy firmware. The project was delivered from our engineering office in Kalyan with pilot validation at customer sites. It shows how established industrial manufacturers can extend proven products with modern connectivity and security without a full redesign.
Business Problem
The client, an industrial controls manufacturer, makes programmable logic controllers and industrial I/O modules used in process control installations across India. Its flagship PLC line ran on legacy 8 bit PIC microcontrollers with assembly firmware written over 15 years ago, with no version control, no documentation and a single retiring engineer who understood the codebase. The controllers lacked network connectivity, modern safety features and remote diagnostics, while customers in chemical processing and water treatment were asking for Ethernet connectivity, cybersecurity and remote monitoring. The client had to choose between developing new hardware from scratch and modernizing the firmware on its proven hardware platform to extend its market life.
Technical Constraints
- Undocumented 8 bit PIC assembly firmware with no version control
- Pin compatible STM32F4 boards to keep the existing backplane and I/O modules
- Scan cycle timing designed to stay within 50 microseconds of the legacy firmware
- 14 PLC variants whose installed ladder logic programs must execute identically
- Modbus RTU preserved for existing SCADA alongside new Modbus TCP and EtherNet/IP
- TLS 1.3, signed firmware updates and security features aligned with IEC 62443
- Critical process control sites in chemical processing and water treatment
Pin compatible ARM controller with network stack
An STM32F4 board drops into the existing backplane and runs FreeRTOS with a deterministic scan cycle engine, IEC 61131 Part 3 interpreters, industrial protocol stacks, an embedded web server and a secure bootloader for signed updates.
Step 1
Controller hardware
Pin compatible STM32F4 Cortex M4 boards for existing backplanes and I/O modules
Step 2
Real time core
FreeRTOS with a deterministic scan cycle engine tuned to legacy timing
Step 3
Control runtime
IEC 61131 Part 3 ladder logic and structured text interpreters
Step 4
Industrial networking
Modbus TCP and EtherNet/IP over lwIP, Modbus RTU on serial
Step 5
Configuration and diagnostics
Embedded web server with role based access control
Step 6
Security
TLS 1.3, secure bootloader with signed firmware and encrypted credential storage
What Our Team Delivered
- Reverse engineered the legacy assembly codebase across all 14 PLC variants
- Produced architecture documentation, state machine diagrams and a full I/O mapping
- Designed the pin compatible migration path to STM32F4 microcontrollers
- Implemented FreeRTOS firmware following MISRA C 2012 guidelines, with IEC 61131 Part 3 interpreters
- Added Modbus TCP, EtherNet/IP, an embedded web server and TLS 1.3 communications
- Built a secure bootloader with signed firmware updates for field deployment
- Built the hardware in the loop bench comparing legacy and modernized firmware
- Supported pilot validation with the client's field engineers at customer pilot sites
Engineering Approach
Drawing on deep bare metal firmware experience, EmbedCrest undertook a firmware modernization program for the client. Our embedded developers first reverse engineered the legacy assembly codebase, producing architecture documentation, state machine diagrams and a full I/O mapping for all 14 PLC variants. We then designed a migration path to a modern ARM Cortex M4 based STM32F4 microcontroller, maintaining pin compatible interface boards to preserve the existing backplane and I/O module ecosystem. The new firmware was implemented in C following MISRA C 2012 guidelines, running on FreeRTOS with a deterministic scan cycle engine designed to match the timing characteristics of the original assembly firmware within 50 microseconds. Our firmware team implemented IEC 61131 Part 3 ladder logic and structured text interpreters, Modbus TCP and EtherNet/IP protocol stacks for network connectivity, an embedded web server for configuration and diagnostics, TLS 1.3 encrypted communications for cybersecurity requirements, and a secure bootloader with signed firmware updates for field deployment. The verification effort included a hardware in the loop test bench that simultaneously ran the legacy and modernized firmware against identical I/O stimulus patterns, checking cycle for cycle equivalence across all 14 PLC variants. Our team worked closely with the client's field engineers to validate the modernized firmware at three customer pilot sites in Maharashtra before full production rollout.
Phases, Testing and Handover
Reverse engineering
Static analysis of the PIC binary and dynamic tracing with logic analyzers and bus probes produced state machine diagrams, timing specifications, I/O truth tables and protocol formats.
Migration design
A pin compatible STM32F4 migration path was designed to preserve the backplane and I/O ecosystem, with the scan cycle engine tuned to legacy timing.
Firmware implementation
FreeRTOS firmware following MISRA C 2012 guidelines added IEC 61131 Part 3 interpreters, Modbus TCP, EtherNet/IP, the embedded web server, TLS 1.3 and the secure bootloader.
Equivalence testing
A hardware in the loop bench ran legacy and modernized firmware against identical I/O stimulus, and every variant underwent 500 hours of parallel operation testing.
Pilot and rollout
The modernized firmware was validated with the client's field engineers at customer pilot sites before full production rollout.
Acceptance criteria
- Cycle for cycle equivalence with the legacy firmware under identical I/O stimulus across all 14 PLC variants
- 500 hours of parallel operation testing against the legacy firmware for every variant before customer deployment
- Modbus RTU preserved so existing SCADA integrations keep working alongside Modbus TCP
- Validation with the client's field engineers at three customer pilot sites before full production rollout
Dependencies
- Existing backplanes and I/O modules, kept in place through pin compatible STM32F4 boards
- The legacy PIC binaries and hardware for static analysis and dynamic tracing
- Customer pilot sites and the client's field engineers
Measured Results
Measured results are published only after the client approves the figures together with their baseline, test conditions and measurement method. Ask us about outcomes during a call.
Engineering Evidence
- System block diagram (shown on this page)
Lessons, Limitations and Next Phase
- Pin compatibility constrained the hardware migration but avoided changes to the installed backplane and I/O module ecosystem.
- Cycle for cycle equivalence testing was needed because installed ladder logic programs depend on the original scan timing.
- Preserving Modbus RTU alongside Modbus TCP kept existing SCADA integrations working.
Next phase
The client planned MQTT cloud connectivity, an OPC UA server and integration with its planned cloud monitoring platform, delivered as OTA firmware updates.
Technologies Used
- STM32F4 (ARM Cortex M4)
- FreeRTOS
- MISRA C 2012
- Modbus TCP
- EtherNet/IP
- TLS 1.3
- IEC 61131 Part 3
- Embedded web server (lwIP)
- Secure bootloader
- Hardware in the loop testing
- Python (test automation)
- Git (version control)
Have a similar engineering problem?
Share a short brief; an engineer replies within one business day. How engagements work
Frequently Asked Questions
How was the legacy assembly firmware reverse engineered without documentation?
Our embedded developers used a systematic approach combining static analysis of the PIC assembly binary with dynamic tracing using logic analyzers and protocol decoders on all I/O pins. We instrumented the legacy hardware with bus probes to capture real time state transitions during normal operation and fault conditions. The reverse engineering produced documentation including state machine diagrams, timing specifications, I/O truth tables and protocol message formats for all 14 PLC variants.
How was backward compatibility maintained with existing customer installations?
The STM32F4 migration boards maintain identical pinout and electrical characteristics to the original PIC boards, allowing direct replacement in existing backplanes. The FreeRTOS based scan cycle engine was tuned to match the original firmware timing within 50 microseconds, so ladder logic programs execute identically. Modbus RTU serial communication, which existing SCADA systems rely on, was preserved alongside the new Modbus TCP capability. Every PLC variant underwent 500 hours of parallel operation testing against the legacy firmware before customer deployment.
What cybersecurity features were added during modernization?
The modernized firmware implements TLS 1.3 for all Ethernet communications, a hardware backed secure bootloader using the STM32 cryptographic accelerator for signed firmware verification, role based access control for the embedded web interface, encrypted credential storage in STM32 option bytes, and network segmentation support through configurable firewall rules. These features are designed to align with IEC 62443 industrial cybersecurity guidelines and to address requirements the client's chemical processing customers faced in regulatory audits.
Can the modernized platform support future product enhancements?
Yes. The ARM Cortex M4 running at 168 MHz provides far more processing headroom than the original 8 bit PIC. The FreeRTOS architecture supports adding new protocol stacks, communication interfaces and control algorithms as modular software components. The client planned additions including MQTT for cloud connectivity, OPC UA server capability and integration with its planned cloud monitoring platform, all of which can be deployed as OTA firmware updates to installed units.
Related Case Studies
Facing a Similar Engineering Problem?
Share a short brief; an engineer replies with questions, a suggested approach and next steps.
Discuss a Similar Engineering Problem

