Skip to content

Commit fd4ecd9

Browse files
authored
Merge pull request #16 from adafruit/add-metro-bin
added metro binaries for program cdc
2 parents 62ffc06 + dfca314 commit fd4ecd9

18 files changed

+114568
-104
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Ha Thach (tinyusb.org) for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#ifndef ESP_BINARIES_H_
26+
#define ESP_BINARIES_H_
27+
28+
#define BIN_ESP32_NINA_1_7_4 0 // nina 1.7.4
29+
#define BIN_ESP32_WIFI_AP_SKETCH \
30+
1 // esp32 wifi accesspoint sketch with ssdi "YourAP"
31+
32+
#define BIN_FEATHER_S2 10 // Feather esp32s2 factory firmware
33+
#define BIN_FEATHER_S3 11 // Feather esp32s3 factory firmware
34+
#define BIN_METRO_S2 12 // Metro esp32s2 factory firmware
35+
36+
#define BIN_DEVKIT_S2 20 // Espressif s2 devkit
37+
#define BIN_DEVKIT_S3 21 // Espressif s3 devkit
38+
39+
// select which bins to flash
40+
#define BIN_FILES BIN_METRO_S2
41+
42+
#if BIN_FILES == BIN_ESP32_WIFI_AP_SKETCH
43+
#include "esp_binaries/wifi_ap_binaries.h"
44+
#elif BIN_FILES == BIN_NINA_1_7_4
45+
#include "esp_binaries/nina_1_7_4_binaries.h"
46+
#elif BIN_FILES == BIN_FEATHER_S2
47+
#include "esp_binaries/feather_esp32s2_binaries.h"
48+
#elif BIN_FILES == BIN_METRO_S2
49+
#include "esp_binaries/metro_esp32s2_binaries.h"
50+
#elif BIN_FILES == BIN_FEATHER_S3
51+
#include "esp_binaries/feather_esp32s3_binaries.h"
52+
#elif BIN_FILES == BIN_DEVKIT_S2
53+
#include "esp_binaries/esp32s2_devkit_binaries.h"
54+
#elif BIN_FILES == BIN_DEVKIT_S3
55+
#include "esp_binaries/esp32s3_devkit_binaries.h"
56+
#endif
57+
58+
struct {
59+
uint32_t addr;
60+
esp32_zipfile_t const *zfile;
61+
} bin_files[] = {
62+
#if BIN_FILES == BIN_NINA_1_7_4
63+
{0x00000, &NINA_W102_1_7_4},
64+
65+
#elif BIN_FILES == BIN_FEATHER_S2
66+
{0x1000, &esp32s2_feather_test_ino_bootloader},
67+
{0x8000, &esp32s2_feather_test_ino_partitions},
68+
{0xe000, &boot_app0},
69+
{0x10000, &esp32s2_feather_test_ino},
70+
{0x2d0000, &tinyuf2},
71+
72+
#elif BIN_FILES == BIN_METRO_S2
73+
{0x1000, &selftest_ino_bootloader},
74+
{0x8000, &selftest_ino_partitions},
75+
{0xe000, &boot_app0},
76+
{0x10000, &selftest_ino},
77+
{0x2d0000, &tinyuf2},
78+
79+
#elif BIN_FILES == BIN_FEATHER_S3
80+
{0x0000, &esp32s3_feather_test_ino_bootloader},
81+
{0x8000, &esp32s3_feather_test_ino_partitions},
82+
{0xe000, &boot_app0},
83+
{0x10000, &esp32s3_feather_test_ino},
84+
{0x2d0000, &tinyuf2},
85+
86+
#elif BIN_FILES == BIN_DEVKIT_S2
87+
{0x1000, &Blink_ino_bootloader},
88+
{0x8000, &Blink_ino_partitions},
89+
{0xe000, &boot_app0},
90+
{0x10000, &Blink_ino},
91+
92+
#elif BIN_FILES == BIN_DEVKIT_S3
93+
{0x0000, &Blink_ino_bootloader},
94+
{0x8000, &Blink_ino_partitions},
95+
{0xe000, &boot_app0},
96+
{0x10000, &Blink_ino},
97+
#endif
98+
};
99+
100+
enum { BIN_FILES_COUNT = sizeof(bin_files) / sizeof(bin_files[0]) };
101+
102+
#endif

examples/Brain/program_esp32_cdc/esp_binaries/metro_esp32s2_binaries.h

Lines changed: 22156 additions & 0 deletions
Large diffs are not rendered by default.

examples/Brain/program_esp32_cdc/program_esp32_cdc.ino

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313

1414
#include "Adafruit_TestBed_Brains.h"
1515

16+
// Change BIN_FILES in esp_binaries.h header to select which binaries to flash
17+
// bin_files[] is defined accordingly
18+
#include "esp_binaries.h"
19+
1620
#define ESP32_RESET 27
1721
#define ESP32_IO0 28
1822

19-
//#define ESP32_BAUDRATE 921600
23+
// Using CDC baudrate does not really matter at all
2024
#define ESP32_BAUDRATE 115200
2125

2226
// CDC Host object
@@ -25,62 +29,6 @@ Adafruit_USBH_CDC SerialHost;
2529
// Defined an boot rom object that use UART Serial1
2630
ESP32BootROMClass ESP32BootROM(SerialHost, ESP32_IO0, ESP32_RESET);
2731

28-
// Bin files header to program
29-
#define BOARD_FEATHER_S2 0
30-
#define BOARD_FEATHER_S3 1
31-
#define BOARD_DEVKIT_S2 2
32-
#define BOARD_DEVKIT_S3 3
33-
34-
// select which bins to flash
35-
#define BIN_FILES BOARD_FEATHER_S2
36-
37-
#if BIN_FILES == BOARD_FEATHER_S2
38-
#include "feather_esp32s2_binaries.h"
39-
#elif BIN_FILES == BOARD_FEATHER_S3
40-
#include "feather_esp32s3_binaries.h"
41-
#elif BIN_FILES == BOARD_DEVKIT_S2
42-
#include "esp32s2_devkit_binaries.h"
43-
#elif BIN_FILES == BOARD_DEVKIT_S3
44-
#include "esp32s3_devkit_binaries.h"
45-
#endif
46-
47-
struct {
48-
uint32_t addr;
49-
esp32_zipfile_t const * zfile;
50-
} bin_list [] =
51-
{
52-
#if BIN_FILES == BOARD_FEATHER_S2
53-
{ 0x1000 , &esp32s2_feather_test_ino_bootloader },
54-
{ 0x8000 , &esp32s2_feather_test_ino_partitions },
55-
{ 0xe000 , &boot_app0 },
56-
{ 0x10000 , &esp32s2_feather_test_ino },
57-
{ 0x2d0000, &tinyuf2 },
58-
59-
#elif BIN_FILES == BOARD_FEATHER_S3
60-
{ 0x0000 , &esp32s3_feather_test_ino_bootloader },
61-
{ 0x8000 , &esp32s3_feather_test_ino_partitions },
62-
{ 0xe000 , &boot_app0 },
63-
{ 0x10000 , &esp32s3_feather_test_ino },
64-
{ 0x2d0000, &tinyuf2 },
65-
66-
#elif BIN_FILES == BOARD_DEVKIT_S2
67-
{ 0x1000 , &Blink_ino_bootloader },
68-
{ 0x8000 , &Blink_ino_partitions },
69-
{ 0xe000 , &boot_app0 },
70-
{ 0x10000 , &Blink_ino },
71-
72-
#elif BIN_FILES == BOARD_DEVKIT_S3
73-
{ 0x0000 , &Blink_ino_bootloader },
74-
{ 0x8000 , &Blink_ino_partitions },
75-
{ 0xe000 , &boot_app0 },
76-
{ 0x10000 , &Blink_ino },
77-
#endif
78-
};
79-
80-
enum {
81-
BIN_LIST_COUNT = sizeof(bin_list)/sizeof(bin_list[0])
82-
};
83-
8432
//--------------------------------------------------------------------+
8533
// Setup and Loop on Core0
8634
//--------------------------------------------------------------------+
@@ -96,7 +44,7 @@ void print_speed(size_t count, uint32_t ms) {
9644
void setup() {
9745
Serial.begin(115200);
9846
while (!Serial) delay(10);
99-
Serial.println("Tester Brains: Programming ESP32 with UART!");
47+
Serial.println("Tester Brains: Programming ESP32 with SerialHost!");
10048

10149
// sync: wait for Brain.begin() called in core1 before accessing SD or other peripherals
10250
while (!Brain.inited()) delay(10);
@@ -108,9 +56,10 @@ void setup() {
10856
// Writing bin files
10957
size_t total_bytes = 0;
11058
uint32_t ms = millis();
111-
for(size_t i=0; i<BIN_LIST_COUNT; i++) {
59+
for(size_t i=0; i<BIN_FILES_COUNT; i++) {
11260
Brain.LCD_printf("Flashing file %u", i);
113-
size_t wr_count = Brain.esp32_programFlashDefl(bin_list[i].zfile, bin_list[i].addr);
61+
Serial.printf("File %s\r\n", bin_files[i].zfile->name);
62+
size_t wr_count = Brain.esp32_programFlashDefl(bin_files[i].zfile, bin_files[i].addr);
11463
total_bytes += wr_count;
11564
if (!wr_count) {
11665
Brain.LCD_printf_error("Failed to flash");
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Ha Thach (tinyusb.org) for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#ifndef ESP_BINARIES_H_
26+
#define ESP_BINARIES_H_
27+
28+
#define BIN_ESP32_NINA_1_7_4 0 // nina 1.7.4
29+
#define BIN_ESP32_WIFI_AP_SKETCH \
30+
1 // esp32 wifi accesspoint sketch with ssdi "YourAP"
31+
32+
#define BIN_FEATHER_S2 10 // Feather esp32s2 factory firmware
33+
#define BIN_FEATHER_S3 11 // Feather esp32s3 factory firmware
34+
#define BIN_METRO_S2 12 // Metro esp32s2 factory firmware
35+
36+
#define BIN_DEVKIT_S2 20 // Espressif s2 devkit
37+
#define BIN_DEVKIT_S3 21 // Espressif s3 devkit
38+
39+
// select which bins to flash
40+
#define BIN_FILES BIN_METRO_S2
41+
42+
#if BIN_FILES == BIN_ESP32_WIFI_AP_SKETCH
43+
#include "esp_binaries/wifi_ap_binaries.h"
44+
#elif BIN_FILES == BIN_NINA_1_7_4
45+
#include "esp_binaries/nina_1_7_4_binaries.h"
46+
#elif BIN_FILES == BIN_FEATHER_S2
47+
#include "esp_binaries/feather_esp32s2_binaries.h"
48+
#elif BIN_FILES == BIN_METRO_S2
49+
#include "esp_binaries/metro_esp32s2_binaries.h"
50+
#elif BIN_FILES == BIN_FEATHER_S3
51+
#include "esp_binaries/feather_esp32s3_binaries.h"
52+
#elif BIN_FILES == BIN_DEVKIT_S2
53+
#include "esp_binaries/esp32s2_devkit_binaries.h"
54+
#elif BIN_FILES == BIN_DEVKIT_S3
55+
#include "esp_binaries/esp32s3_devkit_binaries.h"
56+
#endif
57+
58+
struct {
59+
uint32_t addr;
60+
esp32_zipfile_t const *zfile;
61+
} bin_files[] = {
62+
#if BIN_FILES == BIN_NINA_1_7_4
63+
{0x00000, &NINA_W102_1_7_4},
64+
65+
#elif BIN_FILES == BIN_FEATHER_S2
66+
{0x1000, &esp32s2_feather_test_ino_bootloader},
67+
{0x8000, &esp32s2_feather_test_ino_partitions},
68+
{0xe000, &boot_app0},
69+
{0x10000, &esp32s2_feather_test_ino},
70+
{0x2d0000, &tinyuf2},
71+
72+
#elif BIN_FILES == BIN_METRO_S2
73+
{0x1000, &selftest_ino_bootloader},
74+
{0x8000, &selftest_ino_partitions},
75+
{0xe000, &boot_app0},
76+
{0x10000, &selftest_ino},
77+
{0x2d0000, &tinyuf2},
78+
79+
#elif BIN_FILES == BIN_FEATHER_S3
80+
{0x0000, &esp32s3_feather_test_ino_bootloader},
81+
{0x8000, &esp32s3_feather_test_ino_partitions},
82+
{0xe000, &boot_app0},
83+
{0x10000, &esp32s3_feather_test_ino},
84+
{0x2d0000, &tinyuf2},
85+
86+
#elif BIN_FILES == BIN_DEVKIT_S2
87+
{0x1000, &Blink_ino_bootloader},
88+
{0x8000, &Blink_ino_partitions},
89+
{0xe000, &boot_app0},
90+
{0x10000, &Blink_ino},
91+
92+
#elif BIN_FILES == BIN_DEVKIT_S3
93+
{0x0000, &Blink_ino_bootloader},
94+
{0x8000, &Blink_ino_partitions},
95+
{0xe000, &boot_app0},
96+
{0x10000, &Blink_ino},
97+
#endif
98+
};
99+
100+
enum { BIN_FILES_COUNT = sizeof(bin_files) / sizeof(bin_files[0]) };
101+
102+
#endif

0 commit comments

Comments
 (0)