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

ARM GCC compiles but bin file is very small and download but does not work

I am using the sdk version 11 and arm-none-eabi-gcc version 5.4 on linux mint to compile the blinky test application. I have pointed the Makefile-posix at the location of the compiler gone into the folder for the pca10028 board and into the s130 folder. When i run make everything appears to compile and link with no errors and a bin and a hex file is produced. However the hex file produced is much smaller than the example hex file in the hex folder(which works fine). When i download this hex file it does not do anything at all. The elf file produced is around 340k while the bin file is about 1k and hex is about 3k. I have used keil to compile and got a working hex file but I need to get GCC working. I have not modified the make file so any ideas what might cause this kind of symptom. I have tried using a slightly old version 4.9 of the arm gcc as well but same results

  • Hi Richard, a 1k binary for a program that just blinks a LED sounds resonable to me.

    You can have a look into the map file and see if at least some function you expect to be in the outout are there (main, reset vector etc.). Or you can produce an annotated list file "arm-none-eabi-objdump -S blinky.elf" and see if the resulting assembler code makes sense to you.

    The start of the binary should contain the address of the initial stackpointer followed by the address of the Reset_Handler() function.

    You can use a debugger and set a break point at Reset_Handler() and debug the setup procedure.

    cheers, Torsten

  • Hi thanks for the answer , Initially i thought the size seemed reasonable however the example hex files for blinky with a softdevice on the chip appear to be more like 300k in size. The size looks more like the example hex files for blank with no soft device installed however i have been compiling from the s130 folder which I assume is for use when the chip has a soft device installed and links accordingly. I looked at the log file and while i rarely look at these things the functions appear to be there however the map file does seem to start with a section full of things at address 0x00000000 nrf51422_xxac_s130.map Sorry if I seem a little clueless here as this is my first foray into these chips , quite a steep learning curve

  • If you are using a softdevice, the softdevice is placed at address 0x00000. Your application follows at 0x0001b000 (according to your map file; which looks resonable). Are your sure, that you've flashed the softdevice into your controller?

  • ok I just figured it , my mistake was to use jlinks drag and drop flashing . I used the jlink command line to load the bin file to the correct location 0x1b000 and now it works. I guess that jlink drag and drop just overwrites everything and so perhaps the example hex files are so large because the include the soft device within them

  • That is why I have an own make target for flashing ;-) Just figuring out, how to implement "make blinky.flash" once and then no chance to make a mistake on that side.

Related