Is there a way of compiling a code, written for a certain chip , to another chip.I mean, is such an emulator available for nxp chipsets?
This heavily depends on the code itself and the tool that you use for software development.
In most commercial ARM IDEs you can change the target NXP microcontroller with a few clicks. Then you just rebuild the project. However, different microcontrollers have different functions, peripherals, etc. Not every bit of code can be translated and used for different targets.