Skip to content

Problem with modifying topology files #408

Description

@JCesarMolina

Hello,
I have been following the Hello World Tutorial, and in the Part II - Modifying the Topology & Driver I got the following output:

-- The C compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- No CMAKE_BUILD_TYPE, defaulting to Debug
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kubuntu/Documents/work/sof/sof/tools/build_tools
-- The C compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for one of the modules 'glib-2.0'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kubuntu/Documents/work/sof/sof/tools/build_tools/fuzzer

  • cmake --build /home/kubuntu/Documents/work/sof/sof/tools/build_tools --
    [  0%] Built target abi_v1
    [  0%] Generating production/main-topology.conf
    [  0%] Generating production/main-topology.tplg
    ALSA lib conf.c:2005:(_snd_config_load_with_include) toplevel:21:49:Unexpected char
    ALSA lib parser.c:223:(tplg_load_config) could not load configuration
    Unable to load configuration: Invalid argument
    topology/topology1/CMakeFiles/topology1_main-topology.dir/build.make:72: recipe for target 'topology/topology1/production/main-topology.tplg' failed
    make[2]: *** [topology/topology1/production/main-topology.tplg] Error 1
    CMakeFiles/Makefile2:5081: recipe for target 'topology/topology1/CMakeFiles/topology1_main-topology.dir/all' failed
    make[1]: *** [topology/topology1/CMakeFiles/topology1_main-topology.dir/all] Error 2
    Makefile:135: recipe for target 'all' failed
    make: *** [all] Error 2

I don catch where is the error, then i tried to modify sof-imx8mp-wm8904.m4 , it can be compiled, I where the pipe-volume-playback-4test.m4 file is modified with small changes in order to find out where is the error.

The code for pipe-volume-playback-4test.m4 is:

# Low Latency Passthrough with volume Pipeline and PCM
#
# Pipeline Endpoints for connection are :-
#
#  host PCM_P --> B0 --> Volume 0 --> B1 --> sink DAI0

# Include topology builder
include(`utils.m4')
include(`buffer.m4')
include(`pcm.m4')
include(`pga.m4')
include(`dai.m4')
include(`mixercontrol.m4')
include(`bytecontrol.m4') # ADDED
include(`pipeline.m4')
include(`amp.m4') # ADDED

#
# Controls
#
# Volume Mixer control with max value of 32
C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID,
	CONTROLMIXER_OPS(volsw, 256 binds the mixer control to volume get/put handlers, 256, 256),
	CONTROLMIXER_MAX(, 32),
	false,
	CONTROLMIXER_TLV(TLV 32 steps from -64dB to 0dB for 2dB, vtlv_m64s2),
	Channel register and shift for Front Left/Right,
	VOLUME_CHANNEL_MAP)

#
# Volume configuration
#

define(DEF_PGA_TOKENS, concat(`pga_tokens_', PIPELINE_ID))
define(DEF_PGA_CONF, concat(`pga_conf_', PIPELINE_ID))

W_VENDORTUPLES(DEF_PGA_TOKENS, sof_volume_tokens,
LIST(`		', `SOF_TKN_VOLUME_RAMP_STEP_TYPE	"2"'
     `		', `SOF_TKN_VOLUME_RAMP_STEP_MS		"20"'))

W_DATA(DEF_PGA_CONF, DEF_PGA_TOKENS)


############### ADDED ###############
# Amp Parameters
include(`amp_bytes.m4')

# Amp Bytes control with max value of 140
# The max size needs to also take into account the space required to hold the control data IPC message
# struct sof_ipc_ctrl_data requires 92 bytes
# AMP priv in amp_bytes.m4 (ABI header (32 bytes) + 2 dwords) requires 40 bytes
# Therefore at least 132 bytes are required for this kcontrol
# Any value lower than that would end up in a topology load error
C_CONTROLBYTES(AMP, PIPELINE_ID,
     CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258),
     CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258),
     , , ,
     CONTROLBYTES_MAX(, 140),
     ,
     AMP_priv)
#####################################

#
# Components and Buffers
#

# Host "Passthrough Playback" PCM
# with 2 sink and 0 source periods
W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0, SCHEDULE_CORE)

# "Volume" has 2 source and x sink periods
W_PGA(0, PIPELINE_FORMAT, DAI_PERIODS, 2, DEF_PGA_CONF, SCHEDULE_CORE,
	LIST(`		', "PIPELINE_ID Master Playback Volume"))

# Playback Buffers
W_BUFFER(0, COMP_BUFFER_SIZE(2,
	COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
	PLATFORM_HOST_MEM_CAP, SCHEDULE_CORE)
W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS,
	COMP_SAMPLE_SIZE(DAI_FORMAT), PIPELINE_CHANNELS, COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)),
	PLATFORM_DAI_MEM_CAP, SCHEDULE_CORE)

#
# Pipeline Graph
#
#  host PCM_P --> B0 --> Volume 0 --> B1 --> sink DAI0

P_GRAPH(pipe-volume-playback, PIPELINE_ID,
	LIST(`		',
	`dapm(N_BUFFER(0), N_PCMP(PCM_ID))',
	`dapm(N_PGA(0), N_BUFFER(0))',
	`dapm(N_BUFFER(1), N_PGA(0))'))

#
# Pipeline Source and Sinks
#
indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1))
indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Passthrough Playback PCM_ID)

ifdef(`CHANNELS_MIN',`define(`LOCAL_CHANNELS_MIN', `CHANNELS_MIN')',
`define(`LOCAL_CHANNELS_MIN', `2')')

#
# PCM Configuration

#
PCM_CAPABILITIES(Passthrough Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), PCM_MIN_RATE, PCM_MAX_RATE, LOCAL_CHANNELS_MIN, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536)

undefine(`LOCAL_CHANNELS_MIN')
undefine(`DEF_PGA_TOKENS')
undefine(`DEF_PGA_CONF')

After compilation, i got :

  • cmake --build /home/kubuntu/Documents/work/sof/sof/tools/build_tools --
    [ 0%] Built target abi_v1
    [ 1%] Generating production/sof-imx8mp-wm8904.conf
    [ 1%] Generating production/sof-imx8mp-wm8904.tplg
    ALSA lib data.c:1375:(tplg_parse_data) failed to parse data bytes
    ALSA lib parser.c:231:(tplg_load_config) failed to parse topology
    Unable to load configuration: Invalid argument
    topology/topology1/CMakeFiles/topology1_sof-imx8mp-wm8904.dir/build.make:72: recipe for target 'topology/topology1/production/sof-imx8mp-wm8904.tplg' failed
    make[2]: *** [topology/topology1/production/sof-imx8mp-wm8904.tplg] Error 1
    CMakeFiles/Makefile2:5081: recipe for target 'topology/topology1/CMakeFiles/topology1_sof-imx8mp-wm8904.dir/all' failed
    make[1]: *** [topology/topology1/CMakeFiles/topology1_sof-imx8mp-wm8904.dir/all] Error 2
    Makefile:135: recipe for target 'all' failed
    make: *** [all] Error 2

I hope someone could help me.

Thanks in advanced
Julio C. Molina

Activity

  1. JCesarMolina commented on Mar 21, 2022

    @JCesarMolina
    Author

    Hello,
    I noticed that in the code tools/topology/amp_bytes.m4 in Part II - Modifying the Topology & Driver

    # AMP Example - Parameters
    CONTROLBYTES_PRIV(AMP_priv,
    `       bytes "0x53,0x4f,0x46,0x00,'
    `       0x00,0x00,0x00,0x00,'
    `       0x08,0x00,0x00,0x00,'
    `       0x00,0x00,0x00,0x03,'
    `       0x00,0x00,0x00,0x00,''
    `       0x00,0x00,0x00,0x00,'
    `       0x00,0x00,0x00,0x00,'
    `       0x00,0x00,0x00,0x00,'
    `       0x01,0x00,0x00,0x00,'
    `       0x01,0x00,0x00,0x00"'
    )
    

    It should has just one apostrophe in the end of the 7th line. Now the code for pipe-volume-playback-4test.m4 compiles.

  2. plbossart commented on Mar 21, 2022

    @plbossart
    Member

    Not sure what's going on, this works for me:

    rm -rf tools/build_tools/
    ./scripts/build-tools.sh 
    ls -l tools/build_tools/topology/topology1/production/sof-imx8mp-wm8904.* 
    

    I don't know if it's related but you seem to have an ancient GCC version "The C compiler identification is GNU 7.5.0" so your platform may run into issues others with more recent packages don't see.

  3. lgirdwood commented on Mar 21, 2022

    @lgirdwood
    Member

    @JCesarMolina best to have a recent distro as the SOF developers mostly use recent distro releases with latest ALSA, GCC, cmake etc..

  4. JCesarMolina commented on Mar 23, 2022

    @JCesarMolina
    Author

    @lgirdwood I think so, but i followed the tutorial based on that i have kubuntu 18.04 ,i have to do it using that version. in the website:

    If you are using Ubuntu 16.04, the gcc version must be updated to gcc 7.3+ in order for the Advanced Linux Sound Architecture (ALSA) to build.

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-7 g++-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    

    to avoid any problem , i just followed what in the SOF website is indicated.

  5. JCesarMolina commented on Mar 23, 2022

    @JCesarMolina
    Author

    @plbossart , it means that there's no syntax error in the 7th line?

  6. plbossart commented on Mar 23, 2022

    @plbossart
    Member

    Are you referring to this @JCesarMolina

    `       0x00,0x00,0x00,0x03,'
    `       0x00,0x00,0x00,0x00,''
    

    I am not sure why there are two quotes in the end, but that should be harmless. @ranj063 would you concur?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions