mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
Merge branch 'ci/add_base_size_metric_apps' into 'master'
ci(size_metrics): add base size metric test apps See merge request espressif/esp-idf!46208
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
|
||||
components/esp_timer/test_apps:
|
||||
components/esp_timer/test_apps/esp_timer_tests:
|
||||
enable:
|
||||
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET == "linux"
|
||||
reason: run existing default build targets and include Linux
|
||||
@@ -14,3 +14,10 @@ components/esp_timer/test_apps:
|
||||
reason: The test requires the XTAL32K clock to measure the esp_timer timing accuracy
|
||||
- if: CONFIG_NAME == "dfs" and SOC_PM_SUPPORTED != 1
|
||||
reason: The test requires the PM functionality
|
||||
|
||||
components/esp_timer/test_apps/size_metrics:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32", "esp32c6"]
|
||||
reason: Size metrics tracked on one RISC-V (esp32c6) and one Xtensa (esp32) target
|
||||
depends_components:
|
||||
- esp_timer
|
||||
|
||||
@@ -27,7 +27,7 @@ else()
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
PRIV_INCLUDE_DIRS "../../private_include" "../include"
|
||||
PRIV_INCLUDE_DIRS "../../../private_include" "../../include"
|
||||
PRIV_REQUIRES "${priv_requires}"
|
||||
WHOLE_ARCHIVE)
|
||||
|
||||
12
components/esp_timer/test_apps/size_metrics/CMakeLists.txt
Normal file
12
components/esp_timer/test_apps/size_metrics/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# Size metrics test app for esp_timer component
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
list(PREPEND SDKCONFIG_DEFAULTS
|
||||
"$ENV{IDF_PATH}/tools/test_apps/configs/sdkconfig.size_metrics"
|
||||
"sdkconfig.defaults")
|
||||
|
||||
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
||||
set(COMPONENTS main)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(size_metrics)
|
||||
2
components/esp_timer/test_apps/size_metrics/README.md
Normal file
2
components/esp_timer/test_apps/size_metrics/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C6 |
|
||||
| ----------------- | ----- | -------- |
|
||||
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS "main.c"
|
||||
PRIV_REQUIRES esp_timer
|
||||
WHOLE_ARCHIVE)
|
||||
@@ -0,0 +1,18 @@
|
||||
menu "Size Metrics Test App Configuration"
|
||||
|
||||
choice SIZE_METRICS_FUNCTION_SET
|
||||
prompt "Function set to compile"
|
||||
default SIZE_METRICS_FUNCTION_SET_MINIMAL
|
||||
help
|
||||
Select which set of functions to compile for size metrics comparison.
|
||||
Minimal set includes only basic functions, full set includes all features.
|
||||
|
||||
config SIZE_METRICS_FUNCTION_SET_MINIMAL
|
||||
bool "Minimal function set"
|
||||
|
||||
config SIZE_METRICS_FUNCTION_SET_FULL
|
||||
bool "Full function set"
|
||||
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
85
components/esp_timer/test_apps/size_metrics/main/main.c
Normal file
85
components/esp_timer/test_apps/size_metrics/main/main.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp_timer.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_SIZE_METRICS_FUNCTION_SET_MINIMAL
|
||||
// Minimal function set - basic timer operations only
|
||||
static void minimal_timer_callback(void* arg)
|
||||
{
|
||||
// Minimal callback implementation
|
||||
}
|
||||
|
||||
static void minimal_functions(void)
|
||||
{
|
||||
esp_timer_handle_t timer;
|
||||
esp_timer_create_args_t timer_args = {
|
||||
.callback = minimal_timer_callback,
|
||||
.name = "minimal_timer"
|
||||
};
|
||||
esp_timer_create(&timer_args, &timer);
|
||||
esp_timer_start_once(timer, 1000);
|
||||
esp_timer_stop(timer);
|
||||
esp_timer_delete(timer);
|
||||
}
|
||||
#endif // CONFIG_SIZE_METRICS_FUNCTION_SET_MINIMAL
|
||||
|
||||
#if CONFIG_SIZE_METRICS_FUNCTION_SET_FULL
|
||||
// Full function set - all timer features
|
||||
static void full_timer_callback(void* arg)
|
||||
{
|
||||
// Full callback implementation with more features
|
||||
}
|
||||
|
||||
static void full_periodic_timer_callback(void* arg)
|
||||
{
|
||||
// Periodic timer callback
|
||||
}
|
||||
|
||||
static void full_functions(void)
|
||||
{
|
||||
esp_timer_handle_t oneshot_timer;
|
||||
esp_timer_handle_t periodic_timer;
|
||||
|
||||
// One-shot timer
|
||||
esp_timer_create_args_t oneshot_args = {
|
||||
.callback = full_timer_callback,
|
||||
.name = "oneshot_timer"
|
||||
};
|
||||
esp_timer_create(&oneshot_args, &oneshot_timer);
|
||||
esp_timer_start_once(oneshot_timer, 1000);
|
||||
|
||||
// Periodic timer
|
||||
esp_timer_create_args_t periodic_args = {
|
||||
.callback = full_periodic_timer_callback,
|
||||
.name = "periodic_timer"
|
||||
};
|
||||
esp_timer_create(&periodic_args, &periodic_timer);
|
||||
esp_timer_start_periodic(periodic_timer, 5000);
|
||||
|
||||
// Timer operations
|
||||
esp_timer_stop(oneshot_timer);
|
||||
esp_timer_stop(periodic_timer);
|
||||
esp_timer_delete(oneshot_timer);
|
||||
esp_timer_delete(periodic_timer);
|
||||
}
|
||||
#endif // CONFIG_SIZE_METRICS_FUNCTION_SET_FULL
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
printf("size_metrics app_main started\n");
|
||||
|
||||
#if CONFIG_SIZE_METRICS_FUNCTION_SET_MINIMAL
|
||||
minimal_functions();
|
||||
#endif
|
||||
|
||||
#if CONFIG_SIZE_METRICS_FUNCTION_SET_FULL
|
||||
full_functions();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import pytest
|
||||
from pytest_embedded_idf.dut import IdfDut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize('config', ['minimal', 'full'], indirect=True)
|
||||
@idf_parametrize('target', ['esp32', 'esp32c6'], indirect=['target'])
|
||||
def test_esp_timer_size_metrics_boots(dut: IdfDut) -> None:
|
||||
dut.expect_exact('size_metrics app_main started', timeout=30)
|
||||
@@ -0,0 +1,3 @@
|
||||
# Full configuration for size metrics
|
||||
CONFIG_SIZE_METRICS_FUNCTION_SET_MINIMAL=n
|
||||
CONFIG_SIZE_METRICS_FUNCTION_SET_FULL=y
|
||||
@@ -0,0 +1,3 @@
|
||||
# Minimal configuration for size metrics
|
||||
CONFIG_SIZE_METRICS_FUNCTION_SET_MINIMAL=y
|
||||
CONFIG_SIZE_METRICS_FUNCTION_SET_FULL=n
|
||||
@@ -0,0 +1,2 @@
|
||||
# App-specific defaults for esp_timer size metrics
|
||||
CONFIG_ESP_TIMER_PROFILING=n
|
||||
Reference in New Issue
Block a user