-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Nano 33 BLE: Threads not working on nano 33 ble sense v2 #53
Comments
Playing more with threads on the nano found that the k_create sketch had to add in k_msleep(SLEEPTIME); it will run in "Standard" mode with the default config file. However if I try to run in "Debug" mode if fails to run after I type "sketch"??? I also tried to run the k_define example sketch:
in standard mode but after it loads it looses serial connection (ie. looses comport in the ide). In debug mode after sketch if fails to run and show anything in the serial or serial1 window. This happens even if we increase the stack size:
So question is will threads be supported on the Nano? |
A little more progress. By adding in config_fpu = y the k_define test sketch posted now runs. However, the mutex and semaphore test sketches still fail to run - loose com port. More investigation. |
Merged changes as of this morning
threads_semsphore: looses com port @facchinm - is there a way to have printk send its output to Serial instead of Serial1? |
It used to work that way when compiling with "Debug" menu selected but stopped for some reason, me and @pillo79 are investigating |
Note that this will not work - the macros that define Zephyr kernel objects are useless in a sketch/extension and result in undefined behavior. I will take care of posting a patch to error in these situations, as it is a major issue. The workaround is to use dynamic objects but it is obviously a limited approach. |
Does this also apply to the giga since the sketch I have tested with seem to be working on the giga with no issue. |
Yes, it is an LLEXT limitation - most kernel macros rely on special sections in the ELF file, and those are IIRC silently ignored at extension load time. Those variables end up "anywhere in memory", so while it is possible you are not corrupting anything (yet... 🙂), it's unfortunately out of pure luck. EDIT - TBH the |
@pillo79 Understand what you are saying when you say:
To get threads working we did modify the linker script:
Are you saying this is not sufficient? What else are we missing? |
It appears LLEXT improved recently, as in a quick test I was able to define some kernel stuff (e.g. a semaphore) in an extension without issues 🙂 Have not looked into these details in some time, so I need to dig deeper. Zephyr maintains lists of kernel objects for its own reasons, and those are managed globally when linking the main Zephyr binary by merging together those weird per-file One surely problematic area is with |
Yeah we ran into iterable_sections issue when we first started down this path. That's how we ended up modifing the linker_script - I say we but @KurtE came up with that solution. As for Out of curiousity I decided to modify one of my mutex sketches to access sdram:
Seems to be working on the giga - guess getting lucky:
thread1 writes and thread2 reads. Any suggestions on seeing if I can break it. |
Describe the bug
Testing thread example on nano 33 ble sense v2 fails. Running in debug mode shows no output on serial or serial1. then to reload sketch have to double click reset to reload sketch.
Target board + cli verbose compilation output
Full verbose compilation output, ideally with
arduino-cli
invocation or from IDE 2.3.3+Issues without the full verbose output will be discarded as invalid.
Output of Serial Monitor
Serial OUTPUT:
Serial1 Output:
Output of readelf
You can find the loaction of the elf file by compiling in Verbose mode and looking near the end of the compilation output (after
Linking everything together..
)Paste (or attach) the output of
arm-none-eabi-readelf -a $your_sketch_elf_file
elf_Output.txt
Optional: attach the elf file
k_thread_create.ino.zip
Optional: attach the sketch
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: