Hello Nansen Mo,
You can extract the toolchain from the i.MX Linux BSP by running the following command inside the Yocto environment:
$ bitbake meta-toolchain
(You would need to have followed the i.MX Yocto Project’s User Guide for the BSP Release you are using to setup Yocto)
If you would like to use Fortran you would need to make some changes as it is not supported on the i.MX Linux BSP. There are some documents on the web regarding this, like the one below (however, I haven’t tested it myself)
https://jumpnowtek.com/yocto/Add-Fortran-support-to-a-Yocto-build.html
I hope this helps!
Regards,