Merge branch 'feature/twai_linker_file' into 'master'

feat(twai): Add twai linker.lf to control the placement of driver and hal

Closes IDF-7806

See merge request espressif/esp-idf!25126
This commit is contained in:
morris 2023-08-07 15:21:37 +08:00
commit 27eec5bb6f
4 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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: