Electronic – Moving code from an ARM M0+ to an ARM M4, what changes

armcortex-mcortex-m0cortex-m4

Say I have a very simple program that functions perfectly fine on a ARM Cortex M0+ processor. How much will I need to change in order for it to work on an ARM Cortex M4 processor, assuming they are both made by the same company and I have imported the new cores header.

I just can't think of any reason it wouldn't work. They use a similar instruction set. I mean the M4 has a much more expanded Thumb-2 instruction set over the M0+. In my experience, companies keep the same naming scheme when they make their ARM device headers.

Best Answer

The CPU should not give you any problems, as you say the instruction set of an M4 is a superset of the M0/M0+ instruction set. Note that the timing might be different, so busy-wait based timing might not work the same.

Peripherals can be a PITA, I would not assume they are the same unless the datasheets read the same.