@@ -44,8 +44,7 @@ function print_size_info()
44
44
segments[$seg ]=$size
45
45
fi
46
46
47
-
48
- done < <( xtensa-lx106-elf-size --format=sysv $elf_file )
47
+ done < <( xtensa-lx106-elf-size --format=sysv $elf_file | sed ' s/\r//g' )
49
48
50
49
total_ram=$(( ${segments[data]} + ${segments[rodata]} + ${segments[bss]} ))
51
50
total_flash=$(( ${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]} ))
@@ -66,6 +65,10 @@ function build_sketches()
66
65
local lwip=$6
67
66
mkdir -p $build_dir
68
67
local build_cmd=" python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p $PWD /$build_dir -n $lwip $build_arg "
68
+ if [ " $WINDOWS " = " 1" ]; then
69
+ # Paths to the arduino builder need to be / referenced, not our native ones
70
+ build_cmd=$( echo $build_cmd --ide_path $arduino | sed ' s/ \/c\// \//g' ) # replace '/c/' with '/'
71
+ fi
69
72
local sketches=$( find $srcpath -name * .ino | sort)
70
73
print_size_info > size.log
71
74
export ARDUINO_IDE_PATH=$arduino
@@ -107,6 +110,14 @@ function build_sketches()
107
110
fi
108
111
echo -e " \n ------------ Building $sketch ------------ \n" ;
109
112
# $arduino --verify $sketch;
113
+ if [ " $WINDOWS " == " 1" ]; then
114
+ sketch=$( echo $sketch | sed ' s/^\/c//' )
115
+ # MINGW will try to be helpful and silently convert args that look like paths to point to a spot inside the MinGW dir. This breaks everything.
116
+ # http://www.mingw.org/wiki/Posix_path_conversion
117
+ # https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line#34386471
118
+ export MSYS2_ARG_CONV_EXC=" *"
119
+ export MSYS_NO_PATHCONV=1
120
+ fi
110
121
echo " $build_cmd $sketch "
111
122
time ($build_cmd $sketch > build.log)
112
123
local result=$?
@@ -135,7 +146,7 @@ function install_libraries()
135
146
pushd $HOME /Arduino/libraries
136
147
137
148
# install ArduinoJson library
138
- { test -r ArduinoJson-v6.11.0.zip || wget https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip ArduinoJson-v6.11.0.zip
149
+ { test -r ArduinoJson-v6.11.0.zip || wget -nv https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
139
150
140
151
popd
141
152
}
@@ -145,13 +156,40 @@ function install_ide()
145
156
local ide_path=$1
146
157
local core_path=$2
147
158
local debug=$3
148
- test -r arduino.tar.xz || wget -O arduino.tar.xz https://www.arduino.cc/download.php? f=/arduino-nightly-linux64.tar.xz
149
- tar xf arduino.tar.xz
159
+ if [ " $WINDOWS " = " 1" ]; then
160
+ # Acquire needed packages from Windows package manager
161
+ choco install --no-progress python3
162
+ export PATH=" /c/Python37:$PATH " # Ensure it's live from now on...
163
+ cp /c/Python37/python.exe /c/Python37/python3.exe
164
+ choco install --no-progress unzip
165
+ choco install --no-progress sed
166
+ # choco install --no-progress golang
167
+ test -r arduino-nightly-windows.zip || wget -nv -O arduino-nightly-windows.zip https://www.arduino.cc/download.php? f=/arduino-nightly-windows.zip
168
+ unzip -q arduino-nightly-windows.zip
169
+ elif [ " $MACOSX " = " 1" ]; then
170
+ # MACOS only has next-to-obsolete Python2 installed. Install Python 3 from python.org
171
+ wget https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg
172
+ sudo installer -pkg python-3.7.4-macosx10.9.pkg -target /
173
+ # Install the Python3 certificates, because SSL connections fail w/o them and of course they aren't installed by default.
174
+ ( cd " /Applications/Python 3.7/" && sudo " ./Install Certificates.command" )
175
+ # Hack to place arduino-builder in the same spot as sane OSes
176
+ test -r arduino.zip || wget -O arduino.zip https://downloads.arduino.cc/arduino-nightly-macosx.zip
177
+ unzip -q arduino.zip
178
+ mv Arduino.app arduino-nightly
179
+ mv arduino-nightly/Contents/Java/* arduino-nightly/.
180
+ else
181
+ test -r arduino.tar.xz || wget -O arduino.tar.xz https://www.arduino.cc/download.php? f=/arduino-nightly-linux64.tar.xz
182
+ tar xf arduino.tar.xz
183
+ fi
150
184
mv arduino-nightly $ide_path
151
185
cd $ide_path /hardware
152
186
mkdir esp8266com
153
187
cd esp8266com
154
- ln -s $core_path esp8266
188
+ if [ " $WINDOWS " = " 1" ]; then
189
+ cp -a $core_path esp8266
190
+ else
191
+ ln -s $core_path esp8266
192
+ fi
155
193
local debug_flags=" "
156
194
if [ " $debug " = " debug" ]; then
157
195
debug_flags=" -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM"
@@ -163,8 +201,14 @@ function install_ide()
163
201
cat esp8266/platform.local.txt
164
202
echo -e " \n----\n"
165
203
cd esp8266/tools
166
- python3 get.py
167
- export PATH=" $ide_path :$core_path /tools/xtensa-lx106-elf/bin:$PATH "
204
+ python3 get.py -q
205
+ if [ " $WINDOWS " = " 1" ]; then
206
+ # Because the symlinks don't work well under Win32, we need to add the path to this copy, not the original...
207
+ relbin=$( realpath $PWD /xtensa-lx106-elf/bin)
208
+ export PATH=" $ide_path :$relbin :$PATH "
209
+ else
210
+ export PATH=" $ide_path :$core_path /tools/xtensa-lx106-elf/bin:$PATH "
211
+ fi
168
212
}
169
213
170
214
function install_arduino()
@@ -174,7 +218,6 @@ function install_arduino()
174
218
echo -e " travis_fold:start:sketch_test_env_prepare"
175
219
cd $TRAVIS_BUILD_DIR
176
220
install_ide $HOME /arduino_ide $TRAVIS_BUILD_DIR $debug
177
- which arduino
178
221
cd $TRAVIS_BUILD_DIR
179
222
install_libraries
180
223
echo -e " travis_fold:end:sketch_test_env_prepare"
0 commit comments