<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>emBuild configuration - global macro</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73961/embuild-configuration---global-macro</link><description>Hi, 
 We are building our project with nRF52811 and Segger Studio V5.34. (I have Ubuntu 1804 if it helps.) 
 We have certain variable configurations but would like the ability to build the project without having to change the source files , i.e. the ability</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 May 2021 14:21:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73961/embuild-configuration---global-macro" /><item><title>RE: emBuild configuration - global macro</title><link>https://devzone.nordicsemi.com/thread/308386?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 14:21:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eed0ae38-ce8c-44a8-b959-98da47023692</guid><dc:creator>SLiuCognosos</dc:creator><description>&lt;p&gt;Kind of...&lt;/p&gt;
&lt;p&gt;I was trying out everything I could think of, and I did try something similar to what you discribed in the other reply. And got the same issue.&lt;/p&gt;
&lt;p&gt;I also tried to see if the IDE can grab values from an OS environment var. However, the IDE&amp;#39;s documentation on (what I think was) relevant parts is next to none.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the -D option does not over-ride/create a new definition, then hopping through yet another pre-processor def only makes my project messier.&lt;/p&gt;
&lt;p&gt;So what I decided to do was a python script that generates the &amp;quot;version&amp;quot; #define (you can put this into a &amp;quot;pre build&amp;quot; command), and use the &amp;quot;post build&amp;quot; to call another script (in my case, same script with a different option) to delete the &amp;quot;version&amp;quot; so that you won&amp;#39;t be accidentally building a code that has wrong version info.&lt;/p&gt;
&lt;p&gt;This is waaaay more convoluted that what I envisioned at first... but kinda works for the time being...&lt;/p&gt;
&lt;p&gt;Word of caution: Cross building platform is another beast and my solution here does not play nice enough, at least across Win &amp;lt;-&amp;gt; Linux, but I didn&amp;#39;t put too much effort in it...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: emBuild configuration - global macro</title><link>https://devzone.nordicsemi.com/thread/308253?ContentTypeID=1</link><pubDate>Tue, 04 May 2021 21:59:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c030653-b497-4394-8527-e8ae8f63de1d</guid><dc:creator>mtsunstrum</dc:creator><description>&lt;p&gt;Quirky, but this looks like a way to do it ...&lt;/p&gt;
&lt;p&gt;&lt;a href="https://forum.segger.com/index.php/Thread/4785-SOLVED-EMBuild-D-option/"&gt;https://forum.segger.com/index.php/Thread/4785-SOLVED-EMBuild-D-option/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Only downside is if not using the embuild command-line (ie. using SES IDE), it is not clear what&amp;nbsp;&lt;span&gt;$(EXT_APP_VER) may default to.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The functionality works, but as expected, there seems to be a problem when using the same .emproject via the SES IDE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I setup up a preprocessor variable defined as follows:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;MY_PREPROCESS_VAR=$(EXT_MY_PREPROCESS_VAR)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;... then using -D EXT_MY_PREPROCESS_VAR=3&amp;nbsp; works fine.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BUT via SES IDE,&amp;nbsp;the&amp;nbsp;MY_PREPROCESS_VAR will exist, but I cannot test it as below .. because compiler / preprocessor will see&amp;nbsp;MY_PREPROCESS_VAR defined as&amp;nbsp;$(EXT_MY_PREPROCESS_VAR) and exit on a compile error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;#if defined(MY_PREPROCESS_VAR) &amp;amp;&amp;amp; (MY_PREPROCESS_VAR == 3)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the project, I can define a default project macro:&amp;nbsp; e.g&amp;nbsp;&lt;span&gt;EXT_MY_PREPROCESS_VAR=2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;... but here is the jist of the problem. This project macro value does not get over-ridden &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;by&amp;nbsp;-D EXT_MY_PREPROCESS_VAR=3&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Grrr ...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: emBuild configuration - global macro</title><link>https://devzone.nordicsemi.com/thread/308252?ContentTypeID=1</link><pubDate>Tue, 04 May 2021 21:45:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aff80b7b-3a0b-4491-9ea1-ac9e82c961b4</guid><dc:creator>mtsunstrum</dc:creator><description>&lt;p&gt;Seeing the same here. Did you find a solution ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: emBuild configuration - global macro</title><link>https://devzone.nordicsemi.com/thread/304904?ContentTypeID=1</link><pubDate>Wed, 14 Apr 2021 16:04:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a372e932-09c2-45d2-821b-25f52da664b0</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think this question is best directed to SEGGER:&lt;br /&gt;&lt;a href="https://www.segger.com/support/technical-support/"&gt;https://www.segger.com/support/technical-support/&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;a href="https://forum.segger.com/"&gt;https://forum.segger.com/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>