We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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!
you can refer to this manual page:
developer.arm.com/.../Preprocessing-a-scatter-file
ChenTang This manual page is good for understanding how to get the preprocessor to run on the scatter file (Which I have no problems doing). The question is "Is there a way to have the KEIL project definitions (Defined in the KEIL project c/c++ settings) to be visible when the preprocessor runs on the scatter file?" I want the defines highlighted in yellow in the picture below to be visible to the preprocessor when processing the scatter file.
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"
--predefine="-I../../mydirectory"
This example adds a definition for "MYDEFINITION" to the defines for the linker:--predefine="-DMYDEFINITION"
--predefine="-DMYDEFINITION"
Hope this helps
Thank you coming back and sharing this with the community, much appreciated.