diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb353ce0..aefe960b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,16 +97,6 @@ jobs: run: | ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]') echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV - - name: Trigger framework installation - run: platformio run -e esp32dev-all-test - - name: Replace libbtdm_app.a file - run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - - name: Verify file replacement - run: | - echo "Listing the file at the target location:" - ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/ - echo "Checking file checksum:" - md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - name: Run PlatformIO run: platformio run -e ${{ matrix.environments }} - name: Upload Assets diff --git a/.github/workflows/build_and_docs_to_dev.yml b/.github/workflows/build_and_docs_to_dev.yml index a8d4e6c4..7f527b4f 100644 --- a/.github/workflows/build_and_docs_to_dev.yml +++ b/.github/workflows/build_and_docs_to_dev.yml @@ -32,16 +32,6 @@ jobs: run: | ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]') echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV - - name: Trigger framework installation - run: platformio run -e esp32dev-all-test - - name: Replace libbtdm_app.a file - run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - - name: Verify file replacement - run: | - echo "Listing the file at the target location:" - ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/ - echo "Checking file checksum:" - md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - name: Run PlatformIO run: | export PLATFORMIO_BUILD_FLAGS="'-DDEVELOPMENTOTA=true'" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62beb7b9..19f3cf38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,16 +24,6 @@ jobs: run: | ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]') echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV - - name: Trigger framework installation - run: platformio run -e esp32dev-all-test - - name: Replace libbtdm_app.a file - run: cp lib/esp32-bt-lib/esp32/libbtdm_app.a $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - - name: Verify file replacement - run: | - echo "Listing the file at the target location:" - ls -ltr $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/ - echo "Checking file checksum:" - md5sum $HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/ld/libbtdm_app.a - name: Run PlatformIO run: platformio run - name: Prepare Release Assets diff --git a/environments.ini b/environments.ini index f6a4c6bd..22bc9ac2 100644 --- a/environments.ini +++ b/environments.ini @@ -51,6 +51,7 @@ custom_hardware = RFBridge v1 [env:theengs-bridge] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -89,6 +90,7 @@ custom_hardware = Theengs Bridge gateway ethernet [env:esp32dev-all-test] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -279,6 +281,7 @@ custom_description = Infrared (Emitting and receiving) using IRremoteESP8266 [env:esp32dev-ble] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -295,6 +298,7 @@ custom_description = Regular BLE gateway with adaptive scanning activated, autom [env:esp32dev-ble-mqtt-undecoded] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -312,6 +316,7 @@ custom_description = BLE gateway with the decoding offloaded to Theengs Gateway [env:esp32dev-ble-aws] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -336,6 +341,7 @@ custom_description = BLE gateway with AWS integration capability [env:esp32feather-ble] platform = ${com.esp32_platform} board = featheresp32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -353,6 +359,7 @@ custom_hardware = ESP32 Feather Adafruit [env:esp32-lolin32lite-ble] platform = ${com.esp32_platform} board = lolin32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -382,6 +389,7 @@ custom_hardware = LOLIN 32 Lite [env:esp32-olimex-gtw-ble-eth] platform = ${com.esp32_platform} board = esp32-gateway +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -401,6 +409,7 @@ custom_hardware = OLIMEX ESP32 Gateway [env:esp32-olimex-gtw-ble-poe] platform = ${com.esp32_platform} board = esp32-poe +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -417,6 +426,7 @@ custom_hardware = OLIMEX ESP32 Gateway with POE [env:esp32-olimex-gtw-ble-poe-iso] platform = ${com.esp32_platform} board = esp32-poe-iso +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -433,6 +443,7 @@ custom_hardware = OLIMEX ESP32 Gateway with POE and ISO [env:esp32-wt32-eth01-ble-eth] platform = ${com.esp32_platform} board = esp32-gateway +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -452,6 +463,7 @@ custom_hardware = WT32 [env:esp32-olimex-gtw-ble-wifi] platform = ${com.esp32_platform} board = esp32-gateway +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -470,6 +482,7 @@ custom_hardware = OLIMEX ESP32 Gateway [env:esp32-m5stick-ble] platform = ${com.esp32_platform} board = m5stack-core-esp32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -493,6 +506,7 @@ custom_hardware = M5Stick Grey [env:esp32-m5stack-ble] platform = ${com.esp32_platform} board = m5stack-core-esp32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -517,6 +531,7 @@ custom_hardware = M5Stack Core [env:esp32-m5tough-ble] platform = ${com.esp32_platform} board = m5stack-core-esp32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -535,6 +550,7 @@ custom_hardware = M5Tough rugged [env:esp32-m5stick-c-ble] platform = ${com.esp32_platform} board = m5stick-c +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -565,6 +581,7 @@ custom_hardware = M5Stick C [env:esp32-m5stick-cp-ble] platform = ${com.esp32_platform} board = pico32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -595,6 +612,7 @@ custom_hardware = M5Stick CP [env:esp32-m5atom-matrix] platform = ${com.esp32_platform} board = pico32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -620,6 +638,7 @@ custom_hardware = M5 ATOM Matrix [env:esp32-m5atom-lite] platform = ${com.esp32_platform} board = pico32 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -826,6 +845,7 @@ custom_hardware = ESP32 HELTEC LORA32 V2 [env:heltec-ble] platform = ${com.esp32_platform} board = heltec_wifi_lora_32_V2 +extra_scripts = ${com-esp32.extra_scripts} ; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h board_build.partitions = min_spiffs.csv lib_deps = @@ -912,6 +932,7 @@ custom_hardware = ESP32 LILYGO LoRa32 V2.1 [env:lilygo-ble] platform = ${com.esp32_platform} board = ttgo-lora32-v21 +extra_scripts = ${com-esp32.extra_scripts} ; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h board_build.partitions = min_spiffs.csv lib_deps = @@ -988,6 +1009,7 @@ custom_description = Multi RF library with the possibility to switch between ESP [env:tinypico-ble] platform = ${com.esp32_platform} board = tinypico +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -1051,6 +1073,7 @@ custom_hardware = ESP32 LILYGO LoRa32 V2.1 # https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 platform = ${com.esp32_platform} board = ttgo-t-beam +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -1108,6 +1131,7 @@ custom_hardware = ESP32 HELTEC LORA32 [env:shelly-plus1] platform = ${com.esp32_solo_platform} board = esp32-solo1 +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -1563,6 +1587,7 @@ custom_description = FastLed control [env:esp32dev-ble-datatest] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} @@ -1756,6 +1781,7 @@ custom_hardware = M5Stamp C3 [env:thingpulse-espgateway] platform = ${com.esp32_platform} board = esp32dev +extra_scripts = ${com-esp32.extra_scripts} board_build.partitions = min_spiffs.csv lib_deps = ${com-esp32.lib_deps} diff --git a/platformio.ini b/platformio.ini index 1e612c92..6c513729 100644 --- a/platformio.ini +++ b/platformio.ini @@ -190,6 +190,7 @@ build_flags = ;'-DCORE_DEBUG_LEVEL=4' [com-esp32] ; Used by all ESP32 based builds +extra_scripts = pre:scripts/replace_lib.py lib_deps = ${env.lib_deps} ${libraries.wifimanager32} diff --git a/scripts/replace_lib.py b/scripts/replace_lib.py new file mode 100644 index 00000000..82e09e28 --- /dev/null +++ b/scripts/replace_lib.py @@ -0,0 +1,28 @@ + +import shutil +import os +import hashlib +Import("env") + +def calculate_md5(filepath): + md5_hash = hashlib.md5() + with open(filepath, "rb") as f: + for byte_block in iter(lambda: f.read(4096), b""): + md5_hash.update(byte_block) + return md5_hash.hexdigest() + +def main(): + print(f"Pre build BLE library replacement script") + home_path = os.environ.get('HOME') or os.environ.get('USERPROFILE') + source_file = 'lib/esp32-bt-lib/esp32/libbtdm_app.a' + destination_file = os.path.join(home_path, '.platformio', 'packages', 'framework-arduinoespressif32', 'tools', 'sdk', 'esp32', 'ld', 'libbtdm_app.a') + + try: + shutil.copyfile(source_file, destination_file) + md5_hash = calculate_md5(destination_file) + print(f"Successfully copied {source_file} to {destination_file}") + print(f"MD5: {md5_hash}") + except Exception as e: + print(f"Error occurred: {e}") + +main()