Compare commits
10 commits
140f1296f2
...
1bd405d10f
Author | SHA1 | Date | |
---|---|---|---|
1bd405d10f | |||
ee33836d00 | |||
d9a2cbd26f | |||
bebf6fa55e | |||
d332011d40 | |||
4096854d8b | |||
989a51b2e0 | |||
dec2742902 | |||
30eb32adc3 | |||
10eef76e29 |
2 changed files with 30 additions and 5 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.sh text=auto eol=lf
|
34
compile.sh
34
compile.sh
|
@ -12,7 +12,16 @@ then
|
||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
function is_truthy() {
|
||||||
|
local value;
|
||||||
|
value="$1";
|
||||||
|
|
||||||
|
[ ! -z "$value" ] &&
|
||||||
|
[ "$value" != "0" ] &&
|
||||||
|
[ "$value" != "false" ] &&
|
||||||
|
[ "$value" != "n" ] &&
|
||||||
|
[ "$value" != "no" ];
|
||||||
|
}
|
||||||
|
|
||||||
function handle_status() {
|
function handle_status() {
|
||||||
if [ $1 -ne 0 ]; then
|
if [ $1 -ne 0 ]; then
|
||||||
|
@ -178,6 +187,7 @@ fi
|
||||||
|
|
||||||
if [ ! -z "$projectFile" ];
|
if [ ! -z "$projectFile" ];
|
||||||
then
|
then
|
||||||
|
echo "Project File Found: \"$projectFile\"";
|
||||||
projectRoot="$(dirname "$projectFile")";
|
projectRoot="$(dirname "$projectFile")";
|
||||||
cd "$projectRoot";
|
cd "$projectRoot";
|
||||||
tempFile="$(mktemp)";
|
tempFile="$(mktemp)";
|
||||||
|
@ -209,20 +219,34 @@ then
|
||||||
|
|
||||||
logFile="$(mktemp)";
|
logFile="$(mktemp)";
|
||||||
|
|
||||||
xvfb-run bash -c "dwm & wine \"C:\Keil_v5\UV4\UV4.exe\" -j0 -b \"$projectFile\" -t \"$targetName\" -l \"$logFile\"" > /dev/null 2>&1;
|
if is_truthy "${NATIVE_WINDOWS}"
|
||||||
|
then
|
||||||
|
winFile="$(PROJECT_FILE="$projectFile" WSLENV="PROJECT_FILE/p" cmd.exe /c echo "%PROJECT_FILE%")";
|
||||||
|
LOG_FILE="$logFile" WSLENV="LOG_FILE/p" cmd.exe /c @ "C:\Keil_v5\UV4\UV4.exe" -j0 -b "$winFile" -t "$targetName" -l "%LOG_FILE%";
|
||||||
|
else
|
||||||
|
WINEDEBUG=-all,fixme+event xvfb-run bash -c "dwm & wine \"C:\Keil_v5\UV4\UV4.exe\" -j0 -b \"$projectFile\" -t \"$targetName\" -l \"$logFile\"";
|
||||||
|
fi;
|
||||||
|
|
||||||
mv -f "$tempFile" "$projectFile";
|
mv -f "$tempFile" "$projectFile";
|
||||||
|
|
||||||
errorPatterns=()
|
errorPatterns=()
|
||||||
errorPatterns+=("\(\)\(.*\)\(([[:digit:]]\+): \(warning\|note\|error\): \([A-Z0-9]\+: \)\?.*\)$")
|
errorPatterns+=("\(\)\(.*\)\(([[:digit:]]\+): \(warning\|note\|error\): \([A-Z0-9]\+: \)\?.*\)$")
|
||||||
errorPatterns+=("\(\"\)\(.*\)\(\", line [[:digit:]]\+\( (column [[:digit:]]\+)\)\?: \(Warning\|Error\): [A-Z0-9]\+: .*\)$");
|
errorPatterns+=("\(\"\)\(.*\)\(\", line [[:digit:]]\+\( (column [[:digit:]]\+)\)\?: \(Warning\|Error\): [A-Z0-9]\+: .*\)$");
|
||||||
|
|
||||||
|
if is_truthy "${USE_WINDOWS_PATHS}"
|
||||||
|
then
|
||||||
|
fixCommand="wslpath -m";
|
||||||
|
else
|
||||||
|
fixCommand="realpath";
|
||||||
|
fi;
|
||||||
|
|
||||||
for errorPattern in "${errorPatterns[@]}"
|
for errorPattern in "${errorPatterns[@]}"
|
||||||
do
|
do
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "/$errorPattern/{" \
|
-e "/$errorPattern/{" \
|
||||||
-e "h;" \
|
-e "h;" \
|
||||||
-e "s/$errorPattern/\1\n\3/" \
|
-e "s/$errorPattern/\1\n\3/" \
|
||||||
-e "x; s/$errorPattern/realpath \"\2\"/" \
|
-e "x; s/$errorPattern/$fixCommand \"\2\"/" \
|
||||||
-e "e" \
|
-e "e" \
|
||||||
-e "x; G; h;" \
|
-e "x; G; h;" \
|
||||||
-e "s/\([^\n]*\)\n//" \
|
-e "s/\([^\n]*\)\n//" \
|
||||||
|
@ -238,15 +262,15 @@ then
|
||||||
then
|
then
|
||||||
outputName="$(realpath "$projectRoot/$buildPath/$outputName")";
|
outputName="$(realpath "$projectRoot/$buildPath/$outputName")";
|
||||||
outputFile="$outputName.axf";
|
outputFile="$outputName.axf";
|
||||||
echo "The File Has Been Built to \"$outputFile\".";
|
echo "Target Built: \"$outputFile\".";
|
||||||
pyocd list | {
|
pyocd list | {
|
||||||
grep '^No available' &&
|
grep '^No available' &&
|
||||||
{
|
{
|
||||||
echo "Skpping flash."
|
echo "Skpping Flash."
|
||||||
} ||
|
} ||
|
||||||
{
|
{
|
||||||
pyocd flash --target stm32f439xi "$outputFile";
|
pyocd flash --target stm32f439xi "$outputFile";
|
||||||
handle_status $? "Flashing failed";
|
handle_status $? "Flashing Failed";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue