ESP32 & Espruino & dual core mode

Posted on
  • Hello to every one,
    I have special request.
    I want to run Espruino firmware on ESP32 with dual core support. I would like to join critical time task in C to second core but first core to run Espruino JS interpreter.

    My steps to build original Espruino FW:

    1. I cloned­dTools/
      and checkout to branch ESP32-v3.0.
    2. builded with
      source EspruinoBuildTools/esp32/build./build-id­
    3. uploaded new bootloader + espruino_XvXX_esp32.bin + partitions_espruino.bin to ESP32 mcu

    and everythink is working properly.

    I did full erase flash by
    make erase_flash

    But If I change in menuconfig > Component config > FreeRTOS > [ ] Run FreeRTOS only on first core
    and build again ESP32 still resetting with this log output (VERBOSE mode output):

    ets Jun  8 2016 00:22:57
    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:2
    ho 12 tail 0 room 4
    entry 0x40078c4c
    I (263) cpu_start: Pro cpu up.
    I (263) cpu_start: Starting app cpu, entry point is 0x4008101c
    0x4008101c: call_start_cpu0 at /home/martin/EspruinoBuildTools/esp32/bu­ild/esp-idf/components/esp32/./cpu_start­.c:157 (discriminator 1)
    I (238) cpu_start: App cpu up.
    I (266) heap_init: Initializing. RAM available for dynamic allocation:
    D (273) heap_init: New heap initialised at 0x3ffaff10
    I (278) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
    D (284) heap_init: New heap initialised at 0x3ffdc178
    I (289) heap_init: At 3FFDC178 len 00003E88 (15 KiB): DRAM
    I (296) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
    I (302) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
    D (308) heap_init: New heap initialised at 0x40097e04
    I (313) heap_init: At 40097E04 len 000081FC (32 KiB): IRAM
    I (320) cpu_start: Pro cpu start user code
    D (332) clk: RTC_SLOW_CLK calibration value: 3518234
    V (43) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
    V (43) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
    D (48) intr_alloc: Connected src 46 to int 2 (cpu 0)
    V (53) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
    V (59) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E
    D (67) intr_alloc: Connected src 57 to int 3 (cpu 0)
    V (72) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
    V (78) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
    D (86) intr_alloc: Connected src 24 to int 9 (cpu 0)
    I (92) cpu_start: Starting scheduler on PRO CPU.
    abort() was called at PC 0x40080fe1 on core 0
    0x40080fe1: call_start_cpu0 at /home/martin/EspruinoBuildTools/esp32/bu­ild/esp-idf/components/esp32/./cpu_start­.c:133
    Backtrace: 0x4008bc8f:0x3ffe3be0 0x4008bcbb:0x3ffe3c00 0x40080fe1:0x3ffe3c20 0x400811e7:0x3ffe3c50 0x40078bfb:0x3ffe3c70 0x40078d0e:0x3ffe3e70 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20
    0x4008bc8f: phy_get_most_tpw at ??:?
    0x4008bcbb: ram_index_to_txbbgain at ??:?
    0x40080fe1: call_start_cpu0 at /home/martin/EspruinoBuildTools/esp32/bu­ild/esp-idf/components/esp32/./cpu_start­.c:133
    0x400811e7: timer_insert at /home/martin/EspruinoBuildTools/esp32/bu­ild/esp-idf/components/esp32/./esp_timer­.c:184

    This is my output from make monitor from ~/EspruinoBuildTools/esp32/build/app. So you can see backtrack with function name instead of pointer address.

    Does anybody know where should be problem?
    Thanks a lot

  • I think there are tasks pinned to core in main.c that you might need to change.

    What is that you want to run in c on the other core? There might be another way of doing this.

  • Hi, I put only one new line to main function to create new task but it doesn't working. I tried same code in other IDF project and its working in both variant. With selected dual core in menuconfig and also working with one core mode in menuconfig.

    ifdef RTOS
    // START NEW LINE ========================
      xTaskCreatePinnedToCore(&hello_task_core­_1, "core1_task", 10000, NULL, 5, NULL, 1);
    // END NEW LINE ========================
      xTaskCreatePinnedToCore(&espruinoTask, "espruinoTask", 25000, NULL, 5, NULL, 0);

    I want to drive 20x16 RGB LED display. The driving circuit its very similar like
    Basically I need to transfer 8bytes each 31uS. ( 100Hz frame rate, 16 levels color deep and 20 channel = columns) summary I want transfer 8 byte 32000 times per second. And I think this is task for alone core. It working very good in separate IDF project with mJS library. Now I want achieve similar results with Espruino library. On core 0 I will prepare only 20x16x1B frame buffer to sharing with core 1.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

ESP32 & Espruino & dual core mode

Posted by Avatar for user90324 @user90324