Revision 6886c3b6

View differences:

.gitmodules
1
[submodule "Host/stm32flash"]
2
	path = Host/stm32flash
3
	url = https://git.code.sf.net/p/stm32flash/code
Host/stm32flash
1
Subproject commit 6b6b6e5f5c2870a8ea9bc69d9073a8b6b12165ef
Target/Demo/flash.mk
1
STM32FLASH = stm32flash
1
STM32FLASH := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))../../Host/stm32flash/bin/stm32flash
2 2
ifeq ($(OS),Windows_NT)
3 3
	STM32FLASH_PORT ?= COM5
4 4
else
setup.sh
57 57
  printf "\n"
58 58
  if [[ -z $USER_INPUT || $USER_INPUT == "no_info" ]]; then
59 59
    printf "Please select one of the following actions:\n"
60
    printf "    [F] - stm32flash flashing tool setup\n"
60 61
    printf "    [S] - SerialBoot flashing tool setup\n"
61 62
    printf "    [Q] - setup QtCreator projects\n"
62 63
    printf "    [E] - exit this setup\n"
63 64

  
64
    while [[ ! $USER_INPUT =~ ^[SsQqEe]$ ]]; do
65
    while [[ ! $USER_INPUT =~ ^[FfSsQqEe]$ ]]; do
65 66
      read -p "your selection: " -n 1 -e USER_INPUT
66
      if [[ ! $USER_INPUT =~ ^[SsQqEe]$ ]]; then
67
      if [[ ! $USER_INPUT =~ ^[FfSsQqEe]$ ]]; then
67 68
        printf "[%s] is no valid action. \n" $USER_INPUT
68 69
      fi
69 70
    done
......
76 77
  # action selection
77 78
  case $USER_INPUT in
78 79

  
80
    # stm32flash setup
81
    F|f)
82
    # initialize submodule
83
    git submodule update --init $(dirname ${BASH_SOURCE[0]})/Host/stm32flash/
84

  
85
    USER_DIR=${PWD}
86
    cd $(dirname ${BASH_SOURCE[0]})/Host/stm32flash
87
    BUILD_STM32FLASH=true
88

  
89
    # test for existing bonary
90
    if [ -f bin/stm32flash ]; then
91
      printf "WARNING: stm32flash binary already exists.\n"
92
      read -p "Would you like to delete and rebuild it? [Y/n] " -n 1 -i "Y" -e USER_INPUT
93
      if [[ $USER_INPUT =~ ^[Yy]$ ]]; then
94
        BUILD_STM32FLASH=true
95
        rm -rf bin/
96
      elif [[ ! $USER_INPUT =~ ^[YyNn]$ ]]; then
97
        BUILD_STM32FLASH=false
98
        printf "'%s' is no valid selection. Aborting setup.\n" $USER_INPUT
99
      else
100
        BUILD_STM32FLASH=false
101
      fi
102
    fi
103

  
104
    # build the tool if required
105
    if [ $BUILD_STM32FLASH = true ]; then
106
      mkdir bin
107
      make
108
      mv stm32flash bin/
109
      make clean
110
    fi
111

  
112
    cd $USER_DIR
113
    ;;
114

  
79 115
    # SerailBoot setup
80 116
    S|s)
81 117
      # print setup header
......
102 138
        fi
103 139
      fi
104 140

  
105
      # build the tool, if requested
141
      # build the tool if requested
106 142
      if [ $BUILD_SERIALBOOT = true ]; then
107 143
        mkdir build
108 144
        cd build

Also available in: Unified diff