Ozone multi-step multiple elf load

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

  • Ozone multi-step multiple elf load

    Hi - just getting started using Ozone.

    We're targeting an LPC4350. It has external SDRAM attached that needs to be configured prior to using it (i.e. downloading elf code to it). We've been doing this in other debuggers (JtagJet/Chameleon; JLink/GNUARMEclipse) by a two-step process that can be configured in the Chameleon and GNUARMEclipse setup: downloading the SDRAMSetup.elf, which the debugger does the reset, download (to internal ram), then run until main which configures the SDRAM; then download the App.elf (which downloads to internal ram, overwriting SDRAMSetup, and SDRAM), and no reset but start from the initial vector location and break at main.

    I've been trying to do this with a custom TargetReset() in the .jdebug but not getting it to work. Could you provide a .jdebug example, or similar, how to go about doing something like this?

    Thanks.
    -Kevin


    Target: LPC4350
    OSX 10.11.6
    Ozone 2.22j
    JLink Ultra+
  • Ping. Would like to figure out how to get Ozone working with this. I'm using Eclipse (GNU ARM Eclipse) but there are some Eclipse and gdb bugs that are making it a challenge (e.g. single stepping on either core will cause the debugger/gdb to lose communication and display "Ignoring packet error, continuing..." after a few steps).
  • Hi,

    in general the easiest way to load and run multiple application files is to use the OnProjectLoad to load the first application file and then use the AfterTargetHalt function to load the second application when a certain point, i.e. end of initialisation is reached.
    We might add more complex examples to the user manual in the future.

    Best regards
    Johannes
    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.
  • I'm back to trying to get this to work but still not able to.

    What I'm trying to do:
    -Reset, download, and execute "configure external sdram" elf.
    -Download and execute/debug "main app" elf.

    The "configure external sdram" elf lives entirely within internal sram. The "main app" elf spans internal sram and external sdram. Hence why the "configure external sdram" needs to be downloaded and executed first, then "main app", without reset in between.

    I've been trying to get this working a few different ways, but am stuck. Many paths seem to lead to recursion calls, or other dead ends, including your suggestion (i.e. AfterTargetHalt() correctly gets called when when "configure external sdram" halts execution, but then when FileOpen("main app") and Debug.Download() are executed in AfterTargetHalt(), "main app" downloads and starts execution, then AfterTargetHalt() gets called again and ...).

    Any further hints or help is appreciated. Thanks!
    -Kevin
  • Hi,

    To just load the second file without reset, you can use File.Load() instead of File.Open() and Debug.Download().

    Best regards
    Johannes
    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.
  • Thanks for the File.Load() suggestion, it helps lead to a sort-of solution, but still some issues.

    Here's how I've gotten it to sort-of work:

    Source Code

    1. void DebugStart (void) {
    2. Exec.Connect();
    3. Exec.Reset();
    4. File.Open ("SdramConfig.elf");
    5. /* Wait for it to hit main() */
    6. Util.Sleep(1000);
    7. /* Continue executing main() and wait to hit asm bkpt */
    8. Debug.Continue();
    9. Util.Sleep(1000);
    10. File.Load ("MainApp.elf", "");
    11. /* Seems to be necessary in order to read either GetBaseAddr() or SP & PC correctly */
    12. Util.Sleep(1000);
    13. /* Initialize SP */
    14. unsigned int adr;
    15. unsigned int val;
    16. adr = Elf.GetBaseAddr();
    17. val = Target.ReadU32(adr);
    18. Target.SetReg("SP", val);
    19. /* Initialize PC */
    20. val = Target.ReadU32(adr + 4);
    21. Target.SetReg("PC", val);
    22. }
    Display All


    I can get it to work on the first "download and reset program" but if I "stop debug session" and "download and reset program" again, I get a failed to read target status message. I have to cycle everything: target, jlink, and the app in order to get everything working again.

    Is this the right way to download the elf apps? Any suggestions for better ways of downloading and dealing with the "failed to read target status"?