Mahesh,I've developed an open-source codebase which has disco-based demo code, Ubuntu 18.04-based, gcc, CMake. Detailed installation instructions. I'm soliciting feedback for it. Only difference in your case, however, is that I used a STM34F407 Disco...
Terje,I have an open-source project called Raging Distro that has a reference project which runs the RTOS NUFR on the STM32F407 Discovery board. This codebase is as simplified and decoupled (it uses no libraries!) a project as you'll find, but still ...