Multi Core Support for C module

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
__deets__
Posts: 16
Joined: Sun Aug 20, 2017 4:50 pm

Multi Core Support for C module

Post by __deets__ » Sat Sep 15, 2018 7:07 pm

I'm a happy ESP32/MicroPython user. I know that uP currently does not support multi-threading, and don't want to change this.

But for my current project I could use a bit of extra CPU cycles on the second core for a MPU sensor fusion algorithm. So I thought I create a task bound to core 1 to just do that by writing a little C-module for uP.

Turns out I run into an assert (configASSERT( (xCoreID>=0 && xCoreID<portNUM_PROCESSORS) || (xCoreID==tskNO_AFFINITY) ) in tasks.c:688) that claims there is no such thing as two cores.

I'm not very knowledgeable with the ESP SDK and it's rather intimidating build-system. Any pointers on how to get the second core up and running? Again, I do not care about any uP code running in that task, communication would be over shared memory.

__deets__
Posts: 16
Joined: Sun Aug 20, 2017 4:50 pm

Re: Multi Core Support for C module

Post by __deets__ » Sat Sep 15, 2018 7:37 pm

One insight: the define portNUM_PROCESSORS is depending on CONFIG_FREERTOS_UNICORE which is in turn set by sdkconfig.h in the esp32 port.

Removing CONFIG_FREERTOS_UNICORE builds uP, but then I get an endless reset-cycle with this output:

Code: Select all

/home/deets/softwarets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4616
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:12768
entry 0x4007ad68
W (91) boot: PRO CPU has been reset by WDT.
W (91) boot: WDT reset info: PRO CPU PC=0x40080200
W (91) boot: WDT reset info: APP CPU PC=0x40080203
I (457) cpu_start: Pro cpu up.
I (457) cpu_start: Starting app cpu, entry point is 0x400829b0
I (0) cpu_start: App cpu up.
I (460) heap_init: Initializing. RAM available for dynamic allocation:
I (467) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (473) heap_init: At 3FFC6620 len 000199E0 (102 KiB): DRAM
I (479) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (485) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (492) heap_init: At 40092428 len 0000DBD8 (54 KiB): IRAM
I (498) cpu_start: Pro cpu start user code
I (69) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
/home/deets/softwar
So the RTOS-config seems a bit flaky. Any ideas?

jickster
Posts: 398
Joined: Thu Sep 07, 2017 8:57 pm

Re: Multi Core Support for C module

Post by jickster » Sat Sep 15, 2018 8:29 pm

You’ll probably find more luck on the ESP32 forums.




Sent from my iPhone using Tapatalk Pro

__deets__
Posts: 16
Joined: Sun Aug 20, 2017 4:50 pm

Re: Multi Core Support for C module

Post by __deets__ » Sun Sep 16, 2018 10:54 am

I doubt it. I've got no problem running native multi core apps. The configuration of the ESP32 port is what makes this specific.

Post Reply