<?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>Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99317/zephyr-compile-speedup</link><description>Despite I have a rather modern machine (Intel i7, 12 cores) and a not too big project, compiling a Zephyr application takes too much time. I&amp;#39;m used to FreeRTOS compilation times being 2-5x faster than this. (Of course, Zephyr code base is larger) If my</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 May 2023 08:59:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99317/zephyr-compile-speedup" /><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423715?ContentTypeID=1</link><pubDate>Thu, 04 May 2023 08:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9772837b-59cb-4863-80f0-3766309ee244</guid><dc:creator>AHaug</dc:creator><description>[quote user="Tamas Selmeci"]Could you please give me some hints on what the build system investigates when it decides to regenerate everything or to simply recompile the changes C sources?[/quote]
&lt;p&gt;I think the way to best understand how this works is to investigate &amp;#39;&lt;em&gt;build and configuration systems&amp;#39;&lt;/em&gt; and &amp;#39;&lt;em&gt;Build system (Cmake)&amp;#39;&lt;/em&gt; under &amp;#39;A&lt;em&gt;pplication development&amp;#39;&lt;/em&gt; at&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev.html&lt;/a&gt;&amp;nbsp;in your own time&lt;/p&gt;
[quote user="Tamas Selmeci"]In fact, I&amp;#39;ve added a new board under a directory out of NCS directory tree; and west build is invoked like this:[/quote]
&lt;p&gt;Just speculation: it might be related to the board being outside and/or that you&amp;#39;re using a custom board that is not listed within ..&lt;em&gt;/zephyr/boards&lt;/em&gt;&amp;nbsp;or&lt;em&gt;.../&lt;/em&gt;&lt;em&gt;nrf/boards&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423657?ContentTypeID=1</link><pubDate>Thu, 04 May 2023 06:21:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:116516e6-3d3e-4b85-aecc-2b623fcec1e6</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;Could you please give me some hints on what the build system investigates when it decides to regenerate everything or to simply recompile the changes C sources?&lt;/p&gt;
&lt;p&gt;In fact, I&amp;#39;ve added a new board under a directory out of NCS directory tree; and west build is invoked like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt; west build -b $(ZEPHYR_BOARD) \&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; --build-dir=$(TARGET_OBJ_DIR) \&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; -- -DBOARD_ROOT=$(MY_BOARD_ROOT) \&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; -DVAR1=value \&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; -DVAR2=value&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Some custom defines are also added by &lt;code&gt;zephyr_compile_definitions&lt;/code&gt;, some options by &lt;code&gt;zephyr_compile_options.&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423591?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 13:47:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fdd2c0a-08ab-479e-b7bd-06fad73589bf</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;I&amp;#39;ve verifyed, compiling a sample really won&amp;#39;t recompile everything. So there must be an error on my side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423546?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 12:36:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6ffd8be-4266-4fad-976a-cd2eba6d4251</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Could you state which sample you observed this with? I am assuming that there exists a build folder in this case Here&amp;#39;s the output from calling west build -b nrf52840dk_nrf52840 3 times to build mesh/light_switch sample. First time is a pristine build where I expected to see everything called and generated, second call resulting in no work to do is without any changes and third call is by adding a printk to the main function which only recompiles the source code and does not go through any of the lines in the log you attached. Same result is observed with the VSCode extensions build-action button.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Even with windows it only takes a brief moment to perform the third build where modifications to main.c has been made&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;C:\Nordic\SDKs\ncs\v2.3.0\nrf\samples\bluetooth\mesh\light_switch&amp;gt;west build -b nrf52840dk_nrf52840
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch
-- Using NCS Toolchain 2.3.0 for building. (C:/Nordic/SDKs/ncs/toolchains/v2.3.0/cmake)
-- Found Python3: C:/Nordic/SDKs/ncs/toolchains/v2.3.0/opt/bin/python.exe (found suitable exact version &amp;quot;3.8.2&amp;quot;) found components: Interpreter
-- Cache files will be written to: C:/Nordic/SDKs/ncs/v2.3.0/zephyr/.cache
-- Zephyr version: 3.2.99 (C:/Nordic/SDKs/ncs/v2.3.0/zephyr)
-- Found west (found suitable version &amp;quot;0.14.0&amp;quot;, minimum required is &amp;quot;0.7.1&amp;quot;)
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.15.2 (C:/Nordic/SDKs/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (C:/Nordic/SDKs/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found Dtc: C:/Nordic/SDKs/ncs/toolchains/v2.3.0/opt/bin/dtc.exe (found suitable version &amp;quot;1.4.7&amp;quot;, minimum required is &amp;quot;1.4.6&amp;quot;)
-- Found BOARD.dts: C:/Nordic/SDKs/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build/zephyr/dts.cmake
Parsing C:/Nordic/SDKs/ncs/v2.3.0/zephyr/Kconfig
Loaded configuration &amp;#39;C:/Nordic/SDKs/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig&amp;#39;
Merged configuration &amp;#39;C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/prj.conf&amp;#39;
Configuration saved to &amp;#39;C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build/zephyr/.config&amp;#39;
Kconfig header saved to &amp;#39;C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build/zephyr/include/generated/autoconf.h&amp;#39;
-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Nordic/SDKs/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/Nordic/SDKs/ncs/v2.3.0/zephyr/CMakeLists.txt:1838 (message):
  __ASSERT() statements are globally ENABLED


-- Configuring done
-- Generating done
-- Build files have been written to: C:/Nordic/SDKs/ncs/v2.3.0/nrf/samples/bluetooth/mesh/light_switch/build
-- west build: building application
[1/280] Generating include/generated/version.h
-- Zephyr version: 3.2.99 (C:/Nordic/SDKs/ncs/v2.3.0/zephyr), build: v3.2.99-ncs2
[269/280] Linking C executable zephyr\zephyr_pre0.elf

[273/280] Linking C executable zephyr\zephyr_pre1.elf

[279/280] Linking C executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      307488 B       992 KB     30.27%
             RAM:       67066 B       256 KB     25.58%
        IDT_LIST:          0 GB         2 KB      0.00%
[280/280] Generating zephyr/merged.hex

C:\Nordic\SDKs\ncs\v2.3.0\nrf\samples\bluetooth\mesh\light_switch&amp;gt;west build -b nrf52840dk_nrf52840
ninja: no work to do.

C:\Nordic\SDKs\ncs\v2.3.0\nrf\samples\bluetooth\mesh\light_switch&amp;gt;west build -b nrf52840dk_nrf52840
[3/12] Linking C executable zephyr\zephyr_pre0.elf

[6/12] Linking C executable zephyr\zephyr_pre1.elf

[11/12] Linking C executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      307540 B       992 KB     30.28%
             RAM:       67066 B       256 KB     25.58%
        IDT_LIST:          0 GB         2 KB      0.00%
[12/12] Generating zephyr/merged.hex

C:\Nordic\SDKs\ncs\v2.3.0\nrf\samples\bluetooth\mesh\light_switch&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423544?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 12:22:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fe49e26-ca40-4fc4-896a-7d7e56593c51</guid><dc:creator>Tamas Selmeci</dc:creator><description>&lt;p&gt;I&amp;#39;m issuing the&amp;nbsp;following command:&lt;/p&gt;
&lt;p&gt;west build -b my_board&lt;/p&gt;
&lt;p&gt;You&amp;#39;re right, it&amp;#39;s going to recompile the changed source (C/H) files only, but before it would get there, spends a lot of time being busy with other things, as these console lines indicate:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;-- west build: generating a build system&lt;br /&gt;Loading Zephyr default modules (Zephyr base (cached)).&lt;br /&gt;-- Application: /home/tselmeci/projects/rtls-monolithic.git/src/safetag&lt;br /&gt;-- Cache files will be written to: /home/tselmeci/.cache/zephyr&lt;br /&gt;-- Zephyr version: 3.2.99 (/home/tselmeci/projects/rtls-monolithic.git/packages/nrfconnect/nrfconnect-wlt-v5r1-safetag/zephyr)&lt;br /&gt;-- Found west (found suitable version &amp;quot;0.14.0&amp;quot;, minimum required is &amp;quot;0.7.1&amp;quot;)&lt;br /&gt;-- Board: wlt_v5r1_app&lt;br /&gt;-- Found host-tools: zephyr 0.15.2 (/home/tselmeci/projects/rtls-monolithic.git/toolchain/wlt-v5r1-safetag/zephyr-sdk-0.15.2)&lt;br /&gt;-- Found toolchain: zephyr 0.15.2 (/home/tselmeci/projects/rtls-monolithic.git/toolchain/wlt-v5r1-safetag/zephyr-sdk-0.15.2)&lt;br /&gt;-- Found BOARD.dts: /home/tselmeci/projects/rtls-monolithic.git/src/libbsp/nrfconnect/boards/arm/wlt-v5r1/wlt_v5r1_app.dts&lt;br /&gt;&lt;strong&gt;-- Generated zephyr.dts: /home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/zephyr.dts&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;-- Generated devicetree_generated.h: /home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/include/generated/devicetree_generated.h&lt;/strong&gt;&lt;br /&gt;-- Including generated dts.cmake file: /home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/dts.cmake&lt;br /&gt;&lt;strong&gt;Parsing /home/tselmeci/projects/rtls-monolithic.git/packages/nrfconnect/nrfconnect-wlt-v5r1-safetag/zephyr/Kconfig&lt;/strong&gt;&lt;br /&gt;Loaded configuration &amp;#39;/home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/.config&amp;#39;&lt;br /&gt;&lt;strong&gt;No change to configuration in &amp;#39;/home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/.config&amp;#39;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;No change to Kconfig header in &amp;#39;/home/tselmeci/projects/rtls-monolithic.git/src/safetag/build/wlt-v5r1-safetag-obj/zephyr/include/generated/autoconf.h&amp;#39;&lt;/strong&gt;&lt;br /&gt;Loading Zephyr default modules (Zephyr base (cached)).&lt;br /&gt;Loading Zephyr default modules (Zephyr base (cached)).&lt;br /&gt;Loading Zephyr default modules (Zephyr base (cached)).&lt;br /&gt;Loading Zephyr default modules (Zephyr base (cached)).&lt;br /&gt;-- Configuring done&lt;br /&gt;-- Generating done&lt;/pre&gt;
&lt;p&gt;It takes some seconds till completes, and not a single of my .c files have been recompiled. Some interesting lines are in bold.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr compile speedup</title><link>https://devzone.nordicsemi.com/thread/423535?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 12:11:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f0b4689-8300-42ce-ae39-cb27a7ce7961</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In general: yes, compiling zephyr based applications do take a long time due to the build system scripts you mention. But these scripts are not invoked if you only modify the source code of your project, i.e if you add for instance a line of logging, printing or other arbitrary code to your main.c file. They are only called if you either modify said files (device tree, overlay files, config files) or perfom a pristine build every time you build.&lt;/p&gt;
&lt;p&gt;Are you performing a pristine build every time you build?&amp;nbsp;If so, it makes sense that you observe the regeneration and recompilation of every system you&amp;#39;ve mentioned. Let me know if you need to know how to do this.&lt;/p&gt;
&lt;p&gt;The feedback can also be directed to the zephyr groups discord found under T&lt;em&gt;echnical resources -&amp;gt; Developing with Zephyr&lt;/em&gt; at&amp;nbsp;&lt;a href="https://www.zephyrproject.org/"&gt;https://www.zephyrproject.org/#&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>