diff --git a/components/ulp/test_apps/lp_core/lp_core_basic_tests/check_lp_core_no_soft_float.py b/components/ulp/test_apps/lp_core/lp_core_basic_tests/check_lp_core_no_soft_float.py new file mode 100644 index 00000000000..f4c694bf187 --- /dev/null +++ b/components/ulp/test_apps/lp_core/lp_core_basic_tests/check_lp_core_no_soft_float.py @@ -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() diff --git a/components/ulp/test_apps/lp_core/lp_core_basic_tests/main/CMakeLists.txt b/components/ulp/test_apps/lp_core/lp_core_basic_tests/main/CMakeLists.txt index 78ec8881201..7a22fcef159 100644 --- a/components/ulp/test_apps/lp_core/lp_core_basic_tests/main/CMakeLists.txt +++ b/components/ulp/test_apps/lp_core/lp_core_basic_tests/main/CMakeLists.txt @@ -68,19 +68,43 @@ idf_component_register(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}") +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}") +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}") +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}") +list(APPEND lp_core_test_apps lp_core_test_app_isr) if(CONFIG_SOC_RTC_TIMER_V2_SUPPORTED) 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() ulp_embed_binary(lp_core_test_app_gpio "${lp_core_sources_gpio}" "${lp_core_exp_dep_srcs}") if(CONFIG_SOC_LP_I2C_SUPPORTED) 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() if(CONFIG_SOC_ULP_LP_UART_SUPPORTED) @@ -90,7 +114,9 @@ endif() 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}") + 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}") + list(APPEND lp_core_test_apps lp_core_test_app_spi_slave) endif() if(CONFIG_SOC_LP_ADC_SUPPORTED) @@ -99,9 +125,15 @@ endif() if(CONFIG_SOC_LP_VAD_SUPPORTED) 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() 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_") +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}") +list(APPEND lp_core_test_apps lp_core_test_app_exception) + +lp_core_test_app_checks(${lp_core_test_apps})