Skip to main content
anonymous.8
Senior II
May 22, 2019 2:31 AM UTC
Question

Debug: "No source available for main()"

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?

This topic has been closed for replies.

10 replies

anonymous.8
Senior II
May 22, 2019 2:41 AM UTC

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:

andreaspiezia9
Associate III
May 24, 2019 7:20 AM UTC

Hi,

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 ?

Ivaylo Ilchev
Associate
Feb 15, 2020 11:22 PM UTC

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

SPlys.1
Explorer
Oct 14, 2021 4:12 PM UTC

Thanks, man!

PSali.1
Visitor II
Apr 11, 2021 8:56 AM UTC

Hi

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.

Regards,

DavidAlfa
Senior II
Apr 11, 2021 11:56 AM UTC

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.

AGrun.1
Associate
May 13, 2021 6:56 PM UTC

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)�?

Pcard.2
Associate
Mar 31, 2022 9:22 PM UTC

thanks AGrun.1 this worked for me

appreciate you putting it out there.

Explorer
Jul 24, 2025 5:38 AM UTC

Thank you. You are better than the st staff.