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

How do I figure out why GDB isn't breaking at main?

(PLEASE SEE COMMENT BELOW) I've got a Nordic project that I imported into Eclipse as a makefile project. I've got it working and I can debug into it. Everything is good. So I created a native Eclipse project to build the same target, carefully copying all the flags and such from the makefile. It builds without error (finally!). But I cannot debug it. It seems that GDB tries to set a breakpoint at main, but it never hits. After it loads the program, it hangs on "Starting Target CPU ..." I've carefully looked at the map files for both programs. They aren't completely identical (some versions of the gnu libs are newer in the native eclipse project), but they are really close, and all the entry code at the isr_vector looks the same.

I'm new to this toolset and remote GDB server and so I have absolutely no idea how to figure out what is wrong, since I can't even start to step through code. Can someone help me?

  • FormerMember
    0 FormerMember

    This problem typically occurs if flash and RAM settings for the project aren't set correctly. For GCC, these settings should be set in the linker script (.ld file).

    S134 v.4.0.0 release notes: image description

    Corresponding settings in the linker script:

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000
      RAM (rwx) :  ORIGIN = 0x20002558, LENGTH = 0xdaa8
    }
    
  • It now appears that the problem is not so much a debugger problem as a problem with the SoftDevice transferring control to my app. If I unclick "Continue" in the Debug configuration options, I can see sensible (SoftDevice) code at low addresses. I can also disassemble my main function, it looks correct, and I can see my breakpoint in both the assembly window and the source window. So, it now appears that my question is "How do I debug problem with the SoftDevice transferring control to my app?". Should I file a new question?

  • FormerMember
    0 FormerMember

    Yes, how to debug with softdevice is another topic, so it would be nice if you could post a new question. Before doing so, I would recommend you to search the topic in existing questions, it is a widely discussed topic.

Related