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

You are not logged in.

  • Login
  • Register

Date of registration: Jun 25th 2015

Posts: 25

1

Thursday, May 17th 2018, 6:42pm

J-Link script compiler or interpreter errors

Hello,

for trying to get the FCR4 scripts working with J-Link software V632c, i found that the code is compiled or interpreted wrong.
It can observed that when using function results directly, garbage is returned. Workaround seem to be using temporary variables for the results.

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
int TestFunc(void)
{
  int result;

  result  = 0;

//Report1("      TestFunc: ", result);

  return result;
}


void CallEvalFunc1(void)
{
  int temp;

  Report("  CallEvalFunc1: entry");

  temp = TestFunc();

  if (temp != 0)
  {
    Report1("    ***if (temp != 0)***", temp);
    SYS_Sleep(750);
  }
  else
  {
    Report("    else.1");
  }

  Report("  CallEvalFunc1: exit");
}

void CallEvalFunc2(void)
{
  Report("  CallEvalFunc2: entry");

  if (TestFunc() != 0)
  {
    Report("    ***if (TestFunc() != 0)***");
    SYS_Sleep(750);
  }
  else
  {
    Report("    else.2");
  }

  Report("  CallEvalFunc2: exit");
}

void CallEvalFunc3(void)
{
  Report("  CallEvalFunc3: entry");

  if (0 != TestFunc())
  {
    Report("    ***if (0 != TestFunc())***");
    SYS_Sleep(750);
  }
  else
  {
    Report("    else.3");
  }

  Report("  CallEvalFunc3: exit");
}

void CallEvalFunc4(void)
{
  int temp;

  Report("  CallEvalFunc4: entry");

  temp = TestFunc();
  Report1("    a) TestFunc() temp:   ", temp);
  Report1("    b) TestFunc() direct: ", TestFunc());

  temp = TestFunc();
  Report1("    a) TestFunc() temp:   ", temp);
  Report1("    b) TestFunc() direct: ", TestFunc());

  Report("  CallEvalFunc4: exit");
}

void ResetTarget(void)
{
  Report("ResetTarget() from JLinkScript is executed");
}

void InitTarget(void)
{
  Report("InitTarget: extry");
  CallEvalFunc1();
  CallEvalFunc2();
  CallEvalFunc3();
  CallEvalFunc4();
  Report("InitTarget: exit");
}


output on V612i is:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
InitTarget: extry
  CallEvalFunc1: entry
    else.1
  CallEvalFunc1: exit
  CallEvalFunc2: entry
    else.2
  CallEvalFunc2: exit
  CallEvalFunc3: entry
    else.3
  CallEvalFunc3: exit
  CallEvalFunc4: entry
    a) TestFunc() temp:   0x00000000
    b) TestFunc() direct: 0x00000000
    a) TestFunc() temp:   0x00000000
    b) TestFunc() direct: 0x00000000
  CallEvalFunc4: exit
InitTarget: exit


output on V632c is:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
InitTarget: extry
  CallEvalFunc1: entry
    else.1
  CallEvalFunc1: exit
  CallEvalFunc2: entry
    ***if (TestFunc() != 0)***
  CallEvalFunc2: exit
  CallEvalFunc3: entry
    else.3
  CallEvalFunc3: exit
  CallEvalFunc4: entry
    a) TestFunc() temp:   0x00000000
    b) TestFunc() direct: 0x00000139
    a) TestFunc() temp:   0x00000000
    b) TestFunc() direct: 0x00000139
  CallEvalFunc4: exit
InitTarget: exit

This post has been edited 2 times, last edit by "Veit_Kannegieser" (May 17th 2018, 6:46pm)