Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer API Problems

Associate II


I have noticed the following problems while building an app (permanent data capture via ST-LINK) with the STM32CubeProgrammer API (v 2.12.0):

1. int readMemory() function

The description is very scarce and a bit confusing. The parameter data is defined as 'Pointer to the data buffer'. Most programmers would assume that they have to allocate the memory for the data buffer. I have seen in the Example1.cpp (included in the demo code) that the function allocates the memory buffer for the data read from the microcontroller. No information is given regarding memory housekeeping. The allocated memory is never freed. If the function is called several times, as I need for my project, the app memory footprint grows after every call to this function. There is also no information regarding limitations - e.g. maximal size. I assume that maximal size is the size of memory block in the microcontroller.

The variable dataStruct is set to zero before every call to the readMemory() function in the example source code files. Is this really necessary?

Note: The current implementation is not optimal for my use case, where the first thread reads data from the embedded system into one buffer, and another thread looks for differences between two previously read buffers. The readMemory() function should not free the previous buffer itself on the next call.

2. int unlockchip() function

There is no description for this function in the document 'STM32CubeProgrammer_API.chm'. The return values are not described also in the header file.

3. How to connect to the device faster

The program code in the API examples is quite general and checks how many ST-LINK interfaces are connected, connects to them, etc. The time until you can read the first data from the processor in the embedded system is almost one second. Is there any method by which this time could be significantly reduced in cases where just one ST-LINK is connected to the computer?

Thanks in advance,