@@ -119,7 +119,8 @@ mbed_compile () {
119
119
rm -rf BUILD
120
120
fi
121
121
122
- mbed compile --source . --source ./mbed-os/features/unsupported/dsp/ -v | tee >( cat | grep ' Compile \[' >&2 ) | grep " Macros:" > " $BOARDNAME " .macros.txt
122
+ mbed compile --source . --source ./mbed-os/features/unsupported/dsp/ -v \
123
+ | tee >( cat | grep ' Compile \[' >&2 ) | grep " Macros:" > " $BOARDNAME " .macros.txt
123
124
echo " done."
124
125
}
125
126
@@ -135,39 +136,52 @@ generate_defines () {
135
136
136
137
generate_includes () {
137
138
echo -n " Generating includes..."
139
+
138
140
find ./BUILD/" $BOARDNAME " /GCC_ARM/ -type f -name ' .include*' -print0 | xargs -0 cat \
139
- | tr ' ' ' \n' | tr -d ' "' | sed -e ' s#-I./mbed-os#-iwithprefixbefore/mbed#g' | sed ' /^-I./d' | tac > " $ARDUINOVARIANT " /includes.txt
141
+ | tr ' ' ' \n' | tr -d ' "' | sed -e ' s#-I./mbed-os#-iwithprefixbefore/mbed#g' \
142
+ | sed ' /^-I./d' | tac \
143
+ > " $ARDUINOVARIANT " /includes.txt
144
+
145
+ echo -n " copying to destination... "
146
+
147
+ cut -d' /' -f3- < " $ARDUINOVARIANT " /includes.txt | grep ' ^targets/TARGET_' \
148
+ | sed -e ' s#\(.*\)#+ \1#' -e ' $a+ targets/' -e ' $a+ *.h' -e ' $a- *' \
149
+ | rsync -avvz --include-from=- mbed-os/ " $ARDUINOCOREMBED " /
150
+
140
151
echo " done."
141
152
}
142
153
143
154
generate_flags () {
144
155
echo -n " Generating flags..."
145
156
for fl in c cxx ld; do
146
- jq -r ' .flags | .[] | select(. != "-MMD")' ./BUILD/" $BOARDNAME " /GCC_ARM/.profile-${fl} > " $ARDUINOVARIANT " /${fl} flags.txt
157
+ jq -r ' .flags | .[] | select(. != "-MMD")' ./BUILD/" $BOARDNAME " /GCC_ARM/.profile-${fl} \
158
+ > " $ARDUINOVARIANT " /${fl} flags.txt
147
159
done
148
160
echo " done."
149
161
}
150
162
151
163
generate_libs () {
152
164
echo -n " Generating libs..."
153
- tr ' ' ' \n' < ./BUILD/" $BOARDNAME " /GCC_ARM/.link_options.txt | grep " \.o" | grep -v " /main\.o" | xargs arm-none-eabi-ar rcs ./BUILD/mbed-core-" $BOARDNAME " .a
165
+ tr ' ' ' \n' < ./BUILD/" $BOARDNAME " /GCC_ARM/.link_options.txt | grep " \.o" | grep -v " /main\.o" \
166
+ | xargs arm-none-eabi-ar rcs ./BUILD/mbed-core-" $BOARDNAME " .a
167
+
154
168
cp ./BUILD/mbed-core-" $BOARDNAME " .a " $ARDUINOVARIANT " /libs/libmbed.a
155
169
cp ./BUILD/" $BOARDNAME " /GCC_ARM/.link_script.ld " $ARDUINOVARIANT " /linker_script.ld
156
170
cp ./BUILD/" $BOARDNAME " /GCC_ARM/mbed_config.h " $ARDUINOVARIANT " /
171
+
157
172
find -L . -name ' libcc_310_*.a' -exec cp ' {}' " $ARDUINOVARIANT " /libs/ ' ;'
158
173
echo " done."
159
174
}
160
175
161
176
copy_core_files () {
162
177
echo -n " Copying generic MbedOS headers to core... "
163
- rsync -zar --exclude=" targets/" --exclude=" *TEST*/" --include=" */" --include=" *.h" --exclude=" *" mbed-os/ " $ARDUINOCOREMBED " /
164
- rsync -zar --exclude=" targets/" --exclude=" *TEST*/" --include=" */" --include=" mstd_*" --exclude=" *" mbed-os/ " $ARDUINOCOREMBED " /
165
- echo " done."
166
178
167
- TARGET=$( find mbed-os -type d -name TARGET_" $BOARDNAME " | cut -d' /' -f2-3)
168
- echo -n " Copying MbedOS headers for $TARGET ... "
169
- [ -d " $ARDUINOCOREMBED " /" $TARGET " / ] || mkdir -p " $ARDUINOCOREMBED " /" $TARGET " / && : ;
170
- rsync -zar --include=" */" --include=" *.h" --exclude=" *" mbed-os/" $TARGET " / " $ARDUINOCOREMBED " /" $TARGET " /
179
+ rsync -zar --exclude=" targets/" --exclude=" *TEST*/" --include=" */" --include=" *.h" --exclude=" *" \
180
+ mbed-os/ " $ARDUINOCOREMBED " /
181
+
182
+ rsync -zar --exclude=" targets/" --exclude=" *TEST*/" --include=" */" --include=" mstd_*" --exclude=" *" \
183
+ mbed-os/ " $ARDUINOCOREMBED " /
184
+
171
185
echo " done."
172
186
}
173
187
@@ -285,7 +299,7 @@ for VARIANT in ${!VARIANT_BOARDS[*]}; do
285
299
generate_includes
286
300
generate_flags
287
301
generate_libs
288
- done
302
+ done
289
303
290
304
copy_core_files
291
305
patch_mbed_h
0 commit comments