STM32 gotchas
204.'L4P5 and 'L4R5 are very similar but different, resulting in binary compatibility broken in subtle but possibly significant ways

The STM32L4P5 and STM32L4R5 (together with their crypto-enabled counterparts, 'L4Q5 and 'L4S5, respecitvely; and a couple of yet-higher-end models) form part of what ST calls STM32L4+ series. These form the pinnacle of the 'L4 family: L4+ is a low-power sub-family based around Cortex-M4F processor, with lots of memory, a bunch of powerful periferals and in high-pin-count packages.

Historically, 'L4R5 was the first model in this sub-family, with 'L4P5 coming somewhat later. It may appear - and it in many respect indeed is so - that STM32L4P5 was created as a stripped-down version, to cater for some particular client, who requested a model without the probably large GFXMMU unit (but with an extra SDMMC2), as those appear to be the only differences at the first glance.

There is also AN5017, which is not a direct migration between these two models but could be used to compare them - barring differences in RAM size and peripherals which are present/absent in one of the subfamilies, they otherwise appear to be pin and peripheral-address compatible.

However, there are subtle differences between the two, which in some cases prevents them to be entirely binary compatible, even if the "extra" peripherals are not used:

There may be more such subtle differences in these otherwise almost identical chips.

It's a pity ST does not pay more attention to strict compatibility between models within a family or subfamily, making replacement and sourcing chips more challenging than it would necessarily be 1.

1. Another example of such subtle but potentially significant difference, this time in the 'F303 line, here.