CubeProgrammer API examples not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-07 2:27 AM - edited ‎2025-05-07 2:35 AM
I've just compiled the USB_Example.cpp example and its reporting an initialization error on running (The application could not initialize correctly (0xc000007b)), I have VS 2022 fully updated, I did not migrate the project to the latest toolset to avoid problems.
Any ideas STM team?
D:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\api\project\Visual Studio\x64\STM32CubePrgAPI\/../../../../lib/STM32CubePrgAPI.exe (process 25224) exited with code -1073741701 (0xc000007b).
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
- Labels:
-
Bug-report
-
STM32CubeProgrammer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-07 3:16 AM
Hello @Robmar,
The error code you've encountered typically indicates a problem related to the system's architecture compatibility. Projects in Visual Studio targeting x86 (32-bit) should use 32-bit libraries, while x64 (64-bit) projects should use 64-bit libraries. Mixing these can result in errors.
To resolve this, on a system that supports x64, you should use the x64 version of the STM32CubeProgrammer API from the STM32CubeProgramer_win64 directory. Alternatively, if your project is intended for x86, use the corresponding version from the STM32CubeProgramer_win86 directory.
In my tests, using an x86 version of the project from the STM32CubeProgramer_win64 directory on an x64 system caused the same issue. Switching to the x64 version of the project resolved the error. To ensure we're on the same page, could you please check this point ?
Maryem.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-07 3:28 AM
Thanks, I just loaded the default .sln project though, and changed nothing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-07 3:29 AM
Have you tried to compile the same project and run it as it is?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-07 7:45 AM
Hello @Robmar ,
Yes, I have compiled and run the project as it is using both configurations.
Initially, I encountered the same error when attempting to run the x64 project from the x32 installation directory, indicating an architecture mismatch.
However, when I switched to the x86 project, I didn't encounter any issues, as shown below.
Maryem.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-08 1:38 AM
I don't kbow what you changed, but the STM project I opened is set to use $(ProjectDir)/../../../../lib/x64;%(AdditionalLibraryDirectories) in the linker, and is an x64 project.
Did you have to change something to get it to work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-08 1:52 AM
Hello @Robmar,
I didn't change anything in the project configuration. I simply opened and build both projects. The project under $(ProjectDir)\...\Visual Studio\x86 worked without any issues for me because I used the STM32CubeProgrammer_win32 installer directory. However, the project under $(ProjectDir)\...\Visual Studio\x64 failed, as shown in the first figure.
From your path "D:\Program Files (x86)\", it appears that the installer directory is the 32-bit version. Therefore, I recommend rebuilding the project under the $(ProjectDir)\...\Visual Studio\x86 directory to see if it resolves the issue. Please let me know the outcome after you try this.
Maryem.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-08 2:02 AM
Strange, I had opened from the X86 directory, all the files were there, but when I closed VS 2022, and reloaded the project, it again loaded with my one change to run USB_Example() in main.c, but this time showed X86 and ran.
Do youknow if the downloadFile() function will load from an URL, or if there is a way to load the .hex file from a URL? Hex files are supported I presume.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-08 3:13 AM
The downloadFile()
function supports downloading from various file formats like hex, bin, and others, but it requires a local file path. It does not support loading directly from a URL. You would need to download the .hex file locally first.
Maryem.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-08 3:54 AM
I suppose there isn't a method to load the hex file into memory? Is the source code for the API available so we can modify it?
