Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32-led-strip-sdk crash on ESP32-C6 , cannot use .random #22

Closed
gerwindehaan opened this issue Jun 28, 2024 · 2 comments
Closed

esp32-led-strip-sdk crash on ESP32-C6 , cannot use .random #22

gerwindehaan opened this issue Jun 28, 2024 · 2 comments

Comments

@gerwindehaan
Copy link

I experience a crash/bootloop on the esp32-led-strip-sdk example when run on my ESP32-C6

I traced it down to the use of .random in the led strip color generation (it works if I avoid that). The behavior is illustrated by the following minimal snippet:

@_cdecl("app_main")
func app_main() {
  print("Running Int.random")  
  let _ = Int.random(in: 0...16)
  print(". ")
  while(true){ }
}

Running this on device causes a crash when the .random is invoked, followed by a reboot. When compiling this sample (or anything where .random is spawned, a _warning is spawned around _ _getentropy:

[5/7] Linking CXX executable main.elf
/Users/gerwindehaan/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240305/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/bin/ld: /Users/gerwindehaan/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20240305/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/13.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libc.a(libc_a-getentropyr.o): in function `_getentropy_r':
/builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/riscv32-esp-elf/src/newlib/newlib/libc/reent/getentropyr.c:48:(.text+0x16): warning: _getentropy is not implemented and will always fail

I am wondering if this has to do with my configuration of the device, or that I should somehow enable the random generator RNG when Wifi/BLE are off .

@erhankur
Copy link
Contributor

We have shared the patch here #17 (comment)

@gerwindehaan
Copy link
Author

Thanks, after applying this patch to my esp-idf source solves the issue with .random and the sample works as advertised. Closing as this is tracked by #17 and apple/swift-matter-examples#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants