STM32 product cross-compatibility
The STM32 series embeds a set of peripherals which can be classed in three categories:
The first category is for the peripherals which are by definition common to all products. Those peripherals are identical, so they have the same structure, registers and control bits. There is no need to perform any firmware change to keep the same functionality at the application level after migration. All the features and behavior remain the same.
The second category is for the peripherals which are shared by all products but have only minor differences (in general to support new features), so migration from one product to another is very easy and does not need any significant new development effort.
The third category is for peripherals which have been considerably changed from one product to another (new architecture, new features…). For this category of peripherals, migration will require new development at application level.
The ST Micro ST32 Series Migration and Compatibility Guidelines document gives a general overview of this classification between F1 versus F0 series, F1 versus F2 series, F1 versus F4 series, and F1 versus L1 series.