The tool will scan the image for S7-300/400 blocks (OBs, FCs, FBs).

Create a Python script using the struct library to prepend a 512-byte header: