I believe the ESP32c3 only has a single core so two questions:
1. Does it still build using the ESP modified multi-core version of FreeRTOS or does it use the standard single-threaded version?
2. Do I need to worry about locking or can I be 100% sure that only one task at a time can be running and accessing data?
Thanks.
ESP32c3 - single threaded?
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32c3 - single threaded?
Yes, it's single-core.papadeltasierra wrote: ↑Wed Nov 22, 2023 10:24 amI believe the ESP32c3 only has a single core so two questions:
Yes and no. It uses the same Espressif-FreeRTOS code, but built to run on a single core. That's not a "single-threaded" version though.1. Does it still build using the ESP modified multi-core version of FreeRTOS or does it use the standard single-threaded version?
You do need to manage synchronization ("locking") because the OS is preemptive, which to an individual task is indistinguishable from true concurrency. Plus there are all the other interrupts.2. Do I need to worry about locking or can I be 100% sure that only one task at a time can be running and accessing data?
However, when separating tasks' data and having them communicate via proper inter-task means (queues, semaphores,...) you won't need much 'manual' synchronization.
-
- Posts: 28
- Joined: Thu Nov 03, 2022 1:57 pm
Re: ESP32c3 - single threaded?
Thanks for that info. I was idly wondering "how might I pass a lot of data between tasks" and passing the pointer to a shared buffer would be one way, but would need some sort of protection in this case.
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32c3 - single threaded?
Yes, a shared buffer is a valid use case which may require locking, or some other way of ensuring exclusive use of the buffer at any given time. Passing (pointers to) buffers back and forth between tasks ping-pong style via two queues can also do the trick, or using the IDF's ring buffer, for example.
Who is online
Users browsing this forum: No registered users and 118 guests