JLink-RDI Script Files if-then-else code

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

  • JLink-RDI Script Files if-then-else code

    I'm trying to use a jlink JTAG unit which received recently.

    The atmel processors, specifically the ARM9 I'm using have a configuration bit that toggles with each write.
    I need a method to read address 0x0 take the read value and store it, write something different to address 0x0 to see if I need to remap memory. If I'm successful writing address 0x0 nothing needs to be done, write the original value back to 0x0.
    The following script is for another probe vendor, is there a way to do this with the JLink-RDI script language.

    //==========================================================================
    // CheckNoRemap()
    //==========================================================================
    /* Remap:

    On Reset After remap
    0x0000_0000 Internal ROM -> REMAP -> 0x0000_0000 Internal SRAM
    0x0030_0000 Internal SRAM 0x0040_0000 Internal ROM

    //--------------------------------------------------------------------------
    // 0xFFFFee00 (AT91C_MATRIX_MCFG) = Bus Matrix Master Configuration Register
    //--------------------------------------------------------------------------
    • RCBx[x = 4..0]: Remap Command Bit for AHB Master x
    0: No effect
    1: This Command Bit acts on a toggle basis: writing a 1 alternatively cancels and restores the
    remapping of addressed slaves from master x.
    */

    $i = * 0x00000000
    $mem = $i
    $i++
    memwrite 4 0x00000000 $i

    $pt = * 0x00000000

    if($i == $pt) {
    echo "---------------------- The Remap is done ---------------------------"
    memwrite 4 0x00000000 $mem
    } else {
    echo "--------------------- Toggle the RESET map -------------------------"
    memwrite 4 0xFFFFee00 0x00000003
    }


    Is there any way to do a conditional statement in the RDI script to read-modify and compare to see if the mapping of address 0 is processor SRAM? The processors bit to control this is a toggle function and you got to test before you set it.

    Thanks.

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

  • Hello caltick,

    Currently it is not possible to perform conditional branches in RDI init files.

    Apart from that, it should not be necessary to check the memory mapping because
    if you perform a reset before performing the init steps, the CPU should be in a known state.

    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.