Skip to content

Problem with modifying topology files #408

@JCesarMolina

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

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