mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-14 14:06:54 +00:00
feat(uart): Add sdkconfig.ci.iram_safe test for UART driver
This commit is contained in:
@@ -31,6 +31,10 @@ set(includes "include"
|
||||
"uart/include"
|
||||
"usb_serial_jtag/include")
|
||||
|
||||
# Always included linker fragments
|
||||
set(ldfragments "linker.lf"
|
||||
"gpio/linker.lf")
|
||||
|
||||
# ADC related source files (dprecated)
|
||||
if(CONFIG_SOC_ADC_SUPPORTED)
|
||||
list(APPEND srcs "deprecated/adc_legacy.c")
|
||||
@@ -83,6 +87,8 @@ if(CONFIG_SOC_GPTIMER_SUPPORTED)
|
||||
list(APPEND srcs "gptimer/gptimer.c"
|
||||
"gptimer/gptimer_priv.c"
|
||||
"deprecated/timer_legacy.c")
|
||||
|
||||
list(APPEND ldfragments "gptimer/linker.lf")
|
||||
endif()
|
||||
|
||||
if(CONFIG_SOC_TIMER_SUPPORT_ETM)
|
||||
@@ -95,6 +101,8 @@ if(CONFIG_SOC_I2C_SUPPORTED)
|
||||
"i2c/i2c_master.c"
|
||||
"i2c/i2c_common.c"
|
||||
)
|
||||
|
||||
list(APPEND ldfragments "i2c/linker.lf")
|
||||
endif()
|
||||
|
||||
# I2S related source files
|
||||
@@ -190,11 +198,15 @@ endif()
|
||||
# TWAI related source files
|
||||
if(CONFIG_SOC_TWAI_SUPPORTED)
|
||||
list(APPEND srcs "twai/twai.c")
|
||||
|
||||
list(APPEND ldfragments "twai/linker.lf")
|
||||
endif()
|
||||
|
||||
# UART related source files
|
||||
if(CONFIG_SOC_UART_SUPPORTED)
|
||||
list(APPEND srcs "uart/uart.c")
|
||||
|
||||
list(APPEND ldfragments "uart/linker.lf")
|
||||
endif()
|
||||
|
||||
# USB Serial JTAG related source files
|
||||
@@ -216,10 +228,11 @@ else()
|
||||
# (Legacy drivers requires `esp_adc`, due to ADC HW resource mutex logics are there.
|
||||
# Can be removed together with legacy drivers)
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
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 twai/linker.lf i2c/linker.lf)
|
||||
INCLUDE_DIRS ${includes}
|
||||
PRIV_REQUIRES efuse esp_timer
|
||||
REQUIRES esp_pm esp_ringbuf freertos soc hal esp_hw_support
|
||||
LDFRAGMENTS ${ldfragments}
|
||||
)
|
||||
endif()
|
||||
|
||||
# If system needs to monitor USJ connection status, then usb_serial_jtag_connection_monitor object file has to be linked
|
||||
|
@@ -225,17 +225,7 @@ menu "Driver Configurations"
|
||||
|
||||
endmenu # TEMP_SENSOR Configuration
|
||||
|
||||
menu "UART Configuration"
|
||||
|
||||
config UART_ISR_IN_IRAM
|
||||
bool "Place UART ISR function into IRAM"
|
||||
depends on !RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH
|
||||
default n
|
||||
help
|
||||
If this option is not selected, UART interrupt will be disabled for a long time and
|
||||
may cause data lost when doing spi flash operation.
|
||||
|
||||
endmenu # UART Configuration
|
||||
orsource "./uart/Kconfig.uart"
|
||||
|
||||
menu "GPIO Configuration"
|
||||
config GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
|
||||
|
@@ -8,3 +8,16 @@ set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(uart_test)
|
||||
|
||||
if(CONFIG_COMPILER_DUMP_RTL_FILES)
|
||||
add_custom_target(check_test_app_sections ALL
|
||||
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
|
||||
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/driver/,${CMAKE_BINARY_DIR}/esp-idf/hal/
|
||||
--elf-file ${CMAKE_BINARY_DIR}/uart_test.elf
|
||||
find-refs
|
||||
--from-sections=.iram0.text
|
||||
--to-sections=.flash.text,.flash.rodata
|
||||
--exit-code
|
||||
DEPENDS ${elf}
|
||||
)
|
||||
endif()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
@@ -6,6 +6,13 @@ import pytest
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['release',], indirect=True,)
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'iram_safe',
|
||||
'release',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_uart_single_dev(case_tester) -> None: # type: ignore
|
||||
case_tester.run_all_normal_cases(reset=True)
|
||||
|
8
components/driver/test_apps/uart/sdkconfig.ci.iram_safe
Normal file
8
components/driver/test_apps/uart/sdkconfig.ci.iram_safe
Normal file
@@ -0,0 +1,8 @@
|
||||
CONFIG_COMPILER_DUMP_RTL_FILES=y
|
||||
CONFIG_UART_ISR_IN_IRAM=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_NONE=y
|
||||
# place non-ISR FreeRTOS functions in Flash
|
||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
||||
# silent the error check, as the error string are stored in rodata, causing RTL check failure
|
||||
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
@@ -1,2 +1,2 @@
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_ESP_TASK_WDT=n
|
||||
CONFIG_ESP_TASK_WDT_INIT=n
|
||||
|
11
components/driver/uart/Kconfig.uart
Normal file
11
components/driver/uart/Kconfig.uart
Normal file
@@ -0,0 +1,11 @@
|
||||
menu "UART Configuration"
|
||||
|
||||
config UART_ISR_IN_IRAM
|
||||
bool "Place UART ISR function into IRAM"
|
||||
depends on !RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH
|
||||
default n
|
||||
help
|
||||
If this option is not selected, UART interrupt will be disabled for a long time and
|
||||
may cause data lost when doing spi flash operation.
|
||||
|
||||
endmenu # UART Configuration
|
5
components/driver/uart/linker.lf
Normal file
5
components/driver/uart/linker.lf
Normal file
@@ -0,0 +1,5 @@
|
||||
[mapping:uart_hal]
|
||||
archive: libhal.a
|
||||
entries:
|
||||
if UART_ISR_IN_IRAM = y:
|
||||
uart_hal_iram (noflash)
|
@@ -355,7 +355,7 @@ esp_err_t uart_get_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t *flo
|
||||
|
||||
esp_err_t UART_ISR_ATTR uart_clear_intr_status(uart_port_t uart_num, uint32_t clr_mask)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
||||
ESP_RETURN_ON_FALSE_ISR((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
||||
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), clr_mask);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user