Freedom Studio: include header from subdirectory


sorry for the rookie question but I have some problems to include a simple header file from a subdirectory.

First I added a new source folder, so it looks like this:

I added the include path in the project properties

I also edited the makefiles in the upper project folder …

# SRC_DIR sets the path to the program source directory
SRC_DIR ?= $(abspath src)
# HAL_DIR sets the path to the HAL source directory
HAL_DIR ?= $(abspath src/HAL)

PROGRAM_SRCS = $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/*.h) $(wildcard $(SRC_DIR)/*.S) $(wildcard $(HAL_DIR)/*.c) $(wildcard $(HAL_DIR)/*.h) $(wildcard $(HAL_DIR)/*.S)

…and in the src folder


$(PROGRAM): $(wildcard *.c) $(wildcard *.h) $(wildcard *.S) $(wildcard HAL/*.c) $(wildcard HAL/*.h) $(wildcard HAL/*.S)
	$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.c %.S,$^) $(LOADLIBES) $(LDLIBS) -o $@

	rm -f $(PROGRAM) $(PROGRAM).hex

But I still get this error:

make[1]: Entering directory '/c/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/src'
/C/Users/.../Documents/FreedomStudio- -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/C/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/bsp/install/include --specs=nano.specs -DMTIME_RATE_HZ_DEF=32768 -fcommon -O0 -g -Wl,--gc-sections -Wl,-Map, -nostartfiles -nostdlib -L/C/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/bsp/install/lib/debug/ -T/C/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/bsp/ main.c HAL/HAL_GPIO.c  -Wl,--start-group -lc -lgcc -lm -lmetal -lmetal-gloss -Wl,--end-group -o HIFIVEHAL
main.c:3:10: fatal error: HAL_GPIO.h: No such file or directory
    3 | #include "HAL_GPIO.h"
      |          ^~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:7: HIFIVEHAL] Error 1
make[1]: Leaving directory '/c/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/src'
make: *** [Makefile:287: /c/Users/.../Documents/FreedomStudio_Projekte/sifive_hifive1_revb_HAL/src/debug/HIFIVEHAL.elf] Error 2
"make all CONFIGURATION=debug" terminated with exit code 2. Build might be incomplete.

I hope someone can help me, thank you!

You seem to be specifying the include path to the assembler but not the C compiler?

I presume that the Freedom Studio bundles some example projects which you might be better off starting with before modifying to your specific requirements?