printf & breakpoint text in MS Visual Studio

Sysprogs forums Forums VisualGDB printf & breakpoint text in MS Visual Studio

This topic contains 5 replies, has 2 voices, and was last updated by  support 3 weeks, 3 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25707

    alan856
    Participant

    Just getting started with VisualGDB.

    Using Visual Studio 19, c++, for an STM L4R5T project.  A simple program – compiles ok – seems to load.  But I can’t figure out how to single-step. When I run with debug – F10 & F11 are grayed out in the debug menu.  Must be missing something!!

    VisualMicro for Arduino uses same interface so I’m familiar with setting a breakpoint and including a message.   Program hits breakpoint – but don’t see the bp message. Where is that displayed?

    Also trying to use printf() to see results (this is just a learning program – size doesn’t matter!) – but do not know where printf is sending it’s text to.

    #25708

    support
    Keymaster

    Hi,

    Normally F10 and F11 should work as usual. Perhaps the debug session doesn’t start properly, or the initial breakpoint doesn’t hit (i.e. the program is still running in the background)? If you are not sure, please try attaching a screenshot of the VS window with the step commands disabled and we will help you understand what is going on.

    The printf() output should be redirected to Visual Studio as long as you reference the Advanced Semihosting and Profiling framework via VisualGDB Project Properties -> Embedded Frameworks, or enable the regular semihosting via the first page of VisualGDB Project Properties. Let us know if you need more details on this.

    #25713

    alan856
    Participant

    Greets again!  I did send some screen shots of the VS setup – but forgot to mention I’m working with a Nucleo-L4R5z board – and I guess the print output (either from breakpoint text or printf) would have to come thru the LinkV2/1 connector.  I must be missing some setting to tell VS to write to that…  Ideas?

    #25714

    support
    Keymaster

    Thanks for sending us the screenshots. It looks like you are trying to step through the program while it is already running in the background, hence the “step” and “continue” commands are grayed out.

    Please try setting a breakpoint in main() before starting the debug session and wait for the breakpoint to hit (a yellow arrow will appear inside the breakpoint symbol). Then you will be able to step through the program.

    It also looks like you were trying to use the regular VS Project Properties instead of VisualGDB Project Properties and hence could not locate the Embedded Frameworks page. Please follow this tutorial for a detailed description of the steps required to enable semihosting.

    #25715

    alan856
    Participant

    Ok – thanks – was using reg VS Project stuff.  I’ve also added the block of code in the tutorial link, and I’m getting these errors:

    Unidentified “GPIO_Pin12”
    Undeclared identifier “Bit_RESET”

    I assume I’ll have to be adding that code-block to all future projects?

    Just a side comment: I’ve worked with software/hardware for 40 years and never have come across anything so convoluted and arcane as this ARM HAL environment. EVERYTHING is not straight forward or intuitive…  guess that is the price of speed!   LOL!

     

    #25716

    support
    Keymaster

    Sorry, simply copying arbitrary code snippets between projects will not always work, as there are several different types of projects, libraries and targets and not all of them are mutually compatible.

    If you are new to the STM32 development, please consider following some of our STM32 tutorials step-by-step in order to familiarize yourself with common settings, project types and functions.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.