Skip to content

Commit

Permalink
build: use named arguments for gen_mcu.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
paradajz committed Oct 16, 2023
1 parent 51e7f13 commit 313af03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
23 changes: 18 additions & 5 deletions scripts/gen/gen_mcu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@
# This script is used to provide additional project-specific
# configuration on top of base configuration if required.

for arg in "$@"; do
case "$arg" in
--mcu=*)
mcu=${arg#--mcu=}
;;

--gen-dir=*)
gen_dir=${arg#--gen-dir=}
;;

--extClockMhz=*)
extClockMhz=${arg#--extClockMhz=}
;;
esac
done

script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
mcu=$1
core_yaml_file=$(make --no-print-directory -C "$script_dir"/../../modules/core MCU="$mcu" print-MCU_YML_FILE)
project_yaml_file=${script_dir}/../../config/mcu/$mcu.yml
gen_dir=$2
extClockMhz=$3
yaml_parser="dasel -n -p yaml --plain -f"
core_yaml_file=$(make --no-print-directory -C "$script_dir"/../../modules/core MCU="$mcu" print-MCU_YML_FILE)
out_header="$gen_dir"/MCU.h
out_cmakelists="$gen_dir"/CMakeLists.txt
project_yaml_file=${script_dir}/../../config/mcu/$mcu.yml
cmake_mcu_defines_var=PROJECT_MCU_DEFINES
cmake_usb_defines_var=PROJECT_USB_DEFINES

Expand Down
5 changes: 4 additions & 1 deletion scripts/gen/gen_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ cmake_defines_var=PROJECT_TARGET_DEFINES

if [[ ! -d $mcu_gen_dir ]]
then
if ! "$script_dir"/gen_mcu.sh "$mcu" "$mcu_gen_dir" "$extClockMhz"
if ! "$script_dir"/gen_mcu.sh \
--mcu="$mcu" \
--gen-dir="$mcu_gen_dir" \
--extClockMhz="$extClockMhz"
then
exit 1
fi
Expand Down

0 comments on commit 313af03

Please sign in to comment.