[Scons-users] defining map files

Torsten Robitzki Torsten at Robitzki.de
Thu Aug 2 08:25:10 EDT 2018


Hello,

I try to build several Programs in the same environment. I would like to let the linker generate a map file and that map file name should depend on $TARGET (foo.elf -> foo.map).

All Programs share some common object files. According to "4.2.5. Variable substitution“ it should be possible to call functions during construction variable substitution:

    env = Environment(FUNC = myfunc)
    env.Command(target = ‚foo.out‘, source = 'foo.in', command = "${FUNC($<)}")

I’ve tried that:

    def map_file_name_from_target(target):
        return os.path.splitext(target)[ 0 ] + '.map'

    hsm_env.Append(
        FUNC = map_file_name_from_target,
        EXEC_LDFLAGS = „-Wl,-Map=${FUNC($<)},—cref -Wl,-T,STM32F746NGHx_FLASH.ld „ )

but with no luck:

    SyntaxError `invalid syntax (<string>, line 1)’ trying to evaluate `${FUNC($<)}'

I’m very new to Scons, but I think that deriving file names from other file name is such a common thing, when building software, so there must be a way to achieve what I want to do. Most likely there is a Sconish way that I’m not aware of.

Any hints, tipps?

Kind regards,

Torsten


More information about the Scons-users mailing list