Support for .S files

Sysprogs forums Forums VisualGDB Support for .S files

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36175
    Arek
    Participant

    As for Today, in the project window I can add assembly source code and compile, however:

    • there are no specific setting I can apply to assembler (there are only general & c/c++)
    • no defined symbol is propagated to assembler

    Can handling of the assembly source code be added? With ability to:

    • suppressing warnings,
    • contoling debug level,
    • controlling preprocessor symbols (-D but also -x assembler-with-cpp),
    • adding assembler specific include paths,
    • adding other flags, like -mtune, -march etc
    #36177
    support
    Keymaster

    Hi,

    This should work just fine as long as the assembly files are preprocessed. If you are not sure, let us know your project type (MSBuild/CMake) and the  compiler you are using, and we can suggest where to look for it.

    #36180
    Arek
    Participant

    Hi,

    Environment? CMake/Ninja/arm-eabi/OpenOCD/ST-Link/STM32H5xx

    I have several .S files added to the project. However when I look into the properties of one of them, there is no possibility to set “Compile as” to -x assembler-with-cpp. I mean the combo box edit field stays empty.

    After a bit of playing, compilation stops:

    arm-none-eabi-g++.exe: warning: "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"-x assembler-with-cpp\\\\\\\\\\\\\\\" -x\\\\\\\" assembler-with-cpp\\\" -x\" assembler" -x: linker input file unused because linking not done
    arm-none-eabi-g++.exe: error: "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"-x assembler-with-cpp\\\\\\\\\\\\\\\" -x\\\\\\\" assembler-with-cpp\\\" -x\" assembler" -x: linker input file not found: Invalid argument
    arm-none-eabi-g++.exe: warning: assembler-with-cpp: linker input file unused because linking not done
    arm-none-eabi-g++.exe: error: assembler-with-cpp: linker input file not found: No such file or directory

    #36182
    Arek
    Participant

    For troubleshooting purposes, this is what was added to CMakeLists.txt:

     

    set_source_files_properties(src/bsp/peripherals.S PROPERTIES
    COMPILE_FLAGS "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"-x assembler-with-cpp\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" -x\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" assembler-with-cpp\\\\\\\\\\\\\\\" -x\\\\\\\" assembler\\\" -x\" assembler-with-cpp")

    #36185
    support
    Keymaster

    CMake uses its own logic for deciding how to build each individual file, however most of it is configurable. Specifically, you can pass assembly-specific CFLAGS by using the $<COMPILE_LANGUAGE:ASM> expression in bsp_compile_flags. You can find some more examples of it in the %VISUALGDB_DIR%\cmake\embedded\bsp.cmake file.

    If you cannot get anything working with CMake, you can try using MSBuild. There VisualGDB is in direct control of each compiler invocation, so you can clearly specify which tool to use in each specific case, and what arguments to pass. That said, MSBuild projects rely on a lot of legacy parts from Visual Studio itself, and are somewhat less streamlined than advanced CMake projects.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.