2024-06-27 04:18 PM - edited 2024-06-28 02:31 PM
I recently started a thread called
Why is programming flash with STM32CubeIDE so much slower than with Cube32Programmer?
Hoping to spur ST to make improvements in this area. Are you sick of
...crawling its way to completion 50 times a day, like I am?
If you need to start a debug session in CubeIDE, I'm afraid I don't have any good news for you.
But, if you want to download a new release version of the design, so you can see a LED blink, talk to it over
a UART, see it enumerate over USB etc, prepare to be amazed.
The solution is simple. First, install the standalone STM32CubeProgrammer.
Once installed, you will find that the installation dieectory also includes a CLI version. This is is neither java based, nor does it rely on establishing a debug monitor on the board, so it is very fast. On my STM32G4, downloading a simple "Hello World" example to my chip with this CLI takes a fraction of a second from launch to completion (the GUI version is similarly fast compared to CubeIDE and probably just launches the CLI in the background).
If you use an st-link, the command you need:
<STM32Cube>\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=SWD -d PATH_TO_ELF_FILE -rst
This connects to your ST-LINK, downloads the program, and does a reset.
You can get fancier if you need to, the tool accepts various arguments, but to get started, this is all you need.
Now, you can create create a batch/shell script for your project which launches a specific binary. test that script in the command line to make sure it works.
Then, in CubeIDE go to run/Run Configurations, and create a new "C/C++ Application" (NOT a "STM32 C/C++ Application", as that launches the GDB based downloader), and choose your shell script as the program.
Choose your desired project/build type. Whenever you make changes, the associated build will be triggered and will generate a new elf binary for download.
That's it, now you can lunch your shell script as a run target. It will compile the project if necessary, and download it to your chip in the blink of an eye. No more "Waiting... Waiting...... Waiting.......................".
P.S.
You can instead use the programmer cli binary file as the executable program for the run target, and setup the command line arguments as part of the run target config.
2024-06-28 09:33 AM
Thanks for the tutorial!
Most of the times I am debugging, but when the firmware is already in a "stable state", but I am still developing it, this seems to be appropriate to use in terms of time saving.
I'll give it a try.
2024-06-29 02:51 AM - edited 2024-06-29 04:28 AM
[Sorry. Moved to other thread]