I want to compile FreeRTOS and run it on Qemu. Is it possible for me to do this?
When you build FreeRTOS you end up with a statically linked executable that will run on the target hardware or a QEMU emulation of that target hardware - FreeRTOS doesn’t know what it is going to run in. Here is an example https://www.freertos.org/RTOS-RISC-V-FreedomStudio-QMEU.html I often also run the (really old) LM3S69xx demo and the Xilinx Zynq demos in the QEMU models of those parts too. You can run the debugger easily enough too as QEMU has GDB built in - so build the image, start QEMU with that image and the -S command line option (so it waits for a debug connection) - then connect over GDB as normal.
There are a few gotchas where the QEMU models don’t match the hardware. For example, the Cortex-M model does not fully implement the NVIC and the FreeRTOS code tests its configuration matches the hardware by exercising part of the NVIC that is not modeled - which can result in asserts being hit because it thinks the configuration is wrong when its not.