struct / union in initializer, RFE #901.
[sdcc.git] / sdcc-extra / historygraphs / execute_benchmark-stm8
blob781f70a56e99a82e38b49bbd14a84dead00046c9
1 #!/bin/bash
2 # Takes a few seconds to execute
3 # STM8AF board from STM8A-Discovery must be attached.
4 # Needs read access to a serial device
5 # Must be able to access the integrated ST-Link/v2.
7 STM8FLASH=/home/philipp/stm8flash/stm8flash
9 if [ $# != 2 ]; then
10 echo "execute_benchmark-stm8: Execute a benchmark on an STM8AF board and report the results line"
11 echo "Wrong number of parameters. Usage: execute_benchmark-stm8 <serial device> <benchmark file>"
12 exit 1
15 if ! command -v $STM8FLASH &> /dev/null; then
16 echo "$STM8FLASH not found!";
17 exit 1
20 # Setup serial device
21 stty --file $1 9600 cooked
23 # Ensure that we don't get any leftover results from an old benchmark still running on the device
24 if ! $STM8FLASH -c stlinkv2 -p stm8af5288 -w hello-stm8/hello.ihx &> /dev/null; then
25 echo "FAILED to write hello.ihx to device!"
26 exit 1
28 while read -r line; do
29 if [ "$line" == "Hello, World!" ]; then
30 break
32 done < "$1"
34 # Load benchmark onto the board
35 if ! $STM8FLASH -c stlinkv2 -p stm8af5288 -w "$2"; then
36 echo "FAILED to write benchmark to device!"
37 exit 1
39 while read -r line; do
40 # Whetstone result
41 if [[ "$line" == "Loops:"* ]]; then
42 break
44 # Dhrystone result
45 if [[ "$line" == "Dhrystones per Second"* ]]; then
46 break
48 # Coremark result
49 if [[ "$line" == "Total ticks"* ]]; then
50 break
52 # stdcbench result
53 if [[ "$line" == "stdcbench final score"* ]]; then
54 break
56 done < "$1"
57 echo $line