Skip to content

Commit a4e7ebe

Browse files
committed
Add burst test
Add test for writes to same address. Apparently consecutive 64-bit writes to the same address can turn into burst writes. From: aolofsson#37 Andreas: > Remembered that we have a long forgotten mode in the epiphany chip elink > (not impemented in the fpga elink) that creates bursts when you write > doubles to the same address. (F**K!) > So the writes were likely coming in as bursts. > Looks like the mailbox works fine when you write in "int"s (I tested it on > the board with consecutive) > (see "mailbox_test" in elink/sw0) Signed-off-by: Ola Jeppsson <[email protected]>
1 parent 1f42630 commit a4e7ebe

File tree

7 files changed

+459
-0
lines changed

7 files changed

+459
-0
lines changed

elink/sw/burst-test/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Test burst writes
2+
3+
https://github.com/parallella/oh/issues/37
4+
5+
> Remembered that we have a long forgotten mode in the epiphany chip elink
6+
> (not impemented in the fpga elink) that creates bursts when you write
7+
> doubles to the same address. (F**K!)
8+
> So the writes were likely coming in as bursts.
9+
> Looks like the mailbox works fine when you write in "int"s (I tested it on
10+
> the board with consecutive)
11+
> (see "mailbox_test" in elink/sw0)
12+

elink/sw/burst-test/build.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
ESDK=${EPIPHANY_HOME}
6+
ELIBS="-L ${ESDK}/tools/host/lib"
7+
EINCS="-I ${ESDK}/tools/host/include"
8+
ELDF=${ESDK}/bsps/current/internal.ldf
9+
10+
# Create the binaries directory
11+
mkdir -p bin/
12+
13+
if [ -z "${CROSS_COMPILE+xxx}" ]; then
14+
case $(uname -p) in
15+
arm*)
16+
# Use native arm compiler (no cross prefix)
17+
CROSS_COMPILE=
18+
;;
19+
*)
20+
# Use cross compiler
21+
CROSS_COMPILE="arm-linux-gnueabihf-"
22+
;;
23+
esac
24+
fi
25+
26+
# Build HOST side application
27+
${CROSS_COMPILE}gcc src/main.c -g -o bin/main.elf ${EINCS} ${ELIBS} -le-hal -le-loader -lpthread
28+
29+
# Build DEVICE side program
30+
OPT=3
31+
e-gcc -g -T ${ELDF} -O${OPT} src/emain.c src/etest.S -o bin/emain.elf -le-lib
32+
33+

elink/sw/burst-test/run.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SCRIPT=$(readlink -f "$0")
6+
EXEPATH=$(dirname "$SCRIPT")
7+
8+
9+
cd $EXEPATH/bin
10+
11+
./main.elf
12+

elink/sw/burst-test/src/common.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#define STATUS_ADDR 0x6000
4+
5+
#define NEXPECTED 8
6+
7+
/* External memory */
8+
#define DRAM_RESULT_OFFSET 0x01100000
9+
#define DRAM_RESULT_ADDR 0x8f100000
10+
11+
/* On-chip SRAM */
12+
#define ERAM_RESULT_OFFSET 0x00001000
13+
#define ERAM_RESULT_ADDR 0x80901000
14+
15+
#define EXPECTED_0 0x12345678
16+
#define EXPECTED_1 0xffffffff
17+
#define EXPECTED_2 0xf0f0f0f0
18+
#define EXPECTED_3 0xffff0000
19+
#define EXPECTED_4 0xff00ff00
20+
#define EXPECTED_5 0xaaaaaaaa
21+
#define EXPECTED_6 0x55555555
22+
#define EXPECTED_7 0xa55aa55a
23+

elink/sw/burst-test/src/emain.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <e-lib.h>
2+
#include <stdint.h>
3+
4+
#include "common.h"
5+
6+
extern void test_dram();
7+
extern void test_eram();
8+
9+
int main()
10+
{
11+
volatile uint32_t *status = (uint32_t *) STATUS_ADDR;
12+
13+
test_dram();
14+
test_eram();
15+
16+
/* Tell host we're done */
17+
*status = 1;
18+
}

elink/sw/burst-test/src/etest.S

+216
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
#include "common.h"
2+
3+
/* ANSI concatenation macros. */
4+
5+
#define CONCAT1(a, b) CONCAT2(a, b)
6+
#define CONCAT2(a, b) a ## b
7+
#define STRINGIFY2(a, b) STRINGIFY(a##b)
8+
#define STRINGIFY(a) #a
9+
10+
/* Use the right prefix for global labels. */
11+
12+
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
13+
14+
#define FUNC(X) .type SYM(X),@function
15+
16+
FUNC(test_dram)
17+
.global SYM(test_dram)
18+
.align 3
19+
SYM(test_dram):
20+
mov r20, %low(EXPECTED_0)
21+
movt r20, %high(EXPECTED_0)
22+
mov r21, %low(EXPECTED_1)
23+
movt r21, %high(EXPECTED_1)
24+
mov r22, %low(EXPECTED_2)
25+
movt r22, %high(EXPECTED_2)
26+
mov r23, %low(EXPECTED_3)
27+
movt r23, %high(EXPECTED_3)
28+
mov r24, %low(EXPECTED_4)
29+
movt r24, %high(EXPECTED_4)
30+
mov r25, %low(EXPECTED_5)
31+
movt r25, %high(EXPECTED_5)
32+
mov r26, %low(EXPECTED_6)
33+
movt r26, %high(EXPECTED_6)
34+
mov r27, %low(EXPECTED_7)
35+
movt r27, %high(EXPECTED_7)
36+
37+
mov r30, %low(DRAM_RESULT_ADDR)
38+
movt r30, %high(DRAM_RESULT_ADDR)
39+
40+
# 32-bit writes
41+
42+
# 1 writes
43+
str r20,[r30],+1
44+
45+
# 2 writes
46+
str r20,[r30]
47+
str r21,[r30],+1
48+
49+
# 3 writes
50+
str r20,[r30]
51+
str r21,[r30]
52+
str r22,[r30],+1
53+
54+
# 4 writes
55+
str r20,[r30]
56+
str r21,[r30]
57+
str r22,[r30]
58+
str r23,[r30],+1
59+
60+
# 5 writes
61+
str r20,[r30]
62+
str r21,[r30]
63+
str r22,[r30]
64+
str r23,[r30]
65+
str r24,[r30],+1
66+
67+
# 6 writes
68+
str r20,[r30]
69+
str r21,[r30]
70+
str r22,[r30]
71+
str r23,[r30]
72+
str r24,[r30]
73+
str r25,[r30],+1
74+
75+
# 7 writes
76+
str r20,[r30]
77+
str r21,[r30]
78+
str r22,[r30]
79+
str r23,[r30]
80+
str r24,[r30]
81+
str r25,[r30]
82+
str r26,[r30],+1
83+
84+
# 8 writes
85+
str r20,[r30]
86+
str r21,[r30]
87+
str r22,[r30]
88+
str r23,[r30]
89+
str r24,[r30]
90+
str r25,[r30]
91+
str r26,[r30]
92+
str r27,[r30],+1
93+
94+
;; repeat w/ 64-bit writes
95+
96+
# 1 writes
97+
strd r20,[r30],+1
98+
99+
# 2 writes
100+
strd r20,[r30]
101+
strd r22,[r30],+1
102+
103+
# 3 writes
104+
strd r20,[r30]
105+
strd r22,[r30]
106+
strd r24,[r30],+1
107+
108+
# 4 writes
109+
strd r20,[r30]
110+
strd r22,[r30]
111+
strd r24,[r30]
112+
strd r26,[r30],+1
113+
114+
rts
115+
.size SYM(test_dram), .-SYM(test_dram)
116+
117+
FUNC(test_eram)
118+
.global SYM(test_eram)
119+
.align 3
120+
SYM(test_eram):
121+
mov r20, %low(EXPECTED_0)
122+
movt r20, %high(EXPECTED_0)
123+
mov r21, %low(EXPECTED_1)
124+
movt r21, %high(EXPECTED_1)
125+
mov r22, %low(EXPECTED_2)
126+
movt r22, %high(EXPECTED_2)
127+
mov r23, %low(EXPECTED_3)
128+
movt r23, %high(EXPECTED_3)
129+
mov r24, %low(EXPECTED_4)
130+
movt r24, %high(EXPECTED_4)
131+
mov r25, %low(EXPECTED_5)
132+
movt r25, %high(EXPECTED_5)
133+
mov r26, %low(EXPECTED_6)
134+
movt r26, %high(EXPECTED_6)
135+
mov r27, %low(EXPECTED_7)
136+
movt r27, %high(EXPECTED_7)
137+
138+
mov r30, %low(ERAM_RESULT_ADDR)
139+
movt r30, %high(ERAM_RESULT_ADDR)
140+
141+
# 32-bit writes
142+
143+
# 1 writes
144+
str r20,[r30],+1
145+
146+
# 2 writes
147+
str r20,[r30]
148+
str r21,[r30],+1
149+
150+
# 3 writes
151+
str r20,[r30]
152+
str r21,[r30]
153+
str r22,[r30],+1
154+
155+
# 4 writes
156+
str r20,[r30]
157+
str r21,[r30]
158+
str r22,[r30]
159+
str r23,[r30],+1
160+
161+
# 5 writes
162+
str r20,[r30]
163+
str r21,[r30]
164+
str r22,[r30]
165+
str r23,[r30]
166+
str r24,[r30],+1
167+
168+
# 6 writes
169+
str r20,[r30]
170+
str r21,[r30]
171+
str r22,[r30]
172+
str r23,[r30]
173+
str r24,[r30]
174+
str r25,[r30],+1
175+
176+
# 7 writes
177+
str r20,[r30]
178+
str r21,[r30]
179+
str r22,[r30]
180+
str r23,[r30]
181+
str r24,[r30]
182+
str r25,[r30]
183+
str r26,[r30],+1
184+
185+
# 8 writes
186+
str r20,[r30]
187+
str r21,[r30]
188+
str r22,[r30]
189+
str r23,[r30]
190+
str r24,[r30]
191+
str r25,[r30]
192+
str r26,[r30]
193+
str r27,[r30],+1
194+
195+
;; repeat w/ 64-bit writes
196+
197+
# 1 writes
198+
strd r20,[r30],+1
199+
200+
# 2 writes
201+
strd r20,[r30]
202+
strd r22,[r30],+1
203+
204+
# 3 writes
205+
strd r20,[r30]
206+
strd r22,[r30]
207+
strd r24,[r30],+1
208+
209+
# 4 writes
210+
strd r20,[r30]
211+
strd r22,[r30]
212+
strd r24,[r30]
213+
strd r26,[r30],+1
214+
215+
rts
216+
.size SYM(test_eram), .-SYM(test_eram)

0 commit comments

Comments
 (0)