diff --git a/.gitignore b/.gitignore
index e50d6bee..7921088e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,4 @@ build.xcore
lib_mic_array.egg-info
examples/app_mic_array_basic/output.wav
examples/app_mic_array_basic/mic_array_output.bin
+tests/src/audio-test-tools
diff --git a/Jenkinsfile b/Jenkinsfile
index eaa19c37..f7075e8f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -225,17 +225,32 @@ pipeline {
dir(REPO_NAME){
checkoutScmShallow()
dir("tests") {
+ withTools(params.TOOLS_VX4_VERSION){
createVenv(reqFile: "requirements.txt")
withVenv {
dir("unit") {
- xcoreBuild(toolsVersion: params.TOOLS_VX4_VERSION)
+ xcoreBuild(
+ toolsVersion: params.TOOLS_VX4_VERSION,
+ cmakeOpts: '-DAPP_HW_TARGET=XK-EVK-XU416',
+ jobs:8
+ )
}
dir ("signal/BasicMicArray") {
- withTools(params.TOOLS_VX4_VERSION){
- xcoreBuild(toolsVersion: params.TOOLS_VX4_VERSION, jobs:8)
- }
+ xcoreBuild(
+ toolsVersion: params.TOOLS_VX4_VERSION,
+ cmakeOpts: '-DAPP_HW_TARGET=XK-EVK-XU416',
+ jobs:8
+ )
+ }
+ dir ("signal/profile/app_mips") {
+ xcoreBuild(
+ toolsVersion: params.TOOLS_VX4_VERSION,
+ cmakeOpts: '-DAPP_HW_TARGET=XK-EVK-XU416',
+ jobs:8
+ )
}
} // withVenv
+ } // withTools
} // dir("tests")
} // dir(REPO_NAME)
} // steps
@@ -243,13 +258,18 @@ pipeline {
stage('Run tests') {
steps {
dir("${REPO_NAME}/tests") {
+ withTools(params.TOOLS_VX4_VERSION) {
withVenv {
dir("unit") {
- withTools(params.TOOLS_VX4_VERSION) {sh "xrun --xscope bin/tests-unit.xe"}
+ sh "xrun --xscope bin/tests-unit.xe"
}
dir("signal/BasicMicArray") {
- withTools(params.TOOLS_VX4_VERSION) {sh 'python -m pytest --level nightly --seed 12345 -k "0isr or OneStageFilter" -v'}
+ sh 'pytest --level nightly --seed 12345 -k "0isr or OneStageFilter" -v'
+ }
+ dir ("signal/profile") {
+ sh 'pytest test_measure_mips.py --APP_HW_TARGET=XK-EVK-XU416 -v'
}
+ } // with tools
} // withVenv
}}} // stage('Run tests')
} // stages
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 99700f7d..2e687aa0 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(mic_array_examples)
add_subdirectory(app_mic_array)
-add_subdirectory(app_mic_array_basic)
add_subdirectory(app_shutdown)
add_subdirectory(app_par_decimator)
add_subdirectory(app_custom_filter)
diff --git a/examples/app_mic_array_basic/CMakeLists.txt b/examples/app_mic_array_basic/CMakeLists.txt
index 0b35ca79..b5628f85 100644
--- a/examples/app_mic_array_basic/CMakeLists.txt
+++ b/examples/app_mic_array_basic/CMakeLists.txt
@@ -4,25 +4,9 @@ project(app_mic_array)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
-# conditional depending on target
-set(APP_C_SRCS src/app.c)
-
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0")
- set(APP_HW_TARGET xs3/XK-EVK-XU316-AIV.xn)
- set(APP_INCLUDES src xs3)
- list(APPEND APP_C_SRCS
- xs3/device_pll_ctrl.c
- )
- list(APPEND APP_XC_SRCS
- xs3/mapfile.xc
- )
-else()
- set(APP_HW_TARGET XK-EVK-XU416)
- set(APP_INCLUDES src vx4)
- list(APPEND APP_C_SRCS
- vx4/device_pll_ctrl.c
- vx4/mapfile.c
- )
+# targets (IF NOT DEFINED OR NOT SUPPORTED)
+if(NOT DEFINED APP_HW_TARGET OR NOT APP_HW_TARGET STREQUAL "XK-EVK-XU416")
+ message(FATAL_ERROR "This application is only supported for XK-EVK-XU416. Please re-run cmake with -DAPP_HW_TARGET=XK-EVK-XU416.")
endif()
set(APP_DEPENDENT_MODULES "lib_mic_array")
diff --git a/examples/app_mic_array_basic/README.md b/examples/app_mic_array_basic/README.md
deleted file mode 100644
index 3c305b91..00000000
--- a/examples/app_mic_array_basic/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Basic Mic Array Example
-
-## Hardware Required
-
-- **XMS0016**
-
-## Compile
-
-```sh
-cmake -G "Unix Makefiles" -B build
-xmake -C build
-```
-
-## Run
-
-```sh
-xrun --xscope bin/app_mic_array.xe
-```
-
-## Convert Binary Data to WAV
-
-```sh
-python convert.py
-```
-
-**Output:**
-
-```
-Converted mic_array_output.bin to output.wav with 1 channels, 16000 Hz sample rate, and 32 bits per sample.
-```
diff --git a/examples/app_mic_array_basic/vx4/device_pll_ctrl.c b/examples/app_mic_array_basic/src/device_pll_ctrl.c
similarity index 92%
rename from examples/app_mic_array_basic/vx4/device_pll_ctrl.c
rename to examples/app_mic_array_basic/src/device_pll_ctrl.c
index e9262b51..2690337b 100644
--- a/examples/app_mic_array_basic/vx4/device_pll_ctrl.c
+++ b/examples/app_mic_array_basic/src/device_pll_ctrl.c
@@ -68,11 +68,11 @@ void device_pll_init(void)
// print reg values
printf("PLL Configuration:\n");
- printf("PLL DISABLE: 0x%08lX\n", DEVICE_PLL_DISABLE);
- printf("PLL MUX VAL: 0x%08lX\n", DEVICE_PLL_MUX_VAL);
- printf("PLL CTL VAL: 0x%08lX\n", DEVICE_PLL_CTL_VAL);
- printf("PLL DIV VAL: 0x%08lX\n", DEVICE_PLL_DIV_0);
- printf("PLL FRAC_NOM: 0x%08lX\n", DEVICE_PLL_FRAC_NOM);
+ printf("PLL DISABLE: 0x%08X\n", DEVICE_PLL_DISABLE);
+ printf("PLL MUX VAL: 0x%08X\n", DEVICE_PLL_MUX_VAL);
+ printf("PLL CTL VAL: 0x%08X\n", DEVICE_PLL_CTL_VAL);
+ printf("PLL DIV VAL: 0x%08X\n", DEVICE_PLL_DIV_0);
+ printf("PLL FRAC_NOM: 0x%08X\n", DEVICE_PLL_FRAC_NOM);
// CONFIGURE
sswitch_reg_try_write(tileid, VX_SSB_CSR_PLL1_CTRL_NUM, DEVICE_PLL_DISABLE); // disable PLL before configuration
diff --git a/examples/app_mic_array_basic/vx4/mapfile.c b/examples/app_mic_array_basic/src/mapfile.c
similarity index 100%
rename from examples/app_mic_array_basic/vx4/mapfile.c
rename to examples/app_mic_array_basic/src/mapfile.c
diff --git a/examples/app_mic_array_basic/xs3/XK-EVK-XU316-AIV.xn b/examples/app_mic_array_basic/xs3/XK-EVK-XU316-AIV.xn
deleted file mode 100644
index b4eb8fff..00000000
--- a/examples/app_mic_array_basic/xs3/XK-EVK-XU316-AIV.xn
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
- Board
- xcore.ai Vision Development Kit
-
-
- tileref tile[2]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/app_mic_array_basic/xs3/device_pll_ctrl.c b/examples/app_mic_array_basic/xs3/device_pll_ctrl.c
deleted file mode 100644
index a50d04f8..00000000
--- a/examples/app_mic_array_basic/xs3/device_pll_ctrl.c
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2022-2026 XMOS LIMITED.
-// This Software is subject to the terms of the XMOS Public Licence: Version 1.
-
-#include
-#include
-#include
-#include
-#include "device_pll_ctrl.h"
-
-
-#define DEVICE_PLL_CTL_VAL 0x0A019803 // Valid for all fractional values
-#define DEVICE_PLL_FRAC_NOM 0x800095F9 // 24.576000 MHz
-
-void device_pll_init(void)
-{
- unsigned tileid = get_local_tile_id();
-
- const unsigned DEVICE_PLL_DISABLE = 0x0201FF04;
- const unsigned DEVICE_PLL_DIV_0 = 0x80000004;
-
- write_sswitch_reg(tileid, XS1_SSWITCH_SS_APP_PLL_CTL_NUM,
- DEVICE_PLL_DISABLE);
-
- hwtimer_t tmr = hwtimer_alloc();
- {
- xassert(tmr != 0);
- hwtimer_delay(tmr, 100000); // 1ms with 100 MHz timer tick
- }
- hwtimer_free(tmr);
-
- write_sswitch_reg(tileid, XS1_SSWITCH_SS_APP_PLL_CTL_NUM, DEVICE_PLL_CTL_VAL);
- write_sswitch_reg(tileid, XS1_SSWITCH_SS_APP_PLL_CTL_NUM, DEVICE_PLL_CTL_VAL);
- write_sswitch_reg(tileid, XS1_SSWITCH_SS_APP_PLL_FRAC_N_DIVIDER_NUM, DEVICE_PLL_FRAC_NOM);
- write_sswitch_reg(tileid, XS1_SSWITCH_SS_APP_CLK_DIVIDER_NUM, DEVICE_PLL_DIV_0);
-}
diff --git a/examples/app_mic_array_basic/xs3/mapfile.xc b/examples/app_mic_array_basic/xs3/mapfile.xc
deleted file mode 100644
index 2c695375..00000000
--- a/examples/app_mic_array_basic/xs3/mapfile.xc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2023-2026 XMOS LIMITED.
-// This Software is subject to the terms of the XMOS Public Licence: Version 1.
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-extern "C" {
- void main_tile_0();
- void main_tile_1();
-}
-
-int main(void)
-{
- // Initialize parallel tasks
- par{
- on tile[0]: main_tile_0();
- on tile[1]: main_tile_1();
- }
- return 0;
-}
diff --git a/tests/signal/BasicMicArray/CMakeLists.txt b/tests/signal/BasicMicArray/CMakeLists.txt
index 39f596e0..a672cfd3 100644
--- a/tests/signal/BasicMicArray/CMakeLists.txt
+++ b/tests/signal/BasicMicArray/CMakeLists.txt
@@ -6,26 +6,29 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../..)
set(APP_DEPENDENT_MODULES "lib_mic_array")
-# conditional depending on target
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0") # XS3 (XTC 15.3.1)
- set(APP_HW_TARGET XK-EVK-XU316)
- set(COMMON_COMPILER_FLAGS -O2
- -g
- -report
- -mcmodel=large
- -Wno-xcore-fptrgroup
- -Wno-unknown-pragmas
- -Wno-format)
-
-else() # VX4
- set(APP_HW_TARGET XK-EVK-XU416)
- set(COMMON_COMPILER_FLAGS -Os
- -g
- -lxc
- -Wno-fptrgroup
- -Wno-format)
+# Target configuration
+if(NOT DEFINED APP_HW_TARGET OR APP_HW_TARGET STREQUAL "XK-EVK-XU316")
+ set(APP_HW_TARGET XK-EVK-XU316)
+ set(ARCH_COMPILER_FLAGS -O2
+ -g
+ -report
+ -mcmodel=large
+ -Wno-xcore-fptrgroup
+ -Wno-unknown-pragmas
+ -Wno-format)
+else()
+ if(APP_HW_TARGET STREQUAL "XK-EVK-XU416")
+ set(ARCH_COMPILER_FLAGS -Os
+ -g
+ -lxc
+ -Wno-fptrgroup
+ -Wno-format)
+ else()
+ message(FATAL_ERROR "Unsupported target ${APP_HW_TARGET}.")
+ endif()
endif()
+# Params
set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/test_params.json")
@@ -54,7 +57,7 @@ math(EXPR NUM_SAMP_FREQ "${NUM_SAMP_FREQ} - 1")
math(EXPR NUM_ONE_MIC_OVERRIDE "${NUM_ONE_MIC_OVERRIDE} - 1")
# Remove ISR if vx4 as it's not supported
- if (APP_HW_TARGET STREQUAL "XK-EVK-XU416")
+if(APP_HW_TARGET STREQUAL "XK-EVK-XU416")
set(USE_ISR_LIST "[0]")
set(NUM_USE_ISR 0)
endif()
@@ -113,7 +116,7 @@ foreach(l RANGE 0 ${NUM_SAMP_FREQ})
set(CONFIG "${N_MICS}ch_${FRAME_SIZE}smp_${USE_ISR}isr_${USE_1MIC_OVERRIDE}mo_${samp_freq_str}")
message(${CONFIG})
- set(APP_COMPILER_FLAGS_${CONFIG} ${COMMON_COMPILER_FLAGS}
+ set(APP_COMPILER_FLAGS_${CONFIG} ${ARCH_COMPILER_FLAGS}
-DMIC_ARRAY_CONFIG_USE_PDM_ISR=${USE_ISR}
-DMIC_ARRAY_CONFIG_SAMPLES_PER_FRAME=${FRAME_SIZE}
-DMIC_ARRAY_CONFIG_MIC_COUNT=${N_MICS}
@@ -131,7 +134,7 @@ endforeach()
set(APP_INCLUDES src ${AUTOGEN_OUT_DIR})
# One stage filter (small_768k_to_12k_filter.h) + 1-mic override
-set(APP_COMPILER_FLAGS_1stg_filter_1mic_override ${COMMON_COMPILER_FLAGS}
+set(APP_COMPILER_FLAGS_1stg_filter_1mic_override ${ARCH_COMPILER_FLAGS}
-DMIC_ARRAY_CONFIG_USE_PDM_ISR=0
-DMIC_ARRAY_CONFIG_SAMPLES_PER_FRAME=2
-DMIC_ARRAY_CONFIG_MIC_COUNT=2 # Set to something other than 1 to test 1-mic overriding
@@ -142,7 +145,7 @@ set(APP_COMPILER_FLAGS_1stg_filter_1mic_override ${COMMON_COMPILER_FLAGS}
)
# One stage filter (small_768k_to_12k_filter.h)
-set(APP_COMPILER_FLAGS_1stg_filter ${COMMON_COMPILER_FLAGS}
+set(APP_COMPILER_FLAGS_1stg_filter ${ARCH_COMPILER_FLAGS}
-DMIC_ARRAY_CONFIG_USE_PDM_ISR=0
-DMIC_ARRAY_CONFIG_SAMPLES_PER_FRAME=2
-DMIC_ARRAY_CONFIG_MIC_COUNT=2 # Set to something other than 1 to test 1-mic overriding
diff --git a/tests/signal/pdmrx_isr/CMakeLists.txt b/tests/signal/pdmrx_isr/CMakeLists.txt
index 3878863d..1dc5b63e 100644
--- a/tests/signal/pdmrx_isr/CMakeLists.txt
+++ b/tests/signal/pdmrx_isr/CMakeLists.txt
@@ -12,10 +12,15 @@ set(APP_COMPILER_FLAGS -Os
-DMIC_ARRAY_CONFIG_USE_PDM_ISR=1
)
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0") # XS3 (XTC 15.3.1)
-set(APP_HW_TARGET XK-EVK-XU316)
-else() # VX4
-set(APP_HW_TARGET XK-EVK-XU416)
+# Default target
+if(NOT DEFINED APP_HW_TARGET)
+ set(APP_HW_TARGET XK-EVK-XU316)
+endif()
+
+# Supported targets
+set(SUPPORTED_TARGETS "XK-EVK-XU316;XK-EVK-XU416")
+if(NOT APP_HW_TARGET IN_LIST SUPPORTED_TARGETS)
+ message(FATAL_ERROR "Unsupported target ${APP_HW_TARGET}. Supported: ${SUPPORTED_TARGETS}")
endif()
XMOS_REGISTER_APP()
diff --git a/tests/signal/profile/app_memory/CMakeLists.txt b/tests/signal/profile/app_memory/CMakeLists.txt
index c9410a47..94080d27 100644
--- a/tests/signal/profile/app_memory/CMakeLists.txt
+++ b/tests/signal/profile/app_memory/CMakeLists.txt
@@ -6,6 +6,10 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../../..)
set(APP_DEPENDENT_MODULES "lib_mic_array")
+if(APP_HW_TARGET STREQUAL "XK-EVK-XU416")
+message(FATAL_ERROR "Unsupported target ${APP_HW_TARGET}. This test is only supported on XK-VOICE-L71.xn.")
+endif()
+
set(APP_HW_TARGET XK-VOICE-L71.xn)
set(NAME_MAP custom;default)
diff --git a/tests/signal/profile/app_mips/CMakeLists.txt b/tests/signal/profile/app_mips/CMakeLists.txt
index 068f602e..bd755dcd 100644
--- a/tests/signal/profile/app_mips/CMakeLists.txt
+++ b/tests/signal/profile/app_mips/CMakeLists.txt
@@ -8,11 +8,20 @@ set(APP_DEPENDENT_MODULES "lib_mic_array")
set(AUTOGEN_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/autogen")
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0") # XS3 (XTC 15.3.1)
-set(ISR_LIST 0 1) # ISR and thread-based PDM handling
-else() # VX4
-set(ISR_LIST 0) # Only thread-based PDM handling supported on VX4
+# Target specific
+if(NOT DEFINED APP_HW_TARGET)
+ set(APP_HW_TARGET src/XK-VOICE-L71.xn)
+ set(ISR_LIST 0 1) # ISR and thread-based PDM handling
+ list(APPEND APP_DEPENDENT_MODULES "lib_board_support(1.5.0)")
+else()
+ if(APP_HW_TARGET STREQUAL "XK-EVK-XU416")
+ set(ISR_LIST 0) # Only thread-based PDM handling supported on VX4
+ set(APP_XC_SRCS "") # prevents including xc
+ else()
+ message(FATAL_ERROR "Unsupported target ${APP_HW_TARGET}.")
+ endif()
endif()
+message(STATUS "Building for target ${APP_HW_TARGET} with ISR_LIST=${ISR_LIST}")
set(NAME_MAP thread;isr)
# Exactly one custom filter (.pkl) may be listed alongside numeric sample rates.
@@ -71,16 +80,6 @@ endforeach()
set(APP_INCLUDES src src/mips/ ${AUTOGEN_OUT_DIR})
-# ---- Target specific ----
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0") # XS3 (XTC 15.3.1)
-set(APP_HW_TARGET src/XK-VOICE-L71.xn)
-list(APPEND APP_DEPENDENT_MODULES "lib_board_support(1.5.0)")
-else() # VX4
-set(APP_HW_TARGET XK-EVK-XU416)
-set(APP_XC_SRCS "") # prevents including xc
-endif()
-
-
XMOS_REGISTER_APP()
foreach(target ${APP_BUILD_TARGETS})
diff --git a/tests/signal/profile/app_mips/src/app_pll.c b/tests/signal/profile/app_mips/src/app_pll.c
index c9d266c4..1b8b4731 100644
--- a/tests/signal/profile/app_mips/src/app_pll.c
+++ b/tests/signal/profile/app_mips/src/app_pll.c
@@ -57,11 +57,11 @@ void app_pll_init(void)
// print reg values
printf("PLL Configuration:\n");
- printf("PLL DISABLE: 0x%08lX\n", DEVICE_PLL_DISABLE);
- printf("PLL MUX VAL: 0x%08lX\n", DEVICE_PLL_MUX_VAL);
- printf("PLL CTL VAL: 0x%08lX\n", DEVICE_PLL_CTL_VAL);
- printf("PLL DIV VAL: 0x%08lX\n", DEVICE_PLL_DIV_0);
- printf("PLL FRAC_NOM: 0x%08lX\n", DEVICE_PLL_FRAC_NOM);
+ printf("PLL DISABLE: 0x%08X\n", DEVICE_PLL_DISABLE);
+ printf("PLL MUX VAL: 0x%08X\n", DEVICE_PLL_MUX_VAL);
+ printf("PLL CTL VAL: 0x%08X\n", DEVICE_PLL_CTL_VAL);
+ printf("PLL DIV VAL: 0x%08X\n", DEVICE_PLL_DIV_0);
+ printf("PLL FRAC_NOM: 0x%08X\n", DEVICE_PLL_FRAC_NOM);
// CONFIGURE
sswitch_reg_try_write(tileid, VX_SSB_CSR_PLL1_CTRL_NUM, DEVICE_PLL_DISABLE); // disable PLL before configuration
diff --git a/tests/signal/profile/conftest.py b/tests/signal/profile/conftest.py
index 3a895863..ae63f9ad 100644
--- a/tests/signal/profile/conftest.py
+++ b/tests/signal/profile/conftest.py
@@ -8,3 +8,8 @@ def pytest_addoption(parser):
help=("Overwrite mic_array_memory.json and regenerate mic_array_memory_table.rst. "
"The comparison check which flags mips/memory being out of range doesn't run in this case.")
)
+ parser.addoption(
+ "--APP_HW_TARGET",
+ default="XK-EVK-XU316",
+ help="Hardware target board. Supported: XK-EVK-XU316 (default, xs3), XK-EVK-XU416 (vx4)"
+ )
diff --git a/tests/signal/profile/mic_array_mips_vx4.json b/tests/signal/profile/mic_array_mips_vx4.json
index d0f837b8..5cc650cc 100644
--- a/tests/signal/profile/mic_array_mips_vx4.json
+++ b/tests/signal/profile/mic_array_mips_vx4.json
@@ -1,8 +1,8 @@
{
- "1mic_thread_16000fs": 10.81,
- "1mic_thread_32000fs": 13.16,
- "1mic_thread_48000fs": 16.50,
- "2mic_thread_16000fs": 22.74,
- "2mic_thread_32000fs": 26.94,
- "2mic_thread_48000fs": 33.10
-}
+ "1mic_thread_16000fs": 11.6162,
+ "1mic_thread_32000fs": 13.9999,
+ "1mic_thread_48000fs": 17.3681,
+ "2mic_thread_16000fs": 23.6923,
+ "2mic_thread_32000fs": 27.9639,
+ "2mic_thread_48000fs": 34.2039
+}
\ No newline at end of file
diff --git a/tests/signal/profile/test_measure_mips.py b/tests/signal/profile/test_measure_mips.py
index cdb5fd07..15f5565a 100644
--- a/tests/signal/profile/test_measure_mips.py
+++ b/tests/signal/profile/test_measure_mips.py
@@ -12,31 +12,29 @@
MIC_LIST = [1, 2]
FS_LIST = [16000, 32000, 48000]
-def get_xcc_version() -> str:
- output = subprocess.check_output(["xcc", "--version"], text=True)
- for line in output.splitlines():
- if line.startswith("XTC version:"):
- return line.split(":")[1].strip()
- raise RuntimeError("XTC version not found")
-
-def get_mips_file() -> Path:
- xcc_version = get_xcc_version()
- if "15.3.1" in xcc_version:
- mips_file = cwd / "mic_array_mips_xs3.json"
- elif "99.99.99" in xcc_version:
- mips_file = cwd / "mic_array_mips_vx4.json"
- else:
- raise RuntimeError(f"Unsupported XCC version: {xcc_version}")
- return mips_file
-
-def get_isr_list():
- xcc_version = get_xcc_version()
- if "15.3.1" in xcc_version:
- return ["isr", "thread"]
- elif "99.99.99" in xcc_version:
- return ["thread"] # Only thread-based PDM handling supported on VX4
- else:
- raise RuntimeError(f"Unsupported XCC version: {xcc_version}")
+def get_isr_list(hw_target: str = "XK-EVK-XU316"):
+ options = {
+ "XK-EVK-XU316": ["isr", "thread"],
+ "XK-EVK-XU416": ["thread"],
+ }
+ isr_list = options[hw_target]
+ return isr_list
+
+def get_mips_file(hw_target: str = "XK-EVK-XU316") -> Path:
+ options = {
+ "XK-EVK-XU316": "mic_array_mips_xs3.json",
+ "XK-EVK-XU416": "mic_array_mips_vx4.json",
+ }
+ mips_file = options[hw_target]
+ return cwd / mips_file
+
+def get_rst_file(hw_target: str = "XK-EVK-XU316") -> Path:
+ options = {
+ "XK-EVK-XU316": "mic_array_mips_table.rst",
+ "XK-EVK-XU416": "mic_array_mips_table_vx4.rst",
+ }
+ rst_file = options[hw_target]
+ return cwd / rst_file
def max_mips(lines):
mips_values = []
@@ -105,7 +103,8 @@ def test_measure_mips(pytestconfig):
mic_array_mips_table.rst - autogenerated RST table of results
"""
update = pytestconfig.getoption("--update")
- pdmrx = get_isr_list()
+ hw_target = pytestconfig.getoption("--APP_HW_TARGET") or "XK-EVK-XU316"
+ pdmrx = get_isr_list(hw_target)
mics = MIC_LIST
fs = FS_LIST
results = {}
@@ -120,7 +119,8 @@ def test_measure_mips(pytestconfig):
# Compare against mic_array_mips.json that's already there to ensure MIPS
# number are in the same ballpark, before overwriting mic_array_mips.json
- outfile = get_mips_file()
+ outfile = get_mips_file(hw_target)
+ outfile_rst = get_rst_file(hw_target)
with outfile.open("r") as f:
ref_data = json.load(f)
for cfg in ref_data:
@@ -128,7 +128,7 @@ def test_measure_mips(pytestconfig):
assert cfg in results, f"cfg {cfg} not found in results.\nresults = {results}"
test_mips = results[cfg]
if not update:
- threshold = 0.50 #TODO replace by 0.05 once stable
+ threshold = 0.25 #TODO replace by 0.05 once stable
assert abs(test_mips - ref_mips) < threshold, (f"For cfg {cfg}, test_mips {test_mips} differ "
f"from ref_mips {ref_mips} by more than the allowed threshold of {threshold}.\n"
f"If this is expected, run test with pytest test_measure_mips --update "
@@ -139,5 +139,5 @@ def test_measure_mips(pytestconfig):
json.dump(results, f, indent=2)
# RST table output
- rst_out = cwd / "mic_array_mips_table.rst"
+ rst_out = outfile_rst
write_rst_table(results, rst_out)
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 9352cc9a..3f93e0f9 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -7,16 +7,9 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
set(APP_INCLUDES src)
set(APP_DEPENDENT_MODULES "lib_mic_array" "lib_unity(main)") #TODO release lib_unity
-# conditional depending on target
-if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL "3.6.0")
- set(__XS3__ ON) # XS3 (XTC 15.3.1)
-else()
- set(__XS3__ OFF) # VX4
-endif()
-
# Target specific compiler flags
-if(__XS3__) # xs3
- set(APP_HW_TARGET XK-EVK-XU316)
+if(NOT DEFINED APP_HW_TARGET OR APP_HW_TARGET STREQUAL "XK-EVK-XU316")
+ set(APP_HW_TARGET XK-EVK-XU316)
set(APP_COMPILER_FLAGS -O2
-g
-report
@@ -28,12 +21,15 @@ if(__XS3__) # xs3
-fxscope
-DUNITY_INCLUDE_CONFIG_H=1)
else() # vx4
- set(APP_HW_TARGET XK-EVK-XU416)
+ if(APP_HW_TARGET STREQUAL "XK-EVK-XU416")
set(APP_COMPILER_FLAGS
-Os
-g
-Wno-fptrgroup
-DUNITY_INCLUDE_CONFIG_H=1)
+ else()
+ message(FATAL_ERROR "Unsupported target ${APP_HW_TARGET}.")
+ endif()
endif()
XMOS_REGISTER_APP()