Locking framework version

Recently Zephyr was updated from 2.1 to 2.2. This added deprecation messages for some function calls during compilation, but might at some point in time change the API significantly, resulting in unexpected behaviour or inability to compile.
If I wanted to force the used framework to use a specific version how would I come around to doing so?
And in the same vein, is it possible to force a certain version of the compiler?

See documentation for pinning a certain version for the platform, e.g. ststm32 @ ... (release versions here, 6.0.0 has the initial Zephyr version. When pinning the platform, also all its used sub-packages (framework, compiler, …) are pinned via that version’s platform.json definitions (example).

Moreover, certain packages can be pinned individually, as the documentation says, with the platform_packages directive.