mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
test(ulp): check LP core apps avoid soft-float helpers
Inspect generated LP core ELF files so accidental floating-point helper linkage is caught in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
e1d888cbcb
commit
1b33cacf80
@@ -39,4 +39,4 @@
|
|||||||
*
|
*
|
||||||
* @note Value is calibration-specific and may vary with compiler optimization.
|
* @note Value is calibration-specific and may vary with compiler optimization.
|
||||||
*/
|
*/
|
||||||
#define ULP_LP_CORE_DELAY_CALL_OVERHEAD_IN_CYCLES 11U
|
#define ULP_LP_CORE_DELAY_CALL_OVERHEAD_IN_CYCLES 14U
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
SOFT_FLOAT_SYMBOLS = {
|
||||||
|
'__adddf3',
|
||||||
|
'__addsf3',
|
||||||
|
'__divdf3',
|
||||||
|
'__divsf3',
|
||||||
|
'__eqdf2',
|
||||||
|
'__eqsf2',
|
||||||
|
'__extendsfdf2',
|
||||||
|
'__fixdfsi',
|
||||||
|
'__fixsfsi',
|
||||||
|
'__fixunsdfsi',
|
||||||
|
'__fixunssfsi',
|
||||||
|
'__floatunsidf',
|
||||||
|
'__floatunsisf',
|
||||||
|
'__floatsidf',
|
||||||
|
'__floatsisf',
|
||||||
|
'__gedf2',
|
||||||
|
'__gesf2',
|
||||||
|
'__gtdf2',
|
||||||
|
'__gtsf2',
|
||||||
|
'__ledf2',
|
||||||
|
'__lesf2',
|
||||||
|
'__ltdf2',
|
||||||
|
'__ltsf2',
|
||||||
|
'__muldf3',
|
||||||
|
'__mulsf3',
|
||||||
|
'__nedf2',
|
||||||
|
'__nesf2',
|
||||||
|
'__subdf3',
|
||||||
|
'__subsf3',
|
||||||
|
'__truncdfsf2',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
parser = argparse.ArgumentParser(description='Check that an LP core app does not link soft-float helpers')
|
||||||
|
parser.add_argument('symbol_file', type=Path)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
linked_symbols = set()
|
||||||
|
for line in args.symbol_file.read_text().splitlines():
|
||||||
|
fields = line.split()
|
||||||
|
if fields:
|
||||||
|
linked_symbols.add(fields[-1])
|
||||||
|
|
||||||
|
linked_soft_float = sorted(linked_symbols & SOFT_FLOAT_SYMBOLS)
|
||||||
|
if linked_soft_float:
|
||||||
|
symbols = ', '.join(linked_soft_float)
|
||||||
|
raise SystemExit(f'{args.symbol_file}: LP core app links soft-float helper symbols: {symbols}')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -76,46 +76,83 @@ idf_component_register(SRCS ${app_sources}
|
|||||||
|
|
||||||
set(lp_core_exp_dep_srcs ${app_sources})
|
set(lp_core_exp_dep_srcs ${app_sources})
|
||||||
|
|
||||||
|
function(lp_core_test_app_checks)
|
||||||
|
idf_build_get_property(python PYTHON)
|
||||||
|
|
||||||
|
foreach(app_name ${ARGN})
|
||||||
|
set(symbol_file ${CMAKE_CURRENT_BINARY_DIR}/${app_name}/${app_name}.sym)
|
||||||
|
set(check_output ${CMAKE_CURRENT_BINARY_DIR}/${app_name}/${app_name}.no_soft_float)
|
||||||
|
add_custom_command(OUTPUT ${check_output}
|
||||||
|
COMMAND ${python} ${CMAKE_CURRENT_LIST_DIR}/../check_lp_core_no_soft_float.py ${symbol_file}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch ${check_output}
|
||||||
|
DEPENDS ${symbol_file} ${CMAKE_CURRENT_LIST_DIR}/../check_lp_core_no_soft_float.py
|
||||||
|
VERBATIM)
|
||||||
|
add_custom_target(${app_name}_no_soft_float DEPENDS ${check_output})
|
||||||
|
add_dependencies(${COMPONENT_LIB} ${app_name}_no_soft_float)
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
set(lp_core_test_apps "")
|
||||||
|
|
||||||
ulp_embed_binary(lp_core_test_app "${lp_core_sources}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app "${lp_core_sources}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app)
|
||||||
ulp_embed_binary(lp_core_test_app_counter "${lp_core_sources_counter}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_counter "${lp_core_sources_counter}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_counter)
|
||||||
ulp_embed_binary(lp_core_test_app_wake_stub "${lp_core_sources_wake_stub}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_wake_stub "${lp_core_sources_wake_stub}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_wake_stub)
|
||||||
ulp_embed_binary(lp_core_test_app_isr "lp_core/test_main_isr.c" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_isr "lp_core/test_main_isr.c" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_isr)
|
||||||
|
|
||||||
if(CONFIG_SOC_RTC_TIMER_SUPPORTED)
|
if(CONFIG_SOC_RTC_TIMER_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_set_timer_wakeup "${lp_core_sources_set_timer_wakeup}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_set_timer_wakeup "${lp_core_sources_set_timer_wakeup}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_set_timer_wakeup)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ulp_embed_binary(lp_core_test_app_gpio "${lp_core_sources_gpio}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_gpio "${lp_core_sources_gpio}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_gpio)
|
||||||
|
|
||||||
if(CONFIG_SOC_LP_CORE_SUPPORT_I2C)
|
if(CONFIG_SOC_LP_CORE_SUPPORT_I2C)
|
||||||
ulp_embed_binary(lp_core_test_app_i2c "${lp_core_sources_i2c}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_i2c "${lp_core_sources_i2c}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_i2c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SOC_ULP_LP_UART_SUPPORTED)
|
if(CONFIG_SOC_ULP_LP_UART_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_uart "${lp_core_sources_uart}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_uart "${lp_core_sources_uart}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_uart)
|
||||||
if(CONFIG_SOC_DEEP_SLEEP_SUPPORTED)
|
if(CONFIG_SOC_DEEP_SLEEP_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_uart_wakeup "${lp_core_sources_uart_wakeup}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_uart_wakeup "${lp_core_sources_uart_wakeup}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_uart_wakeup)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SOC_LP_SPI_SUPPORTED)
|
if(CONFIG_SOC_LP_SPI_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_spi_master "${lp_core_sources_spi_master}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_spi_master "${lp_core_sources_spi_master}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_spi_master)
|
||||||
ulp_embed_binary(lp_core_test_app_spi_slave "${lp_core_sources_spi_slave}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_spi_slave "${lp_core_sources_spi_slave}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_spi_slave)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SOC_LP_ADC_SUPPORTED)
|
if(CONFIG_SOC_LP_ADC_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_adc "${lp_core_sources_adc}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_adc "${lp_core_sources_adc}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_adc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_SOC_LP_VAD_SUPPORTED)
|
if(CONFIG_SOC_LP_VAD_SUPPORTED)
|
||||||
ulp_embed_binary(lp_core_test_app_vad "${lp_core_sources_vad}" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_vad "${lp_core_sources_vad}" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_vad)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ulp_embed_binary(lp_core_test_app_prefix1 "lp_core/test_main_prefix1.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp1_")
|
ulp_embed_binary(lp_core_test_app_prefix1 "lp_core/test_main_prefix1.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp1_")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_prefix1)
|
||||||
ulp_embed_binary(lp_core_test_app_prefix2 "lp_core/test_main_prefix2.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp2_")
|
ulp_embed_binary(lp_core_test_app_prefix2 "lp_core/test_main_prefix2.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp2_")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_prefix2)
|
||||||
|
|
||||||
ulp_embed_binary(lp_core_test_app_exception "lp_core/test_main_exception.c" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_exception "lp_core/test_main_exception.c" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_exception)
|
||||||
|
|
||||||
if(CONFIG_SOC_LP_CORE_HW_AUTO_CLRWAKEUPCAUSE)
|
if(CONFIG_SOC_LP_CORE_HW_AUTO_CLRWAKEUPCAUSE)
|
||||||
ulp_embed_binary(lp_core_test_app_halt "lp_core/test_main_halt.c" "${lp_core_exp_dep_srcs}")
|
ulp_embed_binary(lp_core_test_app_halt "lp_core/test_main_halt.c" "${lp_core_exp_dep_srcs}")
|
||||||
|
list(APPEND lp_core_test_apps lp_core_test_app_halt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
lp_core_test_app_checks(${lp_core_test_apps})
|
||||||
|
|||||||
Reference in New Issue
Block a user