Hello Members.. I want to port some applications running on M4 from STM to M4 from NXP. So how can I achieve it.
Understand what is defined by ARM - ie, what will be common - and what is vendor-specific.
See: https://community.arm.com/developer/tools-software/tools/f/keil-forum/43684/lpc2148-timer0-not-working-as-expected/158950#158950
As Mahesh says, you will have to study the datasheets for the two chips for details.
If your STM32 application is well-structured, the vendor-specific parts should be well isolated in their own modules, with a "neutral" interface to the rest of the application. That makes it easy to replace the vendor-specific parts without affecting the rest of the app.
This is standard good practice for portable software.
If your STM32 application is not well-structured, now is probably the time to make it so ...