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
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>"
15 if ! command -v $STM8FLASH &> /dev
/null
; then
16 echo "$STM8FLASH not found!";
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-stm
8/hello.ihx
&> /dev
/null
; then
25 echo "FAILED to write hello.ihx to device!"
28 while read -r line
; do
29 if [ "$line" == "Hello, World!" ]; then
34 # Load benchmark onto the board
35 if ! $STM8FLASH -c stlinkv2
-p stm8af5288
-w "$2"; then
36 echo "FAILED to write benchmark to device!"
39 while read -r line
; do
41 if [[ "$line" == "Loops:"* ]]; then
45 if [[ "$line" == "Dhrystones per Second"* ]]; then
49 if [[ "$line" == "Total ticks"* ]]; then
53 if [[ "$line" == "stdcbench final score"* ]]; then