Created
September 6, 2017 14:20
-
-
Save rpavlik/7e614697fdb35f8017f4af40f0366ec1 to your computer and use it in GitHub Desktop.
STM32F103xB scripts/generate.sh script for xpack/micro-os-plus usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Sample scripts/generate.sh file for use of xPacks on an STM32F103xB, | |
# such as that found on the Nucleo F103RB (only minor changes required for other F1 chips), | |
# using my "unofficial" xPacks of the HAL and CMSIS device code. | |
# Based on a combination of these files: | |
# https://github.com/micro-os-plus/eclipse-demo-projects/blob/master/f4discovery-blinky-micro-os-plus/scripts/generate.sh | |
# https://github.com/micro-os-plus/eclipse-demo-projects/blob/master/f0discovery-blinky-micro-os-plus/scripts/generate.sh | |
# with modifications to use my stm32f1 xpacks. | |
# Ryan Pavlik, September 2017 | |
# See https://www.element14.com/community/message/228318/l/stm32f1-xpacks | |
# for discussion | |
# ----------------------------------------------------------------------------- | |
# Until the xPacks utilities will be functional, use this Bash script | |
# to generate the project folders from the xPacks repository. | |
# ----------------------------------------------------------------------------- | |
# Prefer the environment location XPACKS_REPO_FOLDER, if defined. | |
xpacks_paths_helper_path="${HOME}/Downloads/xpacks-paths.sh" | |
# Check if the helper is present. | |
if [ ! -f "${xpacks_paths_helper_path}" ] | |
then | |
mkdir -p "${HOME}/Downloads" | |
echo "Downloading xpacks-paths.sh..." | |
curl -L https://github.com/xpacks/scripts/raw/master/xpacks-paths.sh -o "${xpacks_paths_helper_path}" | |
fi | |
source "${xpacks_paths_helper_path}" | |
# ----------------------------------------------------------------------------- | |
# Process command line options. | |
do_process_args $@ | |
# Print greeting. | |
do_greet | |
# Check dependencies; clone if not found. | |
do_install_xpack "arm-cmsis" "ilg" "https://github.com/xpacks/arm-cmsis.git" | |
do_install_xpack "micro-os-plus-iii" "ilg" "https://github.com/micro-os-plus/micro-os-plus-iii.git" | |
do_install_xpack "micro-os-plus-iii-cortexm" "ilg" "https://github.com/micro-os-plus/micro-os-plus-iii-cortexm.git" | |
do_install_xpack "stm" "ilg" "https://github.com/xpacks/stm.git" | |
do_install_xpack "stm32f1-cmsis" "ilg" "https://github.com/rpavlik/xpacks-stm32f1-cmsis.git" | |
do_install_xpack "stm32f1-hal" "ilg" "https://github.com/rpavlik/xpacks-stm32f1-hal.git" | |
# Recreate the destination folder. | |
do_remove_dest | |
do_create_dest | |
# Add the 'arm-cmsis' xPack. | |
do_add_arm_cmsis_xpack | |
# Add the 'micro-os-plus-iii' xPack. | |
do_add_micro_os_plus_iii_xpack | |
# Add the 'micro-os-plus-iii-cortexm' xPack. | |
do_add_micro_os_plus_iii_cortexm_xpack | |
# Add the 'stm32f1-cmsis' xPack. | |
do_add_stm32_cmsis_xpack "stm32f103xb" | |
# Add the STM32F1xx CMSIS code from CubeMX. | |
#do_add_stm32_cmsis_cube "stm32f103xb" | |
# Add the 'stm32f1-hal' xpack. | |
do_add_stm32_hal_xpack "f1" | |
# Add the STM32F1xx_HAL_Driver code from CubeMX. | |
#do_add_stm32_hal_cube "f1" | |
# Change file modes to read/only. | |
do_protect | |
# List result. | |
do_list | |
do_done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment