<?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>Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111978/setting-extra-cmake-arguments-only-applies-to-initial-build</link><description>When I apply an Extra CMake build argument when creating a build configuration, it only takes effect on the first build, but none after that. 
 For example, I have added this code to my CMakeLists.txt file: 
 
 If I define JLINK_FLASH_BUILD in the Extra</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jul 2024 18:31:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111978/setting-extra-cmake-arguments-only-applies-to-initial-build" /><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/493510?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 18:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af744a8d-7956-4428-b776-fdfd4c9f4c64</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Sergii_K,&lt;/p&gt;
&lt;p&gt;The issue where additional flags are lost after editing build configuration&amp;nbsp;is a known limitation of nRF Connect for VS Code. It is being worked on.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t remember issue with pristine build though, but it is likely related.&lt;/p&gt;
&lt;p&gt;My apologies for the inconvenience.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/493472?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 14:46:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85c712af-2683-4dd6-9b04-c2cbf45e9a92</guid><dc:creator>Sergii_K</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/vthieu"&gt;Hieu&lt;/a&gt;&amp;nbsp;,&lt;br /&gt;but, is another way to give compiler flag for a specific build exists?&lt;br /&gt;&lt;br /&gt;For example, we need to have two build configurations for single application,&amp;nbsp;&lt;br /&gt;with second configuration CMake compiler flag&amp;nbsp;added&amp;nbsp;&lt;br /&gt; &lt;br /&gt;-DCMAKE_C_FLAGS=&amp;quot;-DUSE_PIPE2&amp;quot;&lt;br /&gt;&lt;br /&gt;The flag works well for the initial build, but lost when I open &amp;quot;edit build configuration&amp;quot; or&amp;nbsp; run pristine build.&lt;br /&gt;&lt;br /&gt;Is it true impossible to use conditional compilation specific to selected build, with nRF Connect extension?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/489329?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2024 13:40:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ffdd812-269d-4725-bc78-fbd21f54235b</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi jrhaws,&lt;/p&gt;
&lt;p&gt;I wonder if the JLINK_FLASH_BUILD trick you are using is working in the first place, rather than that it doesn&amp;#39;t work only on the second image.&lt;/p&gt;
&lt;p&gt;I tested by adding some print() in imgtool.py files as followed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// imgtool main.py

def sign(key, public_key_format, align, version, pad_sig, header_size,
         pad_header, slot_size, pad, confirm, max_sectors, overwrite_only,
         endian, encrypt_keylen, encrypt, infile, outfile, dependencies,
         load_addr, hex_addr, erased_val, save_enctlv, security_counter,
         boot_record, custom_tlv, rom_fixed, max_align, clear, fix_sig,
         fix_sig_pubkey, sig_out, vector_to_sign):

    
    print(&amp;quot;hieu imgtool main.py test point 1&amp;quot;)
    if confirm:
        # Confirmed but non-padded images don&amp;#39;t make much sense, because
        # otherwise there&amp;#39;s no trailer area for writing the confirmed status.
        print(&amp;quot;hieu imgtool main.py test point 2&amp;quot;)
        pad = True&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;// image.py, just to be sure I am tweaking the correct imgtool copy
                if hasattr(key, &amp;#39;sign&amp;#39;):
                    print(os.path.basename(__file__) + &amp;quot;: sign the payload hivo2&amp;quot;)
                    sig = key.sign(bytes(self.payload))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And here is the log I got. It seems the confirm flag was not set for any of the images.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[28/33] Generating ../../zephyr/app_signed.hex
hieu imgtool main.py test point 1
image.py: sign the payload hieu2
[29/33] Generating ../../zephyr/app_update.bin
hieu imgtool main.py test point 1
image.py: sign the payload hieu2
[31/33] Generating ../../zephyr/app_test_update.hex
hieu imgtool main.py test point 1
image.py: sign the payload hieu2
[33/33] Generating zephyr/merged.hex&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I wonder if the&amp;nbsp;IMGTOOL_ARGS line in your CMakeLists.txt works at all. Perhaps the primary slot image is just confirmed by default, not thanks to your change.&lt;/p&gt;
&lt;p&gt;Did you find somewhere the reference that arguments can be added to this&amp;nbsp;IMGTOOL_ARGS list?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/488509?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 13:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c36d9573-1a8e-42c3-861b-e03c5217f7d4</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I understand now.&amp;nbsp;I will have to investigate this and come back later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/488390?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 20:20:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f853552-9eea-468a-8299-b1f6541374f9</guid><dc:creator>jrhaws</dc:creator><description>&lt;p&gt;In our CI system we run a build with this command:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil toolchain-manager launch -- west build -b pru_001697 --build-dir _bld . -DJLINK_FLASH_BUILD=TRUE&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This causes the primary image to be confirmed, but the secondary to not be. I would expect that if I set the JLINK_FLASH_BUILD flag to true, it will apply to BOTH images.&lt;/p&gt;
&lt;p&gt;If I set JLINK_FLASH_BUILD to true inside the CMakeLists.txt file, then both images ARE confirmed properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Extra CMake Arguments only applies to initial build</title><link>https://devzone.nordicsemi.com/thread/488388?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 20:16:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:250b9cf8-8764-4349-9928-7d2671e06cf7</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi jrhaws,&lt;/p&gt;
&lt;p&gt;The nRF Connect Extension for VS Code issue with using build configuration, extra CMake arguments, and multi-image build is unfortunately a known issue that our team hasn&amp;#39;t been able to resolve due to some complications in the build system.&lt;/p&gt;
&lt;p&gt;Our apologies for the inconvenience.&lt;/p&gt;
[quote user=""]In addition, if I run a build from the command line, the same issue shows up. The secondary image is NOT confirmed, when it is expected to be so.[/quote]
&lt;p&gt;Regarding this point, however.&amp;nbsp;Is this from the first time building with the command line? Or from the second time? Could you please give me some detailed steps to reproduce this observation?&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>