Can I disassemble a PG5 project for modifying it?
FAQ #100676
This FAQ explains the possibilities in case a PG5 project is not available but still an existing application needs to be modified.
Disassembling in general
PG5 includes a tool for disassembling code running on a PCD. This tool (the "Disassembler") allows the conversion of uploaded (or just compiled) code that is in "binary" form to its representation in Instruction List (IL).
The resulting code is identical to the code executed by the PCD but it is not equal to the source files from which the project was built. The main differences are
- The missing symbol names; All symbols are addressed statically in the dissected code (while symols in the symbol manager can have "dynamic" addresses distributed at build time)
- All comments are missing in the disassembled code (because they aren't downloaded to the PCD)
- Code can only be disassembled to IL. It is not possible disassembling code back to Fupla or to a HMI file!
- Jump labels are missing (the jumps are directly addressed) in the dissected code
- Assembler directives (like $IF etc.) aren't present in the dissected code (they were evaluated at build time)
Can I reverse-engineer a disassemled project?
Depending on the tools used for the creation of the program and on the complexity of the program this task quickly becomes practically impossible. Disassembling and reverse-engineering e.g. a Fupla program is nearly impossible (well, if you spend hundreds of hours and you understand the tasks of your application very well, you maybe could manage reverse-ingeneering a Fupla project).
The problem is that an FBox can create completely different code which is built in dependence of the target system, options set in the adjust window etc. Further on there can be differences between each version of one and the same FBox (because new features are implemented and bug fixes are applied).
In 99 % of all cases it is far more effective re-engineering an existing project in case the source files are not available.
Can I modify an existing project (e.g. a setpoint)?
Modifying e.g. a setpoint means also identifying and reverse-engineering the relevant part of the code. If only a setpoint needs to be modifyed, it is possible searching for all code parts that load this value to a register. Once all these parts are found the relevant part of the code needs to be identified and modified. Even if this modification is successful still the whole project is only present in "pure" IL and further modifications will require at least as much work (if it will be possible at all). Modifications in this way are only recommended for advanced experts.
In case not only the setpoint but the behaviour of one part of a program needs to be modified the complexity most likely is already too high (at least if the program was written in Fupla or similar).
Categories
Local FAQ Deutschland / Fupla
PG5 2.0 / Fupla
Last update: 01.06.2015 04:29
First release: 01.02.2007 09:15
Views: 4628