From 99fc13958876fe6cdc8592e23bd948b604e82145 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 13 Sep 2024 14:36:45 +0100 Subject: [PATCH 01/47] Initial docs move (files only) --- {lib_spdif/doc => doc}/rst/images/Makefile | 0 .../doc => doc}/rst/images/spdif_rx_connect.odg | Bin .../doc => doc}/rst/images/spdif_rx_connect.pdf | Bin .../doc => doc}/rst/images/spdif_rx_task_diag.odg | Bin .../doc => doc}/rst/images/spdif_rx_task_diag.pdf | Bin .../doc => doc}/rst/images/spdif_tx_connect.odg | Bin .../doc => doc}/rst/images/spdif_tx_connect.pdf | Bin .../doc => doc}/rst/images/spdif_tx_task_diag.odg | Bin .../doc => doc}/rst/images/spdif_tx_task_diag.pdf | Bin {lib_spdif/doc => doc}/rst/lib_spdif.rst | 0 .../doc => doc}/rst/resource_usage_summary.rst | 0 lib_spdif/doc/rst/xdoc.conf | 4 ---- 12 files changed, 4 deletions(-) rename {lib_spdif/doc => doc}/rst/images/Makefile (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_rx_connect.odg (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_rx_connect.pdf (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_rx_task_diag.odg (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_rx_task_diag.pdf (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_tx_connect.odg (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_tx_connect.pdf (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_tx_task_diag.odg (100%) rename {lib_spdif/doc => doc}/rst/images/spdif_tx_task_diag.pdf (100%) rename {lib_spdif/doc => doc}/rst/lib_spdif.rst (100%) rename {lib_spdif/doc => doc}/rst/resource_usage_summary.rst (100%) delete mode 100644 lib_spdif/doc/rst/xdoc.conf diff --git a/lib_spdif/doc/rst/images/Makefile b/doc/rst/images/Makefile similarity index 100% rename from lib_spdif/doc/rst/images/Makefile rename to doc/rst/images/Makefile diff --git a/lib_spdif/doc/rst/images/spdif_rx_connect.odg b/doc/rst/images/spdif_rx_connect.odg similarity index 100% rename from lib_spdif/doc/rst/images/spdif_rx_connect.odg rename to doc/rst/images/spdif_rx_connect.odg diff --git a/lib_spdif/doc/rst/images/spdif_rx_connect.pdf b/doc/rst/images/spdif_rx_connect.pdf similarity index 100% rename from lib_spdif/doc/rst/images/spdif_rx_connect.pdf rename to doc/rst/images/spdif_rx_connect.pdf diff --git a/lib_spdif/doc/rst/images/spdif_rx_task_diag.odg b/doc/rst/images/spdif_rx_task_diag.odg similarity index 100% rename from lib_spdif/doc/rst/images/spdif_rx_task_diag.odg rename to doc/rst/images/spdif_rx_task_diag.odg diff --git a/lib_spdif/doc/rst/images/spdif_rx_task_diag.pdf b/doc/rst/images/spdif_rx_task_diag.pdf similarity index 100% rename from lib_spdif/doc/rst/images/spdif_rx_task_diag.pdf rename to doc/rst/images/spdif_rx_task_diag.pdf diff --git a/lib_spdif/doc/rst/images/spdif_tx_connect.odg b/doc/rst/images/spdif_tx_connect.odg similarity index 100% rename from lib_spdif/doc/rst/images/spdif_tx_connect.odg rename to doc/rst/images/spdif_tx_connect.odg diff --git a/lib_spdif/doc/rst/images/spdif_tx_connect.pdf b/doc/rst/images/spdif_tx_connect.pdf similarity index 100% rename from lib_spdif/doc/rst/images/spdif_tx_connect.pdf rename to doc/rst/images/spdif_tx_connect.pdf diff --git a/lib_spdif/doc/rst/images/spdif_tx_task_diag.odg b/doc/rst/images/spdif_tx_task_diag.odg similarity index 100% rename from lib_spdif/doc/rst/images/spdif_tx_task_diag.odg rename to doc/rst/images/spdif_tx_task_diag.odg diff --git a/lib_spdif/doc/rst/images/spdif_tx_task_diag.pdf b/doc/rst/images/spdif_tx_task_diag.pdf similarity index 100% rename from lib_spdif/doc/rst/images/spdif_tx_task_diag.pdf rename to doc/rst/images/spdif_tx_task_diag.pdf diff --git a/lib_spdif/doc/rst/lib_spdif.rst b/doc/rst/lib_spdif.rst similarity index 100% rename from lib_spdif/doc/rst/lib_spdif.rst rename to doc/rst/lib_spdif.rst diff --git a/lib_spdif/doc/rst/resource_usage_summary.rst b/doc/rst/resource_usage_summary.rst similarity index 100% rename from lib_spdif/doc/rst/resource_usage_summary.rst rename to doc/rst/resource_usage_summary.rst diff --git a/lib_spdif/doc/rst/xdoc.conf b/lib_spdif/doc/rst/xdoc.conf deleted file mode 100644 index f870e98..0000000 --- a/lib_spdif/doc/rst/xdoc.conf +++ /dev/null @@ -1,4 +0,0 @@ -XMOSNEWSTYLE = 2 -DOXYGEN_DIRS=../../api -SPHINX_MASTER_DOC=lib_spdif -XMOS_PART_NUMBER=XM-006988-UG From 9b247ded0e0d3a1f89eccab7d3d27414999d1a5e Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 13 Sep 2024 14:37:28 +0100 Subject: [PATCH 02/47] Examples use XCCM --- deps.cmake | 6 ++++ examples/CMakeLists.txt | 6 ++++ examples/app_spdif_loopback/CMakeLists.txt | 17 ++++++++++ examples/app_spdif_loopback/Makefile | 33 -------------------- examples/app_spdif_rx_example/CMakeLists.txt | 18 +++++++++++ examples/app_spdif_rx_example/Makefile | 33 -------------------- examples/app_spdif_tx_example/CMakeLists.txt | 17 ++++++++++ examples/app_spdif_tx_example/Makefile | 33 -------------------- lib_spdif/.makefile | 8 ----- 9 files changed, 64 insertions(+), 107 deletions(-) create mode 100644 deps.cmake create mode 100644 examples/CMakeLists.txt create mode 100644 examples/app_spdif_loopback/CMakeLists.txt delete mode 100644 examples/app_spdif_loopback/Makefile create mode 100644 examples/app_spdif_rx_example/CMakeLists.txt delete mode 100644 examples/app_spdif_rx_example/Makefile create mode 100644 examples/app_spdif_tx_example/CMakeLists.txt delete mode 100644 examples/app_spdif_tx_example/Makefile delete mode 100644 lib_spdif/.makefile diff --git a/deps.cmake b/deps.cmake new file mode 100644 index 0000000..ba967f5 --- /dev/null +++ b/deps.cmake @@ -0,0 +1,6 @@ +# Common dependencies for examples +set(APP_DEPENDENT_MODULES "lib_spdif" + "lib_sw_pll(2.2.0)" + "lib_xassert(4.2.0)" + "lib_logging(3.2.0)" +) \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..2b15372 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(lib_spdif_examples) +add_subdirectory(app_spdif_loopback) +add_subdirectory(app_spdif_tx_example) +add_subdirectory(app_spdif_rx_example) diff --git a/examples/app_spdif_loopback/CMakeLists.txt b/examples/app_spdif_loopback/CMakeLists.txt new file mode 100644 index 0000000..5857b67 --- /dev/null +++ b/examples/app_spdif_loopback/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(app_spdif_loopback) + +set(APP_HW_TARGET xk-audio-316-mc.xn) + +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(APP_COMPILER_FLAGS -O2 + -report + -g) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() diff --git a/examples/app_spdif_loopback/Makefile b/examples/app_spdif_loopback/Makefile deleted file mode 100644 index a54ddbd..0000000 --- a/examples/app_spdif_loopback/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = xk-audio-316-mc.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = app_spdif_loopback - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -XCC_FLAGS = -O3 -g - -# The USED_MODULES variable lists other module used by the application. - -USED_MODULES = lib_spdif lib_sw_pll lib_xassert - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/examples/app_spdif_rx_example/CMakeLists.txt b/examples/app_spdif_rx_example/CMakeLists.txt new file mode 100644 index 0000000..a8e63d3 --- /dev/null +++ b/examples/app_spdif_rx_example/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(app_spdif_rx_example) + +set(APP_HW_TARGET xk-audio-316-mc.xn) + +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(APP_COMPILER_FLAGS -O2 + -report + -g + -DDEBUG_PRINT_ENABLE=1) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() diff --git a/examples/app_spdif_rx_example/Makefile b/examples/app_spdif_rx_example/Makefile deleted file mode 100644 index f4453ae..0000000 --- a/examples/app_spdif_rx_example/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = xk-audio-316-mc.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = app_example_rx - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -XCC_FLAGS = -O2 -g -DDEBUG_PRINT_ENABLE=1 - -# The USED_MODULES variable lists other module used by the application. - -USED_MODULES = lib_spdif lib_logging - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/examples/app_spdif_tx_example/CMakeLists.txt b/examples/app_spdif_tx_example/CMakeLists.txt new file mode 100644 index 0000000..8308d1b --- /dev/null +++ b/examples/app_spdif_tx_example/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(app_example_tx) + +set(APP_HW_TARGET xk-audio-316-mc.xn) + +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(APP_COMPILER_FLAGS -O2 + -report + -g) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() diff --git a/examples/app_spdif_tx_example/Makefile b/examples/app_spdif_tx_example/Makefile deleted file mode 100644 index 20c1f64..0000000 --- a/examples/app_spdif_tx_example/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = xk-audio-316-mc.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -XCC_FLAGS = -O2 -g - -# The USED_MODULES variable lists other module used by the application. - -USED_MODULES = lib_spdif lib_sw_pll lib_xassert - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/lib_spdif/.makefile b/lib_spdif/.makefile deleted file mode 100644 index 87b347b..0000000 --- a/lib_spdif/.makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: - @echo "** Module only - only builds as part of application **" - - -clean: - @echo "** Module only - only builds as part of application **" - - From b9f3a5f96a0dca95107d26348cc480f18c296f27 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 13 Sep 2024 16:32:38 +0100 Subject: [PATCH 03/47] XCCM for tests (with multi-target) --- examples/app_spdif_rx_example/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 7 ++++ tests/rx_capture/CMakeLists.txt | 18 ++++++++++ tests/rx_capture/Makefile | 32 ----------------- tests/spdif_rx_analyse/CMakeLists.txt | 19 ++++++++++ tests/test_deps.cmake | 5 +++ tests/test_rx/CMakeLists.txt | 33 +++++++++++++++++ tests/test_rx/Makefile | 36 ------------------- tests/test_tx/CMakeLists.txt | 38 ++++++++++++++++++++ 9 files changed, 121 insertions(+), 69 deletions(-) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/rx_capture/CMakeLists.txt delete mode 100644 tests/rx_capture/Makefile create mode 100644 tests/spdif_rx_analyse/CMakeLists.txt create mode 100644 tests/test_deps.cmake create mode 100644 tests/test_rx/CMakeLists.txt delete mode 100644 tests/test_rx/Makefile create mode 100644 tests/test_tx/CMakeLists.txt diff --git a/examples/app_spdif_rx_example/CMakeLists.txt b/examples/app_spdif_rx_example/CMakeLists.txt index a8e63d3..69101c8 100644 --- a/examples/app_spdif_rx_example/CMakeLists.txt +++ b/examples/app_spdif_rx_example/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.21) include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) -project(app_spdif_rx_example) +project(app_example_rx) set(APP_HW_TARGET xk-audio-316-mc.xn) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..8b84368 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(lib_spdif_tests) +add_subdirectory(rx_capture) +add_subdirectory(spdif_rx_analyse) +add_subdirectory(test_rx) +add_subdirectory(test_tx) diff --git a/tests/rx_capture/CMakeLists.txt b/tests/rx_capture/CMakeLists.txt new file mode 100644 index 0000000..fa8b0ec --- /dev/null +++ b/tests/rx_capture/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(rx_capture) + +set(APP_HW_TARGET xk-audio-316-mc.xn) + +include(${CMAKE_CURRENT_LIST_DIR}/../test_deps.cmake) + +set(APP_COMPILER_FLAGS -O2 + -report + -g + -DDEBUG_PRINT_ENABLE=1) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() diff --git a/tests/rx_capture/Makefile b/tests/rx_capture/Makefile deleted file mode 100644 index 745e2c1..0000000 --- a/tests/rx_capture/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = xk-audio-316-mc.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -XCC_FLAGS = $(EXTRA_BUILD_FLAGS) -O2 -g -report -DDEBUG_PRINT_ENABLE=1 - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/spdif_rx_analyse/CMakeLists.txt b/tests/spdif_rx_analyse/CMakeLists.txt new file mode 100644 index 0000000..811e167 --- /dev/null +++ b/tests/spdif_rx_analyse/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(spdif_rx_analyse) + +set(APP_HW_TARGET xcore_ai_generic_500.xn) + +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(APP_COMPILER_FLAGS -O2 + -report + -g + -DDEBUG_PRINT_ENABLE=1 + -DTILE=0) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() diff --git a/tests/test_deps.cmake b/tests/test_deps.cmake new file mode 100644 index 0000000..0018de0 --- /dev/null +++ b/tests/test_deps.cmake @@ -0,0 +1,5 @@ +# Common dependencies for tests +set(APP_DEPENDENT_MODULES "lib_spdif" + "lib_xassert(4.2.0)" + "lib_logging(3.2.0)" +) \ No newline at end of file diff --git a/tests/test_rx/CMakeLists.txt b/tests/test_rx/CMakeLists.txt new file mode 100644 index 0000000..9660c8c --- /dev/null +++ b/tests/test_rx/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.21) + +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +set(APP_PCA_ENABLE ON) + +set(CONFIGS XS2_300 + XS3_300) + +set(HW_TARGETS XCORE-200-EXPLORER-300.xn + XCORE-AI-EXPLORER-300.xn) + +foreach(CONFIG IN LISTS CONFIGS) + list(FIND CONFIGS "${CONFIG}" FOUND_INDEX) + list(GET HW_TARGETS ${FOUND_INDEX} XN_FILE) + message(STATUS "XN_FILE ${XN_FILE} found in config ${CONFIG} index ${FOUND_INDEX}") + + project(test_rx_${CONFIG}) + set(APP_HW_TARGET ${XN_FILE}) + set(APP_COMPILER_FLAGS_${CONFIG} + -O3 + -report + -g + ) + + XMOS_REGISTER_APP() + + unset(APP_COMPILER_FLAGS_${CONFIG}) +endforeach() + diff --git a/tests/test_rx/Makefile b/tests/test_rx/Makefile deleted file mode 100644 index 5c50dd4..0000000 --- a/tests/test_rx/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -ifeq ($(CONFIG), xs2) - TARGET = XCORE-200-EXPLORER-300.xn -endif -ifeq ($(CONFIG), xs3) - TARGET = XCORE-AI-EXPLORER-300.xn -endif - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_xs2 = $(EXTRA_BUILD_FLAGS) -O0 -g -save-temps -XCC_FLAGS_xs3 = $(EXTRA_BUILD_FLAGS) -O0 -g -save-temps - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_spdif - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/test_tx/CMakeLists.txt b/tests/test_tx/CMakeLists.txt new file mode 100644 index 0000000..8188200 --- /dev/null +++ b/tests/test_tx/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.21) + +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +set(APP_PCA_ENABLE ON) + +set(CONFIGS XS2_300 + XS2_500 + XS3_375 + XS3_600) +set(HW_TARGETS XCORE-200-EXPLORER-300.xn + XCORE-200-EXPLORER + XCORE-AI-EXPLORER-375.xn + XCORE-AI-EXPLORER) + + +foreach(CONFIG IN LISTS CONFIGS) + list(FIND CONFIGS "${CONFIG}" FOUND_INDEX) + list(GET HW_TARGETS ${FOUND_INDEX} XN_FILE) + message(STATUS "XN_FILE ${XN_FILE} found in config ${CONFIG} index ${FOUND_INDEX}") + + project(test_tx_${CONFIG}) + set(APP_HW_TARGET ${XN_FILE}) + set(APP_COMPILER_FLAGS_${CONFIG} + -O3 + -report + -g + ) + + XMOS_REGISTER_APP() + + unset(APP_COMPILER_FLAGS_${CONFIG}) + unset(APP_HW_TARGET) +endforeach() + From c532b52785a1af26fb530939d04ac5ff848d4001 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 11:42:29 +0100 Subject: [PATCH 04/47] Initial updated Jenkins --- Jenkinsfile | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec8b1e8..310870d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,5 @@ -@Library('xmos_jenkins_shared_library@v0.29.0') _ +@Library('xmos_jenkins_shared_library@develop') _ +// New lib checks fn - will be merged into mainline soon so will need to update this tag getApproval() @@ -8,22 +9,43 @@ pipeline { } environment { REPO = 'lib_spdif' - VIEW = getViewName(REPO) + PYTHON_VERSION = "3.10.5" + VENV_DIRNAME = ".venv" } options { skipDefaultCheckout() timestamps() - buildDiscarder(xmosDiscardBuildSettings()) - } + // on develop discard builds after a certain number else keep forever + buildDiscarder(logRotator( + numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '', + artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '' + )) } + parameters { + string( + name: 'TOOLS_VERSION', + defaultValue: '15.3.0', + description: 'The XTC tools version' + ) + } stages { - stage('Get view') { + stage('Get Sandbox') { steps { - xcorePrepareSandbox("${VIEW}", "${REPO}") + dir("${REPO}") { + checkout scm + installPipfile(false) + withVenv { + withTools(params.TOOLS_VERSION) { + dir("examples") { + sh 'cmake -B build -G "Unix Makefiles"' + } + } + } + } } } stage('Library checks') { steps { - xcoreLibraryChecks("${REPO}", false) + runLibraryChecks("${WORKSPACE}/${REPO}", "v2.0.0") } } // stage('Generate') { @@ -40,7 +62,11 @@ pipeline { dir("${REPO}/tests"){ viewEnv(){ withVenv() { - sh "pytest -v --junitxml=pytest_result.xml" + withTools(params.TOOLS_VERSION) { + sh 'cmake -B build -G "Unix Makefiles"' + sh 'xmake -j 16 -C build' + sh "pytest -v --junitxml=pytest_result.xml" + } } } } @@ -49,10 +75,10 @@ pipeline { stage('xCORE builds and doc') { steps { dir("${REPO}") { - xcoreAllAppsBuild('examples') - runXdoc("${REPO}/doc") + // xcoreAllAppsBuild('examples') + // runXdoc("${REPO}/doc") // Archive all the generated .pdf docs - archiveArtifacts artifacts: "${REPO}/**/pdf/*.pdf", fingerprint: true, allowEmptyArchive: true + // archiveArtifacts artifacts: "${REPO}/**/pdf/*.pdf", fingerprint: true, allowEmptyArchive: true } } } From bcdc6510a4af00645751be788a0e526f1c329f0a Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 11:45:06 +0100 Subject: [PATCH 05/47] test support --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 310870d..e27d330 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,6 +30,7 @@ pipeline { stages { stage('Get Sandbox') { steps { + sh 'git clone git@github.com:xmos/test_support' dir("${REPO}") { checkout scm installPipfile(false) From b4428950655cb3d94c77ea50a42a187328a65096 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 11:56:12 +0100 Subject: [PATCH 06/47] Update readme --- README.rst | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/README.rst b/README.rst index 65c7ce2..4c43a2d 100644 --- a/README.rst +++ b/README.rst @@ -1,42 +1,30 @@ -S/PDIF Component -################ +S/PDIF Library +############## -:Version: 6.1.1 -:Vendor: XMOS -:Scope: General Use - -Summary -******* +Overview +-------- A software defined S/PDIF library that allows transmission and reception of S/PDIF data via xCORE ports. S/PDIF is a digital data streaming interface. The components in the library are controlled via C using the XMOS multicore extensions (xC) and provides both a S/PDIF receiver and transmitter. Features -======== +........ * Supports stereo S/PDIF receive for sample rates up to 192KHz * Supports stereo S/PDIF transmit for sample rates up to 192KHz * Fully compliant to the IEC60958 specification Related Application Notes -========================= +......................... The following application notes use this library: * AN00231 - SPDIF Receive to I2S output using Asynchronous Sample Rate Conversion + * TODO update to AN02003 etc. -Required Software (dependencies) -================================ - - * None - -Documentation -============= - -You can find the documentation for this software in the /doc directory of the package. - -Support -======= +Software version and dependencies +................................. -This package is supported by XMOS Ltd. Issues can be raised against the software at: http://www.xmos.com/support +The CHANGELOG contains information about the current and previous versions. +For a list of direct dependencies, look for DEPENDENT_MODULES in lib_sw_pll/module_build_info. From 2b358805e4e6a2c77f8c5e70ea5d581e2a7e8edd Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 12:05:39 +0100 Subject: [PATCH 07/47] Correct repo name in readme --- Jenkinsfile | 12 +++++++++++- README.rst | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e27d330..88918c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,7 +73,17 @@ pipeline { } } } - stage('xCORE builds and doc') { + stage('xCORE builds') { + steps { + dir("${REPO}") { + // xcoreAllAppsBuild('examples') + // runXdoc("${REPO}/doc") + // Archive all the generated .pdf docs + // archiveArtifacts artifacts: "${REPO}/**/pdf/*.pdf", fingerprint: true, allowEmptyArchive: true + } + } + } + stage('XMOSDOC') { steps { dir("${REPO}") { // xcoreAllAppsBuild('examples') diff --git a/README.rst b/README.rst index 4c43a2d..159e9cd 100644 --- a/README.rst +++ b/README.rst @@ -27,4 +27,5 @@ Software version and dependencies ................................. The CHANGELOG contains information about the current and previous versions. -For a list of direct dependencies, look for DEPENDENT_MODULES in lib_sw_pll/module_build_info. +For a list of direct dependencies, look for DEPENDENT_MODULES in lib_spdif/module_build_info. + From 08bdc7d445935395c12cb3968402fa4dbf238499 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 12:20:06 +0100 Subject: [PATCH 08/47] Reduce rc_capture mem slightly --- tests/rx_capture/src/main.xc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/rx_capture/src/main.xc b/tests/rx_capture/src/main.xc index ecc606a..5313580 100644 --- a/tests/rx_capture/src/main.xc +++ b/tests/rx_capture/src/main.xc @@ -6,8 +6,9 @@ #include #include -#define ARRAY_LEN_0 130129 -#define ARRAY_LEN_1 130409 +// Sized to allow as much buffer as possible +#define ARRAY_LEN_0 129683 +#define ARRAY_LEN_1 129960 #ifndef OPTICAL #define OPTICAL 1 From 69feed8cd1ea72345267a7a8c1326f91e924bba5 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 12:24:23 +0100 Subject: [PATCH 09/47] Add docs stage --- Jenkinsfile | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88918c4..d38e07e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { } environment { REPO = 'lib_spdif' - PYTHON_VERSION = "3.10.5" + PYTHON_VERSION = "3.10.5" // Move to 3.12.1 and in requirements VENV_DIRNAME = ".venv" } options { @@ -17,20 +17,28 @@ pipeline { timestamps() // on develop discard builds after a certain number else keep forever buildDiscarder(logRotator( - numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '', - artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '' + numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '', + artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '' )) } - parameters { - string( - name: 'TOOLS_VERSION', - defaultValue: '15.3.0', - description: 'The XTC tools version' - ) - } + parameters { + string( + name: 'TOOLS_VERSION', + defaultValue: '15.3.0', + description: 'The XTC tools version' + ) + string( + name: 'XMOSDOC_VERSION', + defaultValue: 'v6.0.0', + description: 'The xmosdoc version' + ) + } stages { stage('Get Sandbox') { steps { + println "Stage running on: ${env.NODE_NAME}" + sh 'git clone git@github.com:xmos/test_support' + dir("${REPO}") { checkout scm installPipfile(false) @@ -49,6 +57,17 @@ pipeline { runLibraryChecks("${WORKSPACE}/${REPO}", "v2.0.0") } } + stage('Documentation') { + steps { + dir("${REPO}") { + withVenv { + sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" + sh 'xmosdoc' + zip zipFile: "${REPO}_docs.zip", archive: true, dir: 'doc/_build' + } // withVenv + } // dir + } + } // stage('Generate') { // steps { // dir("${REPO}/support/rx_generator") { @@ -83,16 +102,6 @@ pipeline { } } } - stage('XMOSDOC') { - steps { - dir("${REPO}") { - // xcoreAllAppsBuild('examples') - // runXdoc("${REPO}/doc") - // Archive all the generated .pdf docs - // archiveArtifacts artifacts: "${REPO}/**/pdf/*.pdf", fingerprint: true, allowEmptyArchive: true - } - } - } } post { always { From 8508676b6043d59d5609475fca921cb17cb84070 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 16:43:06 +0100 Subject: [PATCH 10/47] rx_test uses JSON config --- tests/test_rx.py | 48 ++++++++++++++-------------- tests/test_rx/CMakeLists.txt | 58 ++++++++++++++++++++++++---------- tests/test_rx/test_params.json | 7 ++++ 3 files changed, 73 insertions(+), 40 deletions(-) create mode 100644 tests/test_rx/test_params.json diff --git a/tests/test_rx.py b/tests/test_rx.py index 90d42cf..5e1baf7 100644 --- a/tests/test_rx.py +++ b/tests/test_rx.py @@ -14,6 +14,7 @@ Recorded_stream, freq_for_sample_rate, ) +import json MAX_CYCLES = 200000000 pyxsim_timeout = 3600 @@ -21,6 +22,9 @@ MHz = 1000 * KHz +with open(Path(__file__).parent / "test_rx/test_params.json") as f: + params = json.load(f) + # When set to 0 the first sub-frame sent is Z the offset can be used to change where in the frame # the test starts sending and may help reduce time in the simulator to first Z sub-frame out QUICK_START_OFFSET = 0 @@ -29,8 +33,8 @@ # that it can complete the test while still receiving data NO_OF_TEST_BLOCKS = 7 -SAM_FREQS = [44100, 48000, 88200, 96000, 176400, 192000] -CONFIGS = ["xs2", "xs3"] +SAM_FREQS = params["SAM_FREQS"] +CONFIGS = [item["ARCH"].lower() for item in params["CONFIG"]] STREAMS = [ Recorded_stream("44100-coax.stream", [["ramp", 5], ["ramp", -7]], 44100, 100 * MHz), @@ -106,7 +110,10 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): # time taken in the simulator to correct frequency currently too long for tests. Re-enable sample rate mismatch once resolved # sample_freq_estimate = sam_freq - xe = str(Path(__file__).parent / f"test_rx/bin/{config}/test_rx_{config}.xe") + build_config = f"{config.upper()}_{300}_{sam_freq}" + xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") + assert Path(xe).exists(), f"Cannot find {xe}" + p_spdif_in = "tile[0]:XS1_PORT_1E" p_debug_out = "tile[0]:XS1_PORT_32A" p_debug_strobe = "tile[0]:XS1_PORT_1F" @@ -132,19 +139,15 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): simargs = ["--max-cycles", str(MAX_CYCLES)] - result = Pyxsim.run_on_simulator( + result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, instTracing=True, - clean_before_build=True, tester=tester, capfd=capfd, timeout=pyxsim_timeout, simargs=simargs, - build_options=[ - f"CONFIG={config}", - f"EXTRA_BUILD_FLAGS=-DSAMPLE_FREQ_ESTIMATE={sample_freq_estimate}", - ], + do_xe_prebuild=False ) assert result @@ -156,7 +159,11 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): @pytest.mark.parametrize("stream", STREAMS, ids=param_id) @pytest.mark.parametrize("config", CONFIGS) def test_rx_stream(config, stream, capfd): - xe = str(Path(__file__).parent / f"test_rx/bin/{config}/test_rx_{config}.xe") + + build_config = f"{config.upper()}_{300}_{stream.sam_freq}" + xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") + assert Path(xe).exists(), f"Cannot find {xe}" + p_spdif_in = "tile[0]:XS1_PORT_1E" p_debug_out = "tile[0]:XS1_PORT_32A" p_debug_strobe = "tile[0]:XS1_PORT_1F" @@ -184,19 +191,15 @@ def test_rx_stream(config, stream, capfd): simargs = ["--max-cycles", str(MAX_CYCLES)] - result = Pyxsim.run_on_simulator( + result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, instTracing=True, - clean_before_build=True, + do_xe_prebuild=False, tester=tester, capfd=capfd, timeout=pyxsim_timeout, simargs=simargs, - build_options=[ - f"CONFIG={config}", - f"EXTRA_BUILD_FLAGS=-DSAMPLE_FREQ_ESTIMATE={stream.sam_freq}", - ], ) assert result @@ -210,7 +213,10 @@ def test_rx_stream(config, stream, capfd): ) @pytest.mark.parametrize("config", CONFIGS) def test_rx_samfreq_change(config, stream0, stream1, capfd): - xe = str(Path(__file__).parent / f"test_rx/bin/{config}/test_rx_{config}.xe") + build_config = f"{config.upper()}_{300}_{stream0.sam_freq}" + xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") + assert Path(xe).exists(), f"Cannot find {xe}" + p_spdif_in = "tile[0]:XS1_PORT_1E" p_debug_out = "tile[0]:XS1_PORT_32A" p_debug_strobe = "tile[0]:XS1_PORT_1F" @@ -262,18 +268,14 @@ def test_rx_samfreq_change(config, stream0, stream1, capfd): simargs = ["--max-cycles", str(MAX_CYCLES)] - result = Pyxsim.run_on_simulator( + result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, instTracing=True, - clean_before_build=True, + do_xe_prebuild=False, tester=tester, capfd=capfd, timeout=pyxsim_timeout, simargs=simargs, - build_options=[ - f"CONFIG={config}", - f"EXTRA_BUILD_FLAGS=-DSAMPLE_FREQ_ESTIMATE={stream0.sam_freq}", - ], ) assert result diff --git a/tests/test_rx/CMakeLists.txt b/tests/test_rx/CMakeLists.txt index 9660c8c..c4e736c 100644 --- a/tests/test_rx/CMakeLists.txt +++ b/tests/test_rx/CMakeLists.txt @@ -7,27 +7,51 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) set(APP_PCA_ENABLE ON) -set(CONFIGS XS2_300 - XS3_300) +# set(CONFIGS XS2_300 +# XS3_300) +# Get JSON lists +file(READ ${CMAKE_CURRENT_LIST_DIR}/test_params.json JSON_CONTENT) -set(HW_TARGETS XCORE-200-EXPLORER-300.xn - XCORE-AI-EXPLORER-300.xn) +# Parse the JSON file into variables +string(JSON SAM_FREQS_LIST GET ${JSON_CONTENT} SAM_FREQS) +string(JSON CONFIG_LIST GET ${JSON_CONTENT} CONFIG) -foreach(CONFIG IN LISTS CONFIGS) - list(FIND CONFIGS "${CONFIG}" FOUND_INDEX) - list(GET HW_TARGETS ${FOUND_INDEX} XN_FILE) - message(STATUS "XN_FILE ${XN_FILE} found in config ${CONFIG} index ${FOUND_INDEX}") +# Convert JSON lists to CMake lists +string(JSON NUM_SAM_FREQS LENGTH ${SAM_FREQS_LIST}) +string(JSON NUM_CONFIGS LENGTH ${CONFIG_LIST}) - project(test_rx_${CONFIG}) - set(APP_HW_TARGET ${XN_FILE}) - set(APP_COMPILER_FLAGS_${CONFIG} - -O3 - -report - -g - ) +# Subtract one off each of the lengths because RANGE includes last element +math(EXPR NUM_SAM_FREQS "${NUM_SAM_FREQS} - 1") +math(EXPR NUM_CONFIGS "${NUM_CONFIGS} - 1") - XMOS_REGISTER_APP() +foreach(i RANGE 0 ${NUM_CONFIGS}) + message(STATUS IDX:${i}) + string(JSON CONFIG GET ${CONFIG_LIST} ${i}) + message(STATUS CONFIG:${CONFIG}) + string(JSON ARCH GET ${CONFIG} ARCH) + string(JSON CORE_FREQ GET ${CONFIG} CORE_FREQ) + string(JSON XN_FILE GET ${CONFIG} XN_FILE) - unset(APP_COMPILER_FLAGS_${CONFIG}) + foreach(j RANGE 0 ${NUM_SAM_FREQS}) + string(JSON SAM_FREQ GET ${SAM_FREQS_LIST} ${j}) + set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") + + message(STATUS "CONFIG ${CONFIG} - XN_FILE ${XN_FILE} ARCH ${ARCH} CORE_FREQ ${CORE_FREQ}") + + + project(test_rx_${CONFIG}) + set(APP_HW_TARGET ${XN_FILE}) + set(APP_COMPILER_FLAGS_${CONFIG} + -O3 + -report + -g + -DSAMPLE_FREQ_ESTIMATE=${SAM_FREQ} + ) + + XMOS_REGISTER_APP() + + unset(APP_COMPILER_FLAGS_${CONFIG}) + + endforeach() endforeach() diff --git a/tests/test_rx/test_params.json b/tests/test_rx/test_params.json new file mode 100644 index 0000000..98eed92 --- /dev/null +++ b/tests/test_rx/test_params.json @@ -0,0 +1,7 @@ +{ + "SAM_FREQS" : [44100, 48000, 88200, 96000, 176400, 192000], + "CONFIG": [ + {"ARCH" : "XS2", "CORE_FREQ" : 300, "XN_FILE" : "XCORE-200-EXPLORER-300.xn"}, + {"ARCH" : "XS3", "CORE_FREQ" : 300, "XN_FILE" : "XCORE-AI-EXPLORER-300.xn"} + ] +} \ No newline at end of file From 34224cbc4823b392bf7b41e3958d2e3ccb742404 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 16 Sep 2024 18:54:50 +0100 Subject: [PATCH 11/47] WIP parameterisable tx test --- tests/test_rx/CMakeLists.txt | 2 -- tests/test_tx.py | 35 ++++++++------------ tests/test_tx/CMakeLists.txt | 59 ++++++++++++++++++++++++++++++++++ tests/test_tx/test_params.json | 12 +++++++ 4 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 tests/test_tx/test_params.json diff --git a/tests/test_rx/CMakeLists.txt b/tests/test_rx/CMakeLists.txt index c4e736c..71bb322 100644 --- a/tests/test_rx/CMakeLists.txt +++ b/tests/test_rx/CMakeLists.txt @@ -7,8 +7,6 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) set(APP_PCA_ENABLE ON) -# set(CONFIGS XS2_300 -# XS3_300) # Get JSON lists file(READ ${CMAKE_CURRENT_LIST_DIR}/test_params.json JSON_CONTENT) diff --git a/tests/test_tx.py b/tests/test_tx.py index 430e66c..255d3ab 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -11,15 +11,15 @@ Frames, freq_for_sample_rate, ) +import json -MAX_CYCLES = 15000000 -SAM_FREQS = [44100, 48000, 88200, 96000, 176400, 192000] -CONFIGS = ["xs2", "xs2_300", "xs3", "xs3_375"] - +with open(Path(__file__).parent / "test_tx/test_params.json") as f: + params = json.load(f) -def _get_duration(): - return 193 +MAX_CYCLES = 15000000 +SAM_FREQS = params["SAM_FREQS"] +CONFIGS = [f"{item['ARCH'].lower()}_{item['CORE_FREQ']}" for item in params["CONFIG"]] def _get_mclk_freq(sam_freq): if sam_freq in [48000, 96000, 192000]: @@ -44,17 +44,19 @@ def tx_uncollect(config, sam_freq): @pytest.mark.uncollect_if(func=tx_uncollect) @pytest.mark.parametrize("sam_freq", SAM_FREQS) @pytest.mark.parametrize("config", CONFIGS) -def test_tx(capfd, config, sam_freq): +@pytest.mark.parametrize("duration", [params["NO_OF_SAMPLES"]]) +@pytest.mark.parametrize("ramps", [[params["RAMP0"], params["RAMP1"]],]) +def test_tx(capfd, config, sam_freq, duration, ramps): xe = str(Path(__file__).parent / f"test_tx/bin/{config}/test_tx_{config}.xe") p_clock = "tile[1]:XS1_PORT_1B" p_spdif_out = "tile[1]:XS1_PORT_1A" - no_of_samples = _get_duration() + no_of_samples = duration no_of_blocks = (no_of_samples // 192) + (1 if no_of_samples % 192 != 0 else 0) mclk_freq = _get_mclk_freq(sam_freq) audio = [ - ["ramp", -7], - ["ramp", 5], + ["ramp", ramps[0]], + ["ramp", ramps[1]], ] tester = testers.ComparisonTester( @@ -69,23 +71,14 @@ def test_tx(capfd, config, sam_freq): simargs = ["--max-cycles", str(MAX_CYCLES)] - result = Pyxsim.run_on_simulator( + result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, instTracing=True, - clean_before_build=True, + do_xe_prebuild=False, tester=tester, capfd=capfd, timeout=1500, simargs=simargs, - build_options=[ - f"CONFIG={config}", - "EXTRA_BUILD_FLAGS=" - + f" -DSAMPLE_FREQUENCY_HZ={sam_freq}" - + f" -DCHAN_RAMP_0={audio[0][1]}" - + f" -DCHAN_RAMP_1={audio[1][1]}" - + f" -DNO_OF_SAMPLES={no_of_samples}" - + f" -DMCLK_FREQUENCY={mclk_freq}", - ], ) assert result diff --git a/tests/test_tx/CMakeLists.txt b/tests/test_tx/CMakeLists.txt index 8188200..5e12acc 100644 --- a/tests/test_tx/CMakeLists.txt +++ b/tests/test_tx/CMakeLists.txt @@ -7,6 +7,65 @@ set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) set(APP_PCA_ENABLE ON) +# set(CONFIGS XS2_300 +# XS3_300) +# Get JSON lists +file(READ ${CMAKE_CURRENT_LIST_DIR}/test_params.json JSON_CONTENT) + +# Parse the JSON file into variables +string(JSON SAM_FREQS_LIST GET ${JSON_CONTENT} SAM_FREQS) +string(JSON CONFIG_LIST GET ${JSON_CONTENT} CONFIG) + +# Convert JSON lists to CMake lists +string(JSON NUM_SAM_FREQS LENGTH ${SAM_FREQS_LIST}) +string(JSON NUM_CONFIGS LENGTH ${CONFIG_LIST}) + +# Subtract one off each of the lengths because RANGE includes last element +math(EXPR NUM_SAM_FREQS "${NUM_SAM_FREQS} - 1") +math(EXPR NUM_CONFIGS "${NUM_CONFIGS} - 1") + +foreach(i RANGE 0 ${NUM_CONFIGS}) + message(STATUS IDX:${i}) + string(JSON CONFIG GET ${CONFIG_LIST} ${i}) + message(STATUS CONFIG:${CONFIG}) + string(JSON ARCH GET ${CONFIG} ARCH) + string(JSON CORE_FREQ GET ${CONFIG} CORE_FREQ) + string(JSON XN_FILE GET ${CONFIG} XN_FILE) + + foreach(j RANGE 0 ${NUM_SAM_FREQS}) + string(JSON SAM_FREQ GET ${SAM_FREQS_LIST} ${j}) + set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") + + message(STATUS "CONFIG ${CONFIG} - XN_FILE ${XN_FILE} ARCH ${ARCH} CORE_FREQ ${CORE_FREQ}") + + + project(test_rx_${CONFIG}) + set(APP_HW_TARGET ${XN_FILE}) + set(APP_COMPILER_FLAGS_${CONFIG} + -O3 + -report + -g + -DSAMPLE_FREQUENCY_HZ={sam_freq}" + -DCHAN_RAMP_0={audio[0][1]}" + -DCHAN_RAMP_1={audio[1][1]}" + -DNO_OF_SAMPLES={no_of_samples}" + -DMCLK_FREQUENCY={mclk_freq}", + ) + + XMOS_REGISTER_APP() + + unset(APP_COMPILER_FLAGS_${CONFIG}) + + +cmake_minimum_required(VERSION 3.21) + +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +set(APP_PCA_ENABLE ON) + set(CONFIGS XS2_300 XS2_500 XS3_375 diff --git a/tests/test_tx/test_params.json b/tests/test_tx/test_params.json new file mode 100644 index 0000000..a77bfca --- /dev/null +++ b/tests/test_tx/test_params.json @@ -0,0 +1,12 @@ +{ + "SAM_FREQS" : [44100, 48000, 88200, 96000, 176400, 192000], + "CONFIG": [ + {"ARCH" : "XS2", "CORE_FREQ" : 300, "XN_FILE" : "XCORE-200-EXPLORER-300.xn"}, + {"ARCH" : "XS2", "CORE_FREQ" : 500, "XN_FILE" : "XCORE-200-EXPLORER"}, + {"ARCH" : "XS3", "CORE_FREQ" : 375, "XN_FILE" : "XCORE-AI-EXPLORER-375.xn"}, + {"ARCH" : "XS3", "CORE_FREQ" : 600, "XN_FILE" : "XCORE-AI-EXPLORER"} + ], + "RAMP0" : -7, + "RAMP1" : 5, + "NO_OF_SAMPLES" : 193 +} From 85839dd3985b984a96a2342b7cb204328479f593 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 08:57:25 +0100 Subject: [PATCH 12/47] tx test cmake from JSON --- tests/test_tx/CMakeLists.txt | 67 +++++++++++------------------------- 1 file changed, 21 insertions(+), 46 deletions(-) diff --git a/tests/test_tx/CMakeLists.txt b/tests/test_tx/CMakeLists.txt index 5e12acc..df40955 100644 --- a/tests/test_tx/CMakeLists.txt +++ b/tests/test_tx/CMakeLists.txt @@ -24,6 +24,12 @@ string(JSON NUM_CONFIGS LENGTH ${CONFIG_LIST}) math(EXPR NUM_SAM_FREQS "${NUM_SAM_FREQS} - 1") math(EXPR NUM_CONFIGS "${NUM_CONFIGS} - 1") +# Extract global settings +string(JSON RAMP0 GET ${JSON_CONTENT} RAMP0) +string(JSON RAMP1 GET ${JSON_CONTENT} RAMP1) +string(JSON NO_OF_SAMPLES GET ${JSON_CONTENT} NO_OF_SAMPLES) + + foreach(i RANGE 0 ${NUM_CONFIGS}) message(STATUS IDX:${i}) string(JSON CONFIG GET ${CONFIG_LIST} ${i}) @@ -34,10 +40,17 @@ foreach(i RANGE 0 ${NUM_CONFIGS}) foreach(j RANGE 0 ${NUM_SAM_FREQS}) string(JSON SAM_FREQ GET ${SAM_FREQS_LIST} ${j}) - set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") - message(STATUS "CONFIG ${CONFIG} - XN_FILE ${XN_FILE} ARCH ${ARCH} CORE_FREQ ${CORE_FREQ}") + math(EXPR MCLK_48 "${SAM_FREQ} % 48000") + if(${MCLK_48} MATCHES 0) + set(MCLK_FREQ 24576000) + else() + set(MCLK_FREQ 22579200) + endif() + + set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") + message(STATUS "XN_FILE: ${XN_FILE} ARCH: ${ARCH} CORE_FREQ: ${CORE_FREQ} SAM_FREQ: ${SAM_FREQ} MCLK_FREQ: ${MCLK_FREQ}") project(test_rx_${CONFIG}) set(APP_HW_TARGET ${XN_FILE}) @@ -45,53 +58,15 @@ foreach(i RANGE 0 ${NUM_CONFIGS}) -O3 -report -g - -DSAMPLE_FREQUENCY_HZ={sam_freq}" - -DCHAN_RAMP_0={audio[0][1]}" - -DCHAN_RAMP_1={audio[1][1]}" - -DNO_OF_SAMPLES={no_of_samples}" - -DMCLK_FREQUENCY={mclk_freq}", + -DSAMPLE_FREQUENCY_HZ=${SAM_FREQ} + -DCHAN_RAMP_0=${RAMP0} + -DCHAN_RAMP_1=${RAMP1} + -DNO_OF_SAMPLES=${NO_OF_SAMPLES} + -DMCLK_FREQUENCY=${MCLK_FREQ} ) XMOS_REGISTER_APP() unset(APP_COMPILER_FLAGS_${CONFIG}) - - -cmake_minimum_required(VERSION 3.21) - -include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../../deps.cmake) - -set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) - -set(APP_PCA_ENABLE ON) - -set(CONFIGS XS2_300 - XS2_500 - XS3_375 - XS3_600) -set(HW_TARGETS XCORE-200-EXPLORER-300.xn - XCORE-200-EXPLORER - XCORE-AI-EXPLORER-375.xn - XCORE-AI-EXPLORER) - - -foreach(CONFIG IN LISTS CONFIGS) - list(FIND CONFIGS "${CONFIG}" FOUND_INDEX) - list(GET HW_TARGETS ${FOUND_INDEX} XN_FILE) - message(STATUS "XN_FILE ${XN_FILE} found in config ${CONFIG} index ${FOUND_INDEX}") - - project(test_tx_${CONFIG}) - set(APP_HW_TARGET ${XN_FILE}) - set(APP_COMPILER_FLAGS_${CONFIG} - -O3 - -report - -g - ) - - XMOS_REGISTER_APP() - - unset(APP_COMPILER_FLAGS_${CONFIG}) - unset(APP_HW_TARGET) + endforeach() endforeach() - From ccf46ad9f8194b621d43d8a7464f0682a574317c Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 10:09:42 +0100 Subject: [PATCH 13/47] Update test_tx --- tests/test_tx.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_tx.py b/tests/test_tx.py index 255d3ab..799b0a7 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -30,7 +30,7 @@ def _get_mclk_freq(sam_freq): assert False -def tx_uncollect(config, sam_freq): +def tx_uncollect(config, sam_freq, ramps, duration): reduced_clock_configs = ["xs2_300", "xs3_375"] reduced_freq_set = SAM_FREQS if config in reduced_clock_configs and sam_freq not in reduced_freq_set: @@ -47,7 +47,12 @@ def tx_uncollect(config, sam_freq): @pytest.mark.parametrize("duration", [params["NO_OF_SAMPLES"]]) @pytest.mark.parametrize("ramps", [[params["RAMP0"], params["RAMP1"]],]) def test_tx(capfd, config, sam_freq, duration, ramps): - xe = str(Path(__file__).parent / f"test_tx/bin/{config}/test_tx_{config}.xe") + + + build_config = f"{config.upper()}_{sam_freq}" + xe = str(Path(__file__).parent / f"test_tx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") + assert Path(xe).exists(), f"Cannot find {xe}" + p_clock = "tile[1]:XS1_PORT_1B" p_spdif_out = "tile[1]:XS1_PORT_1A" no_of_samples = duration From ef97a9015c87310775fcb0ebb0d824ff64970a04 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 10:11:26 +0100 Subject: [PATCH 14/47] COmment out docs stage for now --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d38e07e..4189fa3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,9 +61,9 @@ pipeline { steps { dir("${REPO}") { withVenv { - sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" - sh 'xmosdoc' - zip zipFile: "${REPO}_docs.zip", archive: true, dir: 'doc/_build' + // sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" + // sh 'xmosdoc' + // zip zipFile: "${REPO}_docs.zip", archive: true, dir: 'doc/_build' } // withVenv } // dir } From 3be2d37b263b5621e15765cd34ecb997445b447b Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 10:19:14 +0100 Subject: [PATCH 15/47] Avoid clash in CMake when building all tests --- tests/test_rx.py | 2 +- tests/test_rx/CMakeLists.txt | 4 +--- tests/test_tx.py | 2 +- tests/test_tx/CMakeLists.txt | 4 +--- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_rx.py b/tests/test_rx.py index 5e1baf7..4c23567 100644 --- a/tests/test_rx.py +++ b/tests/test_rx.py @@ -110,7 +110,7 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): # time taken in the simulator to correct frequency currently too long for tests. Re-enable sample rate mismatch once resolved # sample_freq_estimate = sam_freq - build_config = f"{config.upper()}_{300}_{sam_freq}" + build_config = f"rx_{config.upper()}_{300}_{sam_freq}" xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") assert Path(xe).exists(), f"Cannot find {xe}" diff --git a/tests/test_rx/CMakeLists.txt b/tests/test_rx/CMakeLists.txt index 71bb322..19d49f8 100644 --- a/tests/test_rx/CMakeLists.txt +++ b/tests/test_rx/CMakeLists.txt @@ -23,16 +23,14 @@ math(EXPR NUM_SAM_FREQS "${NUM_SAM_FREQS} - 1") math(EXPR NUM_CONFIGS "${NUM_CONFIGS} - 1") foreach(i RANGE 0 ${NUM_CONFIGS}) - message(STATUS IDX:${i}) string(JSON CONFIG GET ${CONFIG_LIST} ${i}) - message(STATUS CONFIG:${CONFIG}) string(JSON ARCH GET ${CONFIG} ARCH) string(JSON CORE_FREQ GET ${CONFIG} CORE_FREQ) string(JSON XN_FILE GET ${CONFIG} XN_FILE) foreach(j RANGE 0 ${NUM_SAM_FREQS}) string(JSON SAM_FREQ GET ${SAM_FREQS_LIST} ${j}) - set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") + set(CONFIG "rx_${ARCH}_${CORE_FREQ}_${SAM_FREQ}") message(STATUS "CONFIG ${CONFIG} - XN_FILE ${XN_FILE} ARCH ${ARCH} CORE_FREQ ${CORE_FREQ}") diff --git a/tests/test_tx.py b/tests/test_tx.py index 799b0a7..654378a 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -49,7 +49,7 @@ def tx_uncollect(config, sam_freq, ramps, duration): def test_tx(capfd, config, sam_freq, duration, ramps): - build_config = f"{config.upper()}_{sam_freq}" + build_config = f"tx_{config.upper()}_{sam_freq}" xe = str(Path(__file__).parent / f"test_tx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") assert Path(xe).exists(), f"Cannot find {xe}" diff --git a/tests/test_tx/CMakeLists.txt b/tests/test_tx/CMakeLists.txt index df40955..e4346f0 100644 --- a/tests/test_tx/CMakeLists.txt +++ b/tests/test_tx/CMakeLists.txt @@ -31,9 +31,7 @@ string(JSON NO_OF_SAMPLES GET ${JSON_CONTENT} NO_OF_SAMPLES) foreach(i RANGE 0 ${NUM_CONFIGS}) - message(STATUS IDX:${i}) string(JSON CONFIG GET ${CONFIG_LIST} ${i}) - message(STATUS CONFIG:${CONFIG}) string(JSON ARCH GET ${CONFIG} ARCH) string(JSON CORE_FREQ GET ${CONFIG} CORE_FREQ) string(JSON XN_FILE GET ${CONFIG} XN_FILE) @@ -48,7 +46,7 @@ foreach(i RANGE 0 ${NUM_CONFIGS}) set(MCLK_FREQ 22579200) endif() - set(CONFIG "${ARCH}_${CORE_FREQ}_${SAM_FREQ}") + set(CONFIG "tx_${ARCH}_${CORE_FREQ}_${SAM_FREQ}") message(STATUS "XN_FILE: ${XN_FILE} ARCH: ${ARCH} CORE_FREQ: ${CORE_FREQ} SAM_FREQ: ${SAM_FREQ} MCLK_FREQ: ${MCLK_FREQ}") From fe4e8d4946b53572a1a3b5ce1e7a14f907fe6fd2 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 10:24:51 +0100 Subject: [PATCH 16/47] Use xdist for pytest --- Jenkinsfile | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4189fa3..e0cb8ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -85,7 +85,7 @@ pipeline { withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' - sh "pytest -v --junitxml=pytest_result.xml" + sh "pytest -v --junitxml=pytest_result.xml -n auto" } } } diff --git a/requirements.txt b/requirements.txt index b45139e..26dc14b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,6 +20,7 @@ flake8==3.8.3 pytest==7.1.2 +pytest-xdist==3.6.1 # Pin importlib-metadata to <5 due to https://github.com/python/importlib_metadata/issues/409. importlib-metadata==4.13.0 From c33a96032cd5a8682874e3d4551c3682a8f3e4ba Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 10:32:19 +0100 Subject: [PATCH 17/47] Fix missing prefix --- tests/test_rx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_rx.py b/tests/test_rx.py index 4c23567..033c098 100644 --- a/tests/test_rx.py +++ b/tests/test_rx.py @@ -160,7 +160,7 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): @pytest.mark.parametrize("config", CONFIGS) def test_rx_stream(config, stream, capfd): - build_config = f"{config.upper()}_{300}_{stream.sam_freq}" + build_config = f"rx_{config.upper()}_{300}_{stream.sam_freq}" xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") assert Path(xe).exists(), f"Cannot find {xe}" @@ -213,7 +213,7 @@ def test_rx_stream(config, stream, capfd): ) @pytest.mark.parametrize("config", CONFIGS) def test_rx_samfreq_change(config, stream0, stream1, capfd): - build_config = f"{config.upper()}_{300}_{stream0.sam_freq}" + build_config = f"rx_{config.upper()}_{300}_{stream0.sam_freq}" xe = str(Path(__file__).parent / f"test_rx/bin/{build_config}/test_rx_{build_config}_{build_config}.xe") assert Path(xe).exists(), f"Cannot find {xe}" From 2628ec2d272ddd0ab9b9b3fea2825f4e8518c863 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 11:06:54 +0100 Subject: [PATCH 18/47] Remove updateview (redundant) --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e0cb8ef..85f69d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,9 +107,6 @@ pipeline { always { junit "${REPO}/tests/pytest_result.xml" } - success { - updateViewfiles() - } cleanup { xcoreCleanSandbox() } From a828b05f5867e12bab44cd9d89862f80f2ee512b Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 11:47:47 +0100 Subject: [PATCH 19/47] Bump to 6.2.0 and initial docs support --- CHANGELOG.rst | 5 +++ doc/Doxyfile.inc | 8 +++++ doc/exclude_patterns.inc | 8 +++++ doc/substitutions.inc | 3 ++ lib_spdif/lib_build_info.cmake | 2 +- lib_spdif/module_build_info | 2 +- settings.yml | 25 ++++++++++++++ tests/dump.txt | 63 ++++++++++++++++++++++++++++++++++ 8 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 doc/Doxyfile.inc create mode 100644 doc/exclude_patterns.inc create mode 100644 doc/substitutions.inc create mode 100644 settings.yml create mode 100644 tests/dump.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e6d97da..a12cd26 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_spdif change log ==================== +6.2.0 +----- + + * CHANGED: Use XCommon CMake for examples and tests + 6.1.1 ----- diff --git a/doc/Doxyfile.inc b/doc/Doxyfile.inc new file mode 100644 index 0000000..b79e536 --- /dev/null +++ b/doc/Doxyfile.inc @@ -0,0 +1,8 @@ +# This file provides overrides to the Doxyfile configuration + +PROJECT_NAME = lib_spdif +PROJECT_BRIEF = "SPDIF software libraries" + +INPUT = ../lib_i2s/spdif + +PREDEFINED = C_API= EXTERN_C= UNSAFE= __DOXYGEN__=1 diff --git a/doc/exclude_patterns.inc b/doc/exclude_patterns.inc new file mode 100644 index 0000000..841d4b7 --- /dev/null +++ b/doc/exclude_patterns.inc @@ -0,0 +1,8 @@ +# The following patterns are to be excluded from the documentation build +examples +test +tests/.pytest_cache +CHANGELOG.rst +LICENSE.rst +README.rst +README.md diff --git a/doc/substitutions.inc b/doc/substitutions.inc new file mode 100644 index 0000000..7145d6e --- /dev/null +++ b/doc/substitutions.inc @@ -0,0 +1,3 @@ +.. |newpage| raw:: latex + + \clearpage diff --git a/lib_spdif/lib_build_info.cmake b/lib_spdif/lib_build_info.cmake index f5c0dc7..06eaf7a 100644 --- a/lib_spdif/lib_build_info.cmake +++ b/lib_spdif/lib_build_info.cmake @@ -1,5 +1,5 @@ set(LIB_NAME lib_spdif) -set(LIB_VERSION 6.1.1) +set(LIB_VERSION 6.2.0) set(LIB_INCLUDES api) set(LIB_COMPILER_FLAGS -O3) set(LIB_COMPILER_FLAGS_SpdifTransmitReconfigPort.xc -O3 -Wno-unusual-code) diff --git a/lib_spdif/module_build_info b/lib_spdif/module_build_info index 453b5db..248f9af 100644 --- a/lib_spdif/module_build_info +++ b/lib_spdif/module_build_info @@ -1,4 +1,4 @@ -VERSION = 6.1.1 +VERSION = 6.2.0 DEPENDENT_MODULES = diff --git a/settings.yml b/settings.yml new file mode 100644 index 0000000..4398299 --- /dev/null +++ b/settings.yml @@ -0,0 +1,25 @@ +--- +lib_name: lib_spdif +project: '{{lib_name}}' +title: '{{lib_name}}: XMOS SPDIF Library' +version: 6.2.0 + +documentation: + exclude_patterns_path: doc/exclude_patterns.inc + substitutions_path: doc/substitutions.inc + root_doc: doc/rst/lib_spdif.rst + linkcheck_ignore_regex: [''] + cognidox_part_number: XM-006988-UG + doxygen_projects: + lib_spdif: + doxyfile_path: doc/Doxyfile.inc + pdfs: + doc/rst/lib_spdif.rst: + pdf_title: '{{title}}' + pdf_filename: '{{lib_name}}_v{{version}}' + README.rst: + pdf_title: '{{title}} (README)' + pdf_filename: '{{lib_name}}_v{{version}}_readme' + pdf_short: yes +software: + cognidox_part_number: XM-007501-SM diff --git a/tests/dump.txt b/tests/dump.txt new file mode 100644 index 0000000..dc6bc6f --- /dev/null +++ b/tests/dump.txt @@ -0,0 +1,63 @@ +digraph "lib_spdif_tests" { +node [ + fontsize = "12" +]; +subgraph clusterLegend { + label = "Legend"; + color = black; + edge [ style = invis ]; + legendNode0 [ label = "Executable", shape = egg ]; + legendNode1 [ label = "Static Library", shape = octagon ]; + legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; + legendNode3 [ label = "Module Library", shape = tripleoctagon ]; + legendNode4 [ label = "Interface Library", shape = pentagon ]; + legendNode5 [ label = "Object Library", shape = hexagon ]; + legendNode6 [ label = "Unknown Library", shape = septagon ]; + legendNode7 [ label = "Custom Target", shape = box ]; + legendNode0 -> legendNode1 [ style = solid ]; + legendNode0 -> legendNode2 [ style = solid ]; + legendNode0 -> legendNode3; + legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; + legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; + legendNode3 -> legendNode6 [ style = solid ]; + legendNode0 -> legendNode7; +} + "node0" [ label = "rx_capture", shape = egg ]; + "node1" [ label = "spdif_rx_analyse", shape = egg ]; + "node2" [ label = "test_rx_rx_XS2_300_176400_rx_XS2_300_176400", shape = egg ]; + "node3" [ label = "test_rx_rx_XS2_300_192000_rx_XS2_300_192000", shape = egg ]; + "node4" [ label = "test_rx_rx_XS2_300_44100_rx_XS2_300_44100", shape = egg ]; + "node5" [ label = "test_rx_rx_XS2_300_48000_rx_XS2_300_48000", shape = egg ]; + "node6" [ label = "test_rx_rx_XS2_300_88200_rx_XS2_300_88200", shape = egg ]; + "node7" [ label = "test_rx_rx_XS2_300_96000_rx_XS2_300_96000", shape = egg ]; + "node8" [ label = "test_rx_rx_XS3_300_176400_rx_XS3_300_176400", shape = egg ]; + "node9" [ label = "test_rx_rx_XS3_300_192000_rx_XS3_300_192000", shape = egg ]; + "node10" [ label = "test_rx_rx_XS3_300_44100_rx_XS3_300_44100", shape = egg ]; + "node11" [ label = "test_rx_rx_XS3_300_48000_rx_XS3_300_48000", shape = egg ]; + "node12" [ label = "test_rx_rx_XS3_300_88200_rx_XS3_300_88200", shape = egg ]; + "node13" [ label = "test_rx_rx_XS3_300_96000_rx_XS3_300_96000", shape = egg ]; + "node14" [ label = "test_rx_tx_XS2_300_176400_tx_XS2_300_176400", shape = egg ]; + "node15" [ label = "test_rx_tx_XS2_300_192000_tx_XS2_300_192000", shape = egg ]; + "node16" [ label = "test_rx_tx_XS2_300_44100_tx_XS2_300_44100", shape = egg ]; + "node17" [ label = "test_rx_tx_XS2_300_48000_tx_XS2_300_48000", shape = egg ]; + "node18" [ label = "test_rx_tx_XS2_300_88200_tx_XS2_300_88200", shape = egg ]; + "node19" [ label = "test_rx_tx_XS2_300_96000_tx_XS2_300_96000", shape = egg ]; + "node20" [ label = "test_rx_tx_XS2_500_176400_tx_XS2_500_176400", shape = egg ]; + "node21" [ label = "test_rx_tx_XS2_500_192000_tx_XS2_500_192000", shape = egg ]; + "node22" [ label = "test_rx_tx_XS2_500_44100_tx_XS2_500_44100", shape = egg ]; + "node23" [ label = "test_rx_tx_XS2_500_48000_tx_XS2_500_48000", shape = egg ]; + "node24" [ label = "test_rx_tx_XS2_500_88200_tx_XS2_500_88200", shape = egg ]; + "node25" [ label = "test_rx_tx_XS2_500_96000_tx_XS2_500_96000", shape = egg ]; + "node26" [ label = "test_rx_tx_XS3_375_176400_tx_XS3_375_176400", shape = egg ]; + "node27" [ label = "test_rx_tx_XS3_375_192000_tx_XS3_375_192000", shape = egg ]; + "node28" [ label = "test_rx_tx_XS3_375_44100_tx_XS3_375_44100", shape = egg ]; + "node29" [ label = "test_rx_tx_XS3_375_48000_tx_XS3_375_48000", shape = egg ]; + "node30" [ label = "test_rx_tx_XS3_375_88200_tx_XS3_375_88200", shape = egg ]; + "node31" [ label = "test_rx_tx_XS3_375_96000_tx_XS3_375_96000", shape = egg ]; + "node32" [ label = "test_rx_tx_XS3_600_176400_tx_XS3_600_176400", shape = egg ]; + "node33" [ label = "test_rx_tx_XS3_600_192000_tx_XS3_600_192000", shape = egg ]; + "node34" [ label = "test_rx_tx_XS3_600_44100_tx_XS3_600_44100", shape = egg ]; + "node35" [ label = "test_rx_tx_XS3_600_48000_tx_XS3_600_48000", shape = egg ]; + "node36" [ label = "test_rx_tx_XS3_600_88200_tx_XS3_600_88200", shape = egg ]; + "node37" [ label = "test_rx_tx_XS3_600_96000_tx_XS3_600_96000", shape = egg ]; +} From 83becd7c8d969a4b3366137991c6574a864d25c1 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 11:56:03 +0100 Subject: [PATCH 20/47] Enable examples build and rejig Jenkins --- Jenkinsfile | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85f69d8..78ba15a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,9 +61,12 @@ pipeline { steps { dir("${REPO}") { withVenv { - // sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" - // sh 'xmosdoc' - // zip zipFile: "${REPO}_docs.zip", archive: true, dir: 'doc/_build' + sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" + sh 'xmosdoc' + // Zip and archive doc files + zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" } // withVenv } // dir } @@ -77,9 +80,9 @@ pipeline { // } // } // } - stage("Tests") { + stage('Build Examples') { steps { - dir("${REPO}/tests"){ + dir("${REPO}/examples") { viewEnv(){ withVenv() { withTools(params.TOOLS_VERSION) { @@ -89,16 +92,22 @@ pipeline { } } } - } - } - } - stage('xCORE builds') { + archiveArtifacts artifacts: "**/bin/*.xe", fingerprint: true, allowEmptyArchive: true + } // dir + } // steps + } // stage + stage("Build and run tests") { steps { - dir("${REPO}") { - // xcoreAllAppsBuild('examples') - // runXdoc("${REPO}/doc") - // Archive all the generated .pdf docs - // archiveArtifacts artifacts: "${REPO}/**/pdf/*.pdf", fingerprint: true, allowEmptyArchive: true + dir("${REPO}/tests"){ + viewEnv(){ + withVenv() { + withTools(params.TOOLS_VERSION) { + sh 'cmake -B build -G "Unix Makefiles"' + sh 'xmake -j 16 -C build' + sh "pytest -v --junitxml=pytest_result.xml -n auto" + } + } + } } } } From 92200a7b75e7e1511e55ad42484037479c5b1503 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 12:07:23 +0100 Subject: [PATCH 21/47] Remove rogue pytest line --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78ba15a..fa6b5d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -88,7 +88,6 @@ pipeline { withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' - sh "pytest -v --junitxml=pytest_result.xml -n auto" } } } From 1dad573c9708836bb23503a79806592c8f6ec732 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 13:57:36 +0100 Subject: [PATCH 22/47] Doc tidy and indents --- doc/Doxyfile.inc | 2 +- doc/rst/lib_spdif.rst | 125 ++++++++-------------- doc/rst/resource_usage_summary.rst | 21 ---- examples/app_spdif_rx_example/src/main.xc | 5 +- examples/app_spdif_tx_example/src/main.xc | 2 +- 5 files changed, 49 insertions(+), 106 deletions(-) delete mode 100644 doc/rst/resource_usage_summary.rst diff --git a/doc/Doxyfile.inc b/doc/Doxyfile.inc index b79e536..b48c85d 100644 --- a/doc/Doxyfile.inc +++ b/doc/Doxyfile.inc @@ -3,6 +3,6 @@ PROJECT_NAME = lib_spdif PROJECT_BRIEF = "SPDIF software libraries" -INPUT = ../lib_i2s/spdif +INPUT = ../lib_spdif/api PREDEFINED = C_API= EXTERN_C= UNSAFE= __DOXYGEN__=1 diff --git a/doc/rst/lib_spdif.rst b/doc/rst/lib_spdif.rst index 97b7dbc..a2f2fc0 100644 --- a/doc/rst/lib_spdif.rst +++ b/doc/rst/lib_spdif.rst @@ -1,11 +1,10 @@ -.. include:: ../../../README.rst +.. include:: ../../README.rst -.. include:: resource_usage_summary.rst |newpage| External Signal Description -*************************** +--------------------------- The library implements the S/PDIF (Sony/Philips Digital Interface Format) protocol for transporting uncompressed stereo PCM data of up to 24bits. @@ -15,7 +14,7 @@ Format) protocol for transporting uncompressed stereo PCM data of up to 24bits. medium (optical or electrical). Connecting to the xCORE as Transmitter -====================================== +...................................... The precise transmission frequencies supported depend on the availability of an external clock (e.g. a PLL or a crystal oscillator) that runs at a @@ -50,7 +49,7 @@ functions using the same master clock (e.g. ADAT transmit or I2S). .. note:: The transmit stream user bits are set to 0. The validity bits are set to 0 (i.e. valid). Connecting to the xCORE as Receiver -=================================== +................................... The receiver can receive stereo PCM signals up to 192 KHz. @@ -67,17 +66,21 @@ The connection of an S/PDIF receiver line to the xCORE is shown in .. note:: Only a single wire is connected - the clock is recovered from the incoming data stream. Usage -***** +----- All S/PDIF functions can be accessed via the ``spdif.h`` header:: #include -``lib_spdif`` should also be added to the -``USED_MODULES`` field of the application Makefile. +``lib_spdif`` should also be added to the ``USED_MODULES`` field of the application Makefile or ``APP_DEPENDENT_MODULES`` XCommon-CMake makefile. + + +.. note:: + The receiver and transmitter tasks each require a minimum of 62.5MHz to operate correctly. + S/PDIF Transmitter -================== +.................. S/PDIF components are instantiated as parallel tasks that run in a ``par`` statement. The application can connect via a channel @@ -91,47 +94,30 @@ connection. S/PDIF transmit task diagram For example, the following code instantiates an S/PDIF transmitter component -and connects to it:: +and connects to it: - buffered out port:32 p_spdif_tx = XS1_PORT_1K; - in port p_mclk_in = XS1_PORT_1L; - clock clk_audio = XS1_CLKBLK_1; - int main(void) - { - chanend c_spdif; - par - { - on tile[0]: - { - spdif_tx_port_config(p_spdif_tx, clk_audio, p_mclk_in, 0); - spdif_tx(p_spdif_tx, c_spdif); - } - - on tile[0]: my_application(c_spdif); - } - return 0; - } +.. literalinclude:: ../../examples/app_spdif_tx_example/src/main.xc + :start-at: on tile[1]: out buffered + :end-at: on tile[1]: clock + +.. literalinclude:: ../../examples/app_spdif_tx_example/src/main.xc + :start-at: int main(void) + :end-at: } // end + The helper function ``spdif_tx_port_config()`` clocks the clock-block from the master clock port and, in turn, clocks the S/PDIF transmit port from this clock-block. The application can communicate with the components via API functions -that take the channel end as arguments e.g.:: +that take the channel end as arguments e.g.: - void my_application(chanend c_spdif) - { - int32_t sample = 0; - spdif_tx_reconfigure_sample_rate(c, 96000, 12288000); - while (1) - { - sample++; - spdif_tx_output(c_spdif, sample, sample + 1); - } - } +.. literalinclude:: ../../examples/app_spdif_tx_example/src/main.xc + :start-at: void generate_samples(chanend c) + :end-before: void board_setup(void) Configuring the Underlying Clock --------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When using the transmit component, the internal clock needs to be configured to run off the incoming signal e.g.:: @@ -154,7 +140,7 @@ Note, the delay value shown above is a typical example and may need to be tuned for the specific hardware being used. S/PDIF Receiver -=============== +............... S/PDIF components are instantiated as parallel tasks that run in a ``par`` statement. The application can connect via a channel @@ -168,45 +154,22 @@ connection. S/PDIF receiver task diagram For example, the following code instantiates an S/PDIF receiver component -and connects to it:: +and connects to it: - port p_spdif_rx = XS1_PORT_1F; - clock audio_clk = XS1_CLKBLK_1; +.. literalinclude:: ../../examples/app_spdif_rx_example/src/main.xc + :start-at: on tile[0]: in port p_coax_rx + :end-at: on tile[0]: clock audio_clk - int main(void) - { - streaming chan c; - par - { - spdif_rx(c, p_spdif_rx, audio_clk, 96000); - handle_samples(c); - } - return 0; - } +.. literalinclude:: ../../examples/app_spdif_rx_example/src/main.xc + :start-at: int main(void) + :end-at: } // end The application can communicate with the components via API functions that take the channel end as arguments e.g.:: - void my_application(streaming chanend c) - { - int32_t sample; - size_t index; - size_t left_count = 0; - size_t right_count = 0; - while(1) - { - select - { - case spdif_rx_sample(c, sample, index): - // sample contains the 24bit data - // You can process the audio data here - if (index == 0) - left_count++; - else - right_count++; - break; - } - ... +.. literalinclude:: ../../examples/app_spdif_rx_example/src/main.xc + :start-at: void handle_samples(streaming chanend c) + :end-before: } void board_setup(void) Note that a program can react to incoming samples using a ``select`` statement. More information on using ``par`` and ``select`` @@ -260,17 +223,17 @@ Should other fields be desired - for parity checking, for instance, regular chan |newpage| API -*** +--- Creating an S/PDIF Receiver Instance -==================================== +.................................... .. doxygenfunction:: spdif_rx |newpage| S/PDIF Receiver API -=================== +................... .. doxygenfunction:: spdif_rx_sample .. doxygenfunction:: spdif_rx_shutdown @@ -279,7 +242,7 @@ S/PDIF Receiver API |newpage| Creating an S/PDIF Transmitter Instance -======================================= + .. doxygenfunction:: spdif_tx_port_config .. doxygenfunction:: spdif_tx @@ -287,17 +250,17 @@ Creating an S/PDIF Transmitter Instance |newpage| S/PDIF Transmitter API -====================== +...................... .. doxygenfunction:: spdif_tx_reconfigure_sample_rate .. doxygenfunction:: spdif_tx_output .. doxygenfunction:: spdif_tx_shutdown -|appendix| +|newpage| Known Issues -************ +------------ * None diff --git a/doc/rst/resource_usage_summary.rst b/doc/rst/resource_usage_summary.rst deleted file mode 100644 index d60fa59..0000000 --- a/doc/rst/resource_usage_summary.rst +++ /dev/null @@ -1,21 +0,0 @@ -Typical Resource Usage -====================== - -.. resusage:: - - * - configuration: Transmit - - globals: buffered out port:32 p_spdif_tx = XS1_PORT_1B; in port p_mclk_in = XS1_PORT_1E; clock clk_audio = XS1_CLKBLK_1; - - locals: chan c; - - fn: spdif_tx(p_spdif_tx, c); - - pins: 1 - - ports: 1 (1-bit) - - cores: 1 - * - configuration: Receive - - globals: port p_spdif_rx = XS1_PORT_1F; clock audio_clk = XS1_CLKBLK_1; - - locals: streaming chan c; - - fn: spdif_rx(c, p_spdif_rx, audio_clk, 48000); - - pins: 1 - - ports: 1 (1-bit) - - cores: 1 - -The receiver and transmitter tasks each require a minimum of 62.5MHz to operate correctly. diff --git a/examples/app_spdif_rx_example/src/main.xc b/examples/app_spdif_rx_example/src/main.xc index c6be657..8428472 100644 --- a/examples/app_spdif_rx_example/src/main.xc +++ b/examples/app_spdif_rx_example/src/main.xc @@ -10,9 +10,10 @@ on tile[0]: out port p_ctrl = XS1_PORT_8D; on tile[0]: in port p_i2c_sda = XS1_PORT_1M; -on tile[0]: in port p_coax_rx = XS1_PORT_1N; on tile[0]: in port p_opt_rx = XS1_PORT_1O; on tile[0]: in port p_word_clk = XS1_PORT_1P; + +on tile[0]: in port p_coax_rx = XS1_PORT_1N; on tile[0]: clock audio_clk = XS1_CLKBLK_1; void handle_samples(streaming chanend c) @@ -73,4 +74,4 @@ int main(void) on tile[0]: handle_samples(c); } return 0; -} +} // end diff --git a/examples/app_spdif_tx_example/src/main.xc b/examples/app_spdif_tx_example/src/main.xc index 64c271d..a87275b 100644 --- a/examples/app_spdif_tx_example/src/main.xc +++ b/examples/app_spdif_tx_example/src/main.xc @@ -99,4 +99,4 @@ int main(void) { on tile[1]: generate_samples(c_spdif); } return 0; -} +} // end From ac31350dd534e3b48544a4bf5fcb3baed614a63d Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 15:07:11 +0100 Subject: [PATCH 23/47] Fix up doxy --- doc/exclude_patterns.inc | 2 ++ doc/rst/lib_spdif.rst | 5 +++-- examples/app_spdif_rx_example/src/main.xc | 2 +- lib_spdif/api/spdif.h | 19 ++++++++++++------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/doc/exclude_patterns.inc b/doc/exclude_patterns.inc index 841d4b7..9fabbf0 100644 --- a/doc/exclude_patterns.inc +++ b/doc/exclude_patterns.inc @@ -6,3 +6,5 @@ CHANGELOG.rst LICENSE.rst README.rst README.md +tests/rx_capture/README.rst +tests/test_rx/README.rst diff --git a/doc/rst/lib_spdif.rst b/doc/rst/lib_spdif.rst index a2f2fc0..38a339a 100644 --- a/doc/rst/lib_spdif.rst +++ b/doc/rst/lib_spdif.rst @@ -165,11 +165,11 @@ and connects to it: :end-at: } // end The application can communicate with the components via API functions -that take the channel end as arguments e.g.:: +that take the channel end as arguments e.g.: .. literalinclude:: ../../examples/app_spdif_rx_example/src/main.xc :start-at: void handle_samples(streaming chanend c) - :end-before: } void board_setup(void) + :end-before: void board_setup(void) Note that a program can react to incoming samples using a ``select`` statement. More information on using ``par`` and ``select`` @@ -242,6 +242,7 @@ S/PDIF Receiver API |newpage| Creating an S/PDIF Transmitter Instance +....................................... .. doxygenfunction:: spdif_tx_port_config diff --git a/examples/app_spdif_rx_example/src/main.xc b/examples/app_spdif_rx_example/src/main.xc index 8428472..c09f55b 100644 --- a/examples/app_spdif_rx_example/src/main.xc +++ b/examples/app_spdif_rx_example/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2023 XMOS LIMITED. +// Copyright 2014-2024 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/lib_spdif/api/spdif.h b/lib_spdif/api/spdif.h index 8ed7de3..72d7ab8 100644 --- a/lib_spdif/api/spdif.h +++ b/lib_spdif/api/spdif.h @@ -5,6 +5,11 @@ #include #include #include +#include +#ifdef __DOXYGEN__ +#define in_port_t in port +#define out_port_t out port +#endif /** This constant provides a mask for the bits that should be used when * inspecting the preamble of a sample @@ -43,16 +48,16 @@ * * The receiver will modifiy the divider of the clock-block to lock to the incoming sample rate. * - * \param p S/PDIF input port. - * * \param c Channel to connect to the application. * + * \param p S/PDIF input port. + * * \param clk A clock block used internally to clock data. * * \param sample_freq_estimate The initial expected sample rate (in Hz). * **/ -void spdif_rx(streaming chanend c, in port p, clock clk, unsigned sample_freq_estimate); +void spdif_rx(streaming_chanend_t c, in_port_t p, clock clk, unsigned sample_freq_estimate); /** Receive a sample from the S/PDIF component. * @@ -79,7 +84,7 @@ void spdif_rx(streaming chanend c, in port p, clock clk, unsigned sample_freq_es * (i.e. 0 for left channel and 1 for right channel). */ #pragma select handler -void spdif_rx_sample(streaming chanend c, int32_t &sample, size_t &index); +void spdif_rx_sample(streaming_chanend_t c, REFERENCE_PARAM(int32_t, sample), REFERENCE_PARAM(size_t, index)); /** Shutdown the S/PDIF receiver component. * @@ -88,7 +93,7 @@ void spdif_rx_sample(streaming chanend c, int32_t &sample, size_t &index); * * \param c chanend connected to the S/PDIF receiver component */ -void spdif_rx_shutdown(streaming chanend c); +void spdif_rx_shutdown(streaming_chanend_t c); /** Checks the parity of a received S/PDIF sample * @@ -122,7 +127,7 @@ static inline int spdif_rx_check_parity(unsigned sample) * \param delay delay to uses to sync the SPDIF signal at the external * flip-flop */ -void spdif_tx_port_config(out buffered port:32 p, clock clk, in port p_mclk, unsigned delay); +void spdif_tx_port_config(out_buffered_port_32_t p, clock clk, in_port_t p_mclk, unsigned delay); /** S/PDIF transmit function. * @@ -138,7 +143,7 @@ void spdif_tx_port_config(out buffered port:32 p, clock clk, in port p_mclk, uns * \param p_spdif The output port to transmit to * \param c chanend to connect to the application */ -void spdif_tx(buffered out port:32 p_spdif, chanend c); +void spdif_tx(out_buffered_port_32_t p_spdif, chanend c); /** Reconfigure the S/PDIF tx component to a new sample rate. * From 5d45e82cc2af664bacdc2e2feae0a1398db30ab4 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 15:09:55 +0100 Subject: [PATCH 24/47] Fix rst links and copyright --- doc/rst/lib_spdif.rst | 4 ++-- lib_spdif/api/spdif.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/rst/lib_spdif.rst b/doc/rst/lib_spdif.rst index 38a339a..0b71649 100644 --- a/doc/rst/lib_spdif.rst +++ b/doc/rst/lib_spdif.rst @@ -129,7 +129,7 @@ the programs ``par`` statement. In this function the ``configure_clock_src()`` is used configure a clock to run off an -incoming port - see the :ref:`XMOS Programming Guide` for more information. +incoming port - see the `XMOS Programming Guide `_ for more information. The last parameter is used with the ``set_clock_fall_delay()`` function to configure an internal delay from the incoming clock signal to the internal clock's falling edge. @@ -173,7 +173,7 @@ that take the channel end as arguments e.g.: Note that a program can react to incoming samples using a ``select`` statement. More information on using ``par`` and ``select`` -statements can be found in the :ref:`XMOS Programming Guide`. +statements can be found in the `XMOS Programming Guide `_. Each 32-bit word received from the receive component via the channel has the following format: diff --git a/lib_spdif/api/spdif.h b/lib_spdif/api/spdif.h index 72d7ab8..af1e963 100644 --- a/lib_spdif/api/spdif.h +++ b/lib_spdif/api/spdif.h @@ -1,4 +1,4 @@ -// Copyright 2014-2023 XMOS LIMITED. +// Copyright 2014-2024 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _SPDIF_H_ #define _SPDIF_H_ From ca267dcca7b0798dc38c8b69b2876c01e8d0b92b Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 15:13:53 +0100 Subject: [PATCH 25/47] Header typo --- lib_spdif/api/spdif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_spdif/api/spdif.h b/lib_spdif/api/spdif.h index af1e963..7797a4d 100644 --- a/lib_spdif/api/spdif.h +++ b/lib_spdif/api/spdif.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #ifdef __DOXYGEN__ #define in_port_t in port #define out_port_t out port From 3c5727864045b791479cbb0bcc442717297c8535 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 15:19:29 +0100 Subject: [PATCH 26/47] Correct compat defines --- lib_spdif/api/spdif.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_spdif/api/spdif.h b/lib_spdif/api/spdif.h index 7797a4d..b2992b0 100644 --- a/lib_spdif/api/spdif.h +++ b/lib_spdif/api/spdif.h @@ -6,7 +6,8 @@ #include #include #include -#ifdef __DOXYGEN__ +#if defined(__DOXYGEN__) || defined(__XC__) +/* These are needed to allow doxy to render properly */ #define in_port_t in port #define out_port_t out port #endif @@ -179,4 +180,5 @@ void spdif_tx_output(chanend c_spdif_tx, unsigned lsample, unsigned rsample); */ void spdif_tx_shutdown(chanend c); + #endif /* _SPDIF_H_ */ From 580e0609742d06d88302265980d195d4db23f751 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 17 Sep 2024 17:34:15 +0100 Subject: [PATCH 27/47] App note update in readme --- README.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 159e9cd..4858e93 100644 --- a/README.rst +++ b/README.rst @@ -20,8 +20,9 @@ Related Application Notes The following application notes use this library: - * AN00231 - SPDIF Receive to I2S output using Asynchronous Sample Rate Conversion - * TODO update to AN02003 etc. + * `AN02003: SPDIF/ADAT/I2S Receive to |I2S| Slave Bridge with ASRC `_ + +Several simple usage examples are also included in the ``examples`` directory. Software version and dependencies ................................. From a52dbb2bd19a2cae73963e1f388bb01583542d9a Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 18 Sep 2024 11:34:10 +0100 Subject: [PATCH 28/47] Remove instr tracing to speedup and avoid log file clash --- tests/test_rx.py | 3 --- tests/test_tx.py | 1 - 2 files changed, 4 deletions(-) diff --git a/tests/test_rx.py b/tests/test_rx.py index 033c098..6d5020c 100644 --- a/tests/test_rx.py +++ b/tests/test_rx.py @@ -142,7 +142,6 @@ def test_rx(capfd, config, sam_freq, sample_freq_estimate): result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, - instTracing=True, tester=tester, capfd=capfd, timeout=pyxsim_timeout, @@ -194,7 +193,6 @@ def test_rx_stream(config, stream, capfd): result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, - instTracing=True, do_xe_prebuild=False, tester=tester, capfd=capfd, @@ -271,7 +269,6 @@ def test_rx_samfreq_change(config, stream0, stream1, capfd): result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, - instTracing=True, do_xe_prebuild=False, tester=tester, capfd=capfd, diff --git a/tests/test_tx.py b/tests/test_tx.py index 654378a..5dca102 100644 --- a/tests/test_tx.py +++ b/tests/test_tx.py @@ -79,7 +79,6 @@ def test_tx(capfd, config, sam_freq, duration, ramps): result = Pyxsim.run_on_simulator_( xe, simthreads=simthreads, - instTracing=True, do_xe_prebuild=False, tester=tester, capfd=capfd, From e8cd2811ac0d6f7bc3865a4c5b204e1efd495797 Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 18 Sep 2024 12:05:03 +0100 Subject: [PATCH 29/47] Clarify some wording in rst --- doc/rst/lib_spdif.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rst/lib_spdif.rst b/doc/rst/lib_spdif.rst index 0b71649..d4885b1 100644 --- a/doc/rst/lib_spdif.rst +++ b/doc/rst/lib_spdif.rst @@ -9,7 +9,7 @@ External Signal Description The library implements the S/PDIF (Sony/Philips Digital Interface Format) protocol for transporting uncompressed stereo PCM data of up to 24bits. -.. note:: The S/PDIF signal shown in the diagrams below are digital representations of S/PDIF and not an actual signal +.. note:: The S/PDIF connections shown in the diagrams below are digital representations of S/PDIF and not an actual signal suitable for external devices (which is 0.5V pk-pk etc). External circuitry is required to interface with the chosen medium (optical or electrical). From d35b78cf44632f4ee696d0ae26f8e50ac339af1c Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:01:24 +0100 Subject: [PATCH 30/47] Jenkins updates following review --- Jenkinsfile | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa6b5d2..d1f1cb3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,16 +37,14 @@ pipeline { steps { println "Stage running on: ${env.NODE_NAME}" - sh 'git clone git@github.com:xmos/test_support' + sh 'git clone git@github.com:xmos/test_support --branch 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { checkout scm installPipfile(false) - withVenv { - withTools(params.TOOLS_VERSION) { - dir("examples") { - sh 'cmake -B build -G "Unix Makefiles"' - } + withTools(params.TOOLS_VERSION) { + dir("examples") { + sh 'cmake -B build -G "Unix Makefiles"' } } } @@ -60,14 +58,12 @@ pipeline { stage('Documentation') { steps { dir("${REPO}") { - withVenv { - sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" - sh 'xmosdoc' - // Zip and archive doc files - zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" - } // withVenv + sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" + sh 'xmosdoc' + // Zip and archive doc files + zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" } // dir } } @@ -84,11 +80,9 @@ pipeline { steps { dir("${REPO}/examples") { viewEnv(){ - withVenv() { - withTools(params.TOOLS_VERSION) { - sh 'cmake -B build -G "Unix Makefiles"' - sh 'xmake -j 16 -C build' - } + withTools(params.TOOLS_VERSION) { + sh 'cmake -B build -G "Unix Makefiles"' + sh 'xmake -j 16 -C build' } } archiveArtifacts artifacts: "**/bin/*.xe", fingerprint: true, allowEmptyArchive: true @@ -99,12 +93,10 @@ pipeline { steps { dir("${REPO}/tests"){ viewEnv(){ - withVenv() { - withTools(params.TOOLS_VERSION) { - sh 'cmake -B build -G "Unix Makefiles"' - sh 'xmake -j 16 -C build' - sh "pytest -v --junitxml=pytest_result.xml -n auto" - } + withTools(params.TOOLS_VERSION) { + sh 'cmake -B build -G "Unix Makefiles"' + sh 'xmake -j 16 -C build' + sh "pytest -v --junitxml=pytest_result.xml -n auto" } } } From 48acc9062d28674bb7946cc6a5f6b38665fd171d Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:03:00 +0100 Subject: [PATCH 31/47] remove debug prints and rogue file --- tests/dump.txt | 63 ------------------------------------ tests/test_rx/CMakeLists.txt | 3 -- tests/test_tx/CMakeLists.txt | 2 -- 3 files changed, 68 deletions(-) delete mode 100644 tests/dump.txt diff --git a/tests/dump.txt b/tests/dump.txt deleted file mode 100644 index dc6bc6f..0000000 --- a/tests/dump.txt +++ /dev/null @@ -1,63 +0,0 @@ -digraph "lib_spdif_tests" { -node [ - fontsize = "12" -]; -subgraph clusterLegend { - label = "Legend"; - color = black; - edge [ style = invis ]; - legendNode0 [ label = "Executable", shape = egg ]; - legendNode1 [ label = "Static Library", shape = octagon ]; - legendNode2 [ label = "Shared Library", shape = doubleoctagon ]; - legendNode3 [ label = "Module Library", shape = tripleoctagon ]; - legendNode4 [ label = "Interface Library", shape = pentagon ]; - legendNode5 [ label = "Object Library", shape = hexagon ]; - legendNode6 [ label = "Unknown Library", shape = septagon ]; - legendNode7 [ label = "Custom Target", shape = box ]; - legendNode0 -> legendNode1 [ style = solid ]; - legendNode0 -> legendNode2 [ style = solid ]; - legendNode0 -> legendNode3; - legendNode1 -> legendNode4 [ label = "Interface", style = dashed ]; - legendNode2 -> legendNode5 [ label = "Private", style = dotted ]; - legendNode3 -> legendNode6 [ style = solid ]; - legendNode0 -> legendNode7; -} - "node0" [ label = "rx_capture", shape = egg ]; - "node1" [ label = "spdif_rx_analyse", shape = egg ]; - "node2" [ label = "test_rx_rx_XS2_300_176400_rx_XS2_300_176400", shape = egg ]; - "node3" [ label = "test_rx_rx_XS2_300_192000_rx_XS2_300_192000", shape = egg ]; - "node4" [ label = "test_rx_rx_XS2_300_44100_rx_XS2_300_44100", shape = egg ]; - "node5" [ label = "test_rx_rx_XS2_300_48000_rx_XS2_300_48000", shape = egg ]; - "node6" [ label = "test_rx_rx_XS2_300_88200_rx_XS2_300_88200", shape = egg ]; - "node7" [ label = "test_rx_rx_XS2_300_96000_rx_XS2_300_96000", shape = egg ]; - "node8" [ label = "test_rx_rx_XS3_300_176400_rx_XS3_300_176400", shape = egg ]; - "node9" [ label = "test_rx_rx_XS3_300_192000_rx_XS3_300_192000", shape = egg ]; - "node10" [ label = "test_rx_rx_XS3_300_44100_rx_XS3_300_44100", shape = egg ]; - "node11" [ label = "test_rx_rx_XS3_300_48000_rx_XS3_300_48000", shape = egg ]; - "node12" [ label = "test_rx_rx_XS3_300_88200_rx_XS3_300_88200", shape = egg ]; - "node13" [ label = "test_rx_rx_XS3_300_96000_rx_XS3_300_96000", shape = egg ]; - "node14" [ label = "test_rx_tx_XS2_300_176400_tx_XS2_300_176400", shape = egg ]; - "node15" [ label = "test_rx_tx_XS2_300_192000_tx_XS2_300_192000", shape = egg ]; - "node16" [ label = "test_rx_tx_XS2_300_44100_tx_XS2_300_44100", shape = egg ]; - "node17" [ label = "test_rx_tx_XS2_300_48000_tx_XS2_300_48000", shape = egg ]; - "node18" [ label = "test_rx_tx_XS2_300_88200_tx_XS2_300_88200", shape = egg ]; - "node19" [ label = "test_rx_tx_XS2_300_96000_tx_XS2_300_96000", shape = egg ]; - "node20" [ label = "test_rx_tx_XS2_500_176400_tx_XS2_500_176400", shape = egg ]; - "node21" [ label = "test_rx_tx_XS2_500_192000_tx_XS2_500_192000", shape = egg ]; - "node22" [ label = "test_rx_tx_XS2_500_44100_tx_XS2_500_44100", shape = egg ]; - "node23" [ label = "test_rx_tx_XS2_500_48000_tx_XS2_500_48000", shape = egg ]; - "node24" [ label = "test_rx_tx_XS2_500_88200_tx_XS2_500_88200", shape = egg ]; - "node25" [ label = "test_rx_tx_XS2_500_96000_tx_XS2_500_96000", shape = egg ]; - "node26" [ label = "test_rx_tx_XS3_375_176400_tx_XS3_375_176400", shape = egg ]; - "node27" [ label = "test_rx_tx_XS3_375_192000_tx_XS3_375_192000", shape = egg ]; - "node28" [ label = "test_rx_tx_XS3_375_44100_tx_XS3_375_44100", shape = egg ]; - "node29" [ label = "test_rx_tx_XS3_375_48000_tx_XS3_375_48000", shape = egg ]; - "node30" [ label = "test_rx_tx_XS3_375_88200_tx_XS3_375_88200", shape = egg ]; - "node31" [ label = "test_rx_tx_XS3_375_96000_tx_XS3_375_96000", shape = egg ]; - "node32" [ label = "test_rx_tx_XS3_600_176400_tx_XS3_600_176400", shape = egg ]; - "node33" [ label = "test_rx_tx_XS3_600_192000_tx_XS3_600_192000", shape = egg ]; - "node34" [ label = "test_rx_tx_XS3_600_44100_tx_XS3_600_44100", shape = egg ]; - "node35" [ label = "test_rx_tx_XS3_600_48000_tx_XS3_600_48000", shape = egg ]; - "node36" [ label = "test_rx_tx_XS3_600_88200_tx_XS3_600_88200", shape = egg ]; - "node37" [ label = "test_rx_tx_XS3_600_96000_tx_XS3_600_96000", shape = egg ]; -} diff --git a/tests/test_rx/CMakeLists.txt b/tests/test_rx/CMakeLists.txt index 19d49f8..0ed1880 100644 --- a/tests/test_rx/CMakeLists.txt +++ b/tests/test_rx/CMakeLists.txt @@ -32,9 +32,6 @@ foreach(i RANGE 0 ${NUM_CONFIGS}) string(JSON SAM_FREQ GET ${SAM_FREQS_LIST} ${j}) set(CONFIG "rx_${ARCH}_${CORE_FREQ}_${SAM_FREQ}") - message(STATUS "CONFIG ${CONFIG} - XN_FILE ${XN_FILE} ARCH ${ARCH} CORE_FREQ ${CORE_FREQ}") - - project(test_rx_${CONFIG}) set(APP_HW_TARGET ${XN_FILE}) set(APP_COMPILER_FLAGS_${CONFIG} diff --git a/tests/test_tx/CMakeLists.txt b/tests/test_tx/CMakeLists.txt index e4346f0..b3b56af 100644 --- a/tests/test_tx/CMakeLists.txt +++ b/tests/test_tx/CMakeLists.txt @@ -48,8 +48,6 @@ foreach(i RANGE 0 ${NUM_CONFIGS}) set(CONFIG "tx_${ARCH}_${CORE_FREQ}_${SAM_FREQ}") - message(STATUS "XN_FILE: ${XN_FILE} ARCH: ${ARCH} CORE_FREQ: ${CORE_FREQ} SAM_FREQ: ${SAM_FREQ} MCLK_FREQ: ${MCLK_FREQ}") - project(test_rx_${CONFIG}) set(APP_HW_TARGET ${XN_FILE}) set(APP_COMPILER_FLAGS_${CONFIG} From c30c3b2132b2570c437be2fb84254a2d1d1b899d Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:05:19 +0100 Subject: [PATCH 32/47] Fix attempted git one liner --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d1f1cb3..b0a33dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,8 @@ pipeline { steps { println "Stage running on: ${env.NODE_NAME}" - sh 'git clone git@github.com:xmos/test_support --branch 961532d89a98b9df9ccbce5abd0d07d176ceda40' + sh 'git clone git@github.com:xmos/test_support' + sh 'cd test_support && git checkout 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { checkout scm From defc5f3467d063e5d4eeed6af514198e67d6c7de Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:08:47 +0100 Subject: [PATCH 33/47] Remove duplicate rst subs --- doc/substitutions.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/substitutions.inc b/doc/substitutions.inc index 7145d6e..e69de29 100644 --- a/doc/substitutions.inc +++ b/doc/substitutions.inc @@ -1,3 +0,0 @@ -.. |newpage| raw:: latex - - \clearpage From 0b5e5ed5f807bdc4f35cfe5678fccbb9aff63fbb Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:15:47 +0100 Subject: [PATCH 34/47] Bump python to 3.12.1 --- Jenkinsfile | 3 +-- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0a33dd..5219ed6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,8 +9,7 @@ pipeline { } environment { REPO = 'lib_spdif' - PYTHON_VERSION = "3.10.5" // Move to 3.12.1 and in requirements - VENV_DIRNAME = ".venv" + PYTHON_VERSION = "3.12.1" } options { skipDefaultCheckout() diff --git a/requirements.txt b/requirements.txt index 26dc14b..93907eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# python_version 3.10.13 +# python_version 3.12.1 # pip_version 23.2.1 # # The parse_version_from_requirements() function in the installPipfile.groovy From 33d944a84310a0088f57d516e9ff51e150b9a35c Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:20:18 +0100 Subject: [PATCH 35/47] -n -> --numprocesses --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5219ed6..3c9f20b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -96,7 +96,7 @@ pipeline { withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' - sh "pytest -v --junitxml=pytest_result.xml -n auto" + sh "pytest -v --junitxml=pytest_result.xml --numprocesses=auto" } } } From 91d0822b96c73d3bd61dad35d982a0c5fccfb4d0 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:27:06 +0100 Subject: [PATCH 36/47] Bump deps and xdoc in env --- Jenkinsfile | 14 ++++++++------ requirements.txt | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c9f20b..f166a5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,12 +58,14 @@ pipeline { stage('Documentation') { steps { dir("${REPO}") { - sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" - sh 'xmosdoc' - // Zip and archive doc files - zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" + viewEnv(){ + sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" + sh 'xmosdoc' + // Zip and archive doc files + zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "lib_spdif_docs_html.zip" + archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" + } } // dir } } diff --git a/requirements.txt b/requirements.txt index 93907eb..8824842 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,8 +18,8 @@ # pip-install this one as editable using this repository's setup.py file. The # same modules should appear in the setup.py list as given below. -flake8==3.8.3 -pytest==7.1.2 +flake8==7.1.1 +pytest==8.3.2 pytest-xdist==3.6.1 # Pin importlib-metadata to <5 due to https://github.com/python/importlib_metadata/issues/409. importlib-metadata==4.13.0 From fdfe062e34c04327af2e2f4800058151cc1db6ee Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:31:00 +0100 Subject: [PATCH 37/47] Revert flake --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8824842..29d59cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ # pip-install this one as editable using this repository's setup.py file. The # same modules should appear in the setup.py list as given below. -flake8==7.1.1 +flake8==3.8.3 pytest==8.3.2 pytest-xdist==3.6.1 # Pin importlib-metadata to <5 due to https://github.com/python/importlib_metadata/issues/409. From e78bcadc354ee9a7a7c174353cf5cc22121aa928 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:34:48 +0100 Subject: [PATCH 38/47] More tweaking python module vers --- python/setup.py | 4 ++-- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/setup.py b/python/setup.py index d1fc657..b0f5712 100644 --- a/python/setup.py +++ b/python/setup.py @@ -13,8 +13,8 @@ name='lib_spdif', packages=setuptools.find_packages(), install_requires=[ - 'flake8~=3.8', - "pytest~=7.1", + 'flake8~=7.1.1', + "pytest~=8.3.2", ], dependency_links=[ ], diff --git a/requirements.txt b/requirements.txt index 29d59cb..8824842 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ # pip-install this one as editable using this repository's setup.py file. The # same modules should appear in the setup.py list as given below. -flake8==3.8.3 +flake8==7.1.1 pytest==8.3.2 pytest-xdist==3.6.1 # Pin importlib-metadata to <5 due to https://github.com/python/importlib_metadata/issues/409. From d35b4678a2a15b89a75d9238a775f487ff721977 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 13:45:16 +0100 Subject: [PATCH 39/47] sourcecheck --- python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index b0f5712..ae00467 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,4 +1,4 @@ -# Copyright 2020-2023 XMOS LIMITED. +# Copyright 2020-2024 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import setuptools From 5d53dd6a55f0cedce92209bf1c7d81ff61d36884 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 14:39:01 +0100 Subject: [PATCH 40/47] Use docker for docs (faster and avoids error about Sphynx) --- Jenkinsfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f166a5a..2bc1fb0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,12 +59,18 @@ pipeline { steps { dir("${REPO}") { viewEnv(){ - sh "pip install git+ssh://git@github.com/xmos/xmosdoc@${params.XMOSDOC_VERSION}" - sh 'xmosdoc' - // Zip and archive doc files - zip dir: "doc/_build/html", zipFile: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "lib_spdif_docs_html.zip" - archiveArtifacts artifacts: "doc/_build/pdf/lib_spdif*.pdf" + warnError("Docs") { + sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION" + sh """docker run -u "\$(id -u):\$(id -g)" \ + --rm \ + -v \$(pwd):/build \ + ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION -v html latex""" + + // Zip and archive doc files + zip dir: "doc/_build/html", zipFile: "${REPO}_docs_html.zip" + archiveArtifacts artifacts: "${REPO}_docs_html.zip" + archiveArtifacts artifacts: "doc/_build/pdf/${REPO}*.pdf" + } } } // dir } From 94c2561fe9b7725f2a10e8d21baa56ce612f6858 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 14:46:37 +0100 Subject: [PATCH 41/47] Debug --- Jenkinsfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2bc1fb0..5c52acb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,11 +40,12 @@ pipeline { sh 'cd test_support && git checkout 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { - checkout scm - installPipfile(false) - withTools(params.TOOLS_VERSION) { - dir("examples") { - sh 'cmake -B build -G "Unix Makefiles"' + viewEnv(){ + checkout scm + withTools(params.TOOLS_VERSION) { + dir("examples") { + sh 'cmake -B build -G "Unix Makefiles"' + } } } } @@ -104,7 +105,8 @@ pipeline { withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' - sh "pytest -v --junitxml=pytest_result.xml --numprocesses=auto" + sh 'pip freeze' + runPytest('-s -vv') } } } From 48aff49ed6b579f2d5ac3aa3b6c5ab7a13e3d87e Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 14:52:08 +0100 Subject: [PATCH 42/47] Fix Env JSL typos --- Jenkinsfile | 12 ++++++------ python/setup.py | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5c52acb..294564e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,8 @@ pipeline { sh 'cd test_support && git checkout 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { - viewEnv(){ + createVenv() + withVenv(){ checkout scm withTools(params.TOOLS_VERSION) { dir("examples") { @@ -59,7 +60,7 @@ pipeline { stage('Documentation') { steps { dir("${REPO}") { - viewEnv(){ + withVenv(){ warnError("Docs") { sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION" sh """docker run -u "\$(id -u):\$(id -g)" \ @@ -88,7 +89,7 @@ pipeline { stage('Build Examples') { steps { dir("${REPO}/examples") { - viewEnv(){ + withVenv(){ withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' @@ -101,12 +102,11 @@ pipeline { stage("Build and run tests") { steps { dir("${REPO}/tests"){ - viewEnv(){ + withVenv(){ withTools(params.TOOLS_VERSION) { sh 'cmake -B build -G "Unix Makefiles"' sh 'xmake -j 16 -C build' - sh 'pip freeze' - runPytest('-s -vv') + runPytest('-vv') } } } diff --git a/python/setup.py b/python/setup.py index ae00467..c33643d 100644 --- a/python/setup.py +++ b/python/setup.py @@ -15,6 +15,7 @@ install_requires=[ 'flake8~=7.1.1', "pytest~=8.3.2", + "pytest-xdist==3.6.1" ], dependency_links=[ ], From e5a678ed8ce7571ebe2131721957bf6650b3c8c3 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 15:01:07 +0100 Subject: [PATCH 43/47] Remove venv from docker stage --- Jenkinsfile | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 294564e..c47807a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,9 +40,9 @@ pipeline { sh 'cd test_support && git checkout 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { - createVenv() withVenv(){ checkout scm + installPipfile(false) withTools(params.TOOLS_VERSION) { dir("examples") { sh 'cmake -B build -G "Unix Makefiles"' @@ -60,19 +60,17 @@ pipeline { stage('Documentation') { steps { dir("${REPO}") { - withVenv(){ - warnError("Docs") { - sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION" - sh """docker run -u "\$(id -u):\$(id -g)" \ - --rm \ - -v \$(pwd):/build \ - ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION -v html latex""" + warnError("Docs") { + sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION" + sh """docker run -u "\$(id -u):\$(id -g)" \ + --rm \ + -v \$(pwd):/build \ + ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION -v html latex""" - // Zip and archive doc files - zip dir: "doc/_build/html", zipFile: "${REPO}_docs_html.zip" - archiveArtifacts artifacts: "${REPO}_docs_html.zip" - archiveArtifacts artifacts: "doc/_build/pdf/${REPO}*.pdf" - } + // Zip and archive doc files + zip dir: "doc/_build/html", zipFile: "${REPO}_docs_html.zip" + archiveArtifacts artifacts: "${REPO}_docs_html.zip" + archiveArtifacts artifacts: "doc/_build/pdf/${REPO}*.pdf" } } // dir } From 83da39339ea89b7473f06f07e082a27f64b34701 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 15:05:18 +0100 Subject: [PATCH 44/47] createnv --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c47807a..6304763 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,7 +42,7 @@ pipeline { dir("${REPO}") { withVenv(){ checkout scm - installPipfile(false) + createVenv() withTools(params.TOOLS_VERSION) { dir("examples") { sh 'cmake -B build -G "Unix Makefiles"' From dda9f12850d4f53fed3865242393375249b83008 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 15:07:20 +0100 Subject: [PATCH 45/47] remove venv --- Jenkinsfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6304763..0fdbadd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,13 +40,11 @@ pipeline { sh 'cd test_support && git checkout 961532d89a98b9df9ccbce5abd0d07d176ceda40' dir("${REPO}") { - withVenv(){ - checkout scm - createVenv() - withTools(params.TOOLS_VERSION) { - dir("examples") { - sh 'cmake -B build -G "Unix Makefiles"' - } + checkout scm + createVenv() + withTools(params.TOOLS_VERSION) { + dir("examples") { + sh 'cmake -B build -G "Unix Makefiles"' } } } From e4aa3edbaba01498e351ef980702380179b5a69c Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 27 Sep 2024 15:14:54 +0100 Subject: [PATCH 46/47] Jenkins... --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0fdbadd..3035ca4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,6 +42,9 @@ pipeline { dir("${REPO}") { checkout scm createVenv() + withVenv(){ + installPipfile(false) + } withTools(params.TOOLS_VERSION) { dir("examples") { sh 'cmake -B build -G "Unix Makefiles"' From c321c0609ff5839009fddb3ad307ba961f8053b9 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 30 Sep 2024 10:50:36 +0100 Subject: [PATCH 47/47] JSL 0.34 --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3035ca4..3993f40 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,4 @@ -@Library('xmos_jenkins_shared_library@develop') _ -// New lib checks fn - will be merged into mainline soon so will need to update this tag +@Library('xmos_jenkins_shared_library@v0.34.0') _ getApproval()