Local development and gdb debugging with NetBeans, a step by step guide

Im able to issue following commands:

target remote localhost:9025
monitor reset halt
load

then I try to do:
jump Reset_Handler

and then it never returns gdb shell again. Thats what i incorrectly described as "hang".

(gdb) jump Reset_Handler
Continuing at 0x80081ca.

I can interrupt by pressing CTRL+C:

Program received signal SIGTRAP, Trace/breakpoint trap.
WWDG_IRQHandler () at ../build/arm/startup/startup_stm32f10x_md.S:115
115             b       Infinite_Loop  

Stopping in this infinite loop. Then I issue jump Reset_Handler again and only then i hit app_setup_and_loop breakpoint.

  • So thats one odd thing, why doesn't it end up in that breakpoint on the first jump Reset_Handler/continue combination?

It is not reliable either. Sometimes I get stuck in app_setup_and_loop () and won't get past this check:

if(!SPARK_FLASH_UPDATE && !HAL_watchdog_reset_flagged())

Where HAL_watchdog_reset_flagged() returns 1. But if I modify the value this function returns:

set variable IWDG_SYSTEM_RESET = 0

I can step past this into setup routine.

  • What is HAL_watchdog_reset_flagged() about and why does it sometimes return 1 and sometimes 0?

When in setup code, i can run all the lines until i hit:

delay(10);

This seems to hang gdb, the timer seems to not be updated in function HAL_Timer_Get_Milli_Seconds(void). But again, I can get past this by issuing:

set variable system_1ms_tick = 10
  • Why is the variable system_1ms_tick not being updated? Are interrupts disabled or something when Spark core runs under gbd by default?

Guys @mdma, @AndyW, @wtfuzz or @BDub - could you shed some light? Im trying OpenOCD as well here same issues (apart from HAL_Timer_Get_Milli_Seconds(void)):