diff --git a/scripts/build-tools.sh b/scripts/build-tools.sh index f18ddd9e0a87..7a8a8fad870f 100755 --- a/scripts/build-tools.sh +++ b/scripts/build-tools.sh @@ -1,9 +1,11 @@ #!/bin/bash cd tools -./autogen.sh -./configure + +mkdir build_tools +cd build_tools +cmake .. make -j$(nproc) if [[ "$1" == "-t" ]]; then make tests -j$(nproc) fi -cd ../ +cd ../../ diff --git a/scripts/sof-target-install.sh b/scripts/sof-target-install.sh index f1aa903a12e8..6928eb12d2fd 100755 --- a/scripts/sof-target-install.sh +++ b/scripts/sof-target-install.sh @@ -1,15 +1,14 @@ #!/bin/bash -# usage: ./scripts/sof-target-intsall.sh up2-hostname ip +# usage: ./scripts/sof-target-install.sh up2-hostname ip for host in $@ do scp build_*_*/sof-*.ri root@${host}:/lib/firmware/intel/sof/ - # TODO: need modify when tools CMAKE build system updated - scp tools/topology/*.tplg root@${host}:/lib/firmware/intel/sof-tplg/ - scp tools/logger/sof-logger \ + scp tools/build_tools/topology/*.tplg root@${host}:/lib/firmware/intel/sof-tplg/ + scp tools/build_tools/logger/sof-logger \ build_*_*/src/arch/xtensa/sof-*.ldc \ tools/coredumper/* \ - tools/eqctl/sof-eqctl \ + tools/build_tools/eqctl/sof-eqctl \ tools/kmod_scripts/* \ root@${host}:~/ done diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 000000000000..dfdbc222da0c --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) + +if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(FATAL_ERROR + " In-source builds are not supported.\n" + " Please remove CMakeCache.txt and the CMakeFiles directory.\n" + " Then specify a build directory. Example: cmake -Bbuild ..." + ) +endif() + +project(SOF_TOOLS C) + +set(SOF_ROOT_SOURCE_DIRECTORY "${PROJECT_SOURCE_DIR}/..") + +add_subdirectory(logger) +add_subdirectory(eqctl) +add_subdirectory(topology) +add_subdirectory(test) diff --git a/tools/Makefile.am b/tools/Makefile.am deleted file mode 100644 index da48543f1672..000000000000 --- a/tools/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = logger topology eqctl -TESTDIR = test/topology - -tests: - $(MAKE) -C $(TESTDIR) diff --git a/tools/README b/tools/README index 07e9777d67a8..401ac199f133 100644 --- a/tools/README +++ b/tools/README @@ -7,34 +7,11 @@ DSP firmwares for ALSA. Building and Installing ======================= -./autogen.sh (only needed first time) -./configure +cmake -Bbuild . +cd build make make install - -rimage -====== - -rimage is used to convert ELF executable firmware files to the firmware file -formats used by the kernel drivers. - -e.g. - -rimage -i elf_file -o kernel_file -m machine - -rimage can also convert kernel firmware formats to flat binaries formats to -assist in debugging :- - -e.g. convert to flat binary, then ELF then dissasemble - -rimage -i /lib/firmware/intel/reef-byt.ri -o image.bin -b -m byt - -xtensa-byt-elf-objcopy -I binary -O elf32-xtensa-le -B xtensa image.bin image.bin.elf - -xtensa-byt-elf-objdump -D image.bin.elf > image.dis.txt - - sof-logger ====== @@ -130,4 +107,4 @@ tests To generate all test configuration files: -make tests \ No newline at end of file +make tests diff --git a/tools/autogen.sh b/tools/autogen.sh deleted file mode 100755 index 3b379b6014f2..000000000000 --- a/tools/autogen.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -libtoolize -c --force -aclocal -I m4 --install -autoconf -Wall -autoheader -automake -a --copy --foreign --add-missing diff --git a/tools/configure.ac b/tools/configure.ac deleted file mode 100644 index 829937a699b0..000000000000 --- a/tools/configure.ac +++ /dev/null @@ -1,38 +0,0 @@ - -AC_PREREQ([2.69]) -AC_INIT([sof-tools], [1.0.1]) -AM_INIT_AUTOMAKE([foreign]) -AC_CONFIG_SRCDIR([logger/logger.c]) -AC_CONFIG_SRCDIR([eqctl/eqctl.c]) -AC_CONFIG_HEADERS([config.h]) -AC_CHECK_HEADER([sof/uapi/abi.h]) -AC_CHECK_PROG([XARGS], xargs, "yes", "no", [$PATH]) -AM_CONDITIONAL(XARGS, test "$XARGS" = "yes") - -AC_CANONICAL_HOST - -dnl Initialize maintainer mode -AM_MAINTAINER_MODE([enable]) - -AC_PROG_CC - -AC_OUTPUT([ - Makefile - logger/Makefile - eqctl/Makefile - topology/Makefile - topology/common/Makefile - topology/platform/Makefile - topology/platform/intel/Makefile - topology/platform/common/Makefile - topology/m4/Makefile - topology/sof/Makefile - test/topology/Makefile -]) - -echo " - -prefix: ${prefix} -Compiler: ${CC} -CFLAGS: ${CFLAGS} -" diff --git a/tools/eqctl/CMakeLists.txt b/tools/eqctl/CMakeLists.txt new file mode 100644 index 000000000000..81707cdf1352 --- /dev/null +++ b/tools/eqctl/CMakeLists.txt @@ -0,0 +1,9 @@ +add_executable(sof-eqctl + eqctl.c +) + +target_link_libraries(sof-eqctl PRIVATE + "-lasound" +) + +install(TARGETS sof-eqctl DESTINATION bin) diff --git a/tools/eqctl/Makefile.am b/tools/eqctl/Makefile.am deleted file mode 100644 index c1759c05b65a..000000000000 --- a/tools/eqctl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -LDADD = -lasound - -bin_PROGRAMS = sof-eqctl - -sof_eqctl_SOURCES = \ - eqctl.c diff --git a/tools/logger/CMakeLists.txt b/tools/logger/CMakeLists.txt new file mode 100644 index 000000000000..317d950a4085 --- /dev/null +++ b/tools/logger/CMakeLists.txt @@ -0,0 +1,15 @@ +add_executable(sof-logger + logger.c + convert.c +) + +target_compile_options(sof-logger PRIVATE + -Wall -Werror +) + +target_include_directories(sof-logger PRIVATE + "${SOF_ROOT_SOURCE_DIRECTORY}/src/include" + "${SOF_ROOT_SOURCE_DIRECTORY}" +) + +install(TARGETS sof-logger DESTINATION bin) diff --git a/tools/logger/Makefile.am b/tools/logger/Makefile.am deleted file mode 100644 index 2a154135c7aa..000000000000 --- a/tools/logger/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -bin_PROGRAMS = sof-logger - -sof_logger_SOURCES = \ - logger.c \ - convert.c - -sof_logger_CFLAGS = \ - -I ../../src/include \ - -I ../../ \ - -Wall \ - -Werror diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt new file mode 100644 index 000000000000..7463f9cf1473 --- /dev/null +++ b/tools/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(topology) diff --git a/tools/test/topology/CMakeLists.txt b/tools/test/topology/CMakeLists.txt new file mode 100644 index 000000000000..894eb730df26 --- /dev/null +++ b/tools/test/topology/CMakeLists.txt @@ -0,0 +1,32 @@ +file(GLOB TPLG_DEPS + ../../topology/platform/intel/*.m4 + ../../topology/common/*.m4 + ../../topology/m4/*.m4 + ../../topology/sof/*.m4 +) + +find_program(XARGS NAMES xargs PATHS ENV PATH NO_DEFAULT_PATH) + +if(${XARGS} STREQUAL XARGS-NOTFOUND) + set(USE_XARGS "no") +else() + set(USE_XARGS "yes") +endif() + +add_custom_target(tests + COMMAND ${CMAKE_COMMAND} -E env + SOF_TPLG_BUILD_OUTPUT=${CMAKE_CURRENT_BINARY_DIR} + USE_XARGS=${USE_XARGS} + ./tplg-build.sh + DEPENDS ${TPLG_DEPS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + USES_TERMINAL +) + +add_custom_target(tests-clean + COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/*.conf + COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/*.tplg + VERBATIM + USES_TERMINAL +) diff --git a/tools/test/topology/Makefile.am b/tools/test/topology/Makefile.am deleted file mode 100644 index be2830bd2b92..000000000000 --- a/tools/test/topology/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ - -# -# Dependencies -# - -if XARGS -export USE_XARGS=yes -endif - -DEPS = \ - ../../topology/platform/intel/*.m4 \ - ../../topology/common/*.m4 \ - ../../topology/m4/*.m4 \ - ../../topology/sof/*.m4 - -# Uncomment the following line if you want to debug conf files -.PRECIOUS: %.conf - -all : *.m4 ${DEPS} - ./tplg-build.sh - -clean-local: - rm -f *.conf - rm -f *.tplg - - -EXTRA_DIST = \ - test-capture.m4 \ - test-playback.m4 \ - test-tone-playback.m4 \ - test-all.m4 \ - tplg-build.sh diff --git a/tools/test/topology/tplg-build.sh b/tools/test/topology/tplg-build.sh index 9df05ac71154..5d7af3b1f628 100755 --- a/tools/test/topology/tplg-build.sh +++ b/tools/test/topology/tplg-build.sh @@ -10,6 +10,13 @@ set -e # M4 preprocessor flags export M4PATH="../../topology/:../../topology/m4:../../topology/common:../../topology/platform/intel:../../topology/platform/common" +if [ -z "$SOF_TPLG_BUILD_OUTPUT" ] +then + BUILD_OUTPUT="." +else + BUILD_OUTPUT="$SOF_TPLG_BUILD_OUTPUT" +fi + # Simple component test cases # can be used on components with 1 sink and 1 source. SIMPLE_TESTS=(test-all test-capture test-playback) @@ -63,9 +70,9 @@ function simple_test { -DTEST_DMIC_DUTY_MAX=${12} \ -DTEST_DMIC_SAMPLE_RATE=${13} \ -DTEST_DMIC_PDM_CONFIG=${14} \ - $i.m4 > ${TFILE}.conf - echo "Compiling test $i -> ${TFILE}.tplg" - alsatplg -v 1 -c ${TFILE}.conf -o ${TFILE}.tplg + $i.m4 > "$BUILD_OUTPUT/${TFILE}.conf" + echo "Compiling test $i -> $BUILD_OUTPUT/${TFILE}.tplg" + alsatplg -v 1 -c "$BUILD_OUTPUT/${TFILE}.conf" -o "$BUILD_OUTPUT/${TFILE}.tplg" else if [ "$USE_XARGS" == "yes" ] then @@ -85,9 +92,9 @@ function simple_test { -DTEST_SSP_MCLK=${11},-DTEST_SSP_PHY_BITS=$8\ -DTEST_SSP_DATA_BITS=$9,-DTEST_SSP_MODE=${12}\ -DTEST_SSP_MCLK_ID=${13},-DTEST_DAI_TYPE=$5\ - $i.m4,${TFILE}," + $i.m4,$BUILD_OUTPUT/${TFILE}," #create input string for batch processing of conf files - TEST_STRINGS+=${TFILE}"," + TEST_STRINGS+="$BUILD_OUTPUT/${TFILE}," fi else #if DAI type is SSP, define the SSP specific params @@ -113,9 +120,9 @@ function simple_test { -DTEST_SSP_MODE=${12} \ -DTEST_SSP_MCLK_ID=${13} \ -DTEST_DAI_TYPE=$5 \ - $i.m4 > ${TFILE}.conf - echo "Compiling test $i -> ${TFILE}.tplg" - alsatplg -v 1 -c ${TFILE}.conf -o ${TFILE}.tplg + $i.m4 > "$BUILD_OUTPUT/${TFILE}.conf" + echo "Compiling test $i -> $BUILD_OUTPUT/${TFILE}.tplg" + alsatplg -v 1 -c "$BUILD_OUTPUT/${TFILE}.conf" -o "$BUILD_OUTPUT/${TFILE}.tplg" fi fi fi diff --git a/tools/topology/CMakeLists.txt b/tools/topology/CMakeLists.txt new file mode 100644 index 000000000000..cde5ec5b8b4d --- /dev/null +++ b/tools/topology/CMakeLists.txt @@ -0,0 +1,70 @@ +file(GLOB TPLG_DEPS + platform/intel/*.m4 + platform/common/*.m4 + common/*.m4 + m4/*.m4 + sof/*.m4 +) + +set(MACHINES + sof-cht-nocodec + sof-cht-max98090 + sof-hda-intel-common + sof-apl-nocodec + sof-byt-nocodec + sof-bdw-rt286 + sof-bdw-rt5640 + sof-byt-rt5640 + sof-byt-rt5645 + sof-byt-rt5651 + sof-byt-da7213 + sof-cnl-rt274 + sof-hsw-rt5640 + sof-apl-tdf8532 + sof-apl-pcm512x + sof-apl-pcm512x-nohdmi + sof-apl-rt298 + sof-apl-wm8804 + sof-apl-da7219 + sof-glk-da7219 + sof-glk-rt5682 + sof-icl-nocodec + sof-apl-eq-pcm512x + sof-apl-eq-dmic + sof-apl-dmic-2ch + sof-apl-dmic-4ch + sof-icl-dmic-4ch + sof-apl-src-pcm512x + sof-cml-rt5682 + sof-cml-src-rt5682 + sof-cnl-nocodec +) + +add_custom_target(topologies ALL) + +foreach(machine ${MACHINES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${machine}.conf + COMMAND m4 + -I ${CMAKE_CURRENT_SOURCE_DIR}/m4 + -I ${CMAKE_CURRENT_SOURCE_DIR}/common + -I ${CMAKE_CURRENT_SOURCE_DIR}/platform/common + -I ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/${machine}.m4 + > ${machine}.conf + DEPENDS ${TPLG_DEPS} + VERBATIM + USES_TERMINAL + ) + + add_custom_command( + OUTPUT ${machine}.tplg + COMMAND alsatplg -v 1 -c ${machine}.conf -o ${machine}.tplg + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${machine}.conf + VERBATIM + USES_TERMINAL + ) + + add_custom_target(topology_${machine} DEPENDS ${machine}.tplg) + add_dependencies(topologies topology_${machine}) +endforeach() diff --git a/tools/topology/Makefile.am b/tools/topology/Makefile.am deleted file mode 100644 index 3e293b18871c..000000000000 --- a/tools/topology/Makefile.am +++ /dev/null @@ -1,98 +0,0 @@ - -# -# Dependencies -# - -SUBDIRS = m4 sof common platform - -DEPS = \ - platform/intel/*.m4 \ - platform/common/*.m4 \ - common/*.m4 \ - m4/*.m4 \ - sof/*.m4 - -# -# Machines -# - -MACHINES = \ - sof-cht-nocodec.tplg \ - sof-cht-max98090.tplg \ - sof-hda-intel-common.tplg \ - sof-apl-nocodec.tplg \ - sof-byt-nocodec.tplg \ - sof-bdw-rt286.tplg \ - sof-bdw-rt5640.tplg \ - sof-byt-rt5640.tplg \ - sof-byt-rt5645.tplg \ - sof-byt-rt5651.tplg \ - sof-byt-da7213.tplg \ - sof-cnl-rt274.tplg \ - sof-hsw-rt5640.tplg \ - sof-apl-tdf8532.tplg \ - sof-apl-pcm512x.tplg \ - sof-apl-pcm512x-nohdmi.tplg \ - sof-apl-rt298.tplg \ - sof-apl-wm8804.tplg \ - sof-apl-da7219.tplg \ - sof-glk-da7219.tplg \ - sof-glk-rt5682.tplg \ - sof-icl-nocodec.tplg \ - sof-apl-eq-pcm512x.tplg \ - sof-apl-eq-dmic.tplg \ - sof-apl-dmic-2ch.tplg \ - sof-apl-dmic-4ch.tplg \ - sof-icl-dmic-4ch.tplg \ - sof-apl-src-pcm512x.tplg \ - sof-cml-rt5682.tplg \ - sof-cml-src-rt5682.tplg \ - sof-cnl-nocodec.tplg - -# Uncomment the following line if you want to debug conf files -.PRECIOUS: %.conf - -%.conf : %.m4 ${DEPS} - m4 -I m4 -I common -I platform/common $< > $@ - -%.tplg : %.conf - alsatplg -v 1 -c $< -o $@ - -all: ${MACHINES} - -clean-local: - rm -f *.conf - rm -f *.tplg - -EXTRA_DIST = \ - sof-cht-nocodec.m4 \ - sof-cht-max98090.m4 \ - sof-apl-hdmi.m4 \ - sof-hda-intel-common.m4 \ - sof-apl-nocodec.m4 \ - sof-byt-nocodec.m4 \ - sof-bdw-rt286.m4 \ - sof-bdw-rt5640.m4 \ - sof-byt-rt5640.m4 \ - sof-byt-rt5645.m4 \ - sof-byt-rt5651.m4 \ - sof-byt-da7213.m4 \ - sof-cnl-rt274.m4 \ - sof-hsw-rt5640.m4 \ - sof-apl-tdf8532.m4 \ - sof-apl-pcm512x.m4 \ - sof-apl-pcm512x-nohdmi.m4 \ - sof-apl-rt298.m4 \ - sof-apl-wm8804.m4 \ - sof-apl-da7219.m4 \ - sof-glk-da7219.m4 \ - sof-glk-rt5682.m4 \ - sof-icl-nocodec.m4 \ - sof-apl-eq-pcm512x.m4 \ - sof-apl-eq-dmic.m4 \ - sof-apl-dmic-4ch.m4 \ - sof-apl-dmic-2ch.m4 \ - sof-apl-src-pcm512x.m4 \ - sof-cml-rt5682.m4 \ - sof-cml-src-rt5682.m4 \ - sof-cnl-nocodec.m4 diff --git a/tools/topology/common/Makefile.am b/tools/topology/common/Makefile.am deleted file mode 100644 index 7e207a79703f..000000000000 --- a/tools/topology/common/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -EXTRA_DIST = \ - tlv.m4 \ - memory.m4 - diff --git a/tools/topology/m4/Makefile.am b/tools/topology/m4/Makefile.am deleted file mode 100644 index d7b867f316cd..000000000000 --- a/tools/topology/m4/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -EXTRA_DIST = \ - buffer.m4 \ - dai.m4 \ - mixer.m4 \ - mixercontrol.m4 \ - pcm.m4 \ - pga.m4 \ - pipeline.m4 \ - src.m4 \ - tone.m4 \ - utils.m4 diff --git a/tools/topology/platform/Makefile.am b/tools/topology/platform/Makefile.am deleted file mode 100644 index 011ff9e938aa..000000000000 --- a/tools/topology/platform/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = intel common diff --git a/tools/topology/platform/common/Makefile.am b/tools/topology/platform/common/Makefile.am deleted file mode 100644 index a8576d588efc..000000000000 --- a/tools/topology/platform/common/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST = \ - ssp.m4 diff --git a/tools/topology/platform/intel/Makefile.am b/tools/topology/platform/intel/Makefile.am deleted file mode 100644 index bc56971989ed..000000000000 --- a/tools/topology/platform/intel/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -EXTRA_DIST = \ - bdw.m4 \ - bxt.m4 \ - byt.m4 \ - cht.m4 \ - hsw.m4 \ - cnl.m4 \ - dmic.m4 - diff --git a/tools/topology/sof/Makefile.am b/tools/topology/sof/Makefile.am deleted file mode 100644 index fc92591f738b..000000000000 --- a/tools/topology/sof/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -EXTRA_DIST = \ - pipe-dai-capture.m4 \ - pipe-dai-playback.m4 \ - pipe-low-latency-capture.m4 \ - pipe-low-latency-playback.m4 \ - pipe-passthrough-capture.m4 \ - pipe-passthrough-playback.m4 \ - pipe-pcm-media.m4 \ - pipe-src-capture.m4 \ - pipe-src-playback.m4 \ - pipe-tone.m4 \ - pipe-volume-capture.m4 \ - pipe-volume-playback.m4 \ - tokens.m4