....
For any application that has to do I/O, then there is a VERY HIGH probability that the code will need changing, as every MCU (especially with built-in I/O) will have things in different places. Something that runs fine on an ARM will not necessarily run fine on someone else's ARM as the serial I/O could be at a different address or have different registers.
Even the 'humble' printf could need a lot of work on changing between architectures or creating your own stripped down version.
On a simpler architecture viewpoint memory is laid out differently and will have different memory sizes. Even worse an application may have been tested under an operating system, but the embedded MCU has no operating system and is too small to run the same operating system (even if it was available for that MCU).
Learn how to read datasheets and marketing information for ANY product with the same or higher level of cynicism. They are trying to sell product not be the source of all true knowledge.
How long is a piece of a string?
Depends mainly on when the problems occur in the stages of the design or product life cycle. For a mature product in the field with updates meaning tuning is being down then that is done very carefully to avoid too much extra product testing and respins. Where as VERY early in the design cycle changes to which MCU to use can be made.