...
First, update to the latest patch release of your current major version, e.g. v1.6.0p2 → v1.6.0p30. Then, take the latest patch release of the next major version, e.g. v1.6.0p30 → v2.0.0p36. Then again latest patch release of the next major version until you get to the current version and its latest patch release, e.g., as of the time writing this, v2.0.0p36 → v2.1.0p28 → v2.2.0p20p7.
Take all intermediate major releases within the upgrade.
Firmware
Same as for software, first the latest minor version, then the latest minor version of the next major version, and so on. E.g. v1.3.20 → v1.4.19 → v1.5.5 → v1.6.4 .
...