Tuesday, May 22nd 2018, 11:42pm UTC+2

You are not logged in.

  • Login
  • Register

Date of registration: Jun 25th 2015

Posts: 25

1

Wednesday, May 16th 2018, 3:28pm

J-Link scripts for Cypress FCR4 no longer work

For the __int64 removal
[SOLVED] Error while compiling J-Link script file,
the *.JlinkScript files for FCR4 and others have been changed.

example:
JLink_V612i\Samples\JFlash\ProjectFiles\Spansion\MB9DF125.JLinkScript

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
unsigned int _WriteAPDPReg(unsigned int u32RegIndex, unsigned int u32Data)
{
    unsigned __int64 u64Value;        // We need 35 bits: 32 data, 2 bit addr, 1 bit RnW
    unsigned int u32BitPosData;

    // Write 35 bits (32 bits data, 2 bits addr, 1 bit RnW)
    u64Value = 0; // Bit0 == 0 indicates write access
    u64Value |= (u32RegIndex << 1);
    u64Value |= (u32Data << 3);
    u32BitPosData = JTAG_StoreDR(u64Value, 35); // Updates Data Register scan chain
    JTAG_WriteClocks(1); // Transition from "Update-DR" to "Run-Test/Idle" state of Debug TAP
    return u32BitPosData;
}


JLink_V632c\Samples\JFlash\ProjectFiles\Spansion\MB9DF125.JLinkScript

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int _StoreWriteAPDPReg(unsigned int RegIndex, U32 Data) {
  U32 v;
  int BitPos;
  //
  // Write 35 bits (32 bits data, 2 bits addr, 1 bit RnW)
  //
  v = 0;   // 0 indicates write access
  v |= (RegIndex << 1);
  JLINK_JTAG_StartDR();
  BitPos = JLINK_JTAG_WriteDRCont(v, 3);
  v = Data;
  JLINK_JTAG_WriteDREnd(v, 32);
  JTAG_StoreClocks(8);
  return BitPos;
}


however, this make the script no longer working.

case 6.12i:

--- FSEU script --- OK: Debug port powered up
...
--- FSEU script --- MCU reset
--- FSEU script --- OK: ARM JTAG-DP detected (JTAG IDCODE: 0x4ba00477)
--- FSEU script --- OK: SCCFG_STAT2_DBGRDY is set, whole MCU can now be accessed (if unsecured))
--- FSEU script --- OK: MCU is unsecured
--- FSEU script --- OK: Core is halted now
--- FSEU script --- OK: Watchdog configured
--- FSEU script --- OK: System RAM wait cycles changed
Found 1 JTAG device, Total IRLen = 4:
#0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
Cortex-R4 identified.
01000000 = 00 F0 20 E3 2D 00 00 EA 00 F0 20 E3 46 4C 42 48
01000010 = 00 00 00 00 00 0E 8B 1C 35 30 34 30 30 30 31 30
01000020 = 30 31 30 34 00 00 00 00 00 00 00 00 00 00 00 00
01000030 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8C


while 6.32c:

--- FSEU script --- ERROR: Could not power up debug port (time-out reached)!
...
Memory zones:
Default Default access mode
AHB-AP (AP0) DMA like acc. in AP0 addr. space
APB-AP (AP1) DMA like acc. in AP1 addr. space
Cortex-R4 identified.
Memory access: CPU temp. halted: https://wiki.segger.com/Memory_accesses#Legacy_stop_mode

**************************
WARNING: CPU could not be halted
**************************

my questions are:
  • can you please try to reproduce?
    there seem to be more Scripts that got changed. I can find similar changes in
    MB9DF125.JLinkScript
    MB9DF126.JLinkScript
    MB9EF126.JLinkScript
    MB9EF226.JLinkScript
    CogentCSB740Board_OMAP3550.JLinkScript
    DigiConnectCoreWi-iMX51.JLinkScript
    ScriptBeagleBoard_OMAP3530.JLinkScript

    problematic also seem to be:

    C/C++ Source code

    1
    2
    3
    4
    
        // Trigger read from RDBUFF register to shift out the wanted read data
        _SelDP();
        u32BitPosData = _StoreTriggerReadAPDPReg(3);
        u32Data = JTAG_GetU32(u32BitPosData + 3);


    in old versions the returned bit position was 13, now it is 0.

  • i tried to replace the helper functions to JLINK_CORESIGHT_(Read|Write)(AP|DP):

    C/C++ Source code

    1
    2
    3
    4
    5
    6
    7
    
    unsigned int _ReadViaAhb(unsigned int u32Address)
    {
      JLINK_CORESIGHT_WriteDP(/*2*/JLINK_CORESIGHT_DP_REG_SELECT, 0x00000000); // Bank 0x0 of AHB-AP (0x00) selected
      JLINK_CORESIGHT_WriteAP(/*1*/JLINK_CORESIGHT_AP_REG_ADDR  , u32Address); // Set TAR register of AP
    
      return JLINK_CORESIGHT_ReadAP(/*3*/JLINK_CORESIGHT_AP_REG_DATA); // Read via DRW register of AP
    }


    this seem to help, in some cases it failed. Could be that i am using an car dashbord instead of eval board.

  • i could not find any reference in UM8001.pdf to 'defines' of the form:

    C/C++ Source code

    1
    2
    3
    
    /* Registers */
    __constant U32 FP_CTRL_ADDR     = 0xE0002000;
    __constant U32 FP_COMP0_ADDR    = 0xE0002008;


    are they going to stay?

  • in one case (ONSemiconductor_RSL10.JLinkScript) there seem to existed global variables?

    C/C++ Source code

    1
    2
    3
    4
    
    /* Global variables */
    U32 fp_ctrl_old;  /* Used to restore previous fp_ctrl value */
    U32 fp_comp0_old; /* Used to restore previous fp_comp0 value */
    U32 entry_point;  /* Stores application's entry point and is set by ResetCatchSet */


    i guess that is obsolete?

  • UM8001.pdf descriptions for JLINK_JTAG_WriteDR*()
    6.12.2.29 JLINK_JTAG_WriteDRCont()
    6.12.2.30 JLINK_JTAG_WriteDREnd()
    are very similar. An example would help here, especialy for the usage of the returned bit position.

  • mostly seen with IAR: tight while loops in scripts seem to cause 'out of memory' errors in scripts.
    i have the impression that adding "SYS_Sleep(10);" to the loop body removes these problems.



The " AHB-AP (AP0) DMA like acc. in AP0 addr. space" lines look promising for the usage of RTT/SystemView.
Veit_Kannegieser has attached the following files: