2020-09-09 01:36 PM
I've inherited an existing project. It's got STM HAL / auto-generated code. It's set up with CMake to be compiled at the command line. I've imported it into STM32CubeIDE and it builds.
I have an STM32F407G-DISC1 board (MB997D). Using a hack, I've managed to get my .elf loading onto the discovery board and running, but it's a hack (and the paths to source code are obviously incorrect, so debugging doesn't bring up source code files).
Here's the hack:
This successfully loads my project's .elf onto the discovery board and it appears to run, verified via halting the running code every so often and it claims it's in routines from my project that don't exist in the working project the debug configuration was duplicated from.
This is progress; previously I wasn't able to get debugging working at all. In that question (I was using a different development board but I don't think that changes anything) @Pavel A. suggests "transplanting the target MCU info from a working project".
How do I do that?
I haven't found anything in STM32CubeIDE's (v1.4.2) UI that allows me to add a target MCU to my CMake imported project.
I see in the .cproject file of the working project some XML relating to the STM32F407 MCU as a target. I could cut and paste that directly, but I'm not sure which parts of the XML are relevant and I can't find any documentation about it.
Corollary question:
Shouldn't the CMake generate the target MCU information in the .cproject?
I wasn't able to find anything on that, although that would probably be STM32CubeIDE-specific and not part of the general Eclipse CDT 4 generator.
2020-09-10 11:25 AM
I don't use CMake for my STM32 stuff, but guess that from Eclipse POV it is same as external makefile project.
So this type of project should work for "transplanting" debugger config.
In Atollic, the debugger needs .settings/com.atollic.truestudio.debug.hardware_device.prefs
CubeIDE does not have this file, so the target MCU info should be somewhere in the .cproject. Yes, this xml is a mess.
-- pa
2020-09-10 12:49 PM
Pavel, thanks for you help. You're awesome.
Yes, there is nothing useful under .settings/ in my CMake-based project.
There is in the working .cproject a bit of target MCU config, but it's contained within the XML fragment [ <folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1893187868." name="/" resourcePath=""> ] which my CMake-based project's .cproject does not have, assuming because it's an imported cmake situation and not a managed build situation. Transplanting this did not work for me at any rate.
I've open a Support ticket with ST.