|
62 | 62 | # Espressif
|
63 | 63 | "esp8266" : ["esp8266:esp8266:huzzah:eesz=4M3M,xtal=80", None],
|
64 | 64 | "esp32" : ["esp32:esp32:featheresp32:FlashFreq=80", None],
|
| 65 | + "feather_esp32_v2_daily" : ["espressif:esp32:adafruit_feather_esp32_v2", None], |
65 | 66 | "magtag" : ["esp32:esp32:adafruit_magtag29_esp32s2", "0xbfdd4eee"],
|
66 | 67 | "funhouse" : ["esp32:esp32:adafruit_funhouse_esp32s2", "0xbfdd4eee"],
|
67 | 68 | "metroesp32s2" : ["esp32:esp32:adafruit_metro_esp32s2", "0xbfdd4eee"],
|
|
117 | 118 | "proxlighttrinkey_m0" : ["adafruit:samd:adafruit_proxlighttrinkey_m0", "0x68ed2b88"],
|
118 | 119 | "qtpy_m0" : ["adafruit:samd:adafruit_qtpy_m0", "0x68ed2b88"],
|
119 | 120 | "qtpy_m0_tinyusb" : ["adafruit:samd:adafruit_qtpy_m0:usbstack=tinyusb", "0x68ed2b88"],
|
| 121 | + # Arduino SAMD |
| 122 | + "mkrwifi1010" : ["arduino:samd:mkrwifi1010", "0x8054"], |
| 123 | + "nano_33_iot" : ["arduino:samd:nano_33_iot", "0x8057"], |
120 | 124 | # Arduino nRF
|
121 | 125 | "microbit" : ["sandeepmistry:nRF5:BBCmicrobit:softdevice=s110", None],
|
122 | 126 | # Adafruit nRF
|
@@ -176,17 +180,51 @@ def print_info(message, end = '\n'):
|
176 | 180 | def print_bold(message, end = '\n'):
|
177 | 181 | sys.stdout.write('\x1b[1;37m' + message.strip() + '\x1b[0m' + end)
|
178 | 182 |
|
| 183 | +def manually_install_esp32_bsp(): |
| 184 | + # see - https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#linux |
| 185 | + print("Manually installing latest ESP32 BSP...") |
| 186 | + os.system("mkdir -p /home/runner/Arduino/hardware/espressif") |
| 187 | + # Locally clone repo |
| 188 | + print("Cloning github.com/espressif/arduino-esp32..") |
| 189 | + cmd = "cd /home/runner/Arduino/hardware/espressif && git clone https://github.com/espressif/arduino-esp32.git esp32" |
| 190 | + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
| 191 | + r = proc.wait(timeout=1000) |
| 192 | + out = proc.stdout.read() |
| 193 | + err = proc.stderr.read() |
| 194 | + if r != 0: |
| 195 | + ColorPrint.print_fail("Failed to download ESP32 Arduino BSP!") |
| 196 | + ColorPrint.print_fail(out.decode("utf-8")) |
| 197 | + ColorPrint.print_fail(err.decode("utf-8")) |
| 198 | + exit(-1) |
| 199 | + print(out) |
| 200 | + print("Cloned repository!") |
179 | 201 |
|
180 |
| -def install_platform(platform): |
181 |
| - print("Installing", platform, end=" ") |
182 |
| - if platform == "adafruit:avr": # we have a platform dep |
| 202 | + print("Installing ESP32 Arduino BSP...") |
| 203 | + cmd = "cd /home/runner/Arduino/hardware/espressif/esp32/tools && python3 get.py" |
| 204 | + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
| 205 | + r = proc.wait(timeout=1000) |
| 206 | + out = proc.stdout.read() |
| 207 | + err = proc.stderr.read() |
| 208 | + if r != 0: |
| 209 | + ColorPrint.print_fail("Failed to install ESP32 Arduino BSP!") |
| 210 | + ColorPrint.print_fail(out.decode("utf-8")) |
| 211 | + ColorPrint.print_fail(err.decode("utf-8")) |
| 212 | + exit(-1) |
| 213 | + print(out) |
| 214 | + print("Installed ESP32 BSP from source!") |
| 215 | + |
| 216 | +def install_platform(fqbn, platform_name): |
| 217 | + print("Installing", fqbn, end=" ") |
| 218 | + if fqbn == "adafruit:avr": # we have a platform dep |
183 | 219 | install_platform("arduino:avr")
|
184 |
| - if os.system("arduino-cli core install "+platform+" --additional-urls "+BSP_URLS+" > /dev/null") != 0: |
185 |
| - ColorPrint.print_fail("FAILED to install "+platform) |
| 220 | + if "daily" in platform_name: # manually install ESP32 BSP from latest source |
| 221 | + manually_install_esp32_bsp() |
| 222 | + if os.system("arduino-cli core install "+fqbn+" --additional-urls "+BSP_URLS+" > /dev/null") != 0: |
| 223 | + ColorPrint.print_fail("FAILED to install "+fqbn) |
186 | 224 | exit(-1)
|
187 | 225 | ColorPrint.print_pass(CHECK)
|
188 | 226 | # print installed core version
|
189 |
| - print(os.popen('arduino-cli core list | grep {}'.format(platform)).read(), end='') |
| 227 | + print(os.popen('arduino-cli core list | grep {}'.format(fqbn)).read(), end='') |
190 | 228 |
|
191 | 229 | def run_or_die(cmd, error):
|
192 | 230 | print(cmd)
|
@@ -292,12 +330,20 @@ def generate_uf2(example_path):
|
292 | 330 | ColorPrint.print_info("Used uf2 generated by arduino-cli")
|
293 | 331 | return output_file
|
294 | 332 |
|
295 |
| - # For other uf2-supporting platforms, we can generate it from a hex file |
296 |
| - cli_build_hex_path = "build/*.*." + fqbn.split(':')[2] + "/*.hex" |
297 |
| - hex_input_file = glob1(os.path.join(example_path, cli_build_hex_path)) |
298 |
| - output_file = os.path.splitext(hex_input_file)[0] + ".uf2" |
299 |
| - family_id = ALL_PLATFORMS[platform][1] |
300 |
| - cmd = ['python3', 'uf2conv.py', hex_input_file, '-c', '-f', family_id, '-o', output_file] |
| 333 | + # Generate using a hex file for all platforms except for ESP32-S2 (exports as .bin files) |
| 334 | + if not "esp32s2" in fqbn: |
| 335 | + cli_build_hex_path = "build/*.*." + fqbn.split(':')[2] + "/*.hex" |
| 336 | + hex_input_file = glob1(os.path.join(example_path, cli_build_hex_path)) |
| 337 | + output_file = os.path.splitext(hex_input_file)[0] + ".uf2" |
| 338 | + family_id = ALL_PLATFORMS[platform][1] |
| 339 | + cmd = ['python3', 'uf2conv.py', hex_input_file, '-c', '-f', family_id, '-o', output_file] |
| 340 | + else: |
| 341 | + cli_build_path = "build/*.*." + fqbn.split(':')[2] + "/*.ino.bin" |
| 342 | + input_file = glob1(os.path.join(example_path, cli_build_path)) |
| 343 | + output_file = os.path.splitext(input_file)[0] + ".uf2" |
| 344 | + family_id = ALL_PLATFORMS[platform][1] |
| 345 | + cmd = ['python3', 'uf2conv.py', input_file, '-c', '-f', family_id, '-b', "0x0000", '-o', output_file] |
| 346 | + |
301 | 347 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
302 | 348 | r = proc.wait(timeout=60)
|
303 | 349 | out = proc.stdout.read()
|
@@ -382,11 +428,10 @@ def test_examples_in_folder(folderpath):
|
382 | 428 | cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, folderpath]
|
383 | 429 | else:
|
384 | 430 | cmd = ['arduino-cli', 'compile', '--warnings', 'none', '--export-binaries', '--fqbn', fqbn, folderpath]
|
385 |
| - |
386 | 431 | proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
387 | 432 | stderr=subprocess.PIPE)
|
388 | 433 | try:
|
389 |
| - out, err = proc.communicate(timeout=60) |
| 434 | + out, err = proc.communicate(timeout=120) |
390 | 435 | r = proc.returncode
|
391 | 436 | except:
|
392 | 437 | proc.kill()
|
@@ -463,7 +508,7 @@ def test_examples_in_learningrepo(folderpath):
|
463 | 508 | fqbn = ALL_PLATFORMS[platform][0]
|
464 | 509 | print('#'*80)
|
465 | 510 | ColorPrint.print_info("SWITCHING TO "+fqbn)
|
466 |
| - install_platform(":".join(fqbn.split(':', 2)[0:2])) # take only first two elements |
| 511 | + install_platform(":".join(fqbn.split(':', 2)[0:2]), platform) # take only first two elements |
467 | 512 | print('#'*80)
|
468 | 513 | if not IS_LEARNING_SYS:
|
469 | 514 | test_examples_in_folder(BUILD_DIR+"/examples")
|
|
0 commit comments