cpu/sam0_common: add script to generate Kconfig files for all parts

e.g. Usage:

	./sam0_common/dist/kconfig_gen.sh samd51
This commit is contained in:
Benjamin Valentin 2020-08-18 17:40:01 +02:00 committed by Benjamin Valentin
parent bc904cb396
commit 582da9b233

35
cpu/sam0_common/dist/kconfig_gen.sh vendored Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
#
# Generate Kconfig file for all parts of a sam0 family
# based on the available vendor files.
if [ -z "$1" ]
then
echo "usage: $0 <family>"
exit 1
fi
FAM=$1
FAM_UC=$(echo $FAM | tr a-z A-Z)
VENDOR_FILES=$(dirname $0)/../include/vendor/$FAM/*/$FAM?*.h
{
echo '## CPU Models'
for i in $VENDOR_FILES; do
MODEL_LC=$(basename $i .h)
MODEL_UC=$(echo $MODEL_LC | tr a-z A-Z)
echo "config CPU_MODEL_$MODEL_UC"
echo " bool"
echo " select CPU_FAM_$FAM_UC"
echo ""
done
echo 'config CPU_MODEL'
for i in $VENDOR_FILES; do
MODEL_LC=$(basename $i .h)
MODEL_UC=$(echo $MODEL_LC | tr a-z A-Z)
printf ' default "%s" if CPU_MODEL_%s\n' $MODEL_LC $MODEL_UC
done
} > Kconfig.$FAM