Skip to main content
po221
Senior
November 21, 2023
Question

Disabling iwdg in debug with Visual Studio Code

  • November 21, 2023
  • 2 replies
  • 3083 views

Hi,

I have been using stm32cubeide for years but I never understood anything about GDB and the toolchain.
I discovered the visual studio code interface with interest (the code is incredibly more readable in vsc by default) and I said to myself that it was a good experience to try vsc to better understand the toolchain.
Build, ok
Debug, ok but the watchdog bites during debugging stops, it is not possible to debug.

How can we configure GDB so that it prevents the triggering of the watchdog in debug as is configured by default in STM32cubeIDE?

Thanks in advance

 

This topic has been closed for replies.

2 replies

po221
po221Author
Senior
November 21, 2023

I just understood that the ST-link only modifies a register which could be modified otherwise.

Is it a solution to do this (this seems to work for debugging but it may be dangerous for the proper functioning of the IWDG) ?

int main(void)
{
 HAL_Init();
 __HAL_DBGMCU_FREEZE_IWDG();
...
...

 

TDK
Super User
November 21, 2023

Yes, just the following is sufficient:

__HAL_RCC_DBGMCU_CLK_ENABLE();
__HAL_DBGMCU_FREEZE_IWDG();
"If you feel a post has answered your question, please click ""Accept as Solution""."
po221
po221Author
Senior
November 21, 2023

Hi,

__HAL_RCC_DBGMCU_CLK_ENABLE

is not defined (stm32L431) is this normal?

po221
po221Author
Senior
November 29, 2023

I still haven't found any trace of __HAL_RCC_DBGMCU_CLK_ENABLE

but above all I abandoned visual studio code because the configuration of Cmake (or other) is not functional

and I was not able to understand where the bug is located (Cmake, Gcc, vsc extension, all of this...)

When there are compilation errors, not all of them appear in the PROBLEMS tab and in the console I see errors on files removed yesterday but which still seem to be present in the debug files even though I cleaned the project.

I came back to cubeide and after 2 explicit errors it compiled without problem. No problem with iwdg in cubeide debug.

Thanks for your help.