Hello guys,
I am searching documentation and at least one example to implement a test application to execute a C function on core 0 and another function on core 1 without using FreeRTOS and Arduino framework. My intention is to test a simple solution to execute 2 functions on the different cores and possibly sharing some variables in a producer/consumer fashion.
ESP32 dualcore example without using FreeRTOS
-
- Posts: 9725
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP32 dualcore example without using FreeRTOS
Basically because I want to know how it works as bare metal implementation and eventually to use a different RTOS. There are some RTOS more devoted to IoT applications for instance.
-
- Posts: 1701
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32 dualcore example without using FreeRTOS
It basically works like this:
Code running on core A puts core B into reset (default after power up), writes the memory address from which core B should start executing code into a special register, then un-resets core B.
This is, however, not how the cores coordinate during normal operation. For this, there are two possibilities: a) inter-core messaging, and b) software-triggered interrupts.
a) is basically just another special register to which either core can write a value ("message", usually only a pointer to the actual message/request structure in RAM), which triggers a "message received" interrupt on the respective other core to read and handle the message. b) is a more simple form of the same where software just writes a 1 to one of several software interrupt registers to trigger an interrupt, which makes the core that has registered a handler for the specific interrupt run an ISR.
Code running on core A puts core B into reset (default after power up), writes the memory address from which core B should start executing code into a special register, then un-resets core B.
This is, however, not how the cores coordinate during normal operation. For this, there are two possibilities: a) inter-core messaging, and b) software-triggered interrupts.
a) is basically just another special register to which either core can write a value ("message", usually only a pointer to the actual message/request structure in RAM), which triggers a "message received" interrupt on the respective other core to read and handle the message. b) is a more simple form of the same where software just writes a 1 to one of several software interrupt registers to trigger an interrupt, which makes the core that has registered a handler for the specific interrupt run an ISR.
Re: ESP32 dualcore example without using FreeRTOS
OK, perfect, do you know where can I find some docs about how can I assign one or more functions to run on the 2 cores? I already use other dual core or multicore microcontrollers, they work differently but I am able to use them without a RTOS and sharing some registers or RAM area. The difference is that I know them and when I started to use them I found documentation and examples. In general terms it is more common to design 2 different programs having both a main() function, dedicated ISR banks and dedicate some program code memory (flash or RAM) to each core.
-
- Posts: 1701
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32 dualcore example without using FreeRTOS
No, sorry. All I know is that some TRMs describe some of the relevant registers; the ESP32-S3 TRM seems to be a bit more 'verbose' in this regard than the "OG" ESP32's.do you know where can I find some docs
Apart from that I guess you'd have to look at the IDF code to reverse-engineer what you need.
I am not aware of any toolchain or the like which would let you build simplified multi-core applications as you describe for the ESP32 familiy. The documented way is to use the IDF with its FreeRTOS.
Who is online
Users browsing this forum: Bing [Bot] and 81 guests