gcc and OpenOCD work well.
There are plenty of open source projects for STM32
There is https://www.openstm32.org
Also there are plenty of Open Source RTOS projects that come with a HAL, so you can write code that is vendor independent.
Zephyr is probably the largest full-featured RTOS, it's backed by the Linux Foundation and several hardware vendors (NXP, Nordic, Intel, Ti and SiFive), but the community provides support for other vendor's chips too.
RIOT-OS is more popular in the academic sector, targeting sensor networks.
NuttX tries to bring a POSIX environment to your MCU and of course STM32 is supported there too.
there is of course ARM Mbed, but that feels more like a framework than an integrated OS.
Heck you can even run Linux on the larger STM32s (M4, M7) if you attach some external RAM - kernel support was provided by ST themselves.