From 5951e0397fd81f6eded335726f257b4d6e379c94 Mon Sep 17 00:00:00 2001 From: Guillaume Endignoux Date: Thu, 6 Feb 2020 14:15:34 +0100 Subject: [PATCH 1/3] Pass features to crypto bench example. --- deploy.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 974888d..e02fb38 100755 --- a/deploy.sh +++ b/deploy.sh @@ -176,9 +176,18 @@ build_app () { } build_crypto_bench () { + # Flatten the array + # This is equivalent to the following python snippet: ' '.join(arr).replace(' ', ',') + local feature_list=$(IFS=$'\n'; echo "$@") + if [ "X${feature_list}" != "X" ] + then + feature_list="${feature_list// /,}" + fi + cargo build \ --release \ --target=thumbv7em-none-eabi \ + --features="${feature_list}" \ --example crypto_bench mkdir -p "target/tab" @@ -310,7 +319,7 @@ fi if [ "$install_app" = "crypto_bench" ] then - build_crypto_bench + build_crypto_bench "${!enabled_features[@]}" fi if [ "$install_app" != "none" ] From cab6f0c139037a806d7c2e9d3125e27ef1be5fa6 Mon Sep 17 00:00:00 2001 From: Guillaume Endignoux Date: Thu, 6 Feb 2020 15:52:13 +0100 Subject: [PATCH 2/3] Add a comma_separated function to avoid duplicated code. --- deploy.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/deploy.sh b/deploy.sh index e02fb38..ca7a677 100755 --- a/deploy.sh +++ b/deploy.sh @@ -148,15 +148,19 @@ build_app_padding () { ) | xxd -p -r > "${tab_folder}/padding.bin" } -build_app () { +comma_separated () { # Flatten the array # This is equivalent to the following python snippet: ' '.join(arr).replace(' ', ',') - local feature_list=$(IFS=$'\n'; echo "$@") - if [ "X${feature_list}" != "X" ] + local list=$(IFS=$'\n'; echo "$@") + if [ "X${list}" != "X" ] then - feature_list="${feature_list// /,}" + feature_list="${list// /,}" fi + echo ${list} +} +build_app () { + local feature_list="$(comma_separated $@)" cargo build \ --release \ --target=thumbv7em-none-eabi \ @@ -176,14 +180,7 @@ build_app () { } build_crypto_bench () { - # Flatten the array - # This is equivalent to the following python snippet: ' '.join(arr).replace(' ', ',') - local feature_list=$(IFS=$'\n'; echo "$@") - if [ "X${feature_list}" != "X" ] - then - feature_list="${feature_list// /,}" - fi - + local feature_list="$(comma_separated $@)" cargo build \ --release \ --target=thumbv7em-none-eabi \ From f452b2dee2acfd508048ad8026e4b3ecb4641209 Mon Sep 17 00:00:00 2001 From: Guillaume Endignoux Date: Thu, 6 Feb 2020 16:07:41 +0100 Subject: [PATCH 3/3] Fix Bash syntax. --- deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index ca7a677..e86fcd3 100755 --- a/deploy.sh +++ b/deploy.sh @@ -160,7 +160,7 @@ comma_separated () { } build_app () { - local feature_list="$(comma_separated $@)" + local feature_list="$(comma_separated "$@")" cargo build \ --release \ --target=thumbv7em-none-eabi \ @@ -180,7 +180,7 @@ build_app () { } build_crypto_bench () { - local feature_list="$(comma_separated $@)" + local feature_list="$(comma_separated "$@")" cargo build \ --release \ --target=thumbv7em-none-eabi \