Skip to content

Instantly share code, notes, and snippets.

@thibthibaut
Last active January 28, 2022 13:30
Show Gist options
  • Save thibthibaut/1fdf7374d14f2881c23b6d8bc12b66c5 to your computer and use it in GitHub Desktop.
Save thibthibaut/1fdf7374d14f2881c23b6d8bc12b66c5 to your computer and use it in GitHub Desktop.

How Debug a STM32CubeIDEProject with custom Makefile

From here

  1. File > New > Makefile project with Existing Code Give a name
    • Point to the project location
    • Select MCU ARM GCC
  2. OK - you will now have to make sure that the makefile is found by the build system. Hint, check: Project Properties > C/C++ Build > Builder Settings > Build directory
  3. Once you have a working makefile you probably want to debug as well...
  4. To make debug work the debugger integration needs to know which MCU you are targeting. Because of a known issue in CubeIDE 1.6.0, you have to perform a little stunt:
    • Project Properties > C/C++ Build > Builder Settings > Check "Generate Makefiles automatically".
    • Click Apply
    • WARNING: Do NOT build your project until step 7 is finished!! If you do, the managed build system will overwrite your makefiles!
    • This will expose a hidden GUI:
    • Project Properties > C/C++ Build > Settings > Tool Settings > MCU Settings > Select.
      • Browse for your MCU select it and click Apply.
    • Go back to Project Properties > C/C++ Build > Builder Settings > and Uncheck "Generate Makefiles automatically".
    • Click Apply.
  5. All done. If you create a debug config now you should be able to debug the target... If you instead tried to launch the debug session without performing step 4 you will get tons of errors messages...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment