2023-04-25 01:18 PM
STM32CubeProgrammer v2.13 was giving me the famous "Failed to execute MI command" and "Failed to download Segment[0]" errors within the STM32CubeIDE, so I downloaded the standalone STM32CubeProgrammer v2.10 and it works fine. The IDE still uses v2.13, so how do I downgrade that one to v2.10 so I can program my chip through the IDE?
Solved! Go to Solution.
2023-04-25 08:35 PM
I discovered that the original error was coming from the line "file segment @0x08000000 is not 255-bytes aligned. it will be aligned to @0x07FFFFF8" in the STM32CubeProgrammer output. The programmer cannot download the binary to 0x07FFFFF8 because that is an invalid address for flash memory. For some reason certain versions of the programmer does this incorrect alignment (v2.13 and v2.10, in my experience).
I fixed the problem by downgrading the IDE from v1.12 to v1.11.2, which uses STM32CubeProgrammer v2.12 and works as expected.
2023-04-25 01:25 PM
Rename the directory it currently lives in, and replace it with an unpacked copy of the tools into a directory or the original naming?
Check pathing / naming in the settings for the tools, or within the project meta-data?
2023-04-25 07:23 PM
Ok, I did your first suggestion. I went into my debug configuration and clicked "Show Command Line" and got this:
/opt/st/stm32cubeide_1.12.0/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.linux64_2.0.500.202301161003/tools/bin/ST-LINK_gdbserver -p 61234 -l 1 -d -s -cp /opt/st/stm32cubeide_1.12.0/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.linux64_2.0.600.202301161003/tools/bin -m 0 -k
So I went into the cubeprogrammer directory that's used in the command and replaced the bin folder with the bin folder of my v2.10 STM32CubeProgrammer installation, and it actually worked. Now the IDE uses v2.10 when I click "Debug". However, it's still giving me the "Error: failed to download Sigment[0]" error that v2.13 was giving me, which is strange because the standalone v2.10 STM32CubeProgrammer still works fine. Any suggestions? I'll keep messing around and report back if anything changes.
2023-04-25 08:35 PM
I discovered that the original error was coming from the line "file segment @0x08000000 is not 255-bytes aligned. it will be aligned to @0x07FFFFF8" in the STM32CubeProgrammer output. The programmer cannot download the binary to 0x07FFFFF8 because that is an invalid address for flash memory. For some reason certain versions of the programmer does this incorrect alignment (v2.13 and v2.10, in my experience).
I fixed the problem by downgrading the IDE from v1.12 to v1.11.2, which uses STM32CubeProgrammer v2.12 and works as expected.