This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SEGGER debug "no code for breakpoint"

I can see that other people have run into the "no code for breakpoint" problem when attempting to use the SEGGER debugger.  I have read the earlier posts. I have not been able to fix my problem using the suggestions I have read.

My setup is a PCA10040 board, nRF5 SDK 15.3.0, and SEGGER Embedded Studio v.4.52.

I am unable to set a breakpoint on ANY line in the following function.

void thermistor_read(thermistor_t * thermistor)
{
    nrf_gpio_pin_write(thermistor->gpio_power, 1);
    nrf_delay_us(25);
    APP_ERROR_CHECK( nrf_drv_saadc_sample_convert(thermistor->channel,
                                                  &thermistor->data) );
    nrf_gpio_pin_write(thermistor->gpio_power, 0);
    nrf_delay_us(25);
}

I get a dialog box from SES stating "no code for breakpoint" when I try to run in Debug mode. 

However: I tried setting a breakpoint on various lines in another function elsewhere in the same .c file, and it always works perfectly.  Thinking that the problem might have something to do with the specific function(s) happen to call in thermistor_read(), I tried setting a breakpoint on a call to nrf_delay_us() in another function. It worked fine.

Please help me to understand how this is happening.  I can see the assembly code pop up in the left panel of SES when it claims that I have no code associated with any line of my function.  There's plenty of code there.

Thanks for your advice.

Parents
  • Hi,

    I think it is because of code optimization. set optimization level to 0 and try. 

  • Hello, Surya,

    Thanks for your reply.  I know this isn't a SEGGER forum, and perhaps you don't use SES.  Our team switched to SES because Nordic now recommends it, and the debugger (when it works) is helpful.

    I'm not quite sure where I should be looking to make the code optimization level change that you suggested, but here's what I found.  While my .c file of interest was open, I navigated to Project > Options > Public Configurations > Debug > Code Generation > Optimization Level.  The setting was None: I changed it to zero.

    On a Build and Debug, I was still unable to set a breakpoint within the function shown above.

    Am I looking in the right place?  Do you have any other suggestions?

  • Run in Debug if not already doing so; top left corner pull-down select "debug" and not "release". The function thermistor_read() must be actually invoked from main code, but I expect you have that already. Set a breakpoint just before that invocation and use "Step-into" button to ensure the code actually executes.

  • Run in Debug if not already doing so; top left corner pull-down select "debug" and not "release".

    That was the problem!  I've done that in the past, but I mistakenly thought that when you selected Build > Build and Debug from the SES menu, the system would use the build configuration named "Debug."  Not so.  The names of the build configurations apparently don't mean anything to SES.  You can debug the "Release" build.  That's what I was doing.

    Thanks !

Reply Children
No Data
Related