@@ -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 -q 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,17 +156,27 @@ function install_ide()
145
156
local ide_path=$1
146
157
local core_path=$2
147
158
local debug=$3
148
- if [ " $MACOSX " = " 1" ]; then
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
149
170
# MACOS only has next-to-obsolete Python2 installed. Install Python 3 from python.org
150
171
wget https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg
151
172
sudo installer -pkg python-3.7.4-macosx10.9.pkg -target /
152
173
# Install the Python3 certificates, because SSL connections fail w/o them and of course they aren't installed by default.
153
- ( cd " /Applications/Python 3.7/" && sudo " ./Install Certificates.command" )
174
+ ( cd " /Applications/Python 3.7/" && sudo " ./Install Certificates.command" )
154
175
# Hack to place arduino-builder in the same spot as sane OSes
155
176
test -r arduino.zip || wget -O arduino.zip https://downloads.arduino.cc/arduino-nightly-macosx.zip
156
177
unzip -q arduino.zip
157
- mv Arduino.app arduino-nightly
158
- mv arduino-nightly/Contents/Java/* arduino-nightly/.
178
+ mv Arduino.app arduino-nightly
179
+ mv arduino-nightly/Contents/Java/* arduino-nightly/.
159
180
else
160
181
test -r arduino.tar.xz || wget -O arduino.tar.xz https://www.arduino.cc/download.php? f=/arduino-nightly-linux64.tar.xz
161
182
tar xf arduino.tar.xz
@@ -164,7 +185,11 @@ function install_ide()
164
185
cd $ide_path /hardware
165
186
mkdir esp8266com
166
187
cd esp8266com
167
- 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
168
193
local debug_flags=" "
169
194
if [ " $debug " = " debug" ]; then
170
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"
@@ -176,8 +201,14 @@ function install_ide()
176
201
cat esp8266/platform.local.txt
177
202
echo -e " \n----\n"
178
203
cd esp8266/tools
179
- python3 get.py
180
- 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
181
212
}
182
213
183
214
function install_arduino()
0 commit comments