[SOLVED] Memory zone/background memory access

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

  • [SOLVED] Memory zone/background memory access

    Hello,

    i am trying to get RTT working with our devices, which have Cortex-A9 and Cortex-R4 based controllers on them again.

    jlink.exe shows

    Source Code

    1. Memory zones:
    2. [0]: Default (Default access mode)
    3. [1]: AHB-AP (AP0) (DMA like acc. in AP0 addr. space)
    4. [2]: APB-AP (AP1) (DMA like acc. in AP1 addr. space)

    for both.

    Questions:

    1) are the "zone"s of jlink.exe memory commands that zones?, if yes, how could the be used?

    for example

    Source Code

    1. J-Link>mem 0xD0200000,10
    2. D0200000 = AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA

    but trying to use a zone

    Source Code

    1. J-Link>mem 0:0xD0200000,10
    2. Could not read memory.
    3. J-Link>mem Default:0xD0200000,10
    4. D0200000 = AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
    5. J-Link>mem AP0:0xD0200000,10
    6. Could not read memory.
    7. J-Link>mem AHB-AP:0xD0200000,10
    8. Could not read memory.
    Display All

    fails for the interesting cases. What is the correct syntax here? And examle in the manual would be nice too.

    2) How to use background access?

    Source Code

    1. J-Link>exec CORESIGHT_SetIndexAHBAPToUse = 1
    2. J-Link>exec CORESIGHT_SetIndexAPBAPToUse = 2
    3. J-Link>go
    4. J-Link>mem Default:0xD0200000,10
    5. Memory access: CPU temp. halted: https://wiki.segger.com/Memory_accesses#Stop_mode
    6. D0200000 = AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
    and not one of the stop modes?
  • Hello,

    any ideas?

    With question 1 i meant J-Link Manual (UM08001) V6.42f


    UM08001_JLink.pdf V6.42f wrote:


    3.2.1.22 mem
    The command reads memory from the target system. If necessary, the target CPU is halted
    in order to read memory.
    Syntax
    mem [<Zone>:]<Addr>, <NumBytes> (hex)
    Parameter Meaning
    Zone Name of memory zone to access.
    Addr Start address.
    Numbytes Number of bytes to read. Maximum is 0x100000 .
    Example
    mem 0, 100
    The word "zone" is only used in chapters
    3.2.1.22 to 3.2.1.51.
    No Example uses zone.
  • Hello,

    Thank you for your inquiry.
    The memory zones are not properly documented currently.
    You can find the names of the mem zones when connecting to your target with J-Link Commander. Attached you can find an example output for a Cortex-A7 I tested with.

    To use another zone you need to specify the <Zone> name. In my example the Zone names are as follows:
    • Default
    • APB-AP (AP0)
    • AHB-AB (AP1)
    • AHB-AB (AP2)
    So an example mem callder would like as follows:


    Source Code

    1. mem AHB-AP (AP1):<Addr>, <NumBytes>
    Does this work for you as well?
    We will improve documentation accordingly.
    Sorry for any inconveniences caused.

    Veit_Kannegieser wrote:

    How to use background access?
    Neither Cortex-R nor Cortex-A do have background access capabilities:
    wiki.segger.com/Memory_accesses#Stop_mode

    Best regards,
    Nino
    Images
    • Capture.PNG

      4.88 kB, 479×202, viewed 484 times
    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,

    thank you for the examples.

    Source Code

    1. J-Link>mem AHB-AP (AP0):0x1000000, 0x10
    2. 01000000 = 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48
    3. J-Link>mem APB-AP (AP1):0x0000000, 0x10
    4. 00000000 = 03 10 00 00 03 20 00 00 03 30 00 00 03 40 00 00
    5. J-Link>mem Default:0x1000000, 0x10
    6. 01000000 = 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48


    the zones work nicely.

    For the background memory access, i like to hint for a contradicting wiki link:
    wiki.segger.com/RTT

    I have measured background memory access. once i used an Ultra+ V1.2 (yes i know), and a Ultra+ V4.4.
    Enabled a periodic CAN message, and measured cylce time in CANoe.
    The script is

    Source Code

    1. log _fcr4.log
    2. connect
    3. h
    4. g
    5. Sleep 5000
    6. mem AHB-AP (AP0):0x1000000, 0x40000
    7. Sleep 5000
    8. mem Default:0x1000000, 0x40000
    9. q
    so connect (includes a reset),
    wait 5 seconds
    read 256 KiB Flash using AHB
    wait 5 seconds
    read 256 KiB Flash using "normal" way

    from the log files
    Ultra+ V1.2
    T052C 007:048 JLINK_ReadMemZonedEx(Zone AHB-AP (AP0), 0x01000000, 0x00040000 bytes, Flags = 0x00000000...)-- failed returns -262 (0xFFFFFEFA) (2323ms, 4368ms total)
    T052C 014:372 JLINK_ReadMemZonedEx(Zone Default, 0x01000000, 0x00040000 bytes, Flags = 0x00000000...) -- CPU_ReadMem(262144 bytes @ 0x01000000) - Data: 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48 ... returns 262144 (0x00040000) (0316ms, 4684ms total)

    Ultra+ V4.4
    T04A4 006:340 JLINK_ReadMemZonedEx(Zone AHB-AP (AP0), 0x01000000, 0x00040000 bytes, Flags = 0x00000000...) -- CPU_ReadMem(262144 bytes @ 0x01000000) - Data: 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48 ... returns 262144 (0x00040000) (0281ms, 1618ms total)
    T04A4 017:121 JLINK_ReadMemZonedEx(Zone Default, 0x01000000, 0x00040000 bytes, Flags = 0x00000000...) -- CPU_ReadMem(262144 bytes @ 0x01000000) - Data: 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48 ... returns 262144 (0x00040000) (0189ms, 1807ms total)

    So while Zone AHB-AP (AP0) access is slower, it is completely invisible in the graph.
    Also newer Ultra+ hardware is faster.
    Images
    • background_access.png

      89.57 kB, 1,688×1,030, viewed 447 times
  • This is solved now.

    For the Cortex-A9 (Fujitsu/Socionext Emerald-L), the support for Japan confirmed that AHB-AP does not work, only Triton an later will do it correctly.

    For the Cortex-R4 (Fujitsu/Spansion/Cypress FCR4), problem was that the jlinkscript was developed before RTT was in mind.

    adding a ConfigTargetSettings function

    C Source Code

    1. int ConfigTargetSettings(void)
    2. {
    3. Report("--- FCR4 script --- ConfigTargetSettings - Setting up AP map");
    4. CORESIGHT_AddAP(0, CORESIGHT_AHB_AP );
    5. CORESIGHT_AddAP(1, CORESIGHT_APB_AP );
    6. CORESIGHT_AddAP(2, CORESIGHT_JTAG_AP);
    7. CORESIGHT_IndexAHBAPToUse = 0;
    8. CORESIGHT_IndexAPBAPToUse = 1;
    9. return 0;
    10. }
    Display All

    and calling

    JLINK_ExecCommand("SetRTTSearchRanges 0x00000000 0x10000, 0x01A00000 0xC000, 0xB0638000 0x4000");
    (for MB9DF125)
    or
    JLINK_ExecCommand(" 0x00000000 0x20000, 0x01A00000 0x10000, 0xB0638000 0x4000");

    (for MB9EF226)

    makes RTT work nice, finding the _SEGGER_RTT variable in TCM RAM, System RAM, and Retention RAM.
    Files
    • FCR4.jlinkscript

      (42.22 kB, downloaded 444 times, last: )
  • Hello,

    Thank you for keeping us updated.
    I got to correct myself from my last post. Background mode *is* sometimes availabe on Cortex-A/R but it is implementation defined.
    The linked Wiki articles will be updated accordingly.
    Sorry for any inconvenience caused.


    Veit_Kannegieser wrote:

    For the Cortex-A9 (Fujitsu/Socionext Emerald-L), the support for Japan confirmed that AHB-AP does not work, only Triton an later will do it correctly.

    For the Cortex-R4 (Fujitsu/Spansion/Cypress FCR4), problem was that the jlinkscript was developed before RTT was in mind.
    Ok great, thanks for sharing.

    This thread will be closed now for archiving reasons.

    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.