I'm writing code that can run on both 405 and 407 processors but the device signature is the same for both. How can my code tell which it is running on?
Use some different way - differences in externally connected hardware, your own "signature" programmed during initial tests...
What features are you using on one and not the other? How is the circuit they are used in different? Ethernet? check presence of PHY? Put a serial# in OTP.
Retrieving data ...