[SOLVED] J-Link Commander to read word of memory

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

  • [SOLVED] J-Link Commander to read word of memory

    I have a need to programmatically read the contents of a specific word in memory on my processor. Using J-Mem, I can see the contents of the word, but there doesn't appear to be any way to automate this tool. After doing some more digging, it seems that J-Link Commander (the command line version of j-link with a script file) should be able to do what I need. The problem is that there doesn't appear to be much information on the format of this script file or how one would go about scripting a means of reading a word in memory. Can someone please point me to the right documentation? Or better still, give an example?

    Thanks in advance.

    [EDIT] P.S. - the processor in question is an Atmel AT91SAM7Sxxx

    The post was edited 2 times, last by gri6507 ().

  • After hacking away at the tool, I figured out how to do this. It is actually quite simple. All I had to do was create a short script - the only problem is that I cannot find any documentation on Segger's J-Link which details how to do it. So, for the benefit of everyone else, I'll do my best to describe what I did here. Below is my script to automate the reading of the ChipID register (accessible as a word in the processor's memory space) from the SAM7S256 processor

    Source Code

    1. speed 500
    2. mem 0xfffff240 4
    3. q


    The script is comprised of three commands:
    • Set the JTAG speed to 500kHz (limited by my setup)
    • Read 4 bytes from memory location 0xFFFF F240, which corresponds to 0xFFFF F200 for the base address of DBGU registers plus 0x0040 for the ChipID register offset.
    • Quit the program
    Then, to execute this script, simply start a CMD terminal and run JLink.exe c:\path\to\script.txt. Using this method, you can actually automate a lot more than just reading the value of some register. To see the possibilities, simply run JLink.exe without any arguments and type "?" (the question mark character) on the prompt to see your choices.
  • Hi all,

    indeed we should add some short section to the J-Link User Guide which
    explains how to write and use command-scripts for J-Link commander.

    Writing and using command script files is quite simple:
    As gri6507 already wrote, to use the command-script-file, simply call J-Link commander in this way:
    JLink.exe <CommandScriptFilePath>

    The command script file syntax is the same as in the J-Link commander.
    The parser works on a per-line basis: 1 command per line (same as in J-Link commander).


    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.