210 likes | 332 Views
Migrating Embedded Systems from Assembler to C Using the Fermat Transformation System. Pigs from Sausages?. Extracting the logic and business rules from evolved legacy systems Automatically migrate them to a new High Level Language Re-host them. Why bother?. Increased Speed/Capacity
E N D
Migrating Embedded Systems from Assembler to C Using the Fermat Transformation System
Pigs from Sausages? • Extracting the logic and business rules from evolved legacy systems • Automatically migrate them to a new High Level Language • Re-host them
Why bother? • Increased Speed/Capacity • Better Price/Performance • Larger, more complex systems • Cost per function point: • Assembler: £48.00 • PL/1: £39.00 • C: £21.00 • Pressure to Migrate to HLL
Case Study – Tenovis Gmbh & Co. • Specialists in Convergent Networking • 200,000 Clients • 6000 Employees • Revenues over 950 million euros
Tenovis Challenge • Private Branch eXchange (PBX) system • Four Hardware Platforms • Installed in 18 countries • 800,000 lines of C • 544,000 lines of 186 assembler in 318 source files • Problems: • Backlog of enhancements • Availability and functionality of the processor
SML’s Challenge • To migrate the assembler to high-level structured, maintainable C code suitable for porting to more modern processor and also suitable for implementing the backlog of enhancements. • The migrated code should meet the coding standards used within the existing C code.
FermaT Transformation System • Nearly 20 years research and development (> 120 man years) • Core technology research @ Oxford and Durham University • Migration projects to validate this research funded by IBM, CAA & DTI • Used extensively in Y2K projects • FermaT Workbench • Transformation System
What is WSL • Wide Spectrum Language • From low-level constructs to high-level abstract specifications • Unique transform capability • Fermat product set is implemented in MetaWSL • WSL is now in the Public Domain under a GUL licence
Case Study – Phase 1 • Migration of a single 3,000 line source file • Develop a 186 to WSL parser • Modify the existing WSL to C parser • Implement 186-specific WSL transformations
Case Study – Phase 2 • Mini Call Control • Self contained subsystem • 67,000 lines of assembler • 41 source files
Phase 2 - Requirements • Use existing C header files where available • Use of the “function parameter table” • Translate selected subroutines directly to HLL code • Translate bitfield operations into C record fields • Eliminate stack usage where possible • Detect jump tables and generate appropriate switch statements • Generate switch statements instead of nested if statements • Can ignore segment addressing for this application
Phase 2 - Process • 5 iterations of the Mini Call Control • Customer feedback on each iteration • Update the parsers or transformations • Regenerate the C code automatically • Final iteration C code was compiled installed and tested
Final Migration • 2.6Ghz PC with 512Mb of RAM • All 318 source files processed in 1.5 hours • 1,436,031 transformations: • 4,500 transformations per source file • 275 transformations per second • Largest source file was 8,348 lines • 73,393 transformations • 370 seconds CPU time • 42Mb RAM • 506,672 lines of C code plus 37,047 lines of header files generated
Results • At least 6 bugs were discovered in the system via the migration process • “Hey, this really looks like C!” • Test environment: “soft switch” between C and Assembler Versions on a PC linked to the hardware.
Cost Savings • Estimate for Manual translation: 67 man months • Actual customer effort for automated translation: • SML’s actual effort 52 man days • Less than 10% of manual effort • Larger systems will achieve even greater savings
Advantages of Automated Reengineering • Scalability • Rapid turnaround of the subsystem • Customisability • Low resource requirements • Low Impact on ongoing development • Enables porting to different hardware and/or software platform • Removes dependence on limited resources
Conclusion • Assembler to C using the FermaT Migration System and Workbench is a practical solution to the high costs and skills shortage in assembler maintenance and to the problem of migrating legacy assembler systems to a more modern platform.
The future for Fermat • Currently assembler to C and COBOL • Pascal to C • Assembler/Pascal to C • Output to Java • Joint 3 year research project with DeMontfort University to extend the use of WSL and Fermat
Further Resources www.artechhouse.com
Further Resources • The Fermat Transformation System is available under GNU GPL (General Public Licence) • www.dur.ac.uk/~dcs0mpw/fermat.html • www.cse.dmu.ac.uk/~mward/fermat.html