Blob Blame History Raw
#!/bin/bash -e

CMSIS_VERSION=9fe411cef1cef5de58e5957b89760759de44e393
CMSIS_SVD_VERSION=d9b58694cef35b39ddf61c07ef7e6347d6ec3cbd

if [ -e "cmsis-${CMSIS_VERSION}-clean.tar.xz" ]; then
echo "Not downloading cmsis-${CMSIS_VERSION}-clean.tar.xz again!"
else
# The license for this tarball is complicated, but the headers are under a
# simple BSD license, so we only package them.
wget -nc https://github.com/ARM-software/CMSIS/archive/${CMSIS_VERSION}/cmsis-${CMSIS_VERSION}.tar.gz
tar xf cmsis-${CMSIS_VERSION}.tar.gz
tar cJf cmsis-${CMSIS_VERSION}-clean.tar.xz \
    CMSIS-${CMSIS_VERSION}/README.md \
    CMSIS-${CMSIS_VERSION}/CMSIS/Include/
rm -r CMSIS-${CMSIS_VERSION}/
fi

if [ -e "cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz" ]; then
echo "Not downloading cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz again!"
else
# This is basically a "collection of random stuff" from various vendors, under
# various licenses. Some licenses are non-free and some are actively hostile,
# but we only need a rather small portion under a good license.
#wget https://github.com/posborne/cmsis-svd/archive/${CMSIS_SVD_VERSION}/cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
wget -nc https://github.com/tinygo-org/cmsis-svd/archive/${CMSIS_SVD_VERSION}/cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
tar xf cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
tar cJf cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz \
    cmsis-svd-${CMSIS_SVD_VERSION}/data/Atmel/ \
    cmsis-svd-${CMSIS_SVD_VERSION}/data/Espressif-Community/ \
    cmsis-svd-${CMSIS_SVD_VERSION}/data/Kendryte-Community/ \
    cmsis-svd-${CMSIS_SVD_VERSION}/data/SiFive-Community/ \
    cmsis-svd-${CMSIS_SVD_VERSION}/data/NXP/M* \
    # This has a weird license, so we cannot include it.
    # cmsis-svd-${CMSIS_SVD_VERSION}/data/STMicro/
rm -r cmsis-svd-${CMSIS_SVD_VERSION}/
fi