2020-03-13 09:41 AM
I am developing a custom firmeware programmer software for Windows+Linux.
I'm trying to use STM32 Cube Programmer API with QT Creator, as in the examples included with STM32 Cube Programmer package release.
I successfully compiled the QT Creator STM32CubePrgAPI example in Linux (Mint 19.3) with enabled the Example1 in main.cpp (ret = Example1();), but I get a segmentation fault when running it:
./STM32CubePrgAPI
STM32CubeProgrammer API v2.4.0
+++ Example 1 +++
-------- Connected ST-LINK Probes List --------
ST-LINK Probe 0 :
ST-LINK SN : 0670FF564948897767134155
ST-LINK FW : V2J35M26
-----------------------------------------------
---------------------
ST-LINK Probe : 0
---------------------
ST-LINK SN : 0670FF564948897767134155
ST-LINK FW : V2J35M26
Voltage : 3.25V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Software reset
Device ID : 0x448
Segmentation fault (core dumped)
Analyzing the core dump with gdb gives me the following info:
gdb STM32CubePrgAPI core
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from STM32CubePrgAPI...done.
[New LWP 7621]
[New LWP 7625]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./STM32CubePrgAPI'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f3b87a89653 in FlashLoaderMng::InitElfLoaderParameters(bool, char*) ()
from /data/local/STM32/test_prog/bin/../lib/libCubeProgrammer_API.so.1
[Current thread is 1 (Thread 0x7f3b87f1c780 (LWP 7621))]
(gdb) bt
#0 0x00007f3b87a89653 in FlashLoaderMng::InitElfLoaderParameters(bool, char*) ()
from /data/local/STM32/test_prog/bin/../lib/libCubeProgrammer_API.so.1
#1 0x00007f3b87a7b8bb in Target::Target(TargetInterface*) ()
from /data/local/STM32/test_prog/bin/../lib/libCubeProgrammer_API.so.1
#2 0x00007f3b87a232d7 in connectTargetInterface(QString) ()
from /data/local/STM32/test_prog/bin/../lib/libCubeProgrammer_API.so.1
#3 0x00007f3b87a23b65 in connectStLink () from /data/local/STM32/test_prog/bin/../lib/libCubeProgrammer_API.so.1
#4 0x000055dfd1bd1582 in Example1 () at ../../../src/Example1.cpp:68
#5 0x000055dfd1bd323a in main () at ../../../src/main.cpp:60
(gdb) quit
The problem seems to be a call connectStLink(debugParameters) in example1.cpp
calling
connectTargetInterface(QString)
calling
Target::Target(TargetInterface*)
calling
FlashLoaderMng::InitElfLoaderParameters(bool, char*)
I can't go deeper in sources, because I don't have the API sources.
I checked with the QT Creator debugger the debugConnectParameters debugParameters struct fields, and they seem correct...
Anyone experimented similar problems? Do you have any suggestions?
I am connecting to ST-:Link board embedded into a NUCLEO-F072RB board.
Thank you,
Fausto Marzoli
2021-10-04 10:33 PM
Dear Fausto,
did you solved the issue ?
best regards
2021-10-13 08:23 AM
Downgrading to 2.7.0 cube programmer version fixed it for me.