05-02-2019 02:27 PM
Consider this a follow-up question to https://forums.xilinx.com/t5/Embedded-Development-Tools/Adding-external-include-path-to-a-BSP/m-p/964084
I need to use a relative path in the extra compiler flags field of the BSP (since the GUI method of adding an include path doesn't actually work for BSPs). What is the current directory when the compiler gets called? I tried adding a path relative to the makefile, relative to the project, and relative to where the SDK was started, but none of these worked.
05-12-2019 11:57 PM
Hi @mberemand,
The make command is called from the BSP project location as you can see in the console output based on the path provided in the -C option.
"Running Make libs in psu_cortexa53_0/libsrc/standalone_v6_8/src"
make -C psu_cortexa53_0/libsrc/standalone_v6_8/src -s libs "SHELL=CMD".....
If you take a look to the make manpage, you will notice that the -C option specifies the location to move prior starting to read the makefile, so you need to use relative paths based on that location.
As an example I just modified the xil_io.c file and add a include statement to myheader.h file that I located at workspace level. Hence my BSP has been modified to add "-I../../../../.." to the extra compiler flags.
"Running Make libs in psu_cortexa53_0/libsrc/standalone_v6_8/src" make -C psu_cortexa53_0/libsrc/standalone_v6_8/src -s libs "SHELL=CMD" "COMPILER=aarch64-none-elf-gcc" "ARCHIVER=aarch64-none-elf-ar" "COMPILER_FLAGS= -O2 -c" "EXTRA_COMPILER_FLAGS=-g -Wall -Wextra -I../../../../.."
Regards