[SOLVED] Question regarding Ozones use of JLink

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Question regarding Ozones use of JLink

    Hi there,

    we need to flash an encrypted application to the qspi attached NOR flash of our microcontroller and debug it with Ozone. At runtime, the application will be decrypted transparently in the background on-the-fly by a peripheral of the MCU. For the writing of the unencrypted application we use SEGGERs Open Flashloader and it this works, but doing the encryption in Open Flashloader while writing to the NOR flash does not work at all.

    Our new plan now is to encrypt the application before giving it to Open Flashloader, but we still need to be able to use Ozone for debugging. For this I need some background knowledge regarding how Ozone is using JLink for downloading the application the the MCU.

    Question: Is there a way, to make Ozone use an encrypted .bin for downloading, but using an unencrypted .elf for debugging? I suppose when we encrypt the complete .elf file Ozone won't be able to debug anymore.

    Any further suggestions on how to achieve our goal would be much appreciated.

    Best regards
    Paul
  • Hello Paul,

    Thank you for your inquiry.

    Paul S. wrote:

    Question: Is there a way, to make Ozone use an encrypted .bin for downloading, but using an unencrypted .elf for debugging? I suppose when we encrypt the complete .elf file Ozone won't be able to debug anymore.
    Yes Ozone can be used like this.
    In your Ozone project file (.jdebug) uncomment the TargetDownlad() function and thus overwrite the default download operation which would be the unencrypted elf file.
    In this function add Target.LoadMemory() and specify your bin file + baseaddress.


    Next save everything and reload the project in Ozone. Now on start of the debug session the encrypted binary should be loaded while the unencrypted elf information are used for debugging.

    If you encrypt the elf file this will obviously not work.

    Best regards,
    Nino
    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.
  • Hello Nino,

    thanks a lot for your reply, that sounds good and I will try it.
    Just to be clear here: You mean in the TargetDownload() routine in the .jdbug file, I shall refer a unencrypted .elf file as well, not the .bin file, correct?

    Addition: It seems, that when I point to a .bin file in .jdbug (TargetDownload("<path>/.bin", <adress>), Ozone ignores the bin and downloads the content of the .elf file which is denoted in the Ozone project file with File.Open ("<path-to-elf-file>") in function OnProjectLoad(void){...}

    Best regards
    Paul

    The post was edited 1 time, last by Paul S. ().

  • Hello Paul,

    In TargetDownload() you download the bin with Target.LoadMemory(). The elf file is loaded with File.Open as usual at OnProjectLoad().

    Best regards,
    Nino
    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.
  • Hello Nino,

    unfortunately Ozone does not use for download the .bin I specify in .jdebug file. Here is what I do:
    • Using Ozone v3.10d together with JLink V6.62a
    • Ozone project file (<myApp>.jdebug) contains path to .elf file ( File.Open("<path>/<myApp>.elf") in function OnProjectLoad(){...}) as well as the path to the .bin file ( Target.LoadMemory("<path>/<myApp>.bin", BaseAdress).
    • The bin file is basically the same as the bin part within the .elf file, but I changed a few bytes at the beginning and the end for testing purposes (see next step)
    • After having done "Download & Reset Programm" with Ozone using the .jdebug file mentioned above, I open a Memory View window in Ozone and export the content of the memory (QSPI attached external flash) beginning at BaseAdress (parameter used in Target.LoadMemory(...) function, see above).
    • When I compare the binary data of the memory export and the .bin file indicated in Target.LoadMemory(), the binary data is not the same, i.e. I don't see the modified bytes mentioned above. So obviously Ozone did not download the .bin file denoted in TargetLoadMemory(...).
    • Because we flash the application not to the internal flash of the MCU but to an external flash attached via qspi, we have to use SEGGERs OpenFlashLoader. But think this should not make a difference for our use of Target.LoadMemory
    Am I doing sth. wrong here?

    Many thanks in advance
    Paul
  • Hello Paul,

    Your approach looks correct as described.
    Could you provide your .jdebug file for verification?
    Could you also provide a J-Link log file of the session to make sure there are no additional downloads triggered at some point?
    wiki.segger.com/Enable_J-Link_log_file

    As a sanity check could you try verifying the downloaded application with J-Link Commander instead of the Ozone memory window?
    So the procedure is as follows:
    - Download and Reset Program with Ozone as usual.
    - Leave the debugsession in Ozone open.
    - Start J-Link Commander and connect to your target device.
    - Use "savebin" command to download your test memory range into a bin file for comparison to your original bin file.

    Are they equal now?

    Best regards,
    Nino
    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.
  • Hello Nino,

    sure, I'll attach .jdebug and J-Link log file to this post.

    I tried the export of the external flash memory via J-Link + savebin as you described, still the test.bin (see .jdebug) does not match the savebin export.

    Best regards
    Paul
    Files
    • brc3.jdebug

      (13.34 kB, downloaded 463 times, last: )
    • JLinkLogOverride.zip

      (634.82 kB, downloaded 479 times, last: )
  • Hello,

    We received you inquiry in parallel in our support system. To make sure no data is lost between the channels this thread will be closed now and the matter will be discussed further via email as you are in valid support period.

    Best regards,
    Nino
    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.