Revision 4cce70a8 ide/QtCreator/QtCreatorSetup.sh

View differences:

ide/QtCreator/QtCreatorSetup.sh
1
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4
# Copyright (C) 2016..2017  Thomas Schöpping et al.                            #
5
#                                                                              #
6
# This program is free software: you can redistribute it and/or modify         #
7
# it under the terms of the GNU General Public License as published by         #
8
# the Free Software Foundation, either version 3 of the License, or            #
9
# (at your option) any later version.                                          #
10
#                                                                              #
11
# This program is distributed in the hope that it will be useful,              #
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
14
# GNU General Public License for more details.                                 #
15
#                                                                              #
16
# You should have received a copy of the GNU General Public License            #
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.        #
18
#                                                                              #
19
# This research/work was supported by the Cluster of Excellence Cognitive      #
20
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is   #
21
# funded by the German Research Foundation (DFG).                              #
22
################################################################################
23

  
1 24
#!/bin/bash
2 25

  
3
###############################################################################
4
###   HELPER FUNCTIONS                                                      ###
5
###############################################################################
26
################################################################################
27
###   HELPER FUNCTIONS                                                       ###
28
################################################################################
6 29

  
7
#------------------------------------------------------------------------------
30
#-------------------------------------------------------------------------------
8 31
# toAbsolutePath $1 [$2]
9 32
#
10 33
# Makes a given path absolute and either echos the result or stores it in the
......
46 69
  unset ORIGIN_PATH
47 70
  unset ABSOLUTE_PATH
48 71
}
49
#------------------------------------------------------------------------------
72
#-------------------------------------------------------------------------------
50 73

  
51
#------------------------------------------------------------------------------
74
#-------------------------------------------------------------------------------
52 75
# getRelativePath $1 $2 [$3]
53 76
#
54 77
# Computes the relative path from one to another location.
......
106 129
  unset RELATIVE_PATH
107 130
  unset UNIQUE_POSTFIX
108 131
}
109
#------------------------------------------------------------------------------
110

  
111
#------------------------------------------------------------------------------
112
# printHelp
113
#
114
# Prnts a help text, how to use this script
115
function printHelp {
116
  echo -e "The following commands are available:"
117
  echo -e ""
118
  echo -e "  help  - Prints this help text."
119
  echo -e "  all   - Creates a project for each of the AMiRo base modules."
120
  echo -e "  clean - Deletes all files created by this script."
121
  echo -e "  wipe  - In addittion to 'clean', the .user files created by QtCreator are deleted as well."
122
  echo -e ""
123
  echo -e "Note: This script does not create a project for the host application."
124
  echo -e "      Since the host application uses CMAKE, QtCreator can import it directly."
125
}
132
#-------------------------------------------------------------------------------
126 133

  
127
#------------------------------------------------------------------------------
128 134

  
129 135

  
130

  
131
###############################################################################
132
###   INTRO                                                                 ###
133
###############################################################################
134

  
135
echo "-------------------------------------------------------------------------------"
136
echo ""
137
echo "Setup to create QtCreator projects"
138
echo "=================================="
139
echo ""
140

  
141 136
###############################################################################
142 137
###   INITIALIZATION                                                        ###
143 138
###############################################################################
144 139

  
145
# the current user dir
146
USER_DIR="${PWD}/"
147

  
148
# the directory containing this script file
149
toAbsolutePath $(dirname ${BASH_SOURCE[0]}) SCRIPT_DIR
150

  
151
# the root directory of the project
152
toAbsolutePath ${SCRIPT_DIR}../../ PROJECT_ROOT_DIR
153

  
154
# the location where to create the QtCreator files
155
QTCREATOR_FILES_PATH=${PROJECT_ROOT_DIR}
140
# ignore case when comparing strings
141
shopt -s nocasematch
156 142

  
157
# the include path for GCC specific headers
158
ARM_NONE_EABI_GCC_BIN=$(which arm-none-eabi-gcc)
159
while [ -L $ARM_NONE_EABI_GCC_BIN ]; do
160
  ARM_NONE_EABI_GCC_BIN=$(readlink $ARM_NONE_EABI_GCC_BIN)
143
# detect what exactly should be done
144
NOINFO_FLAG="NOINFO"
145
HELP_FLAG="HELP"
146
CLEAN_FLAG="CLEAN"
147
WIPE_FLAG="WIPE"
148
LIGHTRING_FLAG="LR"
149
POWERMANAGEMENT_FLAG="PM"
150
DIWHEELDRIVE_FLAG="DWD"
151

  
152
# start with an empty array
153
ARG_LIST=()
154
# try to interpret all given arguments
155
for ARG in "$@"; do
156
  case $ARG in
157
    "no_info")
158
      ARG_LIST+=( "$NOINFO_FLAG" )
159
      ;;
160
    "help")
161
      ARG_LIST+=( "$HELP_FLAG" )
162
      ;;
163
    "clean")
164
      ARG_LIST+=( "$CLEAN_FLAG" )
165
      ;;
166
    "wipe")
167
      ARG_LIST+=( "$WIPE_FLAG" )
168
      ;;
169
    "all")
170
      ARG_LIST+=( "$LIGHTRING_FLAG" "$POWERMANAGEMENT_FLAG" "$DIWHEELDRIVE_FLAG" )
171
      ;;
172
    "LightRing"|"LR")
173
      ARG_LIST+=( "$LIGHTRING_FLAG" )
174
      ;;
175
    "PowerManagement"|"PM")
176
      ARG_LIST+=( "$POWERMANAGEMENT_FLAG" )
177
      ;;
178
    "DiWheelDrive"|"DWD")
179
      ARG_LIST+=( "$DIWHEELDRIVE_FLAG" )
180
      ;;
181
  esac
161 182
done
162
toAbsolutePath "$(dirname $ARM_NONE_EABI_GCC_BIN)/../arm-none-eabi/include/" ARM_NONE_EABI_GCC_INCLUDE_PATH
163

  
164
# a common path for all projects
165
COMMON_SOURCE_INCLUDE_PATH=${PROJECT_ROOT_DIR}Target/Source
166 183

  
167
# the paths to the individual projects
168
POWERMANAGEMENT_PROJECT_ROOT_PATH=${PROJECT_ROOT_DIR}Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot
169
DIWHEELDRIVE_PROJECT_ROOT_PATH=${PROJECT_ROOT_DIR}Target/Demo/ARMCM3_STM32F103_DiWheelDrive_GCC/Boot
170
LIGHTRING_PROJECT_ROOT_PATH=${PROJECT_ROOT_DIR}Target/Demo/ARMCM3_STM32F103_LightRing_GCC/Boot
171

  
172
# some prefixes for the project files
173
POWERMANAGEMENT_PROJECT_PREFIX="PowerManagement"
174
DIWHEELDRIVE_PROJECT_PREFIX="DiWheelDrive"
175
LIGHTRING_PROJECT_PREFIX="LightRing"
176

  
177
# evaluate user arguments
178
COMMAND=""
179
shopt -s nocasematch
180
if [ $# == 0 ]; then
181
  COMMAND="help"
182
else
183
  case $1 in
184
    "help"|"h")
185
      COMMAND="help"
184
# evaluate if a help text shall be printed and which further actions to take
185
PRINT_INFO=true
186
PRINT_HELP=false
187
ACTION_REQUESTED=false
188
for ARG in ${ARG_LIST[@]}; do
189
  case $ARG in
190
    $NOINFO_FLAG)
191
      PRINT_INFO=false
186 192
      ;;
187
    "all"|"a")
188
      COMMAND="all"
193
    $HELP_FLAG)
194
      PRINT_HELP=true
189 195
      ;;
190
    "clean"|"c")
191
      COMMAND="clean"
192
      ;;
193
    "wipe"|"w")
194
      COMMAND="wipe"
196
    $CLEAN_FLAG|$WIPE_FLAG|$LIGHTRING_FLAG|$POWERMANAGEMENT_FLAG|$DIWHEELDRIVE_FLAG)
197
      ACTION_REQUESTED=true
195 198
      ;;
196 199
    *)
197
      COMMAND="unknown"
200
      PRINT_HELP=true
198 201
      ;;
199
   esac
200
fi
201

  
202
###############################################################################
203
###   SETUP                                                                 ###
204
###############################################################################
205

  
206
cd $QTCREATOR_FILES_PATH
207

  
208
case $COMMAND in
209

  
210
  #############################################################################
211
  ###   HELP CASE                                                           ###
212
  #############################################################################
213
  "help")
214
    printHelp
215
    ;;
216

  
217
  #############################################################################
218
  ###   CLEAN / WIPE CASE                                                   ###
219
  #############################################################################
220
  "clean"|"wipe")
221
    echo -n "removing project files..."
222

  
223
    rm ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
224
    rm ${POWERMANAGEMENT_PROJECT_PREFIX}.files
225
    rm ${POWERMANAGEMENT_PROJECT_PREFIX}.config
226
    rm ${POWERMANAGEMENT_PROJECT_PREFIX}.creator
227

  
228
    rm ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
229
    rm ${DIWHEELDRIVE_PROJECT_PREFIX}.files
230
    rm ${DIWHEELDRIVE_PROJECT_PREFIX}.config
231
    rm ${DIWHEELDRIVE_PROJECT_PREFIX}.creator
232

  
233
    rm ${LIGHTRING_PROJECT_PREFIX}.includes
234
    rm ${LIGHTRING_PROJECT_PREFIX}.files
235
    rm ${LIGHTRING_PROJECT_PREFIX}.config
236
    rm ${LIGHTRING_PROJECT_PREFIX}.creator
237

  
238
    echo -e "\tdone"
239

  
240
    if [ $COMMAND == "wipe" ]; then
241
      echo -n "removing .user project files..."
242
      if [ -f ${POWERMANAGEMENT_PROJECT_PREFIX}.creator.user ]; then
243
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.creator.user
244
      fi
245
      if [ -f ${DIWHEELDRIVE_PROJECT_PREFIX}.creator.user ]; then
246
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.creator.user
247
      fi
248
      if [ -f ${LIGHTRING_PROJECT_PREFIX}.creator.user ]; then
249
        rm ${LIGHTRING_PROJECT_PREFIX}.creator.user
250
      fi
251
      echo -e "\tdone"
252
    fi
253
    ;;
254

  
255
  #############################################################################
256
  ###   CREATE CASE                                                         ###
257
  #############################################################################
258
  "all")
259
    ###########################################################################
260
    ###   Create PowerManagement Project                                    ###
261
    ###########################################################################
262
    echo -n "creating project files for ${POWERMANAGEMENT_PROJECT_PREFIX} (STM32F405RGT6)..."
263

  
264
    # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
265
    find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
266
    find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM3_STM32" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
267
    find $POWERMANAGEMENT_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
268

  
269
    # generate a file that specifies all files
270
    echo -n "" > ${POWERMANAGEMENT_PROJECT_PREFIX}.files
271
    for path in `cat ${POWERMANAGEMENT_PROJECT_PREFIX}.includes`; do
272
       find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.files
273
    done
274

  
275
    # generate a default project configuration file if none exists so far
276
    if [ ! -f ${POWERMANAGEMENT_PROJECT_PREFIX}.config ]; then
277
      echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${POWERMANAGEMENT_PROJECT_PREFIX}.config
278
    fi
202
  esac
203
done
279 204

  
280
    # generate a default .creator file if none exists so far
281
    if [ ! -f ${POWERMANAGEMENT_PROJECT_PREFIX}.creator ]; then
282
      echo -e "[general]\n" > ${POWERMANAGEMENT_PROJECT_PREFIX}.creator
283
    fi
205
# print the info prompt
206
if [[ $PRINT_INFO = true ]]; then
207

  
208
  ##############################################################################
209
  ###   PRINT INFO                                                           ###
210
  ##############################################################################
211

  
212
  printf "######################################################################\n"
213
  printf "#                                                                    #\n"
214
  printf "#            Welcome to the AMiRo-BLT QtCreator IDE setup            #\n"
215
  printf "#                                                                    #\n"
216
  printf "######################################################################\n"
217
  printf "#                                                                    #\n"
218
  printf "# Copyright (c) 2016..2017  Thomas Schöpping                         #\n"
219
  printf "#                                                                    #\n"
220
  printf "# This is free software; see the source for copying conditions.      #\n"
221
  printf "# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR  #\n"
222
  printf "# A PARTICULAR PURPOSE. The development of this software was         #\n"
223
  printf "# supported by the Excellence Cluster EXC 227 Cognitive Interaction  #\n"
224
  printf "# Technology. The Excellence Cluster EXC 227 is a grant of the       #\n"
225
  printf "# Deutsche Forschungsgemeinschaft (DFG) in the context of the German #\n"
226
  printf "# Excellence Initiative.                                             #\n"
227
  printf "#                                                                    #\n"
228
  printf "######################################################################\n"
229
  printf "\n"
230
fi
284 231

  
285
    echo -e "\tdone"
232
# print setup header
233
printf "QtCreator projects setup\n"
234
printf "========================\n"
235
printf "\n"
236

  
237
# print the help text
238
if [[ ${#ARG_LIST[@]} == 0 ||
239
      (${#ARG_LIST[@]} == 1 && ${ARG_LIST[0]} == "$NOINFO_FLAG") ||
240
      $PRINT_HELP = true ]]; then
241

  
242
  ##############################################################################
243
  ###   PRINT HELP                                                           ###
244
  ##############################################################################
245

  
246
  printf "The following commands are available:                                 \n"
247
  printf "                                                                      \n"
248
  printf "  help            - Prints this help text.                            \n"
249
  printf "  clean           - Deletes all files created by this script.         \n"
250
  printf "  wipe            - Deletes the .user files, created by QtCreator.    \n"
251
  printf "  LightRing       - Creates a project for the LightRing module.       \n"
252
  printf "  PowerManagement - Creates a project for the PowerManagement module. \n"
253
  printf "  DiWheelDrive    - Creates a project for the DiWheelDrive module.    \n"
254
  printf "  all             - Creates all three projects.                       \n"
255
  printf "                                                                      \n"
256
  printf "Any of these commands can be combined, e.g.                           \n"
257
  printf "  $> ./setup.sh PowerManagement DiWheelDrive                          \n"
258
  printf "will create two projects.                                             \n"
259
  printf "\n"
260
  printf "Note that this script does not create a project for the SerialBoot    \n"
261
  printf "application. Since it uses CMAKE, QtCreator can import it directly.   \n"
286 262

  
287
    ###########################################################################
288
    ###   Create DiWheelDrive Project                                       ###
289
    ###########################################################################
290
    echo -n "creating project files for ${DIWHEELDRIVE_PROJECT_PREFIX} (STM32F103RET6)..."
263
fi
291 264

  
292
    # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
293
    find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
294
    find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM4_STM32" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
295
    find $DIWHEELDRIVE_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
265
# execute action
266
if [ $ACTION_REQUESTED = true ]; then
296 267

  
297
    # generate a file that specifies all files
298
    echo -n "" > ${DIWHEELDRIVE_PROJECT_PREFIX}.files
299
    for path in `cat ${DIWHEELDRIVE_PROJECT_PREFIX}.includes`; do
300
       find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.files
301
    done
268
  ##############################################################################
269
  ###   CONFIGURATION                                                        ###
270
  ##############################################################################
302 271

  
303
    # generate a default project configuration file if none exists so far
304
    if [ ! -f ${DIWHEELDRIVE_PROJECT_PREFIX}.config ]; then
305
      echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${DIWHEELDRIVE_PROJECT_PREFIX}.config
306
    fi
272
  # the current user dir
273
  USER_DIR="${PWD}/"
307 274

  
308
    # generate a default .creator file if none exists so far
309
    if [ ! -f ${DIWHEELDRIVE_PROJECT_PREFIX}.creator ]; then
310
      echo -e "[general]\n" > ${DIWHEELDRIVE_PROJECT_PREFIX}.creator
311
    fi
275
  # the directory containing this script file
276
  toAbsolutePath $(dirname ${BASH_SOURCE[0]}) SCRIPT_DIR
312 277

  
313
    echo -e "\tdone"
278
  # the root directory of the project
279
  toAbsolutePath ${SCRIPT_DIR}../.. PROJECT_ROOT_PATH
314 280

  
315
    ###########################################################################
316
    ###   Create LightRing Project                                          ###
317
    ###########################################################################
318
    echo -n "creating project files for ${LIGHTRING_PROJECT_PREFIX} (STM32F103RET6)..."
281
  # the relative path where all project files shall be generated
282
  read -p "path where to create/delete the project files: " -i "$PROJECT_ROOT_PATH" -e QTCREATOR_FILES_PATH
283
  toAbsolutePath $QTCREATOR_FILES_PATH QTCREATOR_FILES_PATH
319 284

  
320
    # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
321
    find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${LIGHTRING_PROJECT_PREFIX}.includes
322
    find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM4_STM32" >> ${LIGHTRING_PROJECT_PREFIX}.includes
323
    find $LIGHTRING_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${LIGHTRING_PROJECT_PREFIX}.includes
285
  # the include path for GCC specific headers
286
  ARM_NONE_EABI_GCC_BIN=$(which arm-none-eabi-gcc)
287
  while [ -L $ARM_NONE_EABI_GCC_BIN ]; do
288
    ARM_NONE_EABI_GCC_BIN=$(readlink $ARM_NONE_EABI_GCC_BIN)
289
  done
290
  toAbsolutePath "$(dirname $ARM_NONE_EABI_GCC_BIN)/../arm-none-eabi/include/" ARM_NONE_EABI_GCC_INCLUDE_PATH
324 291

  
325
    # generate a file that specifies all files
326
    echo -n "" > ${LIGHTRING_PROJECT_PREFIX}.files
327
    for path in `cat ${LIGHTRING_PROJECT_PREFIX}.includes`; do
328
       find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${LIGHTRING_PROJECT_PREFIX}.files
329
    done
292
  # a common path for all projects
293
  COMMON_SOURCE_INCLUDE_PATH=${PROJECT_ROOT_PATH}Target/Source
330 294

  
331
    # generate a default project configuration file if none exists so far
332
    if [ ! -f ${LIGHTRING_PROJECT_PREFIX}.config ]; then
333
      echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${LIGHTRING_PROJECT_PREFIX}.config
334
    fi
295
  # the paths to the individual projects
296
  POWERMANAGEMENT_PROJECT_ROOT_PATH=${PROJECT_ROOT_PATH}Target/Demo/ARMCM4_STM32F405_Power_Management_GCC/Boot
297
  DIWHEELDRIVE_PROJECT_ROOT_PATH=${PROJECT_ROOT_PATH}Target/Demo/ARMCM3_STM32F103_DiWheelDrive_GCC/Boot
298
  LIGHTRING_PROJECT_ROOT_PATH=${PROJECT_ROOT_PATH}Target/Demo/ARMCM3_STM32F103_LightRing_GCC/Boot
335 299

  
336
    # generate a default .creator file if none exists so far
337
    if [ ! -f ${LIGHTRING_PROJECT_PREFIX}.creator ]; then
338
      echo -e "[general]\n" > ${LIGHTRING_PROJECT_PREFIX}.creator
339
    fi
300
  # the prefix names for the projects to be generated
301
  LIGHTRING_PROJECT_PREFIX="LightRing"
302
  POWERMANAGEMENT_PROJECT_PREFIX="PowerManagement"
303
  DIWHEELDRIVE_PROJECT_PREFIX="DiWheelDrive"
340 304

  
341
    echo -e "\tdone"
305
  printf "\n"
342 306

  
343
    ;;
307
  ##############################################################################
308
  ###   SETUP                                                                ###
309
  ##############################################################################
310

  
311
  # move to the project root directory
312
  cd $QTCREATOR_FILES_PATH
313

  
314
  for ARG in ${ARG_LIST[@]}; do
315
    case $ARG in
344 316

  
345
  #############################################################################
346
  ###   ERROR CASE                                                          ###
347
  #############################################################################
348
  *)
349
    echo "ERROR: invalid argument!"
350
    echo ""
351
    printHelp
352
    ;;
317
      ##########################################################################
318
      ###   CLEAN STEP                                                       ###
319
      ##########################################################################
353 320

  
354
esac
321
      $CLEAN_FLAG)
322
        printf "removing project files..."
355 323

  
356
###############################################################################
357
###   OUTRO                                                                 ###
358
###############################################################################
324
        # remove all files
325
        rm ${LIGHTRING_PROJECT_PREFIX}.includes 2> /dev/null
326
        rm ${LIGHTRING_PROJECT_PREFIX}.files 2> /dev/null
327
        rm ${LIGHTRING_PROJECT_PREFIX}.config 2> /dev/null
328
        rm ${LIGHTRING_PROJECT_PREFIX}.creator 2> /dev/null
329

  
330
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.includes 2> /dev/null
331
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.files 2> /dev/null
332
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.config 2> /dev/null
333
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.creator 2> /dev/null
334

  
335
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.includes 2> /dev/null
336
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.files 2> /dev/null
337
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.config 2> /dev/null
338
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.creator 2> /dev/null
339

  
340
        printf "\tdone\n"
341
        ;;
342

  
343
      ##########################################################################
344
      ###   WIPE STEP                                                        ###
345
      ##########################################################################
346

  
347
      $WIPE_FLAG)
348
        printf "removing .user project files..."
349

  
350
        # remove all user files
351
        rm ${POWERMANAGEMENT_PROJECT_PREFIX}.creator.user 2> /dev/null
352
        rm ${DIWHEELDRIVE_PROJECT_PREFIX}.creator.user 2> /dev/null
353
        rm ${LIGHTRING_PROJECT_PREFIX}.creator.user 2> /dev/null
354

  
355
        printf "\tdone\n"
356
        ;;
357

  
358
      ##########################################################################
359
      ###   LIGHTRING SETUP                                                  ###
360
      ##########################################################################
361

  
362
      $LIGHTRING_FLAG)
363
        printf "creating project files for ${LIGHTRING_PROJECT_PREFIX} (STM32F103RET6)..."
364

  
365
        # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
366
        find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${LIGHTRING_PROJECT_PREFIX}.includes
367
        find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM4_STM32" >> ${LIGHTRING_PROJECT_PREFIX}.includes
368
        find $LIGHTRING_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${LIGHTRING_PROJECT_PREFIX}.includes
369

  
370
        # generate a file that specifies all files
371
        echo -n "" > ${LIGHTRING_PROJECT_PREFIX}.files
372
        for path in `cat ${LIGHTRING_PROJECT_PREFIX}.includes`; do
373
          find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${LIGHTRING_PROJECT_PREFIX}.files
374
        done
375

  
376
        # generate a default project configuration file if none exists so far
377
        if [ ! -f ${LIGHTRING_PROJECT_PREFIX}.config ]; then
378
          echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${LIGHTRING_PROJECT_PREFIX}.config
379
        fi
380

  
381
        # generate a default .creator file if none exists so far
382
        if [ ! -f ${LIGHTRING_PROJECT_PREFIX}.creator ]; then
383
          echo -e "[general]\n" > ${LIGHTRING_PROJECT_PREFIX}.creator
384
        fi
385

  
386
        printf "\tdone\n"
387
        ;;
388

  
389
      ##########################################################################
390
      ###   POWERMANAGEMENT SETUP                                            ###
391
      ##########################################################################
392

  
393
      $POWERMANAGEMENT_FLAG)
394
        printf "creating project files for ${POWERMANAGEMENT_PROJECT_PREFIX} (STM32F405RGT6)..."
395

  
396
        # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
397
        find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
398
        find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM3_STM32" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
399
        find $POWERMANAGEMENT_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.includes
400

  
401
        # generate a file that specifies all files
402
        echo -n "" > ${POWERMANAGEMENT_PROJECT_PREFIX}.files
403
        for path in `cat ${POWERMANAGEMENT_PROJECT_PREFIX}.includes`; do
404
          find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${POWERMANAGEMENT_PROJECT_PREFIX}.files
405
        done
406

  
407
        # generate a default project configuration file if none exists so far
408
        if [ ! -f ${POWERMANAGEMENT_PROJECT_PREFIX}.config ]; then
409
          echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${POWERMANAGEMENT_PROJECT_PREFIX}.config
410
        fi
411

  
412
        # generate a default .creator file if none exists so far
413
        if [ ! -f ${POWERMANAGEMENT_PROJECT_PREFIX}.creator ]; then
414
          echo -e "[general]\n" > ${POWERMANAGEMENT_PROJECT_PREFIX}.creator
415
        fi
416

  
417
        printf "\tdone\n"
418
        ;;
419

  
420
      ##########################################################################
421
      ###   DIWHEELDRIVE SETUP                                               ###
422
      ##########################################################################
423

  
424
      $DIWHEELDRIVE_FLAG)
425
        printf "creating project files for ${DIWHEELDRIVE_PROJECT_PREFIX} (STM32F103RET6)..."
426

  
427
        # generate a file that contains all subdirectories as includes (but ignore hidden and documentation directories)
428
        find $ARM_NONE_EABI_GCC_INCLUDE_PATH -type d > ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
429
        find $COMMON_SOURCE_INCLUDE_PATH -type d | grep -v "ARMCM4_STM32" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
430
        find $DIWHEELDRIVE_PROJECT_ROOT_PATH -type d | grep -v "uip\|fatfs\|ethernetlib\|cmd\|ide" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.includes
431

  
432
        # generate a file that specifies all files
433
        echo -n "" > ${DIWHEELDRIVE_PROJECT_PREFIX}.files
434
        for path in `cat ${DIWHEELDRIVE_PROJECT_PREFIX}.includes`; do
435
          find $path -maxdepth 1 -type f \( ! -iname ".*" \) | grep -v "/arm-none-eabi/" | grep -E ".*(\.h|\.c|\.x)$" >> ${DIWHEELDRIVE_PROJECT_PREFIX}.files
436
        done
437

  
438
        # generate a default project configuration file if none exists so far
439
        if [ ! -f ${DIWHEELDRIVE_PROJECT_PREFIX}.config ]; then
440
          echo -e "// Add predefined macros for your project here. For example:\n// #define YOUR_CONFIGURATION belongs here\n" > ${DIWHEELDRIVE_PROJECT_PREFIX}.config
441
        fi
442

  
443
        # generate a default .creator file if none exists so far
444
        if [ ! -f ${DIWHEELDRIVE_PROJECT_PREFIX}.creator ]; then
445
          echo -e "[general]\n" > ${DIWHEELDRIVE_PROJECT_PREFIX}.creator
446
        fi
447

  
448
        printf "\tdone\n"
449
        ;;
450

  
451
    esac
452
  done
453
fi
359 454

  
360
echo ""
361
echo "-------------------------------------------------------------------------------"
455
################################################################################
456
###   OUTRO                                                                  ###
457
################################################################################
362 458

  

Also available in: Unified diff