<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add preprocessor defined symbol in makefile? in S32G</title>
    <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1629362#M2769</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Could you help us elaborate more on this manner? We are not understanding the overall request.&lt;/P&gt;
&lt;P&gt;We understand that you want to generate a preprocessor defined symbol, which can be done by looking into:&lt;/P&gt;
&lt;P&gt;"Properties &amp;gt; C/C++ Build &amp;gt; Setting &amp;gt; Standard S32DS C Compiler &amp;gt; Preprocessor"&lt;/P&gt;
&lt;P&gt;Of your project. In there, you can add new defined symbols for your project.&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 21:30:10 GMT</pubDate>
    <dc:creator>Daniel-Aguirre</dc:creator>
    <dc:date>2023-04-06T21:30:10Z</dc:date>
    <item>
      <title>How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1628899#M2761</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I am using S32DS IDE for development.&lt;/P&gt;&lt;P&gt;Would it be possible to add preprocessor defined symbol using custom build steps with auto-generated makefile?&lt;/P&gt;&lt;P&gt;The value of defined symbol is &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;not fixed&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;I've tried to create makefile.defs, and add the following content in it. It seems not to work.&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_3-1680764599832.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218014iB353E83EBCB4F652/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_3-1680764599832.png" alt="David0406_3-1680764599832.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;TOPREPROCESS_SRCS is declared in source.mk, which would be included in the auto-generated makefile&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_5-1680765357900.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218020i90BA27448F2F7176/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_5-1680765357900.png" alt="David0406_5-1680765357900.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_6-1680765608974.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218022i5E2831DABFB6BAE1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_6-1680765608974.png" alt="David0406_6-1680765608974.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 08:17:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1628899#M2761</guid>
      <dc:creator>David0406</dc:creator>
      <dc:date>2023-04-06T08:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1629362#M2769</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Could you help us elaborate more on this manner? We are not understanding the overall request.&lt;/P&gt;
&lt;P&gt;We understand that you want to generate a preprocessor defined symbol, which can be done by looking into:&lt;/P&gt;
&lt;P&gt;"Properties &amp;gt; C/C++ Build &amp;gt; Setting &amp;gt; Standard S32DS C Compiler &amp;gt; Preprocessor"&lt;/P&gt;
&lt;P&gt;Of your project. In there, you can add new defined symbols for your project.&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 21:30:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1629362#M2769</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-04-06T21:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1629511#M2774</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to write a script to get git commit hash first and make it a preprocessor defined symbol added to my code for identification.&lt;/P&gt;&lt;P&gt;The solution you provide works, but the commit hash varies for each commit. Therefore, the defined symbol might have to be modified manually for each commit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 05:47:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1629511#M2774</guid>
      <dc:creator>David0406</dc:creator>
      <dc:date>2023-04-07T05:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1630748#M2809</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;There is the possibility of adding a "Preprocessor Macros File" to your project, in which you could add new macros. Below will be a picture of where to add this kind of file:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielAguirre_1-1681163937440.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218584i6DAB30EDDBA7E3F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielAguirre_1-1681163937440.png" alt="DanielAguirre_1-1681163937440.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For our test, before trying to add the file, we created a new header file on the project by the name "MACROS.h" in which we have the following information:&lt;/P&gt;
&lt;P&gt;#ifndef MACROS_H_&lt;BR /&gt;#define MACROS_H_&lt;/P&gt;
&lt;P&gt;#define TEST 149&lt;/P&gt;
&lt;P&gt;#endif /* MACROS_H_ */&lt;/P&gt;
&lt;P&gt;We then added the "Preprocessor Macros File" as shown on the image above and created the #IF conditional on our project. Below the results:&lt;/P&gt;
&lt;P&gt;If met:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielAguirre_2-1681164027367.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218585iAD470D41392E6029/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielAguirre_2-1681164027367.png" alt="DanielAguirre_2-1681164027367.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If not met:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielAguirre_3-1681164044718.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218586iD353B5FB093B7D72/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielAguirre_3-1681164044718.png" alt="DanielAguirre_3-1681164044718.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 22:01:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1630748#M2809</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-04-10T22:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1631261#M2812</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;I've follow the solution you provided to test it on one of NXP Uart example code, but it seems not to work on the project.&lt;/P&gt;&lt;P&gt;May I check the testing process with you?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;process&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.create MACRO.h and add it to&amp;nbsp;${ProjDirPath}/ with the same content&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_0-1681206201832.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218734i2A5418F1CEB75DDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_0-1681206201832.png" alt="David0406_0-1681206201832.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2.add it to CDT_User_Setting_Entries&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_2-1681206522080.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218736iB545D8C265672515/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_2-1681206522080.png" alt="David0406_2-1681206522080.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.add #IF conditional in main.c&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_4-1681206785474.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218738i3D7C8BB45C76E5CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_4-1681206785474.png" alt="David0406_4-1681206785474.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_1-1681206353858.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218735i6AB358117E18B74D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_1-1681206353858.png" alt="David0406_1-1681206353858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the #if block did being shaded if changing the compared value with TEST to 150&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;the warning messge was shown in the build log&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_5-1681207359898.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218739i174BE377A8FBA997/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_5-1681207359898.png" alt="David0406_5-1681207359898.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;flash binaries and monitor with uart terminal software&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_6-1681207501624.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218740iD64C035BDEED1587/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_6-1681207501624.png" alt="David0406_6-1681207501624.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 10:22:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1631261#M2812</guid>
      <dc:creator>David0406</dc:creator>
      <dc:date>2023-04-11T10:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1631574#M2822</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for your feedback. It seems that as you are saying, the GUI shows as if the Macro has been detected, but at compilation it does not take it into account.&lt;/P&gt;
&lt;P&gt;Digging further into this topic, seems that S32DS has a bug regarding this same topic. A thread below mentioning this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32-Design-Studio/Macros-to-access-filename/m-p/1073809" target="_blank"&gt;Solved: Macros to access filename - NXP Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I've tried with S32DS v3.5 (since it is the newer version) but I cannot get it working. We apologize.&lt;/P&gt;
&lt;P&gt;On the above-mentioned thread, there is a possibility of adding the flag directly into the command line pattern, but we don't know if it is what you are looking for.&lt;/P&gt;
&lt;P&gt;Please, let us know.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 21:20:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1631574#M2822</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-04-11T21:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1632052#M2840</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks for the reply and discussion thread you provided&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I give up adding git info in preprocessor defined symbol way.&lt;/P&gt;&lt;P&gt;I've followed the solution mentioned in the below image by first executing a script to get git info, then&lt;/P&gt;&lt;P&gt;writing it into the header file which would be included in the main.c in Pre-build steps.&lt;/P&gt;&lt;P&gt;After flashing binaries, it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for providing solutions&amp;nbsp; : )&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="David0406_0-1681293444172.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/218921i0BA780C4C81B5277/image-size/medium?v=v2&amp;amp;px=400" role="button" title="David0406_0-1681293444172.png" alt="David0406_0-1681293444172.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 10:19:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1632052#M2840</guid>
      <dc:creator>David0406</dc:creator>
      <dc:date>2023-04-12T10:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add preprocessor defined symbol in makefile?</title>
      <link>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1632552#M2852</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for your feedback. Good to know you found a workaround.&lt;/P&gt;
&lt;P&gt;Please, let us know if there is anything else we can help you with.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 20:18:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/How-to-add-preprocessor-defined-symbol-in-makefile/m-p/1632552#M2852</guid>
      <dc:creator>Daniel-Aguirre</dc:creator>
      <dc:date>2023-04-12T20:18:15Z</dc:date>
    </item>
  </channel>
</rss>

