vovagorodok / ArduinoBleOTA

Upload firmware over Bluetooth
MIT License
19 stars 7 forks source link

Help w platformio build problem w OTA #16

Closed sdetweil closed 1 year ago

sdetweil commented 1 year ago

using this platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

;
;
;   arduino nano iot 33 , base 
;   uses ArduinoBLE lib
;
[env:nano_33_iot]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    arduino-libraries/ArduinoBLE@^1.3.4
    cmaglie/FlashStorage@^1.0.0
;
;
;   arduino nano iot 33 , with OTA
;   uses ArduinoBLE lib
;
[env:nano_33_iot-ota]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
            -DUSE_OTA

lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    arduino-libraries/ArduinoBLE@^1.3.4
    cmaglie/FlashStorage@^1.0.0    
    https://github.com/sdetweil/ArduinoBleOTA
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3       

;
;
;    DOIT esp32 devkit-v1 with and without OTA and Nimble
;
;  base Arduino esp32 BLE
;
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -D ESP32
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
;
;  wth NimBLE lib
;
[env:esp32doit-devkit-v1-nimble]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -D ESP32 -D USE_NIMBLE
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    h2zero/NimBLE-Arduino
;
;  base with OTA
;
[env:esp32doit-devkit-v1-ota]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DESP32 
    -DUSE_ESP32_BLE_LIB
    -DUSE_OTA
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    https://github.com/sdetweil/ArduinoBleOTA
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001    

;
;   OTA AND Nimble
;
[env:esp32doit-devkit-v1-ota-nimble]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DESP32 
    -DUSE_NIM_BLE_ARDUINO_LIB
    -DUSE_OTA
    -DUSE_NIMBLE
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    https://github.com/sdetweil/ArduinoBleOTA
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3    
;
;
;   different ESP32 board
;
;
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -D ESP32
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0    
;
;
;   devkit4 esp32
;
;

[env:esp32-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32 
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0

upload_port= //dev/cu.usbserial-0001 

;
;   devkit-v4 with esp32 ble ota
;
[env:esp32-devkit-v4-ota]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32 
    -DUSE_ESP32_BLE_LIB
    -DUSE_OTA
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    https://github.com/sdetweil/ArduinoBleOTA
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001

;
;   devkit-v4 with esp32 ble ota
;
[env:esp32-devkit-v4-ota-nimble]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32 
    -DUSE_NIM_BLE_ARDUINO_LIB
    -DUSE_OTA
    -DUSE_NIMBLE   
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0
    https://github.com/sdetweil/ArduinoBleOTA
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001 

and the attached source file (which just has all my includes) and dummy setup and loop init.txt

create a project add the init.txt as init.cpp in the src folder then pio run in the project... the nano-iot 33 -ota fails, trying to compile Nimble??? but its not used by any file that I can find

this uses my updated ArduinoBleOTA fork. once I get thru test I'll submit a PR.

adds a new otaClass and adds a new method (in otaClass, otaClassNimble, and otaClassEsp32. I provide a server, and u give back the service object

only need to the 1st two environments, but I wanted to be complete..

vovagorodok commented 1 year ago

then pio run in the project... the nano-iot 33 -ota fails, trying to compile Nimble??? but its not used by any file that I can find

Nimble library is only for ESP32. Not for nano-iot 33

vovagorodok commented 1 year ago

image image

ArduinoBLE is for atmel

sdetweil commented 1 year ago

yes, but as nimble is a dependency for the project, it gets added to each env whether u like it or not..

BUT its never USED

vovagorodok commented 1 year ago

Take a look how it solved here: https://github.com/vovagorodok/ArduinoBleOTA/blob/main/platformio.ini

sdetweil commented 1 year ago

if I look in the Platformio project config, for the -ota , Nimble is NOT listed BUT its IS listed in the env libs list .

vovagorodok commented 1 year ago

ArduinoOTA - library for upload software and additionally support wifi (not bluetooth). supported by both atmel and esp32. ArduinoBLE and NimBLE-Arduino - are bluetooth libraries

If I correctly understand the issue

sdetweil commented 1 year ago

If I correctly understand the issue

yes, but it is not USED by any source file in any way

sdetweil commented 1 year ago

the use of partitioned libs doesn't help

[env]
framework = arduino
lib_deps = 
    arduino-libraries/Arduino_JSON@^0.2.0
    adafruit/Adafruit VL53L1X@^3.1.0

lib_deps_ota=    
    jandrassy/ArduinoOTA@^1.0.9
    bakercp/CRC32@^2.0.0
    rlogiacco/CircularBuffer@^1.3.3
    https://github.com/sdetweil/ArduinoBleOTA 
;    
;   arduino nano iot 33 , base 
;   uses ArduinoBLE lib
;
[env:nano_33_iot]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
lib_deps = 
    ${env.lib_deps}
    arduino-libraries/ArduinoBLE@^1.3.4
    cmaglie/FlashStorage@^1.0.0
;
;
;   arduino nano iot 33 , with OTA
;   uses ArduinoBLE lib
;
[env:nano_33_iot-ota]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
            -DUSE_OTA
lib_deps = 
    ${env.lib_deps}
    ${env.lib_deps_ota}
    arduino-libraries/ArduinoBLE@^1.3.4     
    cmaglie/FlashStorage@^1.0.0

error

In file included from .pio/libdeps/nano_33_iot-ota/NimBLE-Arduino/src/NimBLE2904.cpp:19:0:
.pio/libdeps/nano_33_iot-ota/NimBLE-Arduino/src/nimconfig.h:6:10: fatal error: ext_nimble_config.h: No such file or directory
vovagorodok commented 1 year ago

Strange, try remove .pio folder. Close and open project again. It will recreate .pio with needed dependencies

sdetweil commented 1 year ago

i created a new project, without nimble lib added.. and only the 2 iot envs.. and it still fails the same way

pio package list

Resolving nano_33_iot-ota dependencies...
Platform atmelsam @ 8.1.0 (required: atmelsam)
├── framework-arduino-samd @ 1.8.13 (required: platformio/framework-arduino-samd @ ~1.8.13)
├── framework-cmsis @ 1.40500.0 (required: platformio/framework-cmsis @ ~1.40500.0)
├── framework-cmsis-atmel @ 1.2.2 (required: platformio/framework-cmsis-atmel @ ~1.2.2)
└── toolchain-gccarmnoneeabi @ 1.70201.0 (required: platformio/toolchain-gccarmnoneeabi @ ~1.70201.0)

Libraries
├── Adafruit VL53L1X @ 3.1.0 (required: adafruit/Adafruit VL53L1X @ ^3.1.0)
│   └── Adafruit BusIO @ 1.14.1 (required: Adafruit BusIO)
├── ArduinoBLE @ 1.3.4 (required: arduino-libraries/ArduinoBLE @ ^1.3.4)
├── ArduinoBleOta @ 1.0.0+sha.1739919 (required: git+https://github.com/sdetweil/ArduinoBleOTA)
│   ├── ArduinoOTA @ 1.0.9 (required: ArduinoOTA)
│   ├── CRC32 @ 2.0.0 (required: CRC32)
│   ├── CircularBuffer @ 1.3.3 (required: CircularBuffer)
│   └── NimBLE-Arduino @ 1.4.1 (required: NimBLE-Arduino)
├── Arduino_JSON @ 0.2.0 (required: arduino-libraries/Arduino_JSON @ ^0.2.0)
└── FlashStorage @ 1.0.0 (required: cmaglie/FlashStorage @ ^1.0.0)

cause its in the library.properties, depends=

sdetweil commented 1 year ago

taking it out of depends make the problem go away

vovagorodok commented 1 year ago

https://github.com/vovagorodok/ArduinoBleOTA/commit/d88c1110239228f53fd4144a9fa1770f7ad55164

Please try with fix

sdetweil commented 1 year ago

yes, I removed it in my fork and the problem went away

sdetweil commented 1 year ago

and u got me!... the security and upload callbacks changes.. oops.. I have a new OtaClassESP32 .. just added those changes and the lib props and the platformio.ini changes for Nimble and it all builds ..

now to update one beacon, drag its firmware.bin over to the linux box, (no dbus etc on mac) and try to python upload it again...

sdetweil commented 1 year ago

build works.. so closing