I want to configure Visual Studio Code to use CMake and armclang to build code for Cortex-M4, on Windows.
My CMakeLists.txt file configures correctly from the ARM DS 2021.1 Command Prompt. In VS Code I set the environment variables for CMake Configuration as follows:
"cmake.configureEnvironment": { "ARMLMD_LICENSE_FILE": "\\Users\\<snip>\\AppData\\Roaming\\arm\\ds\\licenses", "ARM_CONFIG_PATH": "\\Users\\<snip>\\AppData\\Roaming\\arm\\ds\\2021.1", "ARM_PRODUCT_DEF": "\\Program Files\\Arm\\Development Studio 2021.1\\sw\\mappings\\gold.elmap", "DS_CDB_PATH": "\\Program Files\\Arm\\Development Studio 2021.1\\sw\\debugger\\configdb", "DS_HOME": "\\Program Files\\Arm\\Development Studio 2021.1\\sw\\..", "LM_LICENSE_FILE_TMP": "<snip>", "GNU_ARM_TOOLCHAIN_PATH": "/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin", "PATH": "\\Program Files\\Arm\\Development Studio 2021.1\\sw\\..\\sw\\ARMCompiler6.16\\bin;\\Program Files\\Arm\\Development Studio 2021.1\\bin;\\Program Files\\Arm\\Development Studio 2021.1\\sw\\java\\bin;${env:PATH}" }
CMake configuration then fails as follows: [cmake] -- The C compiler identification is ARMClang 6.16.1 [cmake] -- The CXX compiler identification is ARMClang 6.16.1 [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - failed [cmake] -- Check for working C compiler: C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe [cmake] -- Check for working C compiler: C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe - broken [cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message): [cmake] The C compiler [cmake] [cmake] "C:/Program Files/Arm/Development Studio 2021.1/sw/ARMCompiler6.16/bin/armclang.exe" [cmake] [cmake] is not able to compile a simple test program. [cmake] [cmake] It fails with the following output: [cmake] [cmake] Change Dir: C:/SVNProj/Elysion/trunk/software/prototypes/elysion_arm_studio_4/build/CMakeFiles/CMakeTmp [cmake] [cmake] Run Build Command(s):C:/bin/ninja-win/ninja.exe cmTC_5d897 && [1/2] Building C object CMakeFiles/cmTC_5d897.dir/testCCompiler.o [cmake] warning: 'armv4t' is unsupported in this version of the product [cmake] warning: 'arm7tdmi' is unsupported in this version of the product [cmake] [2/2] Linking C static library libcmTC_5d897.a [cmake] FAILED: libcmTC_5d897.a [cmake] cmd.exe /C "cd . && C:\Strawberry\c\bin\ar.exe --create -cr libcmTC_5d897.a CMakeFiles/cmTC_5d897.dir/testCCompiler.o && cd ." [cmake] C:\Strawberry\c\bin\ar.exe: unknown option -- create [cmake] Usage: C:\Strawberry\c\bin\ar.exe [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file... [cmake] C:\Strawberry\c\bin\ar.exe -M [<mri-script] [cmake] commands: [cmake] d - delete file(s) from the archive [cmake] m[ab] - move file(s) in the archive [cmake] p - print file(s) found in the archive [cmake] q[f] - quick append file(s) to the archive [cmake] r[ab][f][u] - replace existing or insert new file(s) into the archive [cmake] s - act as ranlib [cmake] t[O][v] - display contents of the archive [cmake] x[o] - extract file(s) from the archive [cmake] command specific modifiers: [cmake] [a] - put file(s) after [member-name] [cmake] [b] - put file(s) before [member-name] (same as [i]) [cmake] [D] - use zero for timestamps and uids/gids [cmake] [U] - use actual timestamps and uids/gids (default) [cmake] [N] - use instance [count] of name [cmake] [f] - truncate inserted file names [cmake] [P] - use full path names when matching [cmake] [o] - preserve original dates [cmake] [O] - display offsets of files in the archive [cmake] [u] - only replace files that are newer than current archive contents [cmake] generic modifiers: [cmake] [c] - do not warn if the library had to be created [cmake] [s] - create an archive index (cf. ranlib) [cmake] [S] - do not build a symbol table [cmake] [T] - make a thin archive [cmake] [v] - be verbose [cmake] [V] - display the version number [cmake] @<file> - read options from <file> [cmake] --target=BFDNAME - specify the target object format as BFDNAME [cmake] optional: [cmake] --plugin <p> - load the specified plugin [cmake] emulation options: [cmake] No emulation specific options [cmake] C:\Strawberry\c\bin\ar.exe: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf32-iamcu elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex [cmake] ninja: build stopped: subcommand failed. [cmake] [cmake] [cmake] [cmake] [cmake] [cmake] CMake will not be able to correctly generate this project.