Menu

#139 How to write an application with the debugger into flash with offset?

Version 1.x
closed
None
5
2015-07-31
2015-04-30
Lukas Simma
No

Hello

i use eclipse luna with gnu arm gcc plugin, nordic nrf51 soc with S110 softdevice.
The compiled and linked application in elf (hex) file should start at offset (flash address) 0x16000.

How to write the linked application into flash with offset by the debugger configuration?.

If i create an external tool entry to write the application with the nrfjprog.exe (nrfjprog.exe --program S110_EHAL_App.hex --pinreset) then all is ok. That means the linker process was ok. After that i can attach the debugger (with unchecked "Load executable" checkbox) and can debug, the app is running and was written to the right offset address.

But if i enable the checkbox "Load executable" then the application is written to the wrong address. If i enter 16000 into Executable offset (hex) field nothing changed. I think the application is written into a wrong place. The cpu go into a hard fault.

What must be set to write the application to the right offset address?

Thanks,
Lukas

Related

Support requests: #139

Discussion

  • Liviu Ionescu (ilg)

    • status: open --> accepted
    • assigned_to: Liviu Ionescu (ilg)
     
    • Lukas Simma

      Lukas Simma - 2015-05-11

      See also original Post. That File is correct because if i use the nordic
      flasher Software (which use the Segger J-Link SW) then this software read
      the exact destination position from the file.

      But ok, i can check the file, on which position in the elf file is the
      destination address?

      Thanks Lukas
      Am 04.05.2015 10:43 schrieb "Liviu Ionescu (ilg)" ilg-ul@users.sf.net:

      • status: open --> accepted
      • assigned_to: Liviu Ionescu (ilg)
      • Comment:

      What must be set to write the application to the right offset address?

      normally the debugger will use the addresses in the elf header, so if this
      header is correct, flash programming should work.

      I guess there must be something wrong with the linker scripts.

      Status: accepted
      Group: Version 1.x
      Created: Thu Apr 30, 2015 03:17 PM UTC by Lukas Simma
      Last Updated: Thu Apr 30, 2015 03:17 PM UTC
      Owner: Liviu Ionescu (ilg)

      Hello

      i use eclipse luna with gnu arm gcc plugin, nordic nrf51 soc with S110
      softdevice.
      The compiled and linked application in elf (hex) file should start at
      offset (flash address) 0x16000.

      How to write the linked application into flash with offset by the debugger
      configuration?.

      If i create an external tool entry to write the application with the
      nrfjprog.exe (nrfjprog.exe --program S110_EHAL_App.hex --pinreset) then all
      is ok. That means the linker process was ok. After that i can attach the
      debugger (with unchecked "Load executable" checkbox) and can debug, the app
      is running and was written to the right offset address.

      But if i enable the checkbox "Load executable" then the application is
      written to the wrong address. If i enter 16000 into Executable offset (hex)
      field nothing changed. I think the application is written into a wrong
      place. The cpu go into a hard fault.

      What must be set to write the application to the right offset address?

      Thanks,
      Lukas


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gnuarmeclipse/support-requests/139/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Support requests: #139

      • Liviu Ionescu (ilg)

        please do not reply by email, use the web interface.

         
  • Liviu Ionescu (ilg)

    What must be set to write the application to the right offset address?

    normally the debugger will use the addresses in the elf header, so if this header is correct, flash programming should work.

    I guess there must be something wrong with the linker scripts.

     
  • Liviu Ionescu (ilg)

    any progress?

     
  • Liviu Ionescu (ilg)

    I reread the original message and your comments, and I have difficulties to understand your issue.

    are you comparing programming a .hex file using nrfjprog.exe with programming an .elf file using j-Link?

    on which position in the elf file is the
    destination address?

    ah, I don't know, but there are ways to read the elf details (readelf, objdump, etc).

    list the elf section details and try to understand what is wrong.

     
  • Chibby

    Chibby - 2015-06-10

    I use a Bootloader application additionally to my normal application on an STM32.

    I solved the issue of writing the normal application with an offset of 0x8000 by editing the linker script (adding a section in front):

    SECTIONS
    {
        .bootloader :
        {
            . = ALIGN(4);
            KEEP(*(.bootloader))
            . = 32K;
        } > FLASH
    
    ...
    }
    

    Does that answer your question?
    This makes the debugger leave the first 32K as is and then flash the programm.. Though it still starts at 0x0 (where nothing is programmed here..) - i didn't manage to alter the 'start'-address of the debugger.

     
  • Liviu Ionescu (ilg)

    I think the easiest method of reserving the bootloader area is by just modifying the flash start address from 0x0 to 0x8000 or whatever address you like (and also reducing the total flash size).

     
  • Liviu Ionescu (ilg)

    • status: accepted --> closed