Skip to content

Commit f6940cc

Browse files
PontusOPontus Oldberg
andauthored
Adds support for ESP Hosted to WiFi/BLE boards and adds a menu item for ESP WiFi selection (#2468)
* Adds a menu item for selecting type of ESP wifi type. * Updated pin definitions to work with ESP hosted. * Fixed residual debug modification. * Added ESPHost support library. * Removed local cloning of ESPHost and added to excluded from CI * Updated boards.txt --------- Co-authored-by: Pontus Oldberg <[email protected]>
1 parent 5830cd8 commit f6940cc

File tree

11 files changed

+389
-165
lines changed

11 files changed

+389
-165
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@
4646
[submodule "cores/rp2040/tlsf"]
4747
path = lib/tlsf
4848
url = https://github.com/earlephilhower/tlsf.git
49+
[submodule "libraries/ESPHost"]
50+
path = libraries/ESPHost
51+
url = https://github.com/Networking-for-Arduino/ESPHost.git

boards.txt

Lines changed: 343 additions & 142 deletions
Large diffs are not rendered by default.

libraries/ESPHost

Submodule ESPHost added at 1476391

platform.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ build.libpicow=libipv4.a
108108
build.boot2=boot2_generic_03h_4_padded_checksum
109109
build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1
110110
build.wificc=-DWIFICC=CYW43_COUNTRY_WORLDWIDE
111+
build.espwifitype=
111112
build.debugscript=picoprobe_cmsis_dap.tcl
112113
build.picodebugflags=
113114
build.variantdefines=
@@ -126,10 +127,10 @@ pluggable_discovery.rp2040.pattern="{runtime.platform.path}/system/python3/pytho
126127
recipe.hooks.sketch.prebuild.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/signing.py" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
127128

128129
## Compile c files
129-
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {includes} "{source_file}" -o "{object_file}"
130+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} {build.espwifitype} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {includes} "{source_file}" -o "{object_file}"
130131

131132
## Compile c++ files
132-
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" -I "{build.path}/core" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {build.wificc} {includes} "{source_file}" -o "{object_file}"
133+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" -I "{build.path}/core" {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.espwifitype} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {build.wificc} {includes} "{source_file}" -o "{object_file}"
133134

134135
## Compile S files
135136
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}"

tests/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ EOL
2727
fi
2828
# Add items to the following list with "\n" netween them to skip running. No spaces, tabs, etc. allowed
2929
read -d '' skiplist << EOL || true
30+
/ESPHost/
3031
/#attic/
3132
/AvrAdcLogger/
3233
/examplesV1/
@@ -187,7 +188,6 @@ function install_libraries()
187188
{ test -r Adafruit_CircuitPlayground-1.11.3.zip || curl -sS --output Adafruit_CircuitPlayground-1.11.3.zip -L https://github.com/adafruit/Adafruit_CircuitPlayground/archive/refs/tags/1.11.3.zip; } && unzip -qo Adafruit_CircuitPlayground-1.11.3.zip
188189
{ test -r Adafruit_NeoPixel-1.8.1.zip || curl -sS --output Adafruit_NeoPixel-1.8.1.zip -L https://github.com/adafruit/Adafruit_NeoPixel/archive/refs/tags/1.8.1.zip; } && unzip -qo Adafruit_NeoPixel-1.8.1.zip
189190
{ test -r Arduino_MIDI_Library-5.0.2.zip || curl -sS --output Arduino_MIDI_Library-5.0.2.zip -L https://github.com/FortySevenEffects/arduino_midi_library/archive/refs/tags/5.0.2.zip; } && unzip -qo Arduino_MIDI_Library-5.0.2.zip
190-
git clone https://github.com/JAndrassy/ESPHost.git
191191
popd
192192
}
193193

tools/json/challenger_2040_wifi_ble.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"core": "earlephilhower",
1111
"cpu": "cortex-m0plus",
12-
"extra_flags": "-DARDUINO_CHALLENGER_2040_WIFI_BLE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DWIFIESPAT2",
12+
"extra_flags": "-DARDUINO_CHALLENGER_2040_WIFI_BLE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
1313
"f_cpu": "133000000L",
1414
"hwids": [
1515
[

tools/json/challenger_2350_wifi6_ble5.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"core": "earlephilhower",
1111
"cpu": "cortex-m33",
12-
"extra_flags": "-DARDUINO_CHALLENGER_2350_WIFI_BLE_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DWIFIESPAT2",
12+
"extra_flags": "-DARDUINO_CHALLENGER_2350_WIFI_BLE_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
1313
"f_cpu": "150000000L",
1414
"hwids": [
1515
[

tools/makeboards.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,16 @@ def BuildGlobalMenuList():
274274
print("menu.boot2=Boot Stage 2")
275275
print("menu.wificountry=WiFi Region")
276276
print("menu.usbstack=USB Stack")
277+
print("menu.espwifitype=ESP Wifi Type")
277278
print("menu.ipbtstack=IP/Bluetooth Stack")
278279
print("menu.uploadmethod=Upload Method")
279280

281+
def BuildWifiType(name):
282+
print("%s.menu.espwifitype.esp_at=ESP AT" % (name))
283+
print("%s.menu.espwifitype.esp_at.build.espwifitype=-DWIFIESPAT2" % (name))
284+
print("%s.menu.espwifitype.esp_hosted=ESP Hosted" % (name))
285+
print("%s.menu.espwifitype.esp_hosted.build.espwifitype=-DESPHOSTSPI=SPI1" % (name))
286+
280287
def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, psramsize, boot2, extra = None, board_url = None):
281288
fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
282289
for i in range(1, flashsizemb):
@@ -305,6 +312,11 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
305312
BuildFlashMenu(name, chip, 2*1024*1024, [0, 1*1024*1024])
306313
BuildFlashMenu(name, chip, 8*1024*1024, [0, 7*1024*1024, 4*1024*1024, 2*1024*1024])
307314
BuildFlashMenu(name, chip, 16*1024*1024, [0, 15*1024*1024, 14*1024*1024, 12*1024*1024, 8*1024*1024, 4*1024*1024, 2*1024*1024])
315+
elif (name == "challenger_2350_wifi6_ble5") or (name == "challenger_2040_wifi_ble"):
316+
BuildWifiType(name)
317+
BuildCountry(name)
318+
BuildFlashMenu(name, chip, 8*1024*1024, [0, 7*1024*1024, 4*1024*1024, 2*1024*1024])
319+
BuildFlashMenu(name, chip, 16*1024*1024, [0, 15*1024*1024, 14*1024*1024, 12*1024*1024, 8*1024*1024, 4*1024*1024, 2*1024*1024])
308320
else:
309321
BuildFlashMenu(name, chip, flashsizemb * 1024 * 1024, fssizelist)
310322
if chip == "rp2350":
@@ -520,15 +532,15 @@ def MakeBoardJSON(name, chip, vendor_name, product_name, vid, pid, pwr, boarddef
520532
MakeBoard("challenger_2040_lora", "rp2040", "iLabs", "Challenger 2040 LoRa", "0x2e8a", "0x1023", 250, "CHALLENGER_2040_LORA_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
521533
MakeBoard("challenger_2040_subghz", "rp2040", "iLabs", "Challenger 2040 SubGHz", "0x2e8a", "0x1032", 250, "CHALLENGER_2040_SUBGHZ_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
522534
MakeBoard("challenger_2040_wifi", "rp2040", "iLabs", "Challenger 2040 WiFi", "0x2e8a", "0x1006", 250, "CHALLENGER_2040_WIFI_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
523-
MakeBoard("challenger_2040_wifi_ble", "rp2040", "iLabs", "Challenger 2040 WiFi/BLE", "0x2e8a", "0x102C", 500, "CHALLENGER_2040_WIFI_BLE_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
535+
MakeBoard("challenger_2040_wifi_ble", "rp2040", "iLabs", "Challenger 2040 WiFi/BLE", "0x2e8a", "0x102C", 500, "CHALLENGER_2040_WIFI_BLE_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
524536
MakeBoard("challenger_2040_wifi6_ble", "rp2040", "iLabs", "Challenger 2040 WiFi6/BLE", "0x2e8a", "0x105F", 500, "CHALLENGER_2040_WIFI6_BLE_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
525537
MakeBoard("challenger_nb_2040_wifi", "rp2040", "iLabs", "Challenger NB 2040 WiFi", "0x2e8a", "0x100d", 500, "CHALLENGER_NB_2040_WIFI_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
526538
MakeBoard("challenger_2040_sdrtc", "rp2040", "iLabs", "Challenger 2040 SD/RTC", "0x2e8a", "0x102d", 250, "CHALLENGER_2040_SDRTC_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
527539
MakeBoard("challenger_2040_nfc", "rp2040", "iLabs", "Challenger 2040 NFC", "0x2e8a", "0x1036", 250, "CHALLENGER_2040_NFC_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
528540
MakeBoard("challenger_2040_uwb", "rp2040", "iLabs", "Challenger 2040 UWB", "0x2e8a", "0x1052", 500, "CHALLENGER_2040_UWB_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
529541
MakeBoard("connectivity_2040_lte_wifi_ble", "rp2040", "iLabs", "Connectivity 2040 LTE/WiFi/BLE", "0x2e8a", "0x107b", 500, "CONNECTIVITY_2040_LTE_WIFI_BLE_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
530542
MakeBoard("ilabs_rpico32", "rp2040", "iLabs", "RPICO32", "0x2e8a", "0x1010", 250, "ILABS_2040_RPICO32_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
531-
MakeBoard("challenger_2350_wifi6_ble5", "rp2350", "iLabs", "Challenger 2350 WiFi/BLE", "0x2e8a", "0x109a", 500, "CHALLENGER_2350_WIFI_BLE_RP2350", 8, 8, "boot2_generic_03h_2_padded_checksum", ["WIFIESPAT2"])
543+
MakeBoard("challenger_2350_wifi6_ble5", "rp2350", "iLabs", "Challenger 2350 WiFi/BLE", "0x2e8a", "0x109a", 500, "CHALLENGER_2350_WIFI_BLE_RP2350", 8, 8, "boot2_generic_03h_2_padded_checksum")
532544
MakeBoard("challenger_2350_bconnect", "rp2350", "iLabs", "Challenger 2350 BConnect", "0x2e8a", "0x109b", 500, "CHALLENGER_2350_BCONNECT_RP2350", 8, 8, "boot2_generic_03h_2_padded_checksum")
533545

534546
# Melopero

variants/challenger_2040_wifi_ble/pins_arduino.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@
3838
#define PIN_SPI1_SCK (14u)
3939
#define PIN_SPI1_SS (13u)
4040
// Handshake signal from ESP32C3
41-
#define ESP32_HS (18u)
41+
#define PIN_ESP32_HS (18u)
4242
#define ESP32_SPI SPI1
43+
// Definitions for ESP hosted
44+
#define ESPHOST_DATA_READY PIN_ESP_MODE
45+
#define ESPHOST_RESET PIN_ESP_RST
46+
#define ESPHOST_HANDSHAKE PIN_ESP32_HS
47+
#define ESPHOST_CS PIN_SPI1_SS
4348

4449
// Wire
4550
#define PIN_WIRE0_SDA (0u)
@@ -85,3 +90,14 @@ static const uint8_t A2 = (28u);
8590
static const uint8_t A3 = (29u);
8691
static const uint8_t A4 = (25u);
8792
static const uint8_t A5 = (21u);
93+
94+
static const uint8_t SS = PIN_SPI0_SS;
95+
static const uint8_t MOSI = PIN_SPI0_MOSI;
96+
static const uint8_t MISO = PIN_SPI0_MISO;
97+
static const uint8_t SCK = PIN_SPI0_SCK;
98+
99+
static const uint8_t SDA = PIN_WIRE0_SDA;
100+
static const uint8_t SCL = PIN_WIRE0_SCL;
101+
102+
static const uint8_t RX = PIN_SERIAL1_RX;
103+
static const uint8_t TX = PIN_SERIAL1_TX;

variants/challenger_2350_wifi6_ble5/ChallengerWiFi.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,11 @@ bool Challenger2040WiFiClass::waitForReady() {
6969
return false;
7070
}
7171

72-
int esp_host_spi_init(void);
7372
// Reset the ESP and wait for the "ready" prompt to be returned.
7473
bool Challenger2040WiFiClass::reset() {
75-
#if defined(WIFIESPAT2)
7674
runReset();
77-
delay(100);
78-
7975
_serial->begin(DEFAULT_ESP_BAUDRATE);
8076
return waitForReady();
81-
#else
82-
esp_host_spi_init();
83-
return true;
84-
#endif
8577
}
8678

8779
// Checks to see if the modem responds to the "AT" poll command.

0 commit comments

Comments
 (0)