[SOLVED] J-Trace/J-Link preserve memory location on programming

  • [SOLVED] J-Trace/J-Link preserve memory location on programming

    Hello

    I'm searching for a way to preserve a user defined memory location from programming with my j-trace. The section i want to preserve is the section in the flash of my Chip (STM32H7) where i'm storing my parameters and i don't want to erase this section every time i reflash a program to the chip.

    I know this function from microchip and there i got a field in the properties of the debugger (real ice) where i was able to insert a range of storage addresses which were read and concatenated into the hex-file before programming the whole new hex file.

    Is such function possible with the segger j-link/j-trace products?

    Regards Thomas
  • Hi,
    Thank you for your inquiry.

    There are two cases:
    Case 1 - The preserve data is in one or more sectors and there is no data to be flashed to these sectors:
    J-Link Commander:
    a) Make sure there is no data at the preserve data location in your data file.
    b) erase the exact area to be flashed with the erase<range> command.

    c) Flash the data file via the "loadfile" command.
    J-Flash:
    a) Make sure that Project Settings -> Production -> Actions performed by Production programming -> Erase is set to "selected sectors"
    b) Make sure there is no data at the preserve data sector in your data file.
    c) Program the device (Target -> "Production Programming" (F7))

    Case 2 - There is data to be flashed to the sectors the preserve data is located at:
    J-Link Commander:
    a) Make sure there is no data at the preserve data location in your data file.
    b) Open the J-Link Commander (JLink.exe) and use the SetFlashDLNoRMWThreshold exec command (exec SetFlashDLNoRMWThreshold).
    c) erase the exact area to be flashed with the erase<range> command.
    d) Flash the data file via the "loadfile" command.
    J-Flash:
    a) Read back the preserve area (Target Manual Programming -> Read back -> Range)
    b) Merge the read back data to your hex file (File -> Merge data file...).
    c) Program the device with the merged data (Target -> "Production Programming" (F7))

    All the above options are scriptable.

    Does this answer your question?

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.