This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Modern GCC and Eclipse environment for NRF51

Hi

Let's see if you can help me :-)

I've spent several days trying to compile the blinking example for NRF51822 in a more modern Eclipse environment. In fact, latest SDK versions of Nordic don't include the Eclipse project, only the Keil files. I can't understand this decision, mostly when Eclipse is one of the best dev environment in nowdays. Anyway, I've been trying to compile the included GCC example by clicking the .bat files, but with no sucess: The generated .hex file doesn't work. :-(

The NRF51 SDK v4 includes an Eclipse example, but using manual makefiles, and in the other hand, the generated .hex file doesn't work. Must be noticed that I'm using Yagarto 20121222, with GCC 4.7.2.

So, I've decided to create a more modern GCC environment using Eclipse, but I'm having problems with the startup files:

  1. When not using the -nostartfiles option, the generated .hex files has 93K, instead of 3K like the equivalent file generated by Keil. Of course, it doesn't work :-(. When trying to debug it, I lost the trace at _start call in the gcc_startup_nrf51.S. At this point, the execution jumps to crt0.o file, and I don't have the source. In fact, the crt0.o file weren't included by the latest Yagarto, but I get it from a previous version.

  2. When USING the -nostartfiles option, I get a problem in the gcc_startup_nrf51.S:

    D:\gcc\ble_app_hrs\Debug/../Platform/gcc_startup_nrf51.S:181: undefined reference to `_start'

So I think that the problem must be related to the crt0.S or crt0.o file. Using the -nostartfiles option together to the correct crt0.S should fix the problem. It is right?

What can I do? Any suggestion? I include an screenshot of the error, and the Eclipse environment. In case I finally fix the problems, I'll document and post the new Eclipse environment as alternative of Keil projects.

Thanks you in advance

Cheers,

Elena

image description ble_app_hrs.rar

Parents
  • Incredible but truth!!!!!!! :-)

    I've just tested with the blinking example and just works! In addition, compiling with the -nostartfiles option I get a .hex file of 3KB, which is the same size of obtained .hex using Keil.

    I've several things to do, but in the next few days I'll test the Eclipse environment with the ble_app_hrs example. This example must be a bit more complicated because the SoftDevice, but should be something as easy as to modify the linker file. Right?

    Thanks a lot for your help

    Cheers

    Elena

Reply
  • Incredible but truth!!!!!!! :-)

    I've just tested with the blinking example and just works! In addition, compiling with the -nostartfiles option I get a .hex file of 3KB, which is the same size of obtained .hex using Keil.

    I've several things to do, but in the next few days I'll test the Eclipse environment with the ble_app_hrs example. This example must be a bit more complicated because the SoftDevice, but should be something as easy as to modify the linker file. Right?

    Thanks a lot for your help

    Cheers

    Elena

Children
  • When it comes to embedded systems, I like to use the -nostdlib flag (which implies -nostartfiles). This gives me the illusion of controlling what's going on ;-) Anyway I'm glad I could help and, as I'm currently fighting with the HRS example, I suppose we'll meet again on the forum.

  • Elena, please keep us posted on your progress. I was never able to get eclipse working. You may take a look at sourceforge.net/.../ I found this plug in most effective in getting a project to build, however I was not able to get it to flash.

  • Hi Scott

    I haven't tried yet the ble_app_hrs example because we are having hardware problems with the project. Until we don't fix these problems I can't continue the tests with Eclipse. But for now, if you download the attached file of my initial post, you can start working with Eclipse. Don't forget to modify the gcc_startup_nrf51.S file as according in the reply.

    We are in touch.

    Cheers,

    Elena

  • Hi again

    Finally I tested the HRS example by using my Eclipse environment and I had no problems. All I had to do is to modify the linker file (gcc_nrf51_blank_xxaa.ld) in order to fit the SD in flash and RAM memory. For SD s110, v7.0:

    FLASH (rx) : ORIGIN = 0x00016000, LENGTH = 0x2A000 RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000

    This change, of course, is only needed when using a SoftDevice.

    Cheers,

    Elena

Related