First to correct one thing. In Junos world, we call the general junos image as software. Usually we use "request system software add <>". Firmware refers to some specific patch for FPC/SIB/CB.
In theory, as my other colleague mentioned, you need to have an intermediate release to jump between 15.1 and 17.2.
However, in the field, we have seen lots of customer upgrading from 15.1 to 17.2 or even 17.3 directly without any issue. But not from any release before 15.1, as there's FreeBSD ugprade in 15.1. If this is a lab device or with just simple configuration, I would think one step upgrade is enough. Better to check in your lab with desired configuration and see how it goes
In case you need two step upgrade, here's general suggestion for dual-re system
0. Disable GRES/NSR if any
1. upgrade backup re to release 2
3. upgrade new backup re to release 2. Both RE on same verion at this moment