Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e8bc311

Browse files
manchozfacchinm
authored andcommittedNov 14, 2019
Fix per target .h files synch
1 parent a2d9268 commit e8bc311

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed
 

‎mbed-os-to-arduino

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ mbed_compile () {
119119
rm -rf BUILD
120120
fi
121121

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
123124
echo " done."
124125
}
125126

@@ -135,39 +136,52 @@ generate_defines () {
135136

136137
generate_includes () {
137138
echo -n "Generating includes..."
139+
138140
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+
140151
echo " done."
141152
}
142153

143154
generate_flags () {
144155
echo -n "Generating flags..."
145156
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
147159
done
148160
echo " done."
149161
}
150162

151163
generate_libs () {
152164
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+
154168
cp ./BUILD/mbed-core-"$BOARDNAME".a "$ARDUINOVARIANT"/libs/libmbed.a
155169
cp ./BUILD/"$BOARDNAME"/GCC_ARM/.link_script.ld "$ARDUINOVARIANT"/linker_script.ld
156170
cp ./BUILD/"$BOARDNAME"/GCC_ARM/mbed_config.h "$ARDUINOVARIANT"/
171+
157172
find -L . -name 'libcc_310_*.a' -exec cp '{}' "$ARDUINOVARIANT"/libs/ ';'
158173
echo " done."
159174
}
160175

161176
copy_core_files () {
162177
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."
166178

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+
171185
echo " done."
172186
}
173187

@@ -285,7 +299,7 @@ for VARIANT in ${!VARIANT_BOARDS[*]}; do
285299
generate_includes
286300
generate_flags
287301
generate_libs
288-
done
302+
done
289303

290304
copy_core_files
291305
patch_mbed_h

0 commit comments

Comments
 (0)
This repository has been archived.