Search code examples
makefileembeddedincludeheader-filesarmclang

What is the correct way to include (CMSIS) header files when using armclang?


I am currently for learning purposes trying to construct a Makefile to understand the building process for embedded programming. I am using the toolchain included in Keil microVision, so my compiler is "armclang".

The Makefile currently looks like this:

arm-toolchain := C:\Keil_v5\ARM\ARMCLANG\bin
export PATH:=$(arm-toolchain);$(PATH)

.PHONY: all
all: object-files

object-files: $(wildcard *.c) $(wildcard *.h)
    armclang -c -g  -std=c11 --target=arm-arm-none-eabi $??

I tried reading the armclang documentation to see if there is a way to specify an "include path", but nothing is mentioned in the documentation.

Searching online only yields results for other toolchains, which have different methods.

The only solution that currently comes to mind is just putting all in the include files in the path, but that doesn't seem right.

I was expecting that there would be a clear way of accomplishing this.


Solution

  • Apparently, armclang is a variant of Clang. Clang recognizes traditional Unix C compiler options, including in particular -I for adding directories to the include search path.