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

Running application in non debug mode - Eclipse GCC

Hello,

I have been able to get an application to build and run in debug mode using Eclipse GCC (Kepler) for the nRF51822. My application does not use a soft device. We are using some of the nRF files from nRF51 SKD 5.1.0.

I have an IAR license and I can build debug code and I can run the application without the debugger attached.

I followed the instructions found in the tutorial about setting up Eclipse and GCC. devzone.nordicsemi.com/.../

My application will run when I am running a debug session using Eclipse GCC but if I disconnect my debugger (J-Link Lite) and apply power the application does not appear to run. I have been able to 'Connect to running target' and able to get into a back in a debug state after applying power and without the debugger attached and I find that the device is sitting at the HardFault_Handler. Attached is a photo of the general registers when I am at the Hardfault_handler.image description

I found the other thread about HardFault in SystemInit and made sure that I had the correct RAM selected but I still cannot get my application to run without the debugger attached. devzone.nordicsemi.com/.../

Attached is a screenshot of my debugger setup.image description

Any my Startup tab for the Debug.image description

My linker script looks like this.

/* Linker script to configure memory regions. */

SEARCH_DIR(.) GROUP(-lgcc -lc -lnosys)

MEMORY { FLASH (rx) : ORIGIN = 0x0000, LENGTH = 0x40000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 }

INCLUDE "gcc_nrf51_common.ld"


Does anyone have an example of how to setup the Release build? Or does anyone have any suggestions as to why the debug will not just run when I apply power with no debugger attached?

Thanks for your assistance.

Josh

  • Have a look at this blog. It's an Eclipse GCC setup. There are many examples code & projects you can use. It's hard tell what is the problem without knowing what you have in your project.

  • Hello.

    I took at look at your blog and I was able to get your examples to work. Thanks. I need to go through those more but I was able to get my code to work as well.

    I found that in the Properties for my project, under C/C++ Build-> Settings and then under the Tool Settings tabs -> Cross ARM C Linker - Miscellaneous-> Other flags I had the following: --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group

    image description I removed the --specs=rdimon.specs and I found that I could load my code and disconnect the debugger and when applying power the device would run.

    In the readme.txt file of GNU Tools ARM, I found the following:

    Users can choose to use or not use semihosting by following instructions. ** semihosting If you need semihosting, linking like: $ arm-none-eabi-gcc --specs=rdimon.specs $(OTHER_LINK_OPTIONS)

    ** non-semihosting/retarget If you are using retarget, linking like: $ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS)

    Upon changing my code to --specs=nonsys.specs or removing that from my linker flags, I was able to then load my debug code and have the device run when power was applied.

    I hope this can help others if they have problems with getting a debug version working without the debugger attached.

    Thanks.

    Josh

  • I don't know anything about Eclipse, but to get GDB to flash your chip you need to send it the 'load' command. I didn't see load anywhere in your settings so I'm assuming that is the missing piece.

  • Semihosting environment requires debugger to be connected because it works as stdio input/output. So if any stdio function would be used without debugger connected the whole program has to hang. This problem relates only to GCC linking configuration.

  • the radioman stuffs are for semhosting. If you wish to use semixosting, set the debug option for OpenOCD and in your code add the initialization.

    extern void initialise_monitor_handles(void);
    
    int main(void) {
        initialise_monitor_handles();
    
        printf("hello world!\n");
     }
    
Related