Explanation: I've created an STM32 project and aim to get a platform-independent build and output file like .hex, .bin, and .elf. For this, I created the project under the CMake build system. CMake configuration settings and toolchain settings have been made. However, towards the end of the build phase, I encountered this error.
Linker flags: Under "compiler_flags.cmake" file.
...set(LD_FLAGS "-Wl,-Map=${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map,--cref -T${LD_SCRIPT} -Wl, --gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -defsym --Wl,--start-group -lc -lm -Wl,--end-group, __cxa_pure_virtual=1")
Error output:
.........Assembler messages:Fatal error: bad defsym; format is --defsym name=valueninja: build stopped: subcommand failed.