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

Segger Embedded Studio vs IAR: Different Debugging Behavior

Having gotten through the hurdles of getting my IAR project to compile and run on Segger Embedded Studio, I am now seeing different behavior between the two IDEs while debugging and am wondering if I still need to configure something correctly on the Segger.

When I download this project into IAR, I can run, set breakpoints, single-step, as expected.  Because this project includes a Softdevice (4.0.2), I expect to have to set the PRIMASK bit as directed in . https://devzone.nordicsemi.com/question/53488/application-debug-with-softdevice/.  If set this bit, run for a few seconds, then stop and clear this bit, I can make use of breakpoints for several minutes and still have interrupt-based functions such as the timers work.  Eventually, the code will hit a fault handler ISR, at which point I can reset it, repeat this process, and get some more debugging time.

On the Segger side, I can set the PRIMASK bit true and use breakpoints, with the same caveat that setting PRIMASK masks all user-configurable interrupts.  If I then set PRIMASK back to 0, instead of getting some time where breakpoints can be used, the code immediately jumps to ISR Handler ExternalISR9.  My attempt at getting some data for a few minutes before the ISR gets hit works with IAR, but with Segger I can't get the same result.

Could this be related to Segger's Project -> Options menu that IAR handles something correctly and I still don't have set right on the Segger side?  Or am I perhaps getting lucky with IAR on something that shouldn't work, but does long enough for me to collect data?

Thanks,

Mike Marks

Parents
  • By digging through the project files and looking at the same project under both IAR and Segger environments, I may be on to something.  The Segger project explorer lists two ".s" assembly files, iar_startup_nrf52.s, and Cortext_M_Startup.s.  Curiously, only the latter file gives the option for viewing the output files, whereas the iar_ file does not.  When I look at both the "Cortex" and the "IAR" files, I notice that the IAR file has many more named entries in the vector table after the SysTick_Handler, whereas the "Cortex" file  only has entries labelled "EXTERNALISR<x>".  The item corresponding to EXTERNALISR9, where my Segger keeps being stopped at, corresponds to an entry labelled TIMER1_IRQHandler in the IAR startup file.  Is it possible that this iar_startup_nrf52.s is not actually getting used in the Segger, but it is used when I run from IAR?  If so, can someone suggest the best way to fix the Segger project file?

    Thanks,

    Mike Marks

  • Hi Mike!

    I haven't tried porting a project from IAR to SES myself, but we should be able to figure out what is causing your problems.

    Firstly, could you tell me which SDK your project is built on?

    You could try to replace the IAR_startup_nrf52.s and Cortex_M_startup.s files with the SES_startup_nrf52.s file below. (If you are using the nRF51, let me know).

    Also, try adding the system_nrf52.c from:  NRF5_SDK/components/toolchain/

    Let me know if that affects your project.

    Cheers,
    Joakim.

    ses_nrf52_startup.s

  • Joakim,

    The SDK version is 14.  I think it's 14.0, but not sure of the decimal revision.  Is there a project file or other easy way to tell which SDK is used?  I checked with someone else on the project, but was curious if there is a file from Project Explorer that I can inspect.

    I replaced the iar_startup_nrf52.s with the SES_startup_nrf52.s you sent, and everything now works.  There was already a system_nrf52.c file included in the project, so I didn't have to make any changes there.  

    Thanks much for the help, I've been taking longer to get the SES up and running for this project than our project managers wanted to see, but now debugging behavior works  as expected and there are no more jumps to EXTERNALISR9.

  • Hi Mike!

    I'm glad that it worked.

    Be sure to let us know if you have any questions in the future!

    Also, you can check which version of the SDK you are using in the release notes in your SDK folder.
    SDK_Folder/documentation/release_notes.txt

    Cheers,
    Joakim.

Reply Children
No Data
Related