From 9545a10361203a6e1c24c3512b6f28a7e136802a Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:20:20 +0100 Subject: [PATCH 1/8] RP2040: Update core; add mDNS support (#5355) * Update arduino-pico core * RP2040: Add mDNS support * SimpleMDNS `begin` now returns a bool * Add `-g` option to `debug_build_flags` to link files for gdb * RAK11310 needs old platform as well * Change defines to specific architecture * Core version 4.2.1 is out --- arch/rp2xx0/rp2040.ini | 6 +++--- arch/rp2xx0/rp2350.ini | 4 ++-- src/mesh/wifi/WiFiAPClient.cpp | 24 ++++++++++++++---------- variants/rak11310/platformio.ini | 3 ++- variants/rp2040-lora/platformio.ini | 2 +- variants/rpipico/platformio.ini | 2 +- variants/rpipico2/platformio.ini | 2 +- variants/rpipicow/platformio.ini | 2 +- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/arch/rp2xx0/rp2040.ini b/arch/rp2xx0/rp2040.ini index 17b5df618b..57e5d7bc2f 100644 --- a/arch/rp2xx0/rp2040.ini +++ b/arch/rp2xx0/rp2040.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2040_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.0.3 +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.2.1 board_build.core = earlephilhower board_build.filesystem_size = 0.5m @@ -23,4 +23,4 @@ lib_deps = ${arduino_base.lib_deps} ${environmental_base.lib_deps} ${radiolib_base.lib_deps} - rweather/Crypto \ No newline at end of file + rweather/Crypto diff --git a/arch/rp2xx0/rp2350.ini b/arch/rp2xx0/rp2350.ini index 33bb36ad16..58c5e5554c 100644 --- a/arch/rp2xx0/rp2350.ini +++ b/arch/rp2xx0/rp2350.ini @@ -1,8 +1,8 @@ ; Common settings for rp2040 Processor based targets [rp2350_base] -platform = https://github.com/maxgerhardt/platform-raspberrypi.git#9e55f6db5c56b9867c69fe473f388beea4546672 +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#a606be683748c73e9a0d46baf70163478d298f0f ; For arduino-pico 4.2.0 extends = arduino_base -platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#a6ab6e1f95bc1428d667d55ea7173c0744acc03c ; 4.0.2+ +platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.2.1 board_build.core = earlephilhower board_build.filesystem_size = 0.5m diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index faf5ce3de8..911a47093e 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -20,6 +20,8 @@ #include #include static void WiFiEvent(WiFiEvent_t event); +#elif defined(ARCH_RP2040) +#include #endif #ifndef DISABLE_NTP @@ -59,19 +61,21 @@ static void onNetworkConnected() // Start web server LOG_INFO("Start WiFi network services"); -#ifdef ARCH_ESP32 // start mdns if (!MDNS.begin("Meshtastic")) { LOG_ERROR("Error setting up MDNS responder!"); } else { - LOG_INFO("mDNS responder started"); LOG_INFO("mDNS Host: Meshtastic.local"); +#ifdef ARCH_ESP32 MDNS.addService("http", "tcp", 80); MDNS.addService("https", "tcp", 443); - } -#else // ESP32 handles this in WiFiEvent - LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str()); +#elif defined(ARCH_RP2040) + // ARCH_RP2040 does not support HTTPS, create a "meshtastic" service + MDNS.addService("meshtastic", "tcp", 4403); + // ESP32 handles this in WiFiEvent + LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str()); #endif + } #ifndef DISABLE_NTP LOG_INFO("Start NTP time client"); @@ -129,7 +133,7 @@ static int32_t reconnectWiFi() // Make sure we clear old connection credentials #ifdef ARCH_ESP32 WiFi.disconnect(false, true); -#else +#elif defined(ARCH_RP2040) WiFi.disconnect(false); #endif LOG_INFO("Reconnecting to WiFi access point %s", wifiName); @@ -193,7 +197,7 @@ void deinitWifi() if (isWifiAvailable()) { #ifdef ARCH_ESP32 WiFi.disconnect(true, false); -#else +#elif defined(ARCH_RP2040) WiFi.disconnect(true); #endif WiFi.mode(WIFI_OFF); @@ -229,15 +233,15 @@ bool initWifi() if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC && config.network.ipv4_config.ip != 0) { -#ifndef ARCH_RP2040 +#ifdef ARCH_ESP32 WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet, config.network.ipv4_config.dns); -#else +#elif defined(ARCH_RP2040) WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet); #endif } -#ifndef ARCH_RP2040 +#ifdef ARCH_ESP32 WiFi.onEvent(WiFiEvent); WiFi.setAutoReconnect(true); WiFi.setSleep(false); diff --git a/variants/rak11310/platformio.ini b/variants/rak11310/platformio.ini index c7b3504fed..923cedaa37 100644 --- a/variants/rak11310/platformio.ini +++ b/variants/rak11310/platformio.ini @@ -3,6 +3,7 @@ extends = rp2040_base board = wiscore_rak11300 upload_protocol = picotool # keep an old SDK to use less memory. +platform = https://github.com/maxgerhardt/platform-raspberrypi.git#v1.2.0-gcc12 platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#3.7.2 # add our variants files to the include and src paths @@ -13,5 +14,5 @@ build_flags = ${rp2040_base.build_flags} -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} -debug_build_flags = ${rp2040_base.build_flags} +debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rp2040-lora/platformio.ini b/variants/rp2040-lora/platformio.ini index 8499f6f3c6..4c578fb2b5 100644 --- a/variants/rp2040-lora/platformio.ini +++ b/variants/rp2040-lora/platformio.ini @@ -12,5 +12,5 @@ build_flags = ${rp2040_base.build_flags} -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} -debug_build_flags = ${rp2040_base.build_flags} +debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rpipico/platformio.ini b/variants/rpipico/platformio.ini index e4b9e479f5..9c62ebcb5e 100644 --- a/variants/rpipico/platformio.ini +++ b/variants/rpipico/platformio.ini @@ -12,5 +12,5 @@ build_flags = ${rp2040_base.build_flags} -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2040_base.lib_deps} -debug_build_flags = ${rp2040_base.build_flags} +debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rpipico2/platformio.ini b/variants/rpipico2/platformio.ini index a634144187..24714efd57 100644 --- a/variants/rpipico2/platformio.ini +++ b/variants/rpipico2/platformio.ini @@ -12,5 +12,5 @@ build_flags = ${rp2350_base.build_flags} -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus" lib_deps = ${rp2350_base.lib_deps} -debug_build_flags = ${rp2350_base.build_flags} +debug_build_flags = ${rp2350_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file diff --git a/variants/rpipicow/platformio.ini b/variants/rpipicow/platformio.ini index 2600b4b38e..7a43ece3bf 100644 --- a/variants/rpipicow/platformio.ini +++ b/variants/rpipicow/platformio.ini @@ -14,5 +14,5 @@ build_src_filter = ${rp2040_base.build_src_filter} + lib_deps = ${rp2040_base.lib_deps} ${networking_base.lib_deps} -debug_build_flags = ${rp2040_base.build_flags} +debug_build_flags = ${rp2040_base.build_flags}, -g debug_tool = cmsis-dap ; for e.g. Picotool \ No newline at end of file From 90a3050c1fbe711df4096885a03c87d98317d819 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 16 Nov 2024 12:01:41 +0800 Subject: [PATCH 2/8] Add sudo to apt-get commands for Raspbian Build (#5364) Without sudo, inadequate permissions to runs the commands meant the build was failing. --- .github/workflows/build_raspbian.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 1fd8fad307..66c65a3474 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -13,8 +13,8 @@ jobs: - name: Install libbluetooth shell: bash run: | - apt-get update -y --fix-missing - apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev + sudo apt-get update -y --fix-missing + sudp apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev - name: Checkout code uses: actions/checkout@v4 From 1b99543a1558ddfeeb7e7e2c88ef905ce79b5d12 Mon Sep 17 00:00:00 2001 From: Tom Fifield Date: Sat, 16 Nov 2024 12:48:15 +0800 Subject: [PATCH 3/8] Typo fix in build_raspbian.yml (#5365) s/sudp/sudo :(:(:( --- .github/workflows/build_raspbian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_raspbian.yml b/.github/workflows/build_raspbian.yml index 66c65a3474..e857ae6356 100644 --- a/.github/workflows/build_raspbian.yml +++ b/.github/workflows/build_raspbian.yml @@ -14,7 +14,7 @@ jobs: shell: bash run: | sudo apt-get update -y --fix-missing - sudp apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev + sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev - name: Checkout code uses: actions/checkout@v4 From add70b522910bd94a4e9efbdcad7750707e98b0c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 16 Nov 2024 05:58:07 -0600 Subject: [PATCH 4/8] Rework some things --- .github/actions/build-variant/action.yml | 1 + arch/nrf52/nrf52.ini | 1 + src/mesh/mesh-pb-constants.h | 6 +----- version.properties | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index 80d2a56bbb..e0c5fba063 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -51,6 +51,7 @@ runs: file: build.tar target: build.tar token: ${{ inputs.github_token }} + version: v2.5.3 - name: Unpack web ui if: inputs.include-web-ui == 'true' diff --git a/arch/nrf52/nrf52.ini b/arch/nrf52/nrf52.ini index 99e8693dc2..d75f863064 100644 --- a/arch/nrf52/nrf52.ini +++ b/arch/nrf52/nrf52.ini @@ -16,6 +16,7 @@ build_flags = -DLFS_NO_ASSERT ; Disable LFS assertions , see https://github.com/meshtastic/firmware/pull/3818 -DMESHTASTIC_EXCLUDE_AUDIO=1 -DMESHTASTIC_EXCLUDE_PAXCOUNTER=1 + -DMAX_NUM_NODES=80 build_src_filter = ${arduino_base.build_src_filter} - - - - - - - - - - diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index a055804d96..df7ae89e6c 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -1,7 +1,7 @@ #pragma once #include -#include "architecture.h" + #include "mesh/generated/meshtastic/admin.pb.h" #include "mesh/generated/meshtastic/deviceonly.pb.h" #include "mesh/generated/meshtastic/localonly.pb.h" @@ -21,12 +21,8 @@ /// max number of nodes allowed in the mesh #ifndef MAX_NUM_NODES -#ifdef ARCH_NRF52 -#define MAX_NUM_NODES 80 -#else #define MAX_NUM_NODES 100 #endif -#endif #define MAX_NUM_NODES_FS 100 diff --git a/version.properties b/version.properties index bed14bad54..091ebde9eb 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 5 -build = 14 +build = 13 From fdc473e5faf5d97a58629491559718a504c2364f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 16 Nov 2024 06:01:07 -0600 Subject: [PATCH 5/8] Trunk --- src/mesh/mesh-pb-constants.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index df7ae89e6c..039b36d8d2 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -1,7 +1,6 @@ #pragma once #include - #include "mesh/generated/meshtastic/admin.pb.h" #include "mesh/generated/meshtastic/deviceonly.pb.h" #include "mesh/generated/meshtastic/localonly.pb.h" From be6348388edcb170231bbb75c04b343a5d0db8a6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 16 Nov 2024 06:12:45 -0600 Subject: [PATCH 6/8] Separate littlefs bundle --- bin/build-esp32.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index adb6ab12ad..b5f7c126e7 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -35,6 +35,10 @@ cp $SRCBIN $OUTDIR/$basename-update.bin echo "Building Filesystem for ESP32 targets" pio run --environment $1 -t buildfs +cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$VERSION.bin +# Remove webserver files from the filesystem and rebuild +rm -rf data/static +pio run --environment $1 -t buildfs cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$VERSION.bin cp bin/device-install.* $OUTDIR cp bin/device-update.* $OUTDIR From ca3d8da128b6473a5578f1416c909a92f9750a3c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 16 Nov 2024 06:22:08 -0600 Subject: [PATCH 7/8] version tags --- .github/actions/build-variant/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index e0c5fba063..b3303d393a 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -51,7 +51,7 @@ runs: file: build.tar target: build.tar token: ${{ inputs.github_token }} - version: v2.5.3 + version: tags/v2.5.3 - name: Unpack web ui if: inputs.include-web-ui == 'true' From 74d0c58576bd43c24d0bfb68aec86f3da36979a3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 16 Nov 2024 06:24:10 -0600 Subject: [PATCH 8/8] Diag --- bin/build-esp32.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index b5f7c126e7..f8d808ced6 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -37,6 +37,7 @@ echo "Building Filesystem for ESP32 targets" pio run --environment $1 -t buildfs cp .pio/build/$1/littlefs.bin $OUTDIR/littlefswebui-$VERSION.bin # Remove webserver files from the filesystem and rebuild +ls -l data/static # Diagnostic list of files rm -rf data/static pio run --environment $1 -t buildfs cp .pio/build/$1/littlefs.bin $OUTDIR/littlefs-$VERSION.bin