This example is based on FastBit Embedded Brain Academy course lecture #16.
In this Udemy course it was implemented using ARM Cortex M4 based STM32F407 DISCOVERY board from STM. I had NUCLEU-WB15CC while following this course. Please find my implementation on this repository. I hope it serves you well.
There is also a file called LEDexample which shows how to build the same code with custom startup and linkerscript files. Build options and all the flags are presented in the Makefile.