Skip to content

Commit

Permalink
Bump gen_pack script
Browse files Browse the repository at this point in the history
Add pack dependency to CMSIS 6
  • Loading branch information
JonatanAntoni committed Dec 18, 2023
1 parent 4cab14b commit deb4089
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 39 deletions.
6 changes: 6 additions & 0 deletions ARM.Cortex_DFP.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
</release>
</releases>

<requirements>
<packages>
<package vendor="ARM" name="CMSIS" version="6.0.0-0"/>
</packages>
</requirements>

<devices>
<!-- ****************************** Cortex-M0 ****************************** -->
<family Dfamily="ARM Cortex M0" Dvendor="ARM:82">
Expand Down
49 changes: 10 additions & 39 deletions gen_pack.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Version: 2.7
# Date: 2023-05-22
# Version: 3.0
# Date: 2023-11-06
# This bash script generates a CMSIS Software Pack:
#

Expand All @@ -9,7 +9,7 @@ set -o pipefail
# Set version of gen pack library
# For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags.
# Use the tag name without the prefix "v", e.g., 0.7.0
REQUIRED_GEN_PACK_LIB="0.8.7"
REQUIRED_GEN_PACK_LIB="0.9.1"

# Set default command line arguments
DEFAULT_ARGS=(-c "v")
Expand Down Expand Up @@ -100,43 +100,14 @@ function postprocess() {

############ DO NOT EDIT BELOW ###########

function install_lib() {
local URL="https://github.com/Open-CMSIS-Pack/gen-pack/archive/refs/tags/v$1.tar.gz"
local STATUS=$(curl -sLI "${URL}" | grep "^HTTP" | tail -n 1 | cut -d' ' -f2 || echo "$((600+$?))")
if [[ $STATUS -ge 400 ]]; then
echo "Wrong/unavailable gen-pack lib version '$1'!" >&2
echo "Check REQUIRED_GEN_PACK_LIB variable." >&2
echo "For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags." >&2
exit 1
fi
echo "Downloading gen-pack lib version '$1' to '$2' ..."
mkdir -p "$2"
curl -L "${URL}" -s | tar -xzf - --strip-components 1 -C "$2" || exit 1
}

function load_lib() {
if [[ -d ${GEN_PACK_LIB} ]]; then
. "${GEN_PACK_LIB}/gen-pack"
return 0
fi
local GLOBAL_LIB="/usr/local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
local USER_LIB="${HOME}/.local/share/gen-pack/${REQUIRED_GEN_PACK_LIB}"
if [[ ! -d "${GLOBAL_LIB}" && ! -d "${USER_LIB}" ]]; then
echo "Required gen_pack lib not found!" >&2
install_lib "${REQUIRED_GEN_PACK_LIB}" "${USER_LIB}"
fi

if [[ -d "${GLOBAL_LIB}" ]]; then
. "${GLOBAL_LIB}/gen-pack"
elif [[ -d "${USER_LIB}" ]]; then
. "${USER_LIB}/gen-pack"
else
echo "Required gen-pack lib is not installed!" >&2
exit 1
fi
}
# Set GEN_PACK_LIB_PATH to use a specific gen-pack library root
# ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB
if [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then
. "${GEN_PACK_LIB}/gen-pack"
else
. <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap")
fi

load_lib
gen_pack "${DEFAULT_ARGS[@]}" "$@"

exit 0

0 comments on commit deb4089

Please sign in to comment.