This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

KEIL Project Linker Include Definitions

Hi All,

I have a linker scatter file that uses "#!armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m33 -xc" command in the first line to preprocess an included header file.

I've noticed a couple issues that I am not sure the best way to resolve within the KEIL environment.

First is that the header file in not found unless I include the path in the previously mentioned preprocessor command by adding "-I..\..\Linker" to the command.

The second issue is that the header file has references to definitions that are at the project level.

I suspect that both of these issues are related to the fact that the project level settings are not being seen during the linker stage. Is there a way to have the C\C++ include directories and #defines from the project be included during the linker scatter preprocessing?

Thanks for any help!

Parents
  • After closer reading of the ARM documentation, I have found the following: 

    https://developer.arm.com/documentation/101754/0618/armlink-Reference/armlink-Command-line-Options/--predefine--string-

    This article shows how to perform a predefine in the linker settings and provides examples. For the other part of my question about include directories, I found no solution and so I just used the relative address when #including my file.

    UPDATE:
    I have found that the --predefine can be used for both definitions and include directories

    Example Define:

    The following examples can be placed in the "Misc Controls" of the linker settings.

    This example adds a relative include directory for ../../mydirectory to the include list for the linker:
    --predefine="-I../../mydirectory"

    This example adds a definition for "MYDEFINITION" to the defines for the linker:
    --predefine="-DMYDEFINITION"

    Hope this helps

Reply
  • After closer reading of the ARM documentation, I have found the following: 

    https://developer.arm.com/documentation/101754/0618/armlink-Reference/armlink-Command-line-Options/--predefine--string-

    This article shows how to perform a predefine in the linker settings and provides examples. For the other part of my question about include directories, I found no solution and so I just used the relative address when #including my file.

    UPDATE:
    I have found that the --predefine can be used for both definitions and include directories

    Example Define:

    The following examples can be placed in the "Misc Controls" of the linker settings.

    This example adds a relative include directory for ../../mydirectory to the include list for the linker:
    --predefine="-I../../mydirectory"

    This example adds a definition for "MYDEFINITION" to the defines for the linker:
    --predefine="-DMYDEFINITION"

    Hope this helps

Children