ArduinoBLE icon indicating copy to clipboard operation
ArduinoBLE copied to clipboard

Arduino M0 board crashes when setting BLE handle from data buffer

Open fabik111 opened this issue 1 year ago • 1 comments

This PR solves the issue of crashes and hangs on M0 board when assigning the variable uint16_t handle in the methods ATTClass::readOrReadBlobReq and ATTClass::writeReqOrCmd as reported also here.

The problem was identified, also, trying to write a characteristic exposed by Arduino Nano RP2040 and Arduino MKR1010 from other Arduino boards.

fabik111 avatar Oct 03 '24 13:10 fabik111

Memory usage change @ 2e667118aeff192f2bafa38927748bee0814a96b

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect :small_red_triangle: +20 - +20 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:uno2018:mode=on 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi :small_red_triangle: +32 - +32 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 :small_red_triangle: +16 - +24 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot :small_red_triangle: +16 - +24 +0.01 - +0.01 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Central/LedControl
flash
% examples/Central/LedControl
RAM for global variables
% examples/Central/PeripheralExplorer
flash
% examples/Central/PeripheralExplorer
RAM for global variables
% examples/Central/Scan
flash
% examples/Central/Scan
RAM for global variables
% examples/Central/ScanCallback
flash
% examples/Central/ScanCallback
RAM for global variables
% examples/Central/SensorTagButton
flash
% examples/Central/SensorTagButton
RAM for global variables
% examples/Peripheral/Advertising/EnhancedAdvertising
flash
% examples/Peripheral/Advertising/EnhancedAdvertising
RAM for global variables
% examples/Peripheral/Advertising/RawDataAdvertising
flash
% examples/Peripheral/Advertising/RawDataAdvertising
RAM for global variables
% examples/Peripheral/BatteryMonitor
flash
% examples/Peripheral/BatteryMonitor
RAM for global variables
% examples/Peripheral/ButtonLED
flash
% examples/Peripheral/ButtonLED
RAM for global variables
% examples/Peripheral/CallbackLED
flash
% examples/Peripheral/CallbackLED
RAM for global variables
% examples/Peripheral/EncryptedBatteryMonitor
flash
% examples/Peripheral/EncryptedBatteryMonitor
RAM for global variables
% examples/Peripheral/LED
flash
% examples/Peripheral/LED
RAM for global variables
%
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_nano:nanorp2040connect 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0
arduino:megaavr:uno2018:mode=on 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:renesas_uno:unor4wifi 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0
arduino:samd:mkrwifi1010 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0
arduino:samd:nano_33_iot 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0
Click for full report CSV
Board,examples/Central/LedControl<br>flash,%,examples/Central/LedControl<br>RAM for global variables,%,examples/Central/PeripheralExplorer<br>flash,%,examples/Central/PeripheralExplorer<br>RAM for global variables,%,examples/Central/Scan<br>flash,%,examples/Central/Scan<br>RAM for global variables,%,examples/Central/ScanCallback<br>flash,%,examples/Central/ScanCallback<br>RAM for global variables,%,examples/Central/SensorTagButton<br>flash,%,examples/Central/SensorTagButton<br>RAM for global variables,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>flash,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>RAM for global variables,%,examples/Peripheral/Advertising/RawDataAdvertising<br>flash,%,examples/Peripheral/Advertising/RawDataAdvertising<br>RAM for global variables,%,examples/Peripheral/BatteryMonitor<br>flash,%,examples/Peripheral/BatteryMonitor<br>RAM for global variables,%,examples/Peripheral/ButtonLED<br>flash,%,examples/Peripheral/ButtonLED<br>RAM for global variables,%,examples/Peripheral/CallbackLED<br>flash,%,examples/Peripheral/CallbackLED<br>RAM for global variables,%,examples/Peripheral/EncryptedBatteryMonitor<br>flash,%,examples/Peripheral/EncryptedBatteryMonitor<br>RAM for global variables,%,examples/Peripheral/LED<br>flash,%,examples/Peripheral/LED<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_nano:nanorp2040connect,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0
arduino:megaavr:uno2018:mode=on,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:renesas_uno:unor4wifi,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0
arduino:samd:mkrwifi1010,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0
arduino:samd:nano_33_iot,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0

github-actions[bot] avatar Oct 03 '24 13:10 github-actions[bot]

@fabik111 could you check why spellcheck workflow is failing?

I think it is related to this https://github.com/arduino-libraries/ArduinoBLE/pull/376#issuecomment-2522983728

pennam avatar Mar 10 '25 13:03 pennam

it is related to this https://github.com/arduino-libraries/ArduinoBLE/pull/376#issuecomment-2522983728

Correct, and I already fixed the problem in https://github.com/arduino-libraries/ArduinoBLE/pull/382. So the PR only needs to be rebased, which will trigger a new spell check run using the modernized infrastructure from https://github.com/arduino-libraries/ArduinoBLE/pull/382

per1234 avatar Mar 10 '25 14:03 per1234

Thank you @per1234 :+1:

pennam avatar Mar 10 '25 14:03 pennam

Memory usage change @ eef16ce34abb977d147d637c6751b69bf5b1161b

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect :small_red_triangle: +20 - +20 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:uno2018:mode=on 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi :small_red_triangle: +32 - +32 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 :small_red_triangle: +16 - +24 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot :small_red_triangle: +16 - +24 +0.01 - +0.01 0 - 0 0.0 - 0.0
Click for full report table
Board examples/Central/LedControl
flash
% examples/Central/LedControl
RAM for global variables
% examples/Central/PeripheralExplorer
flash
% examples/Central/PeripheralExplorer
RAM for global variables
% examples/Central/Scan
flash
% examples/Central/Scan
RAM for global variables
% examples/Central/ScanCallback
flash
% examples/Central/ScanCallback
RAM for global variables
% examples/Central/SensorTagButton
flash
% examples/Central/SensorTagButton
RAM for global variables
% examples/Peripheral/Advertising/EnhancedAdvertising
flash
% examples/Peripheral/Advertising/EnhancedAdvertising
RAM for global variables
% examples/Peripheral/Advertising/RawDataAdvertising
flash
% examples/Peripheral/Advertising/RawDataAdvertising
RAM for global variables
% examples/Peripheral/BatteryMonitor
flash
% examples/Peripheral/BatteryMonitor
RAM for global variables
% examples/Peripheral/ButtonLED
flash
% examples/Peripheral/ButtonLED
RAM for global variables
% examples/Peripheral/CallbackLED
flash
% examples/Peripheral/CallbackLED
RAM for global variables
% examples/Peripheral/EncryptedBatteryMonitor
flash
% examples/Peripheral/EncryptedBatteryMonitor
RAM for global variables
% examples/Peripheral/LED
flash
% examples/Peripheral/LED
RAM for global variables
%
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_nano:nanorp2040connect 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0 20 0.0 0 0.0
arduino:megaavr:uno2018:mode=on 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:renesas_uno:unor4wifi 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0 32 0.01 0 0.0
arduino:samd:mkrwifi1010 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0
arduino:samd:nano_33_iot 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0 16 0.01 0 0.0 24 0.01 0 0.0
Click for full report CSV
Board,examples/Central/LedControl<br>flash,%,examples/Central/LedControl<br>RAM for global variables,%,examples/Central/PeripheralExplorer<br>flash,%,examples/Central/PeripheralExplorer<br>RAM for global variables,%,examples/Central/Scan<br>flash,%,examples/Central/Scan<br>RAM for global variables,%,examples/Central/ScanCallback<br>flash,%,examples/Central/ScanCallback<br>RAM for global variables,%,examples/Central/SensorTagButton<br>flash,%,examples/Central/SensorTagButton<br>RAM for global variables,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>flash,%,examples/Peripheral/Advertising/EnhancedAdvertising<br>RAM for global variables,%,examples/Peripheral/Advertising/RawDataAdvertising<br>flash,%,examples/Peripheral/Advertising/RawDataAdvertising<br>RAM for global variables,%,examples/Peripheral/BatteryMonitor<br>flash,%,examples/Peripheral/BatteryMonitor<br>RAM for global variables,%,examples/Peripheral/ButtonLED<br>flash,%,examples/Peripheral/ButtonLED<br>RAM for global variables,%,examples/Peripheral/CallbackLED<br>flash,%,examples/Peripheral/CallbackLED<br>RAM for global variables,%,examples/Peripheral/EncryptedBatteryMonitor<br>flash,%,examples/Peripheral/EncryptedBatteryMonitor<br>RAM for global variables,%,examples/Peripheral/LED<br>flash,%,examples/Peripheral/LED<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_nano:nanorp2040connect,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0,20,0.0,0,0.0
arduino:megaavr:uno2018:mode=on,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:renesas_uno:unor4wifi,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0,32,0.01,0,0.0
arduino:samd:mkrwifi1010,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0
arduino:samd:nano_33_iot,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0,16,0.01,0,0.0,24,0.01,0,0.0

github-actions[bot] avatar Mar 10 '25 14:03 github-actions[bot]

Rebased

fabik111 avatar Mar 10 '25 16:03 fabik111