Skip to content
Snippets Groups Projects
Commit cab6f0c1 authored by Guillaume Endignoux's avatar Guillaume Endignoux
Browse files

Add a comma_separated function to avoid duplicated code.

parent 5951e039
No related branches found
No related tags found
No related merge requests found
...@@ -148,15 +148,19 @@ build_app_padding () { ...@@ -148,15 +148,19 @@ build_app_padding () {
) | xxd -p -r > "${tab_folder}/padding.bin" ) | xxd -p -r > "${tab_folder}/padding.bin"
} }
build_app () { comma_separated () {
# Flatten the array # Flatten the array
# This is equivalent to the following python snippet: ' '.join(arr).replace(' ', ',') # This is equivalent to the following python snippet: ' '.join(arr).replace(' ', ',')
local feature_list=$(IFS=$'\n'; echo "$@") local list=$(IFS=$'\n'; echo "$@")
if [ "X${feature_list}" != "X" ] if [ "X${list}" != "X" ]
then then
feature_list="${feature_list// /,}" feature_list="${list// /,}"
fi fi
echo ${list}
}
build_app () {
local feature_list="$(comma_separated $@)"
cargo build \ cargo build \
--release \ --release \
--target=thumbv7em-none-eabi \ --target=thumbv7em-none-eabi \
...@@ -176,14 +180,7 @@ build_app () { ...@@ -176,14 +180,7 @@ build_app () {
} }
build_crypto_bench () { build_crypto_bench () {
# Flatten the array local feature_list="$(comma_separated $@)"
# 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 \ cargo build \
--release \ --release \
--target=thumbv7em-none-eabi \ --target=thumbv7em-none-eabi \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment