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

Firmware not working on own hardware when compiled with gcc

Hello,

I have ported my firmware from SDK Version 13.1.0 to Version 15.2.0. Everything is working smooth and fine now except one thing:

When I flash the firmware to my own hardware AND it is compiled by gcc.

That means: Exactly the same hex is working on the Dev Kit. And even more curious: When I flash the Firmware using SEGGER Embedded Studio, everything works fine. The main() method seems not be invoked. I tried to blink a LED as first execution in the main method, but the LED doesn't light up.

One thing I noticed already: When the hex is created by Segger, the Memory Layout of the application is from 0x00026000 to 0x000473C0. When created by gcc, it is from 0x00026000 to 0x000461B8, so there is a difference between the Output of Segger and gcc. (Found out using the Programmer in nRF Connect)

Can you please give me hints where I could search for the root of the problem? 

I'm using: nRF528132 on my custom hardware by putting a Laird BL652 Module on top.
Dev Kit is the normal nRF52 DK
Softdevice is 6.1.0
gcc is: arm-none-eabi-gcc 6-2017-q1-update 6.3.1
SEGGER Embedded Studio for ARM V4.16
MacOS Mojave

Any ideas?

Thanks and Best regards,
Sebastian

  • Well first off, Segger ES uses GCC to compile so there's nothing wrong with the compilers. The compiler settings might be different and is something that you need to check. 
    Second, Segger ES also flashed the SoftDevice, if you've not flashed the SoftDevice then you will never be able to boot your application. 


  • Hello haakonsch. Thank you for your answer.

    I've compared the Preprocessor Definitions in Segger ES with the CFLAGS in the Makefile. Only difference: In Segger is also 'NO_VTOR_CONFIG' defined.

    Of course I also flash the softdevice. I do exactly the same to my custom hardware as to the DK (nrfjprog --eraseall, make flash_softdevice, make flash). On the DK it works, on my hardware not.
    Using Segger it works on DK AND on my hardware.

    I used the Makefile of the examples/ble_peripheral/ble_app_hrs/pca10040/s132/armgcc as template and just added the files I need / removed the ones which are not needed anymore, so it compiles. No other changes to the Makefile.

  • I've compared the Preprocessor Definitions in Segger ES with the CFLAGS in the Makefile

    Just the Preprocessor Definitions? And what about all the other compiler options?

    is your SES using the same GCC version?

    The main() method seems not be invoked

    Have you confirmed that by looking with the debugger?

  • Sorry for the late reply. I had to work on other stuff.

    I checked each and every bit of the Makefile in comparison to the Settings in SEGGER. I also checked the Linker File. I just can't find any difference.

    I even wrote a new Makefile based on a (working) Makefile from examples/ble_peripheral/ble_app_hrs. When I'm done adding all the Header includes and my C files, the problem appears.

    Yes, I tried to find out what's happening using a Debugger. Unfortunately not even the main() method gets invoked. But maybe I did something wrong here. Can you please give a hint, how to debug a hex file that was produced by another compiler (gcc).

    How can I check which Version of gcc SES is using?

    Thank you for your help!

  • How did you flash your board ? Have you flashed softdevice first ? Are you using RTT ?

Related