]> granicus.if.org Git - esp-idf/commitdiff
ipc: prevent code getting pulled in for unicore configuration
authorMahavir Jain <mahavir@espressif.com>
Thu, 15 Aug 2019 07:05:59 +0000 (12:35 +0530)
committerMahavir Jain <mahavir@espressif.com>
Wed, 28 Aug 2019 07:17:08 +0000 (12:47 +0530)
components/bt/controller/bt.c
components/driver/gpio.c
components/esp32/cpu_start.c
components/esp32/intr_alloc.c
components/esp32/test/test_ipc.c
components/esp_common/CMakeLists.txt
components/esp_common/component.mk

index 0453a102e424ef63aa30e0fb5af7cab9a5918566..0b29e506e49f41096b222777498dcf017d65d847 100644 (file)
 #include "esp_err.h"
 #include "esp_log.h"
 #include "esp_pm.h"
-#include "esp_ipc.h"
 #include "driver/periph_ctrl.h"
 #include "soc/rtc.h"
 #include "soc/soc_memory_layout.h"
 #include "esp32/clk.h"
 #include "esp_coexist_internal.h"
-
+#if !CONFIG_FREERTOS_UNICORE
+#include "esp_ipc.h"
+#endif
 
 #if CONFIG_BT_ENABLED
 
@@ -755,12 +756,15 @@ static int IRAM_ATTR cause_sw_intr_to_core_wrapper(int core_id, int intr_no)
 {
     esp_err_t err = ESP_OK;
 
+#if CONFIG_FREERTOS_UNICORE
+    cause_sw_intr((void *)intr_no);
+#else /* CONFIG_FREERTOS_UNICORE */
     if (xPortGetCoreID() == core_id) {
         cause_sw_intr((void *)intr_no);
     } else {
         err = esp_ipc_call(core_id, cause_sw_intr, (void *)intr_no);
     }
-
+#endif /* !CONFIG_FREERTOS_UNICORE */
     return err;
 }
 
index 96fc7a6658a7ead22889fada45322e0ce2ef8f17..f27a181f6ca0ca5916d4d3627e14dc2b707fa424 100644 (file)
@@ -20,7 +20,9 @@
 #include "soc/soc.h"
 #include "soc/gpio_periph.h"
 #include "esp_log.h"
+#if !CONFIG_FREERTOS_UNICORE
 #include "esp_ipc.h"
+#endif
 
 #define GPIO_CHECK(a, str, ret_val) \
     if (!(a)) { \
@@ -454,7 +456,13 @@ esp_err_t gpio_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags,
         isr_core_id = xPortGetCoreID();
     }
     portEXIT_CRITICAL(&gpio_spinlock);
-    esp_err_t ret = esp_ipc_call_blocking(isr_core_id, gpio_isr_register_on_core_static, (void *)&p);
+    esp_err_t ret;
+#if CONFIG_FREERTOS_UNICORE
+    gpio_isr_register_on_core_static(&p);
+    ret = ESP_OK;
+#else /* CONFIG_FREERTOS_UNICORE */
+    ret = esp_ipc_call_blocking(isr_core_id, gpio_isr_register_on_core_static, (void *)&p);
+#endif /* !CONFIG_FREERTOS_UNICORE */
     if(ret != ESP_OK || p.ret != ESP_OK) {
         return ESP_ERR_NOT_FOUND;
     }
index 5526a1cb43d75744ba28ac58096ade4202fa9e31..9ce5df4aefe1febc78cafddbc2d6a349fd29fcd7 100644 (file)
@@ -47,7 +47,6 @@
 #include "nvs_flash.h"
 #include "esp_event.h"
 #include "esp_spi_flash.h"
-#include "esp_ipc.h"
 #include "esp_private/crosscore_int.h"
 #include "esp_log.h"
 #include "esp_vfs_dev.h"
index 6256f6a8be717f84662a94eeab18362ff6d7dc30..11466a5997e283de3a2d49c53e8bd3013d9b5404 100644 (file)
 #include "esp_log.h"
 #include "esp_intr_alloc.h"
 #include "esp_attr.h"
-#include "esp_ipc.h"
 #include <limits.h>
 #include <assert.h>
+#if !CONFIG_FREERTOS_UNICORE
+#include "esp_ipc.h"
+#endif
 
 static const char* TAG = "intr_alloc";
 
@@ -705,20 +707,26 @@ esp_err_t IRAM_ATTR esp_intr_set_in_iram(intr_handle_t handle, bool is_in_iram)
     return ESP_OK;
 }
 
+#if !CONFIG_FREERTOS_UNICORE
 static void esp_intr_free_cb(void *arg)
 {
     (void)esp_intr_free((intr_handle_t)arg);
 }
+#endif /* !CONFIG_FREERTOS_UNICORE */
 
 esp_err_t esp_intr_free(intr_handle_t handle)
 {
     bool free_shared_vector=false;
     if (!handle) return ESP_ERR_INVALID_ARG;
+
+#if !CONFIG_FREERTOS_UNICORE
     //Assign this routine to the core where this interrupt is allocated on.
     if (handle->vector_desc->cpu!=xPortGetCoreID()) {
         esp_err_t ret = esp_ipc_call_blocking(handle->vector_desc->cpu, &esp_intr_free_cb, (void *)handle);
         return ret == ESP_OK ? ESP_OK : ESP_FAIL;
     }
+#endif /* !CONFIG_FREERTOS_UNICORE */
+
     portENTER_CRITICAL(&spinlock);
     esp_intr_disable(handle);
     if (handle->vector_desc->flags&VECDESC_FL_SHARED) {
index c58e8f79a4cc2ce7acd06282e124141bc3a27bcc..f6dd53103cba147ce94e404696af9d3f5145330d 100644 (file)
@@ -3,7 +3,9 @@
 #include "freertos/task.h"
 #include "unity.h"
 #include "esp_ipc.h"
+#include "sdkconfig.h"
 
+#if !CONFIG_FREERTOS_UNICORE
 static void test_func_ipc_cb(void *arg)
 {
     vTaskDelay(50);
@@ -14,10 +16,7 @@ static void test_func_ipc_cb(void *arg)
 TEST_CASE("Test blocking IPC function call", "[ipc]")
 {
     int val = 0x5a5a;
-#ifdef CONFIG_FREERTOS_UNICORE
-    esp_ipc_call_blocking(xPortGetCoreID(), test_func_ipc_cb, &val);
-#else
     esp_ipc_call_blocking(!xPortGetCoreID(), test_func_ipc_cb, &val);
-#endif
     TEST_ASSERT_EQUAL_HEX(val, 0xa5a5);
 }
+#endif /* !CONFIG_FREERTOS_UNICORE */
index bb9bd8a7a42d5496ee550265b426f615e6fceb75..1c3274dd096a0a473d2052dc96357a922a2f8c93 100644 (file)
@@ -4,14 +4,20 @@ if(BOOTLOADER_BUILD)
     set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-Wl,--gc-sections")
 else()
     # Regular app build
-    idf_component_register(SRCS "src/dbg_stubs.c"
-                                "src/esp_err_to_name.c"
-                                "src/esp_timer.c"
-                                "src/ets_timer_legacy.c"
-                                "src/freertos_hooks.c"
-                                "src/ipc.c"
-                                "src/pm_locks.c"
-                                "src/stack_check.c"
+    set(srcs "src/dbg_stubs.c"
+             "src/esp_err_to_name.c"
+             "src/esp_timer.c"
+             "src/ets_timer_legacy.c"
+             "src/freertos_hooks.c"
+             "src/pm_locks.c"
+             "src/stack_check.c")
+
+    # IPC framework is not applicable if freertos unicore config is selected
+    if(NOT CONFIG_FREERTOS_UNICORE)
+        list(APPEND srcs "src/ipc.c")
+    endif()
+
+    idf_component_register(SRCS "${srcs}"
                         INCLUDE_DIRS include
                         PRIV_REQUIRES soc)
 
index 64c67abcc5475fd8ba8a0032d4d5a684e72713e1..4d80bc4bf6cb8ec656816a8a8b4148b19234cff8 100644 (file)
@@ -5,5 +5,10 @@
 COMPONENT_ADD_INCLUDEDIRS := include
 COMPONENT_SRCDIRS := src
 
+# IPC framework is not applicable if freertos unicore config is selected
+ifdef CONFIG_FREERTOS_UNICORE
+COMPONENT_OBJEXCLUDE := src/ipc.o
+endif
+
 # disable stack protection in files which are involved in initialization of that feature
 src/stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))