Showing results for 
Search instead for 
Did you mean: 

Debug: "No source available for main()"

Senior II

I am trying to debug my code, but it just ain't working the way it's working in e.g. the STM32CubeIDE intro-video on Youtube; I'm getting "No source available for main()", instead of Eclipse displaying where in the code it's actually at.

I haven't changed any of the default-settings, other than where my workspace is and yes, I have build a debug-version instead of release-version and yes, I do see "-g3" - flag enabled in the compilation-console.

How do I fix this?

Senior II

Apparently the problem was that I had both the "release"-executable and the "debug"-executable there and Eclipse insisted on using the wrong one. :unamused_face:

Associate III


I've the same problem "No source available for "main() at  0x800559e" with Atollic TrueSTUDIO® for STM32, Built on Eclipse Neon.1a. Version: 9.3.0 

Any suggestion ?

Click Debug button, Debug Configurations.

Choose STM32 Cortex-M C/C++ Application, Your application name if exists, if not double click "STM32 Cortex-M C/C++ Application" and create one.

Browse for correct elf file for C/C++ Application: Debug/my_meaga_app.elf



It is possible that you have left the BOOT0 pin on your micro-controller floating. To load the program from flash it has to be tied to ground.


Senior II

That's because you're debugging with a release build.

Go to debug profiles, and ensure that it's getting the debug build.

Also enabling autobuild is a good idea.


I had the same problem and here is the solution:

Project => Properties => C/C++ Build (Tree) => Settings => Tool Settings (Tab) => MCU GCC Compiler (Tree) => Optimization

In the “Optimization Level�? list box field I selected “Optimize for Debug (-Og)"

Project => Properties => C/C++ Build (Tree) => Settings => Tool Settings (Tab) => MCU GCC Compiler (Tree) => Debugging

In the “Debug Level�? list box field I selected “Maximum (-g3)�?

Thanks, man!

thanks AGrun.1 this worked for me

appreciate you putting it out there.

Thank you @AGrun.1 

Hi @anonymous.8 , does the solution given by @AGrun.1 is also working for you or you still have issues ?


Best regards