cancel
Showing results for 
Search instead for 
Did you mean: 

Using the STM32CubeProgrammer API

rtl
Associate II

Hello!

I am trying to use the STM32CubeProgrammer API to create my own application with a simple GUI in C++. Currently my solution is compiling the STM32CubePrgAPI as static library and then include it in a MFC project.

Basically user clicks OK from the GUI and then Example2 is executed. The getSTLinkList function executes with no issues, but connectSTLink fucktion gives me this error.

int connectStlinkFlag = connectStLink(debugParameters);
 
0xC0000005: Access violation executing location 0x0000000000000000.

If I compile STM32CubePrgAPI as .exe, it works with no problems.

What am I not understanding? Is compiling it as a static library a valid choice? What other options do I have?

I can't find any examples of applications created using this API. Has anyone done something like this?

1 ACCEPTED SOLUTION

Accepted Solutions
rtl
Associate II

Initially I excluded the progress bar and message display functions callbacks, because I thought they weren't needed for my use case as I am not using the CLI. Apparently it is needed and adding it fixed my issue. Can anyone explain, why?

/**
 * \brief This routine allows to choose your custom display.
 * \param c : Fill the struct to customize the display tool.
 * \note This function must be called first of all to ensure the display management.
 */
void setDisplayCallbacks(displayCallBacks c);

        displayCallBacks vsLogMsg;
 
        /* Set the progress bar and message display functions callbacks */
        vsLogMsg.logMessage = DisplayMessage;
        vsLogMsg.initProgressBar = InitPBar;
        vsLogMsg.loadBar = lBar;
        setDisplayCallbacks(vsLogMsg);

View solution in original post

1 REPLY 1
rtl
Associate II

Initially I excluded the progress bar and message display functions callbacks, because I thought they weren't needed for my use case as I am not using the CLI. Apparently it is needed and adding it fixed my issue. Can anyone explain, why?

/**
 * \brief This routine allows to choose your custom display.
 * \param c : Fill the struct to customize the display tool.
 * \note This function must be called first of all to ensure the display management.
 */
void setDisplayCallbacks(displayCallBacks c);

        displayCallBacks vsLogMsg;
 
        /* Set the progress bar and message display functions callbacks */
        vsLogMsg.logMessage = DisplayMessage;
        vsLogMsg.initProgressBar = InitPBar;
        vsLogMsg.loadBar = lBar;
        setDisplayCallbacks(vsLogMsg);