Adding include path in Freedom Studio


I started working with Freedom Studio a few days ago and have some problems to include a simple header file from another directory in the project. I used an example project for Freedom E SDK and created the new dirctory HAL with the first header file. I added the include path under “Project → Properties → C/C++ General → Path and Sybols” as I know it from other eclipse-based IDEs, but I still get the error: No such file or directory.

I hope you can help me, thank you!

You probably need to provide more details - e.g. the console output from a failed compile.
Maybe it’s failing when trying to process an asm file because you need the include path in the assembler tool settings too?

The folders 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 console ouput:

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.