what is Jlink api equivalent to downloading/running target using CSpyBat?

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

  • what is Jlink api equivalent to downloading/running target using CSpyBat?

    We currently are using the CSpyBat program to reset/download/run a cortex-r4f target device. Something like the following:
    set CSPY="C:\Program Files\IAR Systems\Embedded Workbench 6.0\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 6.0\arm\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 6.0\arm\bin\armjlink.dll"

    set CSPYPARAMS=--plugin "C:\Program Files\IAR Systems\Embedded Workbench 6.0\arm\bin\armbat.dll" --backend -B "--endian=little" "--cpu=Cortex-R4F" "--fpu=VFPv3" "--semihosting" "--drv_communication=USB0" "--jlink_speed=auto" "--jlink_initial_speed=32" "--drv_catch_exceptions=0x000"

    !CSPY! target.out !CSPYPARAMS!

    I would like to progammatically do the same steps but in a C/C++ program using the Jlinksdk.dll API.

    I have seen example postings on this forum that do similar steps but related to Flash programming like the following:
    JLinkApi.Open();
    JLinkApi.SelectInterface(ApiInterfaceType.JLINKARM_TIF_SWD);
    JLinkApi.SetSpeed(1000);
    JLinkApi.ExecCommand_Device("LM3S1968");
    JLinkApi.Reset();
    JLinkApi.Halt();
    JLinkApi.BeginDownload();
    JLinkApi.WriteMem(0x0, b);
    JLinkApi.EndDownload();
    JLinkApi.Reset();
    JLinkApi.Go();

    However I do not want to update the flash, I just want to download into RAM.
    In the FlashDownload.c example I see this code but the comments certainly imply this is flash related:
    JLINKARM_Reset();
    JLINKARM_BeginDownload(0); // Indicates start of flash download
    JLINKARM_WriteMem(FLASH_START_ADDR, FileSize, pBuffer); // Download file (into flash).
    JLINKARM_EndDownload(); // Indicates end of flash download

    would something like the following api calls be what is required?

    JLINKARM_Halt();
    JLINKARM_WriteMem(RAM_INSTRUCTION_START_ADDR, FileSize, pBuffer);
    JLINKARM_Reset();
    JLINKARM_Go();
  • Hi,

    You can take the sample from FlashDownload.c
    and just remove: JLINKARM_BeginDownload() and JLINKARM_EndDownload() if JLINKARM_WriteMem() goes to RAM, that's it.


    Best regards
    Alex
    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.