Debug vs Flash VSC

I working on different applications using nRF5340 and nRF9160.

Debug: When Debugger is launched, the MCU reset repetitively as seen in LTE Monitor (Image 1) in case of asset_tracker application and in  Bluetooth peripheral on 5340 also. Sometimes, during programming for Debug, the connection break occurs and it takes may tries to launch Debugger.

Flash: When same code is run after Flash, then reset does not occur.

  

Parents
  • Hello,

    Can you try to set this in config file CONFIG_THREAD_NAME=y? 

    Thanks. 

    Best Regards,

    Kazi Afroza Sultana

  • After, above changes, the debugger could not yet started, but during programming for debug, programming fails with error code 35 or 33. During past 20 years, I have worked on Microchip, Holtek, ST, NXP, SiLab and many architectures. SO much debug issues never occur on those IDEs. In Zephyr based VSC /  SES projects, I have wasted two days just launching the debugger. Only once, it got launched and during step-in, I had to reset using Debugger command, to re-start execution, it took two days, but could not launch. Very annoying debugging. Too much wastage of time.  

    After many tries, when debugger got launched, the Debug Output is in image below:

      

  • It seems stack overflow. The default behavior is to reset. If you do not want to reset can set CONFIG_RESET_ON_FATAL_ERROR=n. 

  • Hi, 

    CONFIG_RESET_ON_FATAL_ERROR=n. 

    this did not resolve the issue. I observed that in the mcuboot main.c file, inside doboot() finction, there appears some issue (see image 1). When step-in into doboot(), I found that the error occurs when at line number 274, 

     ((void (*)(void))vt->reset)();
    is executed (see image 2). I could not analyze, what is done by ((void (*)(void))vt->reset)();. After reaching to this line, when F11 is pressed, the code enters to reset.S file, see image 3.  Step-in in this file and reach to line number 153 (Image 4). Press F11, code enters prep_c.c. At last line of this file, inside z_start() function, code changes to cmsis_gcc.h and 
    __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); 
    causes fatal error.
    I increased the
    CONFIG_MAIN_STACK_SIZE from 8192 to 16394, but same error.
    How may I know reason of stack overflow and resolve ?

      

       

Reply
  • Hi, 

    CONFIG_RESET_ON_FATAL_ERROR=n. 

    this did not resolve the issue. I observed that in the mcuboot main.c file, inside doboot() finction, there appears some issue (see image 1). When step-in into doboot(), I found that the error occurs when at line number 274, 

     ((void (*)(void))vt->reset)();
    is executed (see image 2). I could not analyze, what is done by ((void (*)(void))vt->reset)();. After reaching to this line, when F11 is pressed, the code enters to reset.S file, see image 3.  Step-in in this file and reach to line number 153 (Image 4). Press F11, code enters prep_c.c. At last line of this file, inside z_start() function, code changes to cmsis_gcc.h and 
    __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); 
    causes fatal error.
    I increased the
    CONFIG_MAIN_STACK_SIZE from 8192 to 16394, but same error.
    How may I know reason of stack overflow and resolve ?

      

       

Children
Related