cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer_api project cannot run

szhih
Associate

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;

17 REPLIES 17
alberto.spagnolo
Associate III

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.
Evangelist III

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 III

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

Thanks,

Alberto

alberto.spagnolo
Associate III

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 III

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

Marcuka
Associate III

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 III

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 III

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 III

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...