Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
429b0305
authored
Feb 24, 2020
by
lwc-tester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generalizing the flash/test algorithm a bit
parent
c5e65005
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
51 deletions
+43
-51
templates/bluepill/test
+0
-3
templates/esp32/test
+0
-4
templates/f7/test
+17
-13
templates/maixduino/test
+26
-28
templates/uno/test
+0
-3
No files found.
templates/bluepill/test
View file @
429b0305
...
...
@@ -142,9 +142,6 @@ def main(argv):
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
templates/esp32/test
View file @
429b0305
...
...
@@ -78,7 +78,6 @@ def main(argv):
build_dir
=
argv
[
2
]
dut
=
ESP32
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
...
...
@@ -100,9 +99,6 @@ def main(argv):
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
templates/f7/test
View file @
429b0305
...
...
@@ -10,6 +10,7 @@ from test_common import (
DeviceUnderTestAeadUARTP
,
compare_dumps
,
eprint
,
FileMutex
,
run_nist_aead_test_line
,
)
...
...
@@ -31,12 +32,19 @@ def get_serial():
class
F7
(
DeviceUnderTestAeadUARTP
):
RAM_SIZE
=
0x50000
def
__init__
(
self
,
firmware_path
,
ram_pattern_path
):
DeviceUnderTestAeadUARTP
.
__init__
(
self
,
get_serial
())
def
__init__
(
self
,
build_dir
):
DeviceUnderTestAeadUARTP
.
__init__
(
self
)
self
.
uart_device
=
get_serial
()
devname
=
os
.
path
.
basename
(
self
.
uart_device
)
self
.
lock
=
FileMutex
(
'/var/lock/lwc-compare.
%
s.lock'
%
devname
)
self
.
build_dir
=
build_dir
self
.
jlink
=
pylink
.
JLink
()
self
.
jlink
.
open
(
779340002
)
self
.
firmware_path
=
firmware_path
self
.
ram_pattern_path
=
ram_pattern_path
self
.
firmware_path
=
os
.
path
.
join
(
build_dir
,
'build'
,
'f7.bin'
)
self
.
ram_pattern_path
=
os
.
path
.
join
(
build_dir
,
'ram_pattern.bin'
)
def
flash
(
self
):
jlink
=
self
.
jlink
...
...
@@ -61,13 +69,7 @@ def main(argv):
kat
=
list
(
parse_nist_aead_test_vectors
(
argv
[
1
]))
build_dir
=
argv
[
2
]
dut
=
F7
(
os
.
path
.
join
(
build_dir
,
'build'
,
'f7.bin'
),
os
.
path
.
join
(
build_dir
,
'ram_pattern.bin'
))
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x000c
)
tool
.
begin_measurement
()
dut
=
F7
(
build_dir
)
dut
.
flash
()
dut
.
prepare
()
...
...
@@ -76,6 +78,10 @@ def main(argv):
dump_a
=
dut
.
dump_ram
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x000c
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
...
...
@@ -92,8 +98,6 @@ def main(argv):
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
...
...
templates/maixduino/test
View file @
429b0305
...
...
@@ -9,6 +9,7 @@ from test_common import (
LogicMultiplexerTimeMeasurements
,
parse_nist_aead_test_vectors
,
DeviceUnderTestAeadUARTP
,
FileMutex
,
eprint
,
run_nist_aead_test_line
,
)
...
...
@@ -31,19 +32,38 @@ class Maixduino(DeviceUnderTestAeadUARTP):
def
__init__
(
self
,
build_dir
):
DeviceUnderTestAeadUARTP
.
__init__
(
self
)
self
.
uart_device
=
get_serial
()
devname
=
os
.
path
.
basename
(
self
.
uart_device
)
self
.
lock
=
FileMutex
(
'/var/lock/lwc-compare.
%
s.lock'
%
devname
)
self
.
build_dir
=
build_dir
def
reset
(
self
):
self
.
ser
.
setRTS
(
True
)
time
.
sleep
(
0.1
)
self
.
ser
.
setRTS
(
False
)
time
.
sleep
(
0.1
)
self
.
ser
.
setRTS
(
True
)
time
.
sleep
(
1
)
def
prepare
(
self
):
self
.
ser
=
serial
.
Serial
(
self
.
uart_device
,
baudrate
=
1500000
,
timeout
=
5
)
self
.
reset
()
DeviceUnderTestAeadUARTP
.
prepare
(
self
)
def
flash
(
self
):
pipe
=
subprocess
.
PIPE
previous_dir
=
os
.
path
.
abspath
(
os
.
curdir
)
os
.
chdir
(
self
.
build_dir
)
cmd
=
[
'platformio'
,
'run'
,
'-e'
,
'sipeed-maixduino'
]
cmd
.
extend
([
'--target'
,
'upload'
])
cmd
.
extend
([
'--upload-port'
,
get_serial
()])
cmd
.
extend
([
'--upload-port'
,
get_serial
()])
cmd
.
extend
([
'--upload-port'
,
self
.
uart_device
])
p
=
subprocess
.
Popen
(
cmd
,
stdout
=
sys
.
stderr
,
stdin
=
pipe
)
stdout
,
stderr
=
p
.
communicate
(
""
)
assert
p
.
returncode
==
0
eprint
(
"Firmware flashed."
)
os
.
chdir
(
previous_dir
)
...
...
@@ -60,31 +80,15 @@ def main(argv):
build_dir
=
argv
[
2
]
dut
=
Maixduino
(
build_dir
)
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x00c0
)
tool
.
begin_measurement
()
dut
.
flash
()
ser
=
serial
.
Serial
(
get_serial
(),
baudrate
=
1500000
,
timeout
=
5
)
ser
.
setRTS
(
True
)
time
.
sleep
(
0.1
)
ser
.
setRTS
(
False
)
time
.
sleep
(
0.1
)
ser
.
setRTS
(
True
)
time
.
sleep
(
1
)
dut
.
ser
=
ser
dut
.
prepare
()
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
try
:
tool
=
LogicMultiplexerTimeMeasurements
(
0x00c0
)
tool
.
begin_measurement
()
for
i
,
m
,
ad
,
k
,
npub
,
c
in
kat
:
tool
.
arm
()
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
...
...
@@ -96,12 +100,6 @@ def main(argv):
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
if
__name__
==
"__main__"
:
...
...
templates/uno/test
View file @
429b0305
...
...
@@ -98,9 +98,6 @@ def main(argv):
finally
:
tool
.
end_measurement
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment