Arduino M0 board crashes when setting BLE handle from data buffer
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.
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/LedControlflash |
% | examples/Central/LedControlRAM for global variables |
% | examples/Central/PeripheralExplorerflash |
% | examples/Central/PeripheralExplorerRAM for global variables |
% | examples/Central/Scanflash |
% | examples/Central/ScanRAM for global variables |
% | examples/Central/ScanCallbackflash |
% | examples/Central/ScanCallbackRAM for global variables |
% | examples/Central/SensorTagButtonflash |
% | examples/Central/SensorTagButtonRAM for global variables |
% | examples/Peripheral/Advertising/EnhancedAdvertisingflash |
% | examples/Peripheral/Advertising/EnhancedAdvertisingRAM for global variables |
% | examples/Peripheral/Advertising/RawDataAdvertisingflash |
% | examples/Peripheral/Advertising/RawDataAdvertisingRAM for global variables |
% | examples/Peripheral/BatteryMonitorflash |
% | examples/Peripheral/BatteryMonitorRAM for global variables |
% | examples/Peripheral/ButtonLEDflash |
% | examples/Peripheral/ButtonLEDRAM for global variables |
% | examples/Peripheral/CallbackLEDflash |
% | examples/Peripheral/CallbackLEDRAM for global variables |
% | examples/Peripheral/EncryptedBatteryMonitorflash |
% | examples/Peripheral/EncryptedBatteryMonitorRAM for global variables |
% | examples/Peripheral/LEDflash |
% | examples/Peripheral/LEDRAM 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
@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
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
Thank you @per1234 :+1:
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/LedControlflash |
% | examples/Central/LedControlRAM for global variables |
% | examples/Central/PeripheralExplorerflash |
% | examples/Central/PeripheralExplorerRAM for global variables |
% | examples/Central/Scanflash |
% | examples/Central/ScanRAM for global variables |
% | examples/Central/ScanCallbackflash |
% | examples/Central/ScanCallbackRAM for global variables |
% | examples/Central/SensorTagButtonflash |
% | examples/Central/SensorTagButtonRAM for global variables |
% | examples/Peripheral/Advertising/EnhancedAdvertisingflash |
% | examples/Peripheral/Advertising/EnhancedAdvertisingRAM for global variables |
% | examples/Peripheral/Advertising/RawDataAdvertisingflash |
% | examples/Peripheral/Advertising/RawDataAdvertisingRAM for global variables |
% | examples/Peripheral/BatteryMonitorflash |
% | examples/Peripheral/BatteryMonitorRAM for global variables |
% | examples/Peripheral/ButtonLEDflash |
% | examples/Peripheral/ButtonLEDRAM for global variables |
% | examples/Peripheral/CallbackLEDflash |
% | examples/Peripheral/CallbackLEDRAM for global variables |
% | examples/Peripheral/EncryptedBatteryMonitorflash |
% | examples/Peripheral/EncryptedBatteryMonitorRAM for global variables |
% | examples/Peripheral/LEDflash |
% | examples/Peripheral/LEDRAM 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 |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: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
Rebased