This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Cannot set a breakpoint in a given method in SimpleBLECentral.

Hi,

I have spend hours figuring out why I can't set a breakpoint anywhere in GAP_DEVICE_INFO_EVENT case.  The breakpoints suddenly jumps down to 

GAP_DEVICE_DISCOVERY_EVENT, whenever I'm starting the debugger. What is the reason behind this ?. 

  • Hello Osman,
    Try to reduce the optimizations level:
    Project options -> "C/C++ Compiler" tab ->"Optimizations" column -> set level to low , recompile and try again.
    Does that work?
  • I have tried, and the only difference is that I can now set a breakpoint at the "break" in line 714, but cannot still set it anywhere in GAP_DEVICE_INFO_EVENT . It just bothers me that it is the only part of the whole project, where I'm not able to debug. 

  • Hi Osman,

    On the out-of-the-box SimpleBLECentral (high optimization, size) on IAR 8.20.2 it works fine to set a breakpoint here.
    Have you done any modifications to the code? If so, please check that the function (simpleBLECentralEventCB) also exist in your .map file.

    You could also try placing a #pragma optimize=none on top of the simpleBLECentralEventCB function to ensure there are no compiler optimizations playing tricks with you.

    Regards,
    Svend
  • I found the issue. I tested it once again by downloading the source code without any modifications, and it works well.

    The issue occurs once I'm adding the rssi parameter in simpleBLEAddDeviceInfo:

        static void simpleBLEAddDeviceInfo( uint8 *pAddr, uint8 addrType, int8 rssi); 

    and parsing the three parameters in GAP_DEVICE_INFO_EVENT

        simpleBLEAddDeviceInfo( pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType, pEvent->deviceInfo.rssi );

    Is there any explanations of why it fails ?.