From e8b1d84985cb8fea63f3023a8227c4b9b81697d6 Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Wed, 27 Nov 2024 20:55:31 +0300 Subject: [PATCH] [RP2XXX] more of RP2350 build infra --- .github/workflows/main.yml | 6 ++- .../source/SkyView/Platform_RP2040.cpp | 12 +++++ .../firmware/source/SkyView/Platform_RP2040.h | 2 + software/firmware/source/SkyView/SoCHelper.h | 10 +++- .../source/SkyWatch/Platform_RP2040.cpp | 10 ++++ .../source/SkyWatch/Platform_RP2040.h | 2 + software/firmware/source/SkyWatch/SoCHelper.h | 10 +++- .../source/SoftRF/src/driver/WiFi.cpp | 3 +- .../source/SoftRF/src/platform/RP2XXX.cpp | 25 ++++++---- .../source/SoftRF/src/platform/RP2XXX.h | 2 +- .../firmware/source/SoftRF/src/ui/Web.cpp | 48 +++++++++++-------- 11 files changed, 96 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4c09788e..fc2907143 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,10 @@ jobs: 'arduino:renesas_uno:unor4wifi', 'rp2040:rp2040:generic', 'rp2040:rp2040:rpipicow', - 'rp2040:rp2040:rpipico2', + 'rp2040:rp2040:rpipico2:arch=arm', + 'rp2040:rp2040:rpipico2:arch=riscv', + #'rp2040:rp2040:rpipico2w:arch=arm', + #'rp2040:rp2040:rpipico2w:arch=riscv', 'arduino:mbed_rp2040:pico', #'arduino:mbed_nano:nanorp2040connect', 'SiliconLabs:silabs:nano_matter:protocol_stack=ble_arduino', @@ -408,6 +411,7 @@ jobs: if [[ "$BOARD" =~ "rp2040:rp2040:" ]]; then arduino --pref "boardsmanager.additional.urls=https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" --save-prefs ; arduino --install-boards rp2040:rp2040:4.2.1 ; + #arduino --install-boards rp2040:rp2040:4.3.0 ; arduino --board $BOARD --save-prefs ; if [[ "$BOARD" =~ "rp2040:rp2040:rpipicow" ]]; then arduino --pref "custom_freq=rpipicow_120" --save-prefs ; diff --git a/software/firmware/source/SkyView/Platform_RP2040.cpp b/software/firmware/source/SkyView/Platform_RP2040.cpp index 0c4ee6f00..6f84aede6 100644 --- a/software/firmware/source/SkyView/Platform_RP2040.cpp +++ b/software/firmware/source/SkyView/Platform_RP2040.cpp @@ -504,7 +504,9 @@ static void RP2040_fini() #if defined(ARDUINO_RASPBERRY_PI_PICO_W) if (RP2040_board == RP2040_RPIPICO_W) { if (cyw43_is_initialized(&cyw43_state)) cyw43_arch_deinit(); +#if !(ARDUINO_PICO_MAJOR == 4 && ARDUINO_PICO_MINOR == 3 && ARDUINO_PICO_REVISION == 0) pinMode(CYW43_PIN_WL_REG_ON, INPUT_PULLDOWN); +#endif } #endif /* ARDUINO_RASPBERRY_PI_PICO_W */ @@ -1792,8 +1794,18 @@ IODev_ops_t RP2040_USBSerial_ops = { }; const SoC_ops_t RP2040_ops = { +#if defined(PICO_RP2350) +#if defined(PICO_RISCV) + SOC_RP2350_RISC, + "RP2350-RISC", +#else + SOC_RP2350_ARM, + "RP2350-ARM", +#endif /* PICO_RISCV */ +#else SOC_RP2040, "RP2040", +#endif /* PICO_RP2350 */ RP2040_setup, RP2040_post_init, RP2040_loop, diff --git a/software/firmware/source/SkyView/Platform_RP2040.h b/software/firmware/source/SkyView/Platform_RP2040.h index 2c17fd19c..30116c7d2 100644 --- a/software/firmware/source/SkyView/Platform_RP2040.h +++ b/software/firmware/source/SkyView/Platform_RP2040.h @@ -65,6 +65,8 @@ enum RP2040_board_id { RP2040_RPIPICO, RP2040_RPIPICO_W, RP2040_WEACT, + RP2350_RPIPICO_2, + RP2350_RPIPICO_2W, }; /* Console I/O */ diff --git a/software/firmware/source/SkyView/SoCHelper.h b/software/firmware/source/SkyView/SoCHelper.h index ddb9ae94b..10fce9301 100644 --- a/software/firmware/source/SkyView/SoCHelper.h +++ b/software/firmware/source/SkyView/SoCHelper.h @@ -74,8 +74,11 @@ enum SOC_ESP32, SOC_ESP32S2, SOC_ESP32S3, + SOC_ESP32C2, SOC_ESP32C3, SOC_ESP32C6, + SOC_ESP32H2, + SOC_ESP32P4, SOC_RPi, SOC_CC13X0, SOC_CC13X2, @@ -86,7 +89,12 @@ enum SOC_SAMD, SOC_AVR, SOC_ASR66, - SOC_RP2040 + SOC_RP2040, + SOC_RP2350_ARM, + SOC_RP2350_RISC, + SOC_RA4M1, + SOC_EFR32, + SOC_CH32 }; extern const SoC_ops_t *SoC; diff --git a/software/firmware/source/SkyWatch/Platform_RP2040.cpp b/software/firmware/source/SkyWatch/Platform_RP2040.cpp index 08f1e2c20..840b56b9e 100644 --- a/software/firmware/source/SkyWatch/Platform_RP2040.cpp +++ b/software/firmware/source/SkyWatch/Platform_RP2040.cpp @@ -871,8 +871,18 @@ IODev_ops_t RP2040_USBSerial_ops = { }; const SoC_ops_t RP2040_ops = { +#if defined(PICO_RP2350) +#if defined(PICO_RISCV) + SOC_RP2350_RISC, + "RP2350-RISC", +#else + SOC_RP2350_ARM, + "RP2350-ARM", +#endif /* PICO_RISCV */ +#else SOC_RP2040, "RP2040", +#endif /* PICO_RP2350 */ RP2040_setup, RP2040_post_init, RP2040_loop, diff --git a/software/firmware/source/SkyWatch/Platform_RP2040.h b/software/firmware/source/SkyWatch/Platform_RP2040.h index d3c960d75..6a2e3f6a6 100644 --- a/software/firmware/source/SkyWatch/Platform_RP2040.h +++ b/software/firmware/source/SkyWatch/Platform_RP2040.h @@ -56,6 +56,8 @@ enum RP2040_board_id { RP2040_RPIPICO, RP2040_RPIPICO_W, RP2040_WEACT, + RP2350_RPIPICO_2, + RP2350_RPIPICO_2W, }; /* Console I/O */ diff --git a/software/firmware/source/SkyWatch/SoCHelper.h b/software/firmware/source/SkyWatch/SoCHelper.h index 149d38924..06e31ba83 100644 --- a/software/firmware/source/SkyWatch/SoCHelper.h +++ b/software/firmware/source/SkyWatch/SoCHelper.h @@ -71,8 +71,11 @@ enum SOC_ESP32, SOC_ESP32S2, SOC_ESP32S3, + SOC_ESP32C2, SOC_ESP32C3, SOC_ESP32C6, + SOC_ESP32H2, + SOC_ESP32P4, SOC_RPi, SOC_CC13X0, SOC_CC13X2, @@ -83,7 +86,12 @@ enum SOC_SAMD, SOC_AVR, SOC_ASR66, - SOC_RP2040 + SOC_RP2040, + SOC_RP2350_ARM, + SOC_RP2350_RISC, + SOC_RA4M1, + SOC_EFR32, + SOC_CH32 }; extern const SoC_ops_t *SoC; diff --git a/software/firmware/source/SoftRF/src/driver/WiFi.cpp b/software/firmware/source/SoftRF/src/driver/WiFi.cpp index deb5ef37f..d8e92b2c0 100644 --- a/software/firmware/source/SoftRF/src/driver/WiFi.cpp +++ b/software/firmware/source/SoftRF/src/driver/WiFi.cpp @@ -223,7 +223,8 @@ void WiFi_setup() host_name += "-"; host_name += String((SoC->getChipId() & 0xFFFFFF), HEX); - if (SoC->id == SOC_ESP8266 || SoC->id == SOC_RP2040) { + if (SoC->id == SOC_ESP8266 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RP2350_ARM || SoC->id == SOC_RP2350_RISC) { WiFi.mode(WIFI_STA); if (SoC->WiFi_hostname(host_name) == false) { return; diff --git a/software/firmware/source/SoftRF/src/platform/RP2XXX.cpp b/software/firmware/source/SoftRF/src/platform/RP2XXX.cpp index 43029f17f..317e0ed5a 100644 --- a/software/firmware/source/SoftRF/src/platform/RP2XXX.cpp +++ b/software/firmware/source/SoftRF/src/platform/RP2XXX.cpp @@ -311,6 +311,7 @@ static void RP2xxx_setup() SPI1.setSCK(SOC_GPIO_PIN_SCK); #if !defined(ARDUINO_RASPBERRY_PI_PICO) && \ !defined(ARDUINO_RASPBERRY_PI_PICO_W) && \ + !defined(ARDUINO_RASPBERRY_PI_PICO_2) && \ !defined(ARDUINO_RASPBERRY_PI_PICO_2W) SPI1.setCS(SOC_GPIO_PIN_SS); #endif /* ARDUINO_RASPBERRY_PI_PICO or ARDUINO_RASPBERRY_PI_PICO_W */ @@ -340,7 +341,7 @@ static void RP2xxx_setup() #elif defined(ARDUINO_RASPBERRY_PI_PICO_W) RP2xxx_board = rp2040.isPicoW() ? RP2040_RPIPICO_W : RP2040_RPIPICO; #elif defined(ARDUINO_RASPBERRY_PI_PICO_2W) - RP2xxx_board = rp2040.isPicoW() ? RP2040_RPIPICO_2W : RP2040_RPIPICO; + RP2xxx_board = rp2040.isPicoW() ? RP2350_RPIPICO_2W : RP2350_RPIPICO_2; #endif /* ARDUINO_RASPBERRY_PI_PICO */ RP2xxx_board = (SoC->getChipId() == 0xcf516424) ? @@ -517,7 +518,7 @@ static void RP2xxx_fini(int reason) Wire.end(); #if defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ARDUINO_RASPBERRY_PI_PICO_2W) - if (RP2xxx_board == RP2040_RPIPICO_W) { + if (RP2xxx_board == RP2040_RPIPICO_W || RP2xxx_board == RP2350_RPIPICO_2W) { if (cyw43_is_initialized(&cyw43_state)) cyw43_arch_deinit(); #if !(ARDUINO_PICO_MAJOR == 4 && ARDUINO_PICO_MINOR == 3 && ARDUINO_PICO_REVISION == 0) pinMode(CYW43_PIN_WL_REG_ON, INPUT_PULLDOWN); @@ -761,7 +762,7 @@ static bool RP2xxx_WiFi_hostname(String aHostname) { bool rval = false; #if !defined(EXCLUDE_WIFI) && !defined(USE_ARDUINO_WIFI) - if (RP2xxx_board == RP2040_RPIPICO_W) { + if (RP2xxx_board == RP2040_RPIPICO_W || RP2xxx_board == RP2350_RPIPICO_2W) { WiFi.hostname(aHostname.c_str()); rval = true; } @@ -881,7 +882,8 @@ static void RP2xxx_EEPROM_extension(int cmd) #endif /* USE_USB_HOST */ #endif /* EXCLUDE_WIFI and EXCLUDE_BLUETOOTH */ - if (RP2xxx_board != RP2040_RPIPICO_W && + if (RP2xxx_board != RP2040_RPIPICO_W && + RP2xxx_board != RP2350_RPIPICO_2W && settings->bluetooth != BLUETOOTH_NONE) { settings->bluetooth = BLUETOOTH_NONE; } @@ -1520,13 +1522,18 @@ IODev_ops_t RP2xxx_USBSerial_ops = { }; const SoC_ops_t RP2xxx_ops = { -#if defined(ARDUINO_ARCH_RP2040) +#if defined(PICO_RP2350) +#if defined(PICO_RISCV) + SOC_RP2350_RISC, + "RP2350-RISC", +#else + SOC_RP2350_ARM, + "RP2350-ARM", +#endif /* PICO_RISCV */ +#else SOC_RP2040, "RP2040", -#elif defined(ARDUINO_ARCH_RP2350) - SOC_RP2350_ARM, - "RP2350", -#endif /* 2XXX */ +#endif /* PICO_RP2350 */ RP2xxx_setup, RP2xxx_post_init, RP2xxx_loop, diff --git a/software/firmware/source/SoftRF/src/platform/RP2XXX.h b/software/firmware/source/SoftRF/src/platform/RP2XXX.h index cf554ac2a..2a5ad4cfa 100644 --- a/software/firmware/source/SoftRF/src/platform/RP2XXX.h +++ b/software/firmware/source/SoftRF/src/platform/RP2XXX.h @@ -69,7 +69,7 @@ enum RP2xxx_board_id { RP2040_RPIPICO_W, RP2040_WEACT, RP2350_RPIPICO_2, - RP2040_RPIPICO_2W, + RP2350_RPIPICO_2W, }; struct rst_info { diff --git a/software/firmware/source/SoftRF/src/ui/Web.cpp b/software/firmware/source/SoftRF/src/ui/Web.cpp index 2ffbaa378..017ddd957 100644 --- a/software/firmware/source/SoftRF/src/ui/Web.cpp +++ b/software/firmware/source/SoftRF/src/ui/Web.cpp @@ -372,7 +372,8 @@ void handleSettings() { #if !defined(EXCLUDE_BLUETOOTH) /* SoC specific part 1 */ - if (SoC->id == SOC_ESP32 || SoC->id == SOC_RP2040) { + if (SoC->id == SOC_ESP32 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RP2350_ARM || SoC->id == SOC_RP2350_RISC) { snprintf_P ( offset, size, PSTR("\ \ @@ -475,9 +476,10 @@ void handleSettings() { size -= len; /* SoC specific part 2 */ - if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || - SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RP2350_ARM || SoC->id == SOC_RP2350_RISC || SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR( @@ -494,9 +496,10 @@ void handleSettings() { offset += len; size -= len; } - if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || + SoC->id == SOC_RP2040 || SoC->id == SOC_RP2350_ARM || + SoC->id == SOC_RP2350_RISC) { snprintf_P ( offset, size, PSTR(""), (settings->nmea_out == NMEA_USB ? "selected" : ""), NMEA_USB); @@ -529,9 +532,10 @@ void handleSettings() { #if !defined(EXCLUDE_BLUETOOTH) /* SoC specific part 3 */ - if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || - SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RP2350_ARM || SoC->id == SOC_RP2350_RISC || SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR(""), @@ -543,9 +547,10 @@ void handleSettings() { } #endif /* EXCLUDE_BLUETOOTH */ - if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || + SoC->id == SOC_RP2040 || SoC->id == SOC_RP2350_ARM || + SoC->id == SOC_RP2350_RISC) { snprintf_P ( offset, size, PSTR(""), (settings->gdl90 == GDL90_USB ? "selected" : ""), GDL90_USB); @@ -576,9 +581,10 @@ void handleSettings() { #if !defined(EXCLUDE_BLUETOOTH) /* SoC specific part 4 */ - if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || - SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RP2350_ARM || SoC->id == SOC_RP2350_RISC || SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR(""), @@ -590,9 +596,10 @@ void handleSettings() { } #endif /* EXCLUDE_BLUETOOTH */ - if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + if (SoC->id == SOC_ESP32S2 || SoC->id == SOC_ESP32S3 || + SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || + SoC->id == SOC_RP2040 || SoC->id == SOC_RP2350_ARM || + SoC->id == SOC_RP2350_RISC) { snprintf_P ( offset, size, PSTR(""), (settings->d1090 == D1090_USB ? "selected" : ""), D1090_USB); @@ -856,7 +863,8 @@ void handleRoot() { #endif /* ENABLE_RECORDER */ /* SoC specific part 1 */ - if (SoC->id != SOC_RP2040 && SoC->id != SOC_RA4M1) { + if (SoC->id != SOC_RP2040 && SoC->id != SOC_RP2350_ARM && + SoC->id != SOC_RP2350_RISC && SoC->id != SOC_RA4M1) { snprintf_P ( offset, size, PSTR("\ ")); len = strlen(offset);