SiliconLabs / arduino

Arduino Core for Silicon Labs devices
86 stars 16 forks source link

[bug] examples contain classic race between ISR and main thread #74

Closed ericwertz closed 3 months ago

ericwertz commented 4 months ago

Hardware

xG2x dev kits

Core version

2.x

Arduino IDE version

2.x

Operating system

any

Radio stack variant

BLE

OpenThread Border Router device (if using Matter)

No response

Issue description

ble_blinky and ble_hid_keyboard examples both contain the data-sharing-between-ISR-and-main bug where the shared data isn't declared volatile. The code will only work as long as the optimizer is turned down/off and the globals' re-loads into registers aren't optimized away.

Serial output

No response

RTT output (if using Matter)

No response

Minimal reproducer code

No response

silabs-bozont commented 4 months ago

Hello @ericwertz - please fill in the missing parts of the issue template - especially the title. Thank you!

silabs-bozont commented 3 months ago

Hello @ericwertz, It has been fixed in 2.1.0 - thank you for the report!