Skip to main content
szhih
Visitor II
February 21, 2019
Question

STM32CubeProgrammer_api project cannot run

  • February 21, 2019
  • 13 replies
  • 5562 views

hi,

   I'm trying to run STM32CubeProgrammer_api project, I could build the STM32CubePrgAPI.exe with no error, but I got the 0xc000007B error when I run it; it seems that missing some runtime DLLs, I tried to install vs2015, vs2013, vs2010 runtime, but got the mistake;

my environment as blow:

os: win7 64bit

build with VS2017 version 15.6.6 and Windows SDK version 10.0.16299.0;

This topic has been closed for replies.

13 replies

alberto.spagnolo
Associate
March 17, 2019

Hi,

same problem here. I've tried both with VisualStudio and Qt Creator, with STM32CubeProgrammer 2.0 APIs.

I could compile, but execution leads to 0xC000007B error.

Pavel A.
Super User
March 17, 2019

0xC000007B  is STATUS_INVALID_IMAGE_FORMAT.

A.k.a. running 64-bit executable on 32-bit machine, or running on WinXP executable built without backward compatibility. With Windows specific issues, you're welcome to the MSDN forums.

-- pa

alberto.spagnolo
Associate
March 17, 2019

indeed, I was able to compile and run with MinGW32.

Thanks,

Alberto

alberto.spagnolo
Associate
March 18, 2019

Ok, going a bit further... I was able to compile and run with MinGW32, as long as I don't connect an ST-Link.

  1. Calling getStLinkList() with no ST-Link connected works fine, giving 0 as return value.
  2. Calling getStLinkList() with an ST-Link v3 connected leads to a crash.

Also, I've noticed that on different machines (both Win7, 64-bit) STM32CubeProgrammer gets installed in different fodlers:

  • C:\Program Files - no way to get to point 1. in my previous list
  • C:\Program Files (x86) - point 1. ok, point 2. crashes.

I've compared the DLLs in the "api" folder and they are different, despite the STM32CubeProgrammer version is the same on both PCs!

Any ideas?

Thank you,

Alberto

alberto.spagnolo
Associate
March 18, 2019

About my previous point 2, setDisplayCallbacks() MUST be called. By doing so, ST Link finally gets enumerated.

Jim Frederick_2
Associate II
September 2, 2021

@alberto.spagnolo​, Thanks! Just curious - how did you know that setDisplayCallbacks() must be called to enumerate the ST Link? It solved the 0xC0000005 I was seeing when calling getStLinkList() from Python.

The STM32CubeProgrammer_API.chm doc says, regarding setDisplayCallbacks(), "This function must be called first of all to ensure the display management" which implies that it's needed only for display management.

alberto.spagnolo
Associate
September 2, 2021

Well, actually I replicated the initialization in the sample application, then started to remove parts that were missing in my application. I started right from setDisplayCallbacks(), because I was suspecting that there were void pointers somewhere.

I'm happy that I could spare you some headache...

Marcuka
Associate II
October 14, 2019

Hello,

I'm facing the same error when try to start the application. Can you tell me some solution, different from using MINGW32? Is it mandatory to install the STM32CubeProgrammer.exe in the "Program files (x86)" directory?

alberto.spagnolo
Associate
October 14, 2019

Well, it seems to be related to the DLL you use.

Depending on the Java version you installed (either 32 or 64 bit), you obtain a 32 or 64 bit DLL. Then, of course, your exe must comply with the architecture.

I've managed to make it work (with Msys2/MinGW64) by making sure that everything was 64 bit.

Haven't tried with VisualStudio, but I think it's the same.

Marcuka
Associate II
October 14, 2019

Thank you for the response, Alberto!

I'm running Windows 7 64 bit. On my PC STM32CubeProgrammer is installed in the Program files directory. In the same directory is and the Java (JRE). I try with mingw32-g++ without success - the program executes successfully but nothing is seen in the console. It is possible to have problem with the console printing here, but currently I'm busy with another urgent task and will continue after. Below is the mingw-32 build command:

mingw32-g++.exe src/DisplayManager.cpp src/Example1.cpp src/main.cpp -I include/ -L lib/ -o lib/out.exe -lCubeProgrammer_API

You mention the DLL file (CubeProgrammer_API.dll), but it is provided by ST and I don't know is it 32 or 64 bit compiled.

I'll continue struggle that problem after few days. Meanwhile attached is the Visual studio output when the exe crashes.

alberto.spagnolo
Associate
October 21, 2019

Dear Martin,

what I meant is:

  • if your Java is Java32, when you install the STM32CubeProgrammer you obtain a 32 bit dll
  • if your Java is Java64, when you install the STM32CubeProgrammer you obtain a 64 bit dll

From you screenshot, I guess you're compiling (and executing) a 32 bit application that opens a 64 bit dll. This shouldn't be done.

I've tried to download the latest version (2.2), but it's still a mess: the VisualStudio example project is setup for a 32 bit build even if the installed dll is 64 bit...

In my case, since I'm used to MinGW, I've succeeded in generating a 64 bit exe by not using the provided .lib and manually loading the dll.

You'll find attached the "stLink" subfolder of my project: maybe you can use it as a guideline.

Please also note that it is mandatory to duplicate the folder structure exactly, that is (folders are marked with square brackets):

<your project>
|-- [bin]
| |-- [ExternalLoader]
| |-- [FlashLoader]
| |-- CubeProgrammer_API.dll
| |-- STLinkUSBDriver.dll
| |-- <other DLLs>
| \-- <your executable>
|
\-- [Data_Base]

Hope this helps...

Marcuka
Associate II
October 21, 2019

Hi Alberto,

Thank you for spending time to write to me. If you come to Bulgaria call me to drink a beer!

Now on the problem. I configure new visual studio project for 64 bit architecture and got error (The attached picture). It says that the library is for 32bit but the application is for 64 bit. The last week I try with MSYS2 and mingw64, again can't start the application, due to the first error I got.

May be it is better to try with another tool provided by ST - STVP programming toolkit.

I'm still wondering, could it be possible the provided demo by ST to not work properly even with the new software release!!!