JLINK: how to download to ARM-cortex using the command line

  • JLINK: how to download to ARM-cortex using the command line

    Hello,

    it looks like JLINK commander (jlink.exe) is the tool to use, but I can't find any documentation.

    - how do I download an ELF to the target?
    - how can I directly write a byte to the internal flash (or a complete page)

    Thanks!
  • Hi Sebastian,

    it looks like JLINK commander (jlink.exe) is the tool to use, but I can't find any documentation.

    Most of the documentation is the "?" command to list the available commands in J-Link Commander.

    - how do I download an ELF to the target?

    ELF files are currently not supported by J-Link Commander.
    Only bin files are supported for download into flash, but there are many free utilities out there like "objcopy" which allow extracting the data from an ELF file into a binary file.

    - how can I directly write a byte to the internal flash (or a complete page)

    UM08001, chapter "Flash Download" => J-Link Commander
    segger.com/admin/uploads/productDocs/UM08001_JLinkARM.pdf


    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.
  • thanks, i can write to flash now.

    what I like to do besides a complete download is writing just some lookup tables.
    in the example below i have a table in flash @1688 containing {1, 2, 3 ...}
    When I write the first byte of the table, JLINK downloads a block of 4096bytes, setting the byte at 1688 to 0 (as expected) and the rest to FF.
    So, do I have to first savebin a complete block, alter the resulting file, and then loadbin the block or is there a better way to say write 100 bytes at address 12345?


    SEGGER J-Link Commander V4.56b ('?' for help)
    Compiled Nov 7 2012 18:44:47
    DLL version V4.56b, compiled Nov 7 2012 18:44:28
    Firmware: J-Link ARM V8 compiled Jul 17 2013 11:24:15
    Hardware: V8.00
    S/N: xxxxxxxx
    Feature(s): GDB
    VTarget = 3.287V
    Info: Found SWD-DP with ID 0x0BB11477
    Info: FPUnit: 4 code (BP) slots and 0 literal slots
    Info: Found Cortex-M0 r0p0, Little endian.
    Found 1 JTAG device, Total IRLen = 4:
    Cortex-M0 identified.
    JTAG speed: 100 kHz
    J-Link>exec device lpc1227
    Info: Device "LPC1227/301" selected (128 KB flash, 8 KB RAM).
    J-Link>h
    R0 = 00000000, R1 = 40020000, R2 = 00000000, R3 = 00000006
    R4 = 00000003, R5 = 00001951, R6 = 12345678, R7 = 00000020
    R8 = 00024080, R9 = 00014080, R10= 00030500, R11= 00818000
    R12= 1FFF1429, R13= 10000808, MSP= 10000808, PSP= 00018144
    R14(LR) = 00000F09, R15(PC) = 00000B22
    XPSR = 61000000, APSR = 60000000, EPSR = 01000000, IPSR = 00000000
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    CycleCnt = 00000000
    J-Link>mem 1688, 9
    00001688 = 01 02 03 04 05 06 07 08 09
    J-Link>w1 1688, 0
    Writing 00 -> 00001688
    J-Link>q
    Info: J-Link: Flash download: Flash programming performed for 1 range (4096 bytes)
    Info: J-Link: Flash download: Total time needed: 1.876s (Prepare: 0.839s, Compare: 0.052s, Program: 0.527s, Verify: 0.052s, Restore: 0.404s)

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