How to configure SCONS to properly compile c, cpp and .S files?

120 Views Asked by At

I have ARM project with .c and .cpp files. I use SCONS as build system. So far everything works fine, but I wanted to add SEGGER SystemView to my project, and there is SEGGER_RTT_ASM_ARMv7M.S assembly file in it. When I just added this file like this:

src = Glob('somepath/*.c') + \
      Glob('someotherpath/*.c') + \
      Glob('resources/segger/*.c') + \
      Glob('resources/segger/*.S')

program = env.Program("my-binary.elf", src)

SCONS added '.S' file to liker stage as it was object file, without compiling it to object file:

arm-none-eabi-g++ -o build\my-binary.elf ...linker-options... object-file1.o object-file2.o resources\segger\SEGGER_RTT_ASM_ARMv7M.S

How can I make SCONS compile this assembly file to object file, like it does for .c and .cpp files? My env options (flags and paths omitted for clarity):

env_options_arm_gcc = {
    "CC"    : arch_arm_gcc + "gcc",
    "CXX"   : arch_arm_gcc + "g++",
    "LD"    : arch_arm_gcc + "g++",
    "AR"    : arch_arm_gcc + "ar",
    "STRIP" : arch_arm_gcc + "strip",
    "TARGET_ARCH" : "arm",
    "PROGSUFFIX" : ".elf",
    "OBJSUFFIX" : ".o",
    "LIBPATH" : ["#src\\Device_Startup", "#build\\resources"],
    "LINKFLAGS" : ...linker_flags...,
    "CCFLAGS" : ...c/cpp compile flags...
    "CFLAGS" : '-std=gnu99',
    "CXXFLAGS" : '-std=c++11',
    "LIBS" : 'stdc++',
    "CPPPATH" : [
    ...Include path...
    ]
}
0

There are 0 best solutions below