]> granicus.if.org Git - esp-idf/commitdiff
Merge branch 'feature/crosscore_int' into 'master'
authorJeroen Domburg <jeroen@espressif.com>
Mon, 31 Oct 2016 03:04:28 +0000 (11:04 +0800)
committerJeroen Domburg <jeroen@espressif.com>
Mon, 31 Oct 2016 03:04:28 +0000 (11:04 +0800)
Add cross-core int to accelerate task being awoken from another CPU.

This adds a per-CPU interrupt that can be used to poke the CPU to go do something. In this case all that is implemented is a request to yield the current task, used in case a CPU unblocks a task that runs on another CPU. This gets rid of the limitation that inter-CPU communication using queues, muxes etc can take up to a FreeRTOS tick to happen.

Specs!
Sending an in in a queue of length 1 (essentially a semaphore) as quickly as possible (just a small delay in the sender, to make sure the receiver task gets swapped out) for 10 seconds. Number indicates the amount of ints transferred

Old code:

CPU0->CPU0: 42986

CPU0->CPU1,: 2999

New code:

CPU0->CPU0: 42868

CPU0->CPU1: 62073

See merge request !155

1  2 
components/esp32/cpu_start.c
components/freertos/Kconfig
components/freertos/include/freertos/FreeRTOSConfig.h
components/freertos/port.c
components/freertos/tasks.c

index 12189ccf66d12edd3c38e1b8de7113d7b865450d,bfc751d4539eab7e39df35a28b7d2427df4f2863..d94a4e6e79d4285a2777b0470f7362ce205c3e4d
  #include "esp_event.h"
  #include "esp_spi_flash.h"
  #include "esp_ipc.h"
+ #include "esp_crosscore_int.h"
  #include "esp_log.h"
 -
 +#include "esp_vfs_dev.h"
 +#include "esp_newlib.h"
 +#include "esp_brownout.h"
 +#include "esp_int_wdt.h"
 +#include "esp_task_wdt.h"
  #include "trax.h"
  
  void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default")));
@@@ -151,26 -145,13 +152,29 @@@ void start_cpu0_default(void
  #endif
      esp_set_cpu_freq();     // set CPU frequency configured in menuconfig
      uart_div_modify(0, (APB_CLK_FREQ << 4) / 115200);
 -    ets_setup_syscalls();
 +#if CONFIG_BROWNOUT_DET
 +    esp_brownout_init();
 +#endif
 +#if CONFIG_INT_WDT
 +    esp_int_wdt_init();
 +#endif
 +#if CONFIG_TASK_WDT
 +    esp_task_wdt_init();
 +#endif
 +    esp_setup_syscalls();
 +    esp_vfs_dev_uart_register();
 +    esp_reent_init(_GLOBAL_REENT);
 +    const char* default_uart_dev = "/dev/uart/0";
 +    _GLOBAL_REENT->_stdout = fopen(default_uart_dev, "w");
 +    _GLOBAL_REENT->_stderr = fopen(default_uart_dev, "w");
 +    _GLOBAL_REENT->_stdin  = fopen(default_uart_dev, "r");
      do_global_ctors();
+ #if !CONFIG_FREERTOS_UNICORE
+     esp_crosscore_int_init();
+ #endif
      esp_ipc_init();
      spi_flash_init();
 +
      xTaskCreatePinnedToCore(&main_task, "main",
              ESP_TASK_MAIN_STACK, NULL,
              ESP_TASK_MAIN_PRIO, NULL, 0);
Simple merge
index 834d787bea45647ec9ec481233250fd05709c837,acf18c32540099ee584fb0a81dbd87bfe6e26009..25480ed4756037197dd3b6beb1c61ec09b3d3839
  #include "FreeRTOS.h"
  #include "task.h"
  
 -#include "panic.h"
 +#include "esp_panic.h"
  
+ #include "esp_crosscore_int.h"
  /* Defined in portasm.h */
  extern void _frxt_tick_timer_init(void);
  
Simple merge