What is really needed here is experience, and to get experience, a working setup for experimentation.
We are using STM32F4 and STM32F7 parts and the client has required us to use FreeRTOS and implement separate threads for each part of the application, communicating by queues and such.
I implemented various interrupt handlers for peripherals that didn't already have a firmware driver provided by STMicroelectronics, and what these mostly do is wake up a FreeRTOS task that services the device and then goes back to sleep until the next interrupt wakes it up.
Why I mention those details is to recommend to the OP to set up an environment similar to what I have been required to use. First you run STM32CubeMX and graphically specify the pinout, function of each pin, and enable the needed functional blocks such as UART, CAN controller etc, and also the associated firmware blocks (STM32 HAL, FreeRTOS) and set clock, DMA, and interrupt configuration etc. It is all extremely easy and menu driven. You can also, if you wish, define FreeRTOS tasks, semaphores, queues etc here.
Then you run Atollic TrueSTUDIO which has been acquired by ST and is now free. And build your project and start filling in the code for the different tasks and so forth. All hardware has a HAL driver and while none of this is particularly efficient or elegant (and the HAL has bugs and missing features), it is extremely EASY to get started and mostly gets the job done. It is also easier for someone else to pick up later, than your hand optimized, interrupt driven code that directly accesses hardware (do this but only if you need to).
cheers, Nick