Writing firmware in SES issues

Dear all,

I use Segger embedded studio to upload my firmware to my nRF52840 custom board. When I do it with build and run button everything works as expected but when I do it from Target > Download File > Download .elf file, nothing seems to work. What am I doing wrong?

Thanks

Parents
  • Hello,

    Does it work if you click this button instead: 

    ? Note that the "Download .elf" button will only program the application FW. It will not include other files such as the Softdevice.

  • Hi Vidar, 

    I tried the blinky example (blank) to make things more simple. Yes the way you mention works  but when I try to do it with Download file > ...  it doesn't work...

    My core issue here is the following.
    I want to send to a colleague the .bin file of my code so that he can perform some tests he wants and when I place the .bin file with "Download File > Download Binary File" to check that the code is uploaded to the chip without issues it did not work. So I thought to do the same thing with the .elf file and it didn't work either.

  • UPDATE: I tried the blinky example (blank and MBR). I created the .bin file and after I  performed Download File > Download Binary File on the DK and I reset the board , it worked.

    Then I tried to do the same thing with my project firmware but it doesn't work..
    I checked the memory addresses:

    Application FW: 0x00026000 - 0x000413DB  , Size: 111580 bytes
    SoftDevice FW: 0x00001000 - 0x00025FFF,   Size: 151016 bytes
    MasterBootRecord : 0x00 - 0x00000FFF, Size: 4096 bytes
    Normally, when Segger performs the whole process, I also include the softdevice .hex file in the "Loader" option in project options so that to also write the softdevice in flash along with the app firmware and it works ok as expected.
    Now that I want to do the same thing manually with Download File > Download Binary File, in order to make it a bit easier, I modified my app firmware by removing BLE initialization functions in main()  and then, since only application firmware is needed (without softDevice) I wrote with Download File > Download Binary File, only the .bin file of the app firmware again. So I re-created the .bin file and set the starting address for the .bin to be written in MCU flash at 0x00026000. But the device crashed  again.
    What am I doing wrong here?
  • You need to link the application to start at address 0x0 if you want it to boot without the Softdevice present, since address 0x0 is the entry point after reset. If you are working only with .bin files, you can convert the Softdevice .hex file into a binary file using 'objcopy'.

    $ arm-none-eabi-objcopy --gap-fill 0xff --input-target=ihex --output-target=binary s132_nrf52_x.x.x_softdevice.hex softdevice.bin
    

    Then you can load the application and Softdevice separately. Just remember to use the correct offset.

  • Ok I will try that. I also tried the mergehex.exe to convert 2 hex files (app + softdevice) in one .bin file but it seems to work only when you name the output file as a .hex. One of the options though that sets the output file format to BIN|HEX|ELF doesn't work . Any ideas on how to do that with mergehex?

  • It won't work with mergehex as it lacks the option to fill empty sections with 0xFFs.

  • ok so what is the purpose of this command?


    Could you give me a hint on how to  install objCopy so that I can use it? Is there some guide or something?

Reply Children
Related