Dealing with STM32 Default_Handler() DEBUG_DEFAULT_INTERRUPT_HANDLERS

Sysprogs forums Forums VisualGDB Dealing with STM32 Default_Handler() DEBUG_DEFAULT_INTERRUPT_HANDLERS

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10800
    gojimmypi
    Participant

     

    Greetings,

    I was wondering if there’s a tutorial / documentation on the DEBUG_DEFAULT_INTERRUPT_HANDLERS mentioned here:

    https://sysprogs.com/w/forums/topic/visual-gdb-defualt-code-dose-not-work/#post-7891

    You see, I’ve found myself somehow stuck here:

    void __attribute__((naked, noreturn)) Default_Handler()
    {
     //If you get stuck here, your code is missing a handler for some interrupt.
     //Define a 'DEBUG_DEFAULT_INTERRUPT_HANDLERS' macro via VisualGDB Project Properties and rebuild your project.
     //This will pinpoint a specific missing vector.
     for (;;) ;
    }

    And I cannot seem to find the place mentioned: “Preprocessor Macros field on the Makefile Settings page of VisualGDB Project Properties“; I do not seem to have a “Makefile Settings” page. As the post I am referring to is almost a year old, perhaps this setting has moved? See screen snip:

    https://twitter.com/gojimmypi/status/845752682685972481

    Additional information: I created a sample project using the SMM32F1 Legacy Peripheral Library – then added some OLED code I found on GitHub:

    https://github.com/LonelyWolf/stm32/tree/master/ST7735

    I tried simply defining a DEBUG_DEFAULT_INTERRUPT_HANDLERS per the comments, but there did not seem to be any noticeable difference in code operation.

    Any tips on how I ended up there & how to resolve would be appreciated. 🙂

    Thanks

    *edit: code formatting, odd html was included with prior copy/paste from Visual Studio

     

    • This topic was modified 7 years, 6 months ago by gojimmypi.
    • This topic was modified 7 years, 6 months ago by gojimmypi. Reason: odd html was included with prior copy/paste from Visual Studio
    #10805
    support
    Keymaster

    Hi,

    Sorry, there is not much documentation on this one. DEBUG_DEFAULT_INTERRUPT_HANDLERS is a preprocessor macro used in an #ifdef statement, so it should be specified in the place where other preprocessor macros are. It is different for different project types, but generally opening the Build Settings page of VisualGDB Project Properties, locating a similarly named field and adding the macro there should be sufficient to get it working.

    #10806
    gojimmypi
    Participant

    aha! very cool. So that’s not a VisualGDB project property, rather simply a Visual Studio one:  Select Project (Right-Click) Properties;

    Configuration Properties; c/c++; Preprocessor

    Pasted on the end line this:

    %(ClCompile.PreprocessorDefinitions);DEBUG=1;DEBUG_DEFAULT_INTERRUPT_HANDLERS

    and so now when I simply run, there’s a new automatic breakpoint here:

    void __attribute__ ((weak)) SysTick_Handler() 
    {
     //If you hit the breakpoint below, one of the interrupts was unhandled in your code. 
     //Define the following function in your code to handle it:
     // extern "C" void SysTick_Handler();
     asm("bkpt 255");
    }

    …complete with suggestion as to what to do; indeed the code in my specific case seems to have not properly implemented some sort of delay / interrupt initializer.

    That’s a very cool feature of VisualGDB  🙂

     

     

     

    #10815
    support
    Keymaster

    Hi,

    No problem. If you are using MSBuild, you can use the regular VS Project Properties as well. For other build systems like GNU Make the VisualGDB Project Properties will be the right place to go.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.