Revision 4cce70a8
Host/Source/SerialBoot/main.c | ||
---|---|---|
209 | 209 |
static void DisplayProgramInfo(void) |
210 | 210 |
{ |
211 | 211 |
printf("---------------------------------------------------------------------------\n"); |
212 |
printf("SerialBoot version 1.00. Performs firmware updates via the serial port\n"); |
|
213 |
printf("for a microcontroller based system that runs the OpenBLT bootloader.\n\n"); |
|
214 |
printf("Copyright (c) by Feaser http://www.feaser.com\n"); |
|
212 |
printf("SerialBoot version 1.00. Performs firmware updates via the serial port \n"); |
|
213 |
printf("for a microcontroller based system that runs the OpenBLT bootloader. \n"); |
|
214 |
printf(" \n"); |
|
215 |
printf("Copyright (c) by Feaser http://www.feaser.com \n"); |
|
215 | 216 |
printf("---------------------------------------------------------------------------\n"); |
216 |
printf("This tool was modified for the 'Autonomous Mini Robot' - AMiRo.\n"); |
|
217 |
printf("Copyright (c) 2016 by Marvin Barther, Thomas Schoepping, and Stefan\n");
|
|
218 |
printf("Herbrechtsmeier.\n");
|
|
219 |
printf("This is free software; see the source for copying conditions. There is NO\n"); |
|
217 |
printf("This tool was modified for the 'Autonomous Mini Robot' - AMiRo. \n");
|
|
218 |
printf("Copyright (c) 2016..2017 Marvin Barther, Thomas Schoepping, and Stefan \n");
|
|
219 |
printf(" Herbrechtsmeier \n");
|
|
220 |
printf("This is free software; see the source for copying conditions. There is NO \n");
|
|
220 | 221 |
printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); |
221 |
printf("The development of this software was supported by the Excellence Cluster\n"); |
|
222 |
printf("The development of this software was supported by the Excellence Cluster \n");
|
|
222 | 223 |
printf("EXC 227 Cognitive Interaction Technology. The Excellence Cluster EXC 227 is\n"); |
223 |
printf("a grant of the Deutsche Forschungsgemeinschaft (DFG) in the context of the\n"); |
|
224 |
printf("German Excellence Initiative.\n"); |
|
224 |
printf("a grant of the Deutsche Forschungsgemeinschaft (DFG) in the context of the \n");
|
|
225 |
printf("German Excellence Initiative. \n");
|
|
225 | 226 |
printf("---------------------------------------------------------------------------\n"); |
226 | 227 |
} /*** end of DisplayProgramInfo ***/ |
227 | 228 |
|
README.txt | ||
---|---|---|
1 |
AMiRo-BLT is the bootloader and flashing toolchain for the base |
|
2 |
version of the Autonomous Mini Robot (AMiRo) [1,2,3]. It is based on
|
|
3 |
OpenBLT developed by Feaser (<http://feaser.com/en/openblt.php>).
|
|
1 |
AMiRo-BLT is the bootloader and flashing toolchain for the base version of the
|
|
2 |
Autonomous Mini Robot (AMiRo) [1,2]. It is based on OpenBLT developed by Feaser
|
|
3 |
(see <http://feaser.com/en/openblt.php>).
|
|
4 | 4 |
|
5 |
Copyright (C) 2016 Thomas Schöpping et al. |
|
5 |
Copyright (C) 2016..2017 Thomas Schöpping et al.
|
|
6 | 6 |
(a complete list of all authors is given below) |
7 | 7 |
|
8 |
For details about the license of this software, please refer to the |
|
9 |
provided file (./Doc/license.html). |
|
8 |
This program is free software: you can redistribute it and/or modify |
|
9 |
it under the terms of the GNU General Public License as published by |
|
10 |
the Free Software Foundation, either version 3 of the License, or (at |
|
11 |
your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, but |
|
14 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
10 | 20 |
|
11 | 21 |
This research/work was supported by the Cluster of Excellence |
12 | 22 |
Cognitive Interaction Technology 'CITEC' (EXC 277) at Bielefeld |
... | ... | |
18 | 28 |
- Marvin Barther |
19 | 29 |
|
20 | 30 |
References: |
21 |
[1] Herbrechtsmeier S., Rückert U., & Sitte J. (2012). "AMiRo - |
|
22 |
Autonomous Mini Robot for Research and Education". In Advances in |
|
23 |
Autonomous Mini Robots (pp. 101-112). Springer Berlin Heidelberg. |
|
24 |
[2] Schöpping T., Korthals T., Herbrechtsmeier S., & Rückert U. |
|
25 |
(2015). "AMiRo: A Mini Robot for Scientific Applications" In |
|
26 |
Advances in Computational Intelligence (pp. 199-205). Springer |
|
27 |
International Publishing. |
|
31 |
[1] Herbrechtsmeier S., Rückert U., & Sitte J. (2012). "AMiRo - Autonomous Mini |
|
32 |
Robot for Research and Education". In Advances in Autonomous Mini Robots |
|
33 |
(pp. 101-112). Springer Berlin Heidelberg. |
|
34 |
[2] Schöpping T., Korthals T., Herbrechtsmeier S., & Rückert U. (2015). "AMiRo: |
|
35 |
A Mini Robot for Scientific Applications" In Advances in Computational |
|
36 |
Intelligence (pp. 199-205). Springer International Publishing. |
|
28 | 37 |
|
29 | 38 |
|
30 | 39 |
|
31 |
##################################################################### |
|
32 |
# # |
|
33 |
# RRRRRRRR EEEEEEEE AAA DDDDDDDD MM MM EEEEEEEE #
|
|
34 |
# RR RR EE AA AA DD DD MMM MMM EE #
|
|
35 |
# RR RR EE AA AA DD DD MMMM MMMM EE #
|
|
36 |
# RRRRRRRR EEEEEE AA AA DD DD MM MMM MM EEEEEE #
|
|
37 |
# RR RR EE AAAAAAAAA DD DD MM MM EE #
|
|
38 |
# RR RR EE AA AA DD DD MM MM EE #
|
|
39 |
# RR RR EEEEEEEE AA AA DDDDDDDD MM MM EEEEEEEE #
|
|
40 |
# # |
|
41 |
##################################################################### |
|
40 |
################################################################################
|
|
41 |
# #
|
|
42 |
# RRRRRRRR EEEEEEEE AAA DDDDDDDD MM MM EEEEEEEE #
|
|
43 |
# RR RR EE AA AA DD DD MMM MMM EE #
|
|
44 |
# RR RR EE AA AA DD DD MMMM MMMM EE #
|
|
45 |
# RRRRRRRR EEEEEE AA AA DD DD MM MMM MM EEEEEE #
|
|
46 |
# RR RR EE AAAAAAAAA DD DD MM MM EE #
|
|
47 |
# RR RR EE AA AA DD DD MM MM EE #
|
|
48 |
# RR RR EEEEEEEE AA AA DDDDDDDD MM MM EEEEEEEE #
|
|
49 |
# #
|
|
50 |
################################################################################
|
|
42 | 51 |
|
43 |
This file will help you to setup all required software on your system, |
|
44 |
compile the source code, and use the tools and flash the bootloader
|
|
45 |
software to the AMiRo modules.
|
|
52 |
This file will help you to setup all required software on your system, compile
|
|
53 |
the source code, and use the tools and flash the bootloader software to the
|
|
54 |
AMiRo base modules.
|
|
46 | 55 |
|
47 |
===================================================================== |
|
56 |
================================================================================
|
|
48 | 57 |
|
49 | 58 |
CONTENTS: |
50 |
1 Required software |
|
51 |
1.1 stm32flash |
|
52 |
1.2 gcc-arm-none-eabi |
|
53 |
2 Compiling the source code |
|
54 |
1.1 target software |
|
55 |
1.2 host software |
|
56 | 59 |
|
57 |
===================================================================== |
|
60 |
1 Required software |
|
61 |
1.1 stm32flash |
|
62 |
1.2 GCC ARM Embedded Toolchain |
|
63 |
1.3 GNU Make |
|
64 |
1.4 CMake |
|
65 |
2 Recommended Software |
|
66 |
3 Compiling the source code |
|
67 |
3.1 target software |
|
68 |
3.2 host software |
|
69 |
|
|
70 |
================================================================================ |
|
71 |
|
|
72 |
|
|
58 | 73 |
|
59 | 74 |
1 - REQUIRED SOFTWARE |
60 | 75 |
--------------------- |
61 | 76 |
|
62 |
The only third party software required are stm32flash and GCC for ARM |
|
63 |
embedded devices. |
|
77 |
The only third party software required are stm32flash and GCC for ARM embedded |
|
78 |
devices. While the latter is a compiler to build binaries that are compatible |
|
79 |
with the microcontrollers (MCUs) of AMiRo, the former is used to write this data |
|
80 |
to the hardware. |
|
81 |
|
|
82 |
|
|
64 | 83 |
|
65 | 84 |
1.1 - stm32flash |
85 |
---------------- |
|
66 | 86 |
|
67 |
To build the tool from source, clone the GIT repository to a local |
|
68 |
folder on your machine:
|
|
87 |
To build the tool from source, clone the GIT repository to a local folder on
|
|
88 |
your machine: |
|
69 | 89 |
>$ git clone git://git.code.sf.net/p/stm32flash/code |
70 |
Please make sure that you have version 0.4 or later of the tool. It is |
|
71 |
recommend to checkout the following commit: |
|
72 |
>$ git checkout fb52b4d80613b19b28ab82ba9fa415378d00fb9a |
|
73 |
You can now build the tool by executing 'make'. |
|
74 |
Finally, you must make the resulting binary (stm32flash) globally |
|
75 |
available on your system. You can do so by either copying the file to |
|
76 |
an appropriate location (e.g. /usr/local/bin/) or creating an |
|
77 |
according link. |
|
90 |
Make sure that you have selected version 0.4 or later of the tool. You can now |
|
91 |
build the tool simply by executing 'make'. Finally, you must make the resulting |
|
92 |
binary (stm32flash) globally available in your environment. You can do so by |
|
93 |
either copying the file to an appropriate location (e.g. /usr/local/bin/) or |
|
94 |
creating an according link. The tool must be available as 'stm32flash' in every |
|
95 |
new shell. |
|
78 | 96 |
|
79 |
1.2 - gcc-arm-none-eabi |
|
97 |
|
|
98 |
1.2 - GCC ARM Embedded Toolchain |
|
99 |
-------------------------------- |
|
80 | 100 |
|
81 | 101 |
Various versions of the GCC for ARM embedded devices can be found at |
82 |
<https://launchpad.net/gcc-arm-embedded>. It is highly recommended to |
|
83 |
use the version 4.8 with update 2014-q1 since some others will cause |
|
84 |
issues. For installation of the compiler toolchain, please follow the |
|
85 |
instructions that can be found on the web page. |
|
102 |
<https://launchpad.net/gcc-arm-embedded>. For installation of the compiler |
|
103 |
toolchain, please follow the instructions that can be found on the web page. |
|
104 |
If you have access to the AMiRo-OS project as well, it is highly recommended |
|
105 |
to use the setup application provided there. |
|
106 |
|
|
107 |
|
|
108 |
1.3 - GNU Make |
|
109 |
-------------- |
|
110 |
|
|
111 |
GNU Make usually comes as preinstalled tool on Ubuntu based operating systems. |
|
112 |
If your system is missing GNU Make, it is recommended to install it from the |
|
113 |
standard repositories since no special requirements (e.g. features of a very |
|
114 |
recent version) are required. |
|
115 |
|
|
116 |
|
|
117 |
1.4 - CMake |
|
118 |
----------- |
|
86 | 119 |
|
87 |
2 - COMPILING THE SOURCE CODE |
|
120 |
In order to build the SerialBoot host application, CMake version 2.8 or later is |
|
121 |
required. If possible, it is recommended to instal it from the standard |
|
122 |
repositories of your operating system. |
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
2 - RECOMMENDED SOFTWARE |
|
127 |
------------------------ |
|
128 |
|
|
129 |
AMiRo-BLT provides support for the QtCreator IDE. In order to setup according |
|
130 |
projects, use the ./setup.sh script and follow the instructions. It will |
|
131 |
automatically generate the required files and you can import the projects by |
|
132 |
opening the .creator files with Qtcreator IDE. |
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
3 - COMPILING THE SOURCE CODE |
|
88 | 137 |
----------------------------- |
89 | 138 |
|
90 |
The AMiRo-BLT project is separated into two major parts: target and |
|
91 |
host related software. The former comprises the bootloaders for the |
|
92 |
three base modules of the AMiRo. The latter is the SerialBoot tool, |
|
93 |
which can be used to flash further binaries (e.g. a complex operating |
|
94 |
system) to the microcontrollers without the need to connect to the |
|
95 |
module directly. Since the programming connector of the lowermost |
|
96 |
AMiRo module is the only one accessible when the robot is fully set |
|
97 |
up, this enables to update the firmware even for other modules. |
|
98 |
|
|
99 |
2.1 - target software |
|
100 |
|
|
101 |
In the ./Target/Demo/ directory there are three subfolders, one for |
|
102 |
each AMiRo base module. Within each of these is an additional Boot/ |
|
103 |
folder (./Target/Demo/<device>/Boot/), which contains a makefile. |
|
104 |
Each bootloader can be compiled by executing 'make' in these |
|
105 |
directories. |
|
106 |
|
|
107 |
In order to flash the bootloader to the microcontroller, you first |
|
108 |
have to set full read and write permissions to the USB ports of your |
|
109 |
system. You can do so by executing the following command: |
|
139 |
The AMiRo-BLT project is separated into two major parts: target- and host- |
|
140 |
related software. The former comprises the bootloaders for the three base |
|
141 |
modules of the AMiRo. The latter is the SerialBoot tool, which can be used to |
|
142 |
flash further binaries (e.g. a complex operating system) to the microcontrollers |
|
143 |
without connecting to the module directly (data is passed through via CAN bus). |
|
144 |
Since the programming connector of the lowermost AMiRo module is the only one |
|
145 |
accessible when the robot is fully set up, this enables to update the firmware |
|
146 |
even for other modules. |
|
147 |
|
|
148 |
|
|
149 |
3.1 - target software |
|
150 |
--------------------- |
|
151 |
|
|
152 |
In the ./Target/Demo/ directory there are three subfolders, one for each AMiRo |
|
153 |
base module. Within each of these is an additional Boot/ folder |
|
154 |
(./Target/Demo/<device>/Boot/), which contains a makefile. Each bootloader can |
|
155 |
be compiled by executing 'make' in these directories. |
|
156 |
|
|
157 |
In order to flash the bootloader to a microcontroller, you first have to set |
|
158 |
full read and write permissions to the USB ports of your system. You can do so |
|
159 |
by executing the following command: |
|
110 | 160 |
>$ sudo echo 'KERNEL=="ttyUSB[0-9]*",NAME="tts/USB%n",SYMLINK+="%k",MODE="0666"' > /etc/udev/rules.d/50-ttyusb.rules |
111 |
Now connect the module you want to flash directly to your system (note |
|
112 |
that indirect flashing is not possible for the bootloader itself) and |
|
113 |
run the command |
|
161 |
Now connect the module you want to flash directly to your system (note that |
|
162 |
indirect flashing is not possible for the bootloader itself) and run the command |
|
114 | 163 |
>$ make flash |
115 | 164 |
If the procedure was not successful, the following hints might help: |
116 |
1) Could the makefile execute the stm32flash tool? |
|
117 |
2) Are the permissions for USB ports set correctly? |
|
118 |
3) Is the AMiRo module connected to your system? |
|
165 |
- Could the makefile execute the stm32flash tool? |
|
166 |
- Are the permissions for USB ports set correctly? |
|
167 |
- Are there any other applications using the serial connection? |
|
168 |
- Is the AMiRo module connected to your system? |
|
169 |
- Is the AMiRo module powered up? |
|
170 |
|
|
171 |
ATTENTION: |
|
172 |
Never flash a bootloader to the wrong module! Doing so might cause severe errors |
|
173 |
and damage the robot. |
|
119 | 174 |
|
120 |
WARNING: |
|
121 |
never flash a bootloader to another module! Doing so might cause |
|
122 |
severe errors and damage the robot. |
|
123 | 175 |
|
124 |
2.2 - host software |
|
176 |
3.2 - host software |
|
177 |
------------------- |
|
125 | 178 |
|
126 |
The SerialBoot tool can be built by using cmake. The according |
|
127 |
CMakeLists.txt file can be found in the ./Host/Source/SerialBoot/ |
|
128 |
directory. You can just run the command |
|
129 |
>$ cmake . && make |
|
130 |
to generate the binary, though it is recommended to built the tool |
|
131 |
out-of-source. |
|
179 |
The SerialBoot tool can be built by using cmake. The according CMakeLists.txt |
|
180 |
file can be found in the ./Host/Source/SerialBoot/ directory. To ensure |
|
181 |
compatibility with other software (e.g. AMiRo-OS) it is higly recommended to use |
|
182 |
the provided ./setup.sh script to build SerialBoot. In the end the binary path |
|
183 |
should be ./Host/Sotware/SerialBoot/build/SerialBoot. |
|
132 | 184 |
|
133 |
===================================================================== |
|
185 |
================================================================================
|
|
134 | 186 |
|
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 |
|
setup.sh | ||
---|---|---|
1 |
################################################################################ |
|
2 |
# AMiRo-BLT is an bootloader and toolchain designed for the Autonomous Mini # |
|
3 |
# Robot (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 |
|
|
24 |
#!/bin/bash |
|
25 |
|
|
26 |
# initial info text (can be disabled with 'no_info' as last argument) |
|
27 |
if [[ ! ${!#} = "no_info" ]]; then |
|
28 |
printf "######################################################################\n" |
|
29 |
printf "# #\n" |
|
30 |
printf "# Welcome to the AMiRo-BLT setup! #\n" |
|
31 |
printf "# #\n" |
|
32 |
printf "######################################################################\n" |
|
33 |
printf "# #\n" |
|
34 |
printf "# Copyright (c) 2016..2017 Thomas Schöpping #\n" |
|
35 |
printf "# #\n" |
|
36 |
printf "# This is free software; see the source for copying conditions. #\n" |
|
37 |
printf "# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR #\n" |
|
38 |
printf "# A PARTICULAR PURPOSE. The development of this software was #\n" |
|
39 |
printf "# supported by the Excellence Cluster EXC 227 Cognitive Interaction #\n" |
|
40 |
printf "# Technology. The Excellence Cluster EXC 227 is a grant of the #\n" |
|
41 |
printf "# Deutsche Forschungsgemeinschaft (DFG) in the context of the German #\n" |
|
42 |
printf "# Excellence Initiative. #\n" |
|
43 |
printf "# #\n" |
|
44 |
printf "######################################################################\n" |
|
45 |
printf "\n" |
|
46 |
fi |
|
47 |
|
|
48 |
# initialization of variables |
|
49 |
ARG_IDX=1 |
|
50 |
USER_INPUT=${!ARG_IDX} |
|
51 |
|
|
52 |
while [[ ! $USER_INPUT =~ ^[Ee]$ ]]; do |
|
53 |
|
|
54 |
# main menu info prompt and selection |
|
55 |
printf "AMiRo-BLT setup\n" |
|
56 |
printf "===============\n" |
|
57 |
printf "\n" |
|
58 |
if [[ -z $USER_INPUT || $USER_INPUT == "no_info" ]]; then |
|
59 |
printf "Please select one of the following actions:\n" |
|
60 |
printf " [S] - SerialBoot flashing tool setup\n" |
|
61 |
printf " [Q] - setup QtCreator projects\n" |
|
62 |
printf " [E] - exit this setup\n" |
|
63 |
|
|
64 |
while [[ ! $USER_INPUT =~ ^[SsQqEe]$ ]]; do |
|
65 |
read -p "your selection: " -n 1 -e USER_INPUT |
|
66 |
if [[ ! $USER_INPUT =~ ^[SsQqEe]$ ]]; then |
|
67 |
printf "[%s] is no valid action. \n" $USER_INPUT |
|
68 |
fi |
|
69 |
done |
|
70 |
|
|
71 |
printf "\n" |
|
72 |
printf "######################################################################\n" |
|
73 |
printf "\n" |
|
74 |
fi |
|
75 |
|
|
76 |
# action selection |
|
77 |
case $USER_INPUT in |
|
78 |
|
|
79 |
# SerailBoot setup |
|
80 |
S|s) |
|
81 |
# print setup header |
|
82 |
printf "SerialBoot setup\n" |
|
83 |
printf "================\n" |
|
84 |
printf "\n" |
|
85 |
|
|
86 |
USER_DIR=${PWD} |
|
87 |
cd $(dirname ${BASH_SOURCE[0]})/Host/Source/SerialBoot |
|
88 |
BUILD_SERIALBOOT=true |
|
89 |
|
|
90 |
# test for existing binary |
|
91 |
if [ -f build/SerialBoot ]; then |
|
92 |
printf "WARNING: SerialBoot binary already exists.\n" |
|
93 |
read -p "Would you like to delete and rebuild it? [Y|n] " -n 1 -i "Y" -e USER_INPUT |
|
94 |
if [[ $USER_INPUT =~ ^[Yy]$ ]]; then |
|
95 |
BUILD_SERIALBOOT=true |
|
96 |
rm -rf build/ |
|
97 |
elif [[ ! $USER_INPUT =~ ^[YyNn]$ ]]; then |
|
98 |
BUILD_SERIALBOOT=false |
|
99 |
printf "'%s' is no valid selection. Aborting setup.\n" $USER_INPUT |
|
100 |
else |
|
101 |
BUILD_SERIALBOOT=false |
|
102 |
fi |
|
103 |
fi |
|
104 |
|
|
105 |
# build the tool, if requested |
|
106 |
if [ $BUILD_SERIALBOOT = true ]; then |
|
107 |
mkdir build |
|
108 |
cd build |
|
109 |
cmake .. |
|
110 |
make |
|
111 |
fi |
|
112 |
|
|
113 |
cd $USER_DIR |
|
114 |
;; |
|
115 |
|
|
116 |
# QtCreator setup |
|
117 |
Q|q) |
|
118 |
# calling the script with no arguments prints the help and returns |
|
119 |
source $(dirname ${BASH_SOURCE[0]})/ide/QtCreator/QtCreatorSetup.sh "no_info" |
|
120 |
printf "\n" |
|
121 |
# set deafult arguments and call the script again |
|
122 |
USER_INPUT="clean all" |
|
123 |
read -p "select commands: " -i "$USER_INPUT" -e USER_INPUT |
|
124 |
printf "\n" |
|
125 |
source $(dirname ${BASH_SOURCE[0]})/ide/QtCreator/QtCreatorSetup.sh "no_info" $USER_INPUT |
|
126 |
;; |
|
127 |
|
|
128 |
# exit |
|
129 |
E|e) |
|
130 |
break; |
|
131 |
;; |
|
132 |
|
|
133 |
# sanity check |
|
134 |
*) |
|
135 |
printf "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" |
|
136 |
printf "ERROR (${LINENO}): unexpected state; aborting script\n" |
|
137 |
printf "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" |
|
138 |
printf "\n" |
|
139 |
exit |
|
140 |
;; |
|
141 |
|
|
142 |
esac |
|
143 |
|
|
144 |
printf "\n" |
|
145 |
printf "######################################################################\n" |
|
146 |
printf "\n" |
|
147 |
|
|
148 |
let ARG_IDX++ |
|
149 |
USER_INPUT=${!ARG_IDX} |
|
150 |
|
|
151 |
done |
|
152 |
|
Also available in: Unified diff