diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index ff86d327bc..c76641075a 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -216,7 +216,7 @@ else() INCLUDE_DIRS ${includes} PRIV_REQUIRES efuse esp_timer REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support - LDFRAGMENTS linker.lf gptimer/linker.lf gpio/linker.lf) + LDFRAGMENTS linker.lf gptimer/linker.lf gpio/linker.lf twai/linker.lf) endif() # If system needs to monitor USJ connection status, then usb_serial_jtag_connection_monitor object file has to be linked diff --git a/components/driver/twai/linker.lf b/components/driver/twai/linker.lf new file mode 100644 index 0000000000..b3a3545d52 --- /dev/null +++ b/components/driver/twai/linker.lf @@ -0,0 +1,14 @@ +[mapping:twai_hal] +archive: libhal.a +entries: + if TWAI_ISR_IN_IRAM = y: + twai_hal_iram (noflash) + +[mapping:twai_driver] +archive: libdriver.a +entries: + if TWAI_ISR_IN_IRAM = y: + twai: twai_alert_handler (noflash) + twai: twai_handle_rx_buffer_frames (noflash) + twai: twai_handle_tx_buffer_frame (noflash) + twai: twai_intr_handler_main (noflash) diff --git a/components/driver/twai/twai.c b/components/driver/twai/twai.c index 0f46b55c66..ab56a629d7 100644 --- a/components/driver/twai/twai.c +++ b/components/driver/twai/twai.c @@ -44,11 +44,9 @@ #define TWAI_SET_FLAG(var, mask) ((var) |= (mask)) #define TWAI_RESET_FLAG(var, mask) ((var) &= ~(mask)) #ifdef CONFIG_TWAI_ISR_IN_IRAM -#define TWAI_ISR_ATTR IRAM_ATTR #define TWAI_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) #else #define TWAI_TAG "TWAI" -#define TWAI_ISR_ATTR #define TWAI_MALLOC_CAPS MALLOC_CAP_DEFAULT #endif //CONFIG_TWAI_ISR_IN_IRAM @@ -103,7 +101,7 @@ static twai_hal_context_t twai_context; /* -------------------- Interrupt and Alert Handlers ------------------------ */ -TWAI_ISR_ATTR static void twai_alert_handler(uint32_t alert_code, int *alert_req) +static void twai_alert_handler(uint32_t alert_code, int *alert_req) { if (p_twai_obj->alerts_enabled & alert_code) { //Signify alert has occurred @@ -123,7 +121,6 @@ TWAI_ISR_ATTR static void twai_alert_handler(uint32_t alert_code, int *alert_req } } -TWAI_ISR_ATTR static inline void twai_handle_rx_buffer_frames(BaseType_t *task_woken, int *alert_req) { #ifdef SOC_TWAI_SUPPORTS_RX_STATUS @@ -173,7 +170,6 @@ static inline void twai_handle_rx_buffer_frames(BaseType_t *task_woken, int *ale #endif //SOC_TWAI_SUPPORTS_RX_STATUS } -TWAI_ISR_ATTR static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *alert_req) { //Handle previously transmitted frame @@ -203,7 +199,7 @@ static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *aler } } -TWAI_ISR_ATTR static void twai_intr_handler_main(void *arg) +static void twai_intr_handler_main(void *arg) { BaseType_t task_woken = pdFALSE; int alert_req = 0; diff --git a/components/hal/linker.lf b/components/hal/linker.lf index cbcbb81a76..39e101e1c7 100644 --- a/components/hal/linker.lf +++ b/components/hal/linker.lf @@ -26,8 +26,6 @@ entries: wdt_hal_iram (noflash) if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n: systimer_hal (noflash) - if TWAI_ISR_IN_IRAM = y: - twai_hal_iram (noflash) if SOC_GPSPI_SUPPORTED = y && IDF_TARGET_ESP32 = n: spi_flash_hal_gpspi (noflash) if SOC_PMU_SUPPORTED = y: