mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ipc: prevent code getting pulled in for unicore configuration
This commit is contained in:
parent
2d7be5c35d
commit
6babdfc0b7
@ -37,14 +37,15 @@
|
|||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
#include "esp_ipc.h"
|
|
||||||
#include "driver/periph_ctrl.h"
|
#include "driver/periph_ctrl.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
#include "soc/soc_memory_layout.h"
|
#include "soc/soc_memory_layout.h"
|
||||||
#include "esp_clk.h"
|
#include "esp_clk.h"
|
||||||
#include "esp_coexist_internal.h"
|
#include "esp_coexist_internal.h"
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
|
#include "esp_ipc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_BT_ENABLED
|
#if CONFIG_BT_ENABLED
|
||||||
|
|
||||||
@ -742,12 +743,15 @@ static int IRAM_ATTR cause_sw_intr_to_core_wrapper(int core_id, int intr_no)
|
|||||||
{
|
{
|
||||||
esp_err_t err = ESP_OK;
|
esp_err_t err = ESP_OK;
|
||||||
|
|
||||||
|
#if CONFIG_FREERTOS_UNICORE
|
||||||
|
cause_sw_intr((void *)intr_no);
|
||||||
|
#else /* CONFIG_FREERTOS_UNICORE */
|
||||||
if (xPortGetCoreID() == core_id) {
|
if (xPortGetCoreID() == core_id) {
|
||||||
cause_sw_intr((void *)intr_no);
|
cause_sw_intr((void *)intr_no);
|
||||||
} else {
|
} else {
|
||||||
err = esp_ipc_call(core_id, cause_sw_intr, (void *)intr_no);
|
err = esp_ipc_call(core_id, cause_sw_intr, (void *)intr_no);
|
||||||
}
|
}
|
||||||
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "soc/gpio_periph.h"
|
#include "soc/gpio_periph.h"
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
#include "esp_ipc.h"
|
#include "esp_ipc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GPIO_CHECK(a, str, ret_val) \
|
#define GPIO_CHECK(a, str, ret_val) \
|
||||||
if (!(a)) { \
|
if (!(a)) { \
|
||||||
@ -455,7 +457,13 @@ esp_err_t gpio_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags,
|
|||||||
isr_core_id = xPortGetCoreID();
|
isr_core_id = xPortGetCoreID();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL(&gpio_spinlock);
|
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) {
|
if(ret != ESP_OK || p.ret != ESP_OK) {
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ else()
|
|||||||
"hw_random.c"
|
"hw_random.c"
|
||||||
"int_wdt.c"
|
"int_wdt.c"
|
||||||
"intr_alloc.c"
|
"intr_alloc.c"
|
||||||
"ipc.c"
|
|
||||||
"lib_printf.c"
|
"lib_printf.c"
|
||||||
"panic.c"
|
"panic.c"
|
||||||
"phy_init.c"
|
"phy_init.c"
|
||||||
@ -53,6 +52,10 @@ else()
|
|||||||
"hwcrypto/sha.c")
|
"hwcrypto/sha.c")
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
||||||
|
|
||||||
|
if(NOT CONFIG_FREERTOS_UNICORE)
|
||||||
|
list(APPEND COMPONENT_SRCS "ipc.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(COMPONENT_REQUIRES driver tcpip_adapter esp_event efuse)
|
set(COMPONENT_REQUIRES driver tcpip_adapter esp_event efuse)
|
||||||
# driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t
|
# driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t
|
||||||
# tcpip_adapter is a public requirement because esp_event.h uses tcpip_adapter types
|
# tcpip_adapter is a public requirement because esp_event.h uses tcpip_adapter types
|
||||||
|
@ -8,6 +8,10 @@ ifndef CONFIG_NO_BLOBS
|
|||||||
LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh
|
LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_FREERTOS_UNICORE
|
||||||
|
COMPONENT_OBJEXCLUDE := ipc.o
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
|
||||||
# This linker script must come before esp32.project.ld
|
# This linker script must come before esp32.project.ld
|
||||||
LINKER_SCRIPTS += esp32.extram.bss.ld
|
LINKER_SCRIPTS += esp32.extram.bss.ld
|
||||||
|
@ -47,7 +47,6 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_spi_flash.h"
|
#include "esp_spi_flash.h"
|
||||||
#include "esp_ipc.h"
|
|
||||||
#include "esp_crosscore_int.h"
|
#include "esp_crosscore_int.h"
|
||||||
#include "esp_dport_access.h"
|
#include "esp_dport_access.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
@ -29,9 +29,11 @@
|
|||||||
#include "esp_intr.h"
|
#include "esp_intr.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "esp_ipc.h"
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
|
#include "esp_ipc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char* TAG = "intr_alloc";
|
static const char* TAG = "intr_alloc";
|
||||||
|
|
||||||
@ -706,20 +708,26 @@ esp_err_t IRAM_ATTR esp_intr_set_in_iram(intr_handle_t handle, bool is_in_iram)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
static void esp_intr_free_cb(void *arg)
|
static void esp_intr_free_cb(void *arg)
|
||||||
{
|
{
|
||||||
(void)esp_intr_free((intr_handle_t)arg);
|
(void)esp_intr_free((intr_handle_t)arg);
|
||||||
}
|
}
|
||||||
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
|
|
||||||
esp_err_t esp_intr_free(intr_handle_t handle)
|
esp_err_t esp_intr_free(intr_handle_t handle)
|
||||||
{
|
{
|
||||||
bool free_shared_vector=false;
|
bool free_shared_vector=false;
|
||||||
if (!handle) return ESP_ERR_INVALID_ARG;
|
if (!handle) return ESP_ERR_INVALID_ARG;
|
||||||
|
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
//Assign this routine to the core where this interrupt is allocated on.
|
//Assign this routine to the core where this interrupt is allocated on.
|
||||||
if (handle->vector_desc->cpu!=xPortGetCoreID()) {
|
if (handle->vector_desc->cpu!=xPortGetCoreID()) {
|
||||||
esp_err_t ret = esp_ipc_call_blocking(handle->vector_desc->cpu, &esp_intr_free_cb, (void *)handle);
|
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;
|
return ret == ESP_OK ? ESP_OK : ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
|
|
||||||
portENTER_CRITICAL(&spinlock);
|
portENTER_CRITICAL(&spinlock);
|
||||||
esp_intr_disable(handle);
|
esp_intr_disable(handle);
|
||||||
if (handle->vector_desc->flags&VECDESC_FL_SHARED) {
|
if (handle->vector_desc->flags&VECDESC_FL_SHARED) {
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "esp_ipc.h"
|
#include "esp_ipc.h"
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
static void test_func_ipc_cb(void *arg)
|
static void test_func_ipc_cb(void *arg)
|
||||||
{
|
{
|
||||||
vTaskDelay(50);
|
vTaskDelay(50);
|
||||||
@ -14,10 +16,7 @@ static void test_func_ipc_cb(void *arg)
|
|||||||
TEST_CASE("Test blocking IPC function call", "[ipc]")
|
TEST_CASE("Test blocking IPC function call", "[ipc]")
|
||||||
{
|
{
|
||||||
int val = 0x5a5a;
|
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);
|
esp_ipc_call_blocking(!xPortGetCoreID(), test_func_ipc_cb, &val);
|
||||||
#endif
|
|
||||||
TEST_ASSERT_EQUAL_HEX(val, 0xa5a5);
|
TEST_ASSERT_EQUAL_HEX(val, 0xa5a5);
|
||||||
}
|
}
|
||||||
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
|
Loading…
Reference in New Issue
Block a user