<?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>Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62775/differentiating-compiler-options-between-zdebug-and-zrelease-build-configs-with-ncs-ses</link><description>The following questions are in regards to the instructions at nRF_Connect_SDK-modifying-a-sample-application . 
 In the Windows environment, I am transitioning from using nRF5_SDK_16.0.0 to using 
 
 nRF Connect SDK v1.3.0, with 
 SES 4.52 
 board nrf52840dk_nrf52840</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Aug 2020 18:24:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62775/differentiating-compiler-options-between-zdebug-and-zrelease-build-configs-with-ncs-ses" /><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/262864?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2020 18:24:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fe1686b-9c51-4e44-840d-2e965e6c33a8</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Thanks for your help, Amanda.&amp;nbsp; You can close this ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/261901?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 08:25:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e12d4dd-d9b6-4eb2-bd86-7aff88c0dd99</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the delay.&amp;nbsp;The support staff is reduced during the summer holidays, and you may experience delayed answers.&lt;/p&gt;
&lt;p&gt;I agree with you all, and thanks for the nice sharing detail.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can put t&lt;span&gt;he .conf file like&amp;nbsp;&lt;/span&gt;&lt;span&gt;app_ZRelease.conf anywhere in the project only if the&amp;nbsp;&lt;/span&gt;CONF_FILE variable could be set in the&amp;nbsp;&lt;span&gt;CMakeLists.txt, and any modification of setting in .conf, .proj, .yaml,&amp;nbsp;.overlay, etc., need to reopen the SES to source them again.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/261082?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2020 21:31:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e0c9797-2312-4001-b2df-47daebbb2074</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Hi Amanda,&lt;/p&gt;
&lt;p&gt;From my experiments, I&amp;rsquo;ve determined that&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It does matter where we place the CONF_FILE assignment in CMakeLists.txt.&lt;/li&gt;
&lt;li&gt;It does not matter where we actually put the .conf file within the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In other words:&amp;nbsp; The .conf file like &lt;span&gt;app_ZRelease.conf can be placed anywhere in the project, so&amp;nbsp;&lt;/span&gt;the CONF_FILE value itself doesn&amp;rsquo;t matter.&amp;nbsp; But it does matter where in CMakeLists.txt that the CONF_FILE assignment is placed.&lt;/p&gt;
&lt;p&gt;With the first bullet being met, I was able to control the compile optimizations specified in the .conf file.&lt;/p&gt;
&lt;p&gt;Per the first bullet:&amp;nbsp; In CMakeLists.txt, the CONF_FILE setting must be &lt;strong&gt;before&lt;/strong&gt; the find_package for Zephyr, as in:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#

cmake_minimum_required(VERSION 3.8.2)

# changes to specify CONF_FILE
if (CMAKE_BUILD_TYPE)
&amp;#160; set(CONF_FILE &amp;quot;arbitrary/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
endif()
message(STATUS &amp;quot;NOTE: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}&amp;quot;)
message(STATUS &amp;quot;NOTE: CONF_FILE: ${CONF_FILE}&amp;quot;)
# end CONF_FILE changes

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(central_uart)
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note in the above that the actual location of the .conf file is in an arbitrary place (per the second bullet), under a directory called &amp;ldquo;arbitrary&amp;rdquo;, which is under the project directory central_uart.&amp;nbsp; I could have just as well put the .conf file in the central_uart top-level directory, as in:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set(CONF_FILE &amp;quot;app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Do you agree?&lt;/p&gt;
&lt;p&gt;The advantage of using CMAKE_CURRENT_SOURCE_DIR when specifying the value of CONF_FILE in CMakeLists.txt is that you can later use an assert_exists() to make sure that the .conf file pointed to by CONF_FILE exists.&amp;nbsp; I was not able to get the assert_exists() to work properly without using&amp;nbsp;&lt;span&gt;CMAKE_CURRENT_SOURCE_DIR to set the path in the CONF_FILE value.&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example using &lt;span&gt;CMAKE_CURRENT_SOURCE_DIR in CONF_FILE, and then using the assert_exists(), which is&lt;/span&gt;&amp;nbsp;at the end of the snippet:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (CMAKE_BUILD_TYPE)
  set(CONF_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
endif()
message(STATUS &amp;quot;NOTE: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}&amp;quot;)
message(STATUS &amp;quot;NOTE: CONF_FILE: ${CONF_FILE}&amp;quot;)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(central_uart)
assert_exists(CONF_FILE)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also, as a reminder, mainly for my benefit: Whenever you change the CONF_FILE value in CMakeLists.txt, you must re-open the solution in SES with the Clean Build Directory checked for that change to take affect.&amp;nbsp; If you don&amp;rsquo;t change the CONF_FILE value in CMakeLists.txt but change a value within the .conf file (e.g., change the value of CONFIG_SPEED_OPTIMIZATIONS in app_ZRelease.conf), you must re-open the solution in SES, but you don&amp;rsquo;t need to have the Clean Build Directory checked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/260502?ContentTypeID=1</link><pubDate>Fri, 17 Jul 2020 09:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:193961d9-a821-4ed2-a3c6-351f083f7c2c</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
[quote user="variant"]Is the issue where the location that we put the conf file?[/quote]
&lt;p&gt;It might be. I use your code in the&amp;nbsp;&lt;span&gt;CMakeLists.txt and modify the location as:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (CMAKE_BUILD_TYPE) 
   #set(CONF_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
   set(CONF_FILE &amp;quot;configuration/${BOARD}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
   message(STATUS &amp;quot;NOTE: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}&amp;quot;)
   message(STATUS &amp;quot;NOTE: CONF_FILE: ${CONF_FILE}&amp;quot;)
endif()
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; It works as expected. Try this&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-a7c1fb78222641afbbdd8569bfcff7a2/central_5F00_uart_5F00_build_5F00_type_5F00_0717.zip"&gt;devzone.nordicsemi.com/.../central_5F00_uart_5F00_build_5F00_type_5F00_0717.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/260419?ContentTypeID=1</link><pubDate>Thu, 16 Jul 2020 14:31:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:016dc8ab-adda-4156-b329-5a963e27ebec</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;In my comment way above (it says 21 days ago right now), I wrote:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;In CMakeLists.txt, I added this in the Nordic SDK App section:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (CMAKE_BUILD_TYPE) 
   set(CONF_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
endif()
message(STATUS &amp;quot;NOTE: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}&amp;quot;)
message(STATUS &amp;quot;NOTE: CONF_FILE: ${CONF_FILE}&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Then I showed in that old comment that my status messages inserted above showed up in the output:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;
-- NOTE: CMAKE_BUILD_TYPE: ZDebug
-- NOTE: CONF_FILE: C:/ncs/v1.3.0/nrf/samples/bluetooth/central_uart/app_ZDebug.conf&lt;/pre&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;So I&amp;#39;m not sure what you are doing differently than what I already did.&amp;nbsp; My output above shows that CMAKE found the CONF_FILE.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Is the issue where the location that we put the conf file?&lt;/p&gt;
&lt;div class="evolution-code-editor theme-clouds" style="padding-left:30px;"&gt;
&lt;div class=" ace_editor ace-clouds" style="padding-left:30px;"&gt;
&lt;div class="ace_scroller" style="padding-left:30px;"&gt;
&lt;div class="ace_content" style="padding-left:30px;"&gt;
&lt;div class="ace_layer ace_cursor-layer ace_hidden-cursors"&gt;
&lt;div class="ace_cursor"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/260334?ContentTypeID=1</link><pubDate>Thu, 16 Jul 2020 10:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d4282f6-558b-4c34-8923-8f1d6d68aa1b</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It seems that the config files are not used. You can modify like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;# Define configuration files.
set(CONF_FILE &amp;quot;configuration/${BOARD}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)

#########################################
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(central_uart)

# NORDIC SDK APP START
target_sources(app PRIVATE
  src/main.c
)
# NORDIC SDK APP END

zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also modify central_uart as this project&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-a7c1fb78222641afbbdd8569bfcff7a2/central_5F00_uart_5F00_build_5F00_type.zip"&gt;devzone.nordicsemi.com/.../central_5F00_uart_5F00_build_5F00_type.zip&lt;/a&gt;&amp;nbsp;to use build type, and it can work as expected in west build and Segger.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Amanda H.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/260203?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 15:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:553dcc56-6ffb-4aa0-b466-d55f335b17d8</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Thanks for the reply and the update, Amanda!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/260031?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 06:11:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa4c238d-808f-4ed9-ac15-63c1ffacbb28</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can reproduce the issue as you. I will report to the internal.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note that we are moving into the summer vacation period here in Norway, so it might take a bit longer to get to the bottom of this than expected, as staff during the month of July will be reduced. I&amp;#39;m sorry about the inconvenience, but please be patient. And I&amp;#39;ll get back to you as soon as I hear something from the devs.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/259511?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2020 15:54:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b596d7f4-4c29-402b-80ae-5b58450766f9</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Hi Amanda,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I use west to build the project, with &amp;quot;&lt;span&gt;CONFIG_SPEED_OPTIMIZATIONS=y&amp;quot; added into the proj.conf, &lt;strong&gt;I get the same desired result as you did&lt;/strong&gt;:&amp;nbsp; 176 files compiled with the -O2 option.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So the question remains, what is the missing step or mistake I am making to achieve the same result using the SES &amp;quot;Integrated&amp;quot; Development Environment?&amp;nbsp; In four replies above, I tried my best to list&amp;nbsp;all the steps that I performed for the SES build.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/259341?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2020 07:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cee7478f-fa6b-4738-bd65-31b6ef4835bd</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
[quote user="variant"]Did you use a command line to build yours instead of using SES (which this ticket is about)?[/quote]
&lt;p&gt;I used west build to build the project as&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;## before run the west build, please set the environment variable
setx -m GNUARMEMB_TOOLCHAIN_PATH C:\ncs\v1.3.0\toolchain\opt
echo %GNUARMEMB_TOOLCHAIN_PATH% &amp;amp; echo %ZEPHYR_TOOLCHAIN_VARIANT%
set ZEPHYR_BASE=C:\ncs\v1.3.0\zephyr
echo %ZEPHYR_BASE%

v1.3.0\nrf\samples\bluetooth\central_uart&amp;gt;west -v build -b nrf52840dk_nrf52840&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please try that and let me know the result.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/259299?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2020 02:08:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62d25996-554b-4571-a169-3b313995481d</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Thank you for the update about delayed replies.&amp;nbsp; I understand.&amp;nbsp; And thank you very much for trying the build yourself.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You got 176 files compiled with -O2.&amp;nbsp; That is what I expect.&amp;nbsp; I&amp;#39;m glad you attached a build log.&amp;nbsp; I should have, so I&amp;#39;m attaching&amp;nbsp;mine&amp;nbsp;now (my logs has&amp;nbsp;176 files compiled with -Os, of which 28 of them have a -O2 following the -Os):&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/build_5F00_central_5F00_uart_5F00_zrelease_5F00_opt_5F00_for_5F00_speedYes_5F00_176_5F00_Os_5F00_28_5F00_O2.txt"&gt;devzone.nordicsemi.com/.../build_5F00_central_5F00_uart_5F00_zrelease_5F00_opt_5F00_for_5F00_speedYes_5F00_176_5F00_Os_5F00_28_5F00_O2.txt&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My build output is from the SES &amp;quot;Output&amp;quot; window after I use the SES menu Build / Build zephyr/zephyr.elf (after following the pre-build steps that I outlined in my previous reply, using CONFIG_SPEED_OPTIMIZATIONS=y).&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My build output format is very different from yours.&amp;nbsp; Did you use a command line to build yours instead of using SES (which this ticket is about)?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Your build lines begin with &amp;quot;cmd.exe&amp;quot; and &amp;quot;C:\gnuarmemb\bin\arm-none-eabi-gcc.exe&amp;quot;.&lt;/p&gt;
&lt;p&gt;My build lines begin with &amp;quot;Building&amp;quot; and &amp;quot;Compiling&amp;quot;, which I think are from SES. And my compiler commands are invoked as c:/ncs/v1.3.0/toolchain/opt/bin/arm-none-eabi-gcc, which shows that I am indeed using the NCS environment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/258767?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2020 09:42:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0f7164d-6295-4964-bdfc-71001c28919e</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Updated.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the delay.&lt;span&gt;&amp;nbsp;&lt;/span&gt;I add&amp;nbsp;CONFIG_SPEED_OPTIMIZATIONS=y into the porj.conf as&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;####
CONFIG_SPEED_OPTIMIZATIONS=y
###
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And I got 176 files compiled with -O2 as&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-a7c1fb78222641afbbdd8569bfcff7a2/251642.log"&gt;devzone.nordicsemi.com/.../251642.log&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is that as you expect?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The support staff is reduced during the summer holidays, and you may experience delayed answers.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/257030?ContentTypeID=1</link><pubDate>Fri, 26 Jun 2020 00:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:071427c0-771b-40ba-83db-b7dcfab6d389</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Hi Amanda,&lt;/p&gt;
&lt;p&gt;Thank you for the responses.&amp;nbsp; I&amp;rsquo;m still having trouble with item 1.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can effect a compiler optimization change in the nrf_desktop app, but not in a sample project such as nrf\samples\bluetooth\central_uart.&lt;/p&gt;
&lt;p&gt;The nrf_desktop\configuration\nrf52840dk_nrf52840\app_ZDebug.conf has&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SPEED_OPTIMIZATIONS=y&lt;/pre&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In fact, all 50 .conf files in that project, be it ZDebug or ZRelease variants, have the &lt;em&gt;CONFIG_SPEED_OPTIMIZATIONS=y.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That default config results in all 207 compile commands in the build output to have the &amp;ldquo;-O2&amp;rdquo; option, which makes sense.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If I change that CONFIG line in nrf_desktop&amp;rsquo;s nrf52840dk_nrf52840\app_ZDebug.conf to this:&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SIZE_OPTIMIZATIONS=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then I see all 207 compile commands have the &amp;ldquo;-Os&amp;rdquo; option instead of the &amp;ldquo;-O2&amp;rdquo; option, which also makes sense.&amp;nbsp; So far so good.&lt;/p&gt;
&lt;p&gt;Now, whatever I do for the central_uart project, I can&amp;rsquo;t get the compiler optimization to change in the build output.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First, the default prj.conf file for central_uart (with no changes on my part) results in:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;176 compiles, of which all 176 compiles have the &amp;ldquo;-Os&amp;rdquo; option.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Also, 28 of the 176 files additionally have a &amp;ldquo;-O2&amp;rdquo; (the later -O2 overrules the earlier -Os in the compile command) for the 28 files in the bluetooth_controller library.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So that&amp;rsquo;s the default baseline: -Os, with some additional -O2 just for one library.&amp;nbsp; Now, here&amp;#39;s my attempt to make a change in the compiler optimization.&lt;/p&gt;
&lt;p&gt;In CMakeLists.txt, I added this in the Nordic SDK App section:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (CMAKE_BUILD_TYPE) 
   set(CONF_FILE &amp;quot;${CMAKE_CURRENT_SOURCE_DIR}/app_${CMAKE_BUILD_TYPE}.conf&amp;quot;)
endif()
message(STATUS &amp;quot;NOTE: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}&amp;quot;)
message(STATUS &amp;quot;NOTE: CONF_FILE: ${CONF_FILE}&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In SES/Tools/Options/nRF Connect/Additional CMake Options, I added this:&amp;nbsp; &amp;#39;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;-DCMAKE_BUILD_TYPE=ZDebug&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I copied prj.conf to app_ZDebug.conf.&lt;/p&gt;
&lt;p&gt;In app_ZDebug.conf, I added the line shown below.&amp;nbsp; (I also tried this in app_ZRelease.conf when selecting ZRelease instead of ZDebug.)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NCS_SAMPLES_DEFAULTS=y
# My addition
CONFIG_SPEED_OPTIMIZATIONS=y
#end my addition.&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also tried this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NCS_SAMPLES_DEFAULTS=y
# My additions
CONFIG_SIZE_OPTIMIZATIONS=n
CONFIG_SPEED_OPTIMIZATIONS=y
#end my additions.&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I open the nRF SDK project in SES (with the Clean Build Directory option selected), I see this (i.e., I see my NOTE prints that I added in CMakeLists.txt):&lt;pre class="ui-code" data-mode="text"&gt;-- Cache files will be written to: C:/ncs/v1.3.0/zephyr/.cache
CMake Warning at C:/ncs/v1.3.0/zephyr/CMakeLists.txt:1384 (message):
  __ASSERT() statements are globally ENABLED

-- NOTE: CMAKE_BUILD_TYPE: ZDebug
-- NOTE: CONF_FILE: C:/ncs/v1.3.0/nrf/samples/bluetooth/central_uart/app_ZDebug.conf&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;No matter what I do in the conf file, I get the same compiler optimization flag in the build output as does the default config (128 -Os, with 28 -O2).&amp;nbsp; I should be getting 128 files compiled with -O2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also tried the same type of above CONFIG_* changes in prj.conf when I remove the CMAKE_BUILD_TYPE selection so that the plain old prj.conf is used.&amp;nbsp; Same thing.&amp;nbsp; I can&amp;rsquo;t effect a change in the build output compiler optimization flags in central_uart.&lt;/p&gt;
&lt;p&gt;Can you try using SES as the build tool with the central_uart app and see if you can get the build output to show a change in the compiler optimization flag from the default output, such as trying to get all compile commands to show -O2 instead of all -Os?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/256825?ContentTypeID=1</link><pubDate>Thu, 25 Jun 2020 07:58:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e566fb72-4bd7-43be-83b6-a081e99f1071</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
[quote user="variant"]would there be any hidden problem if I go unconventional (not that I would) and use names&amp;nbsp;app_debug.conf and app_release.conf instead of app_ZDebug.conf and app_ZRelease.conf, as long as I account for those names in the CMakeLists.txt?[/quote]
&lt;p&gt;From the engineer:&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_TYPE.html"&gt;CMAKE_BUILD_TYPE&lt;/a&gt; is actually a special variable in cmake. Zephyr does not handle it, so if you use one of the values from the documentation cmake will take over and add some changes to variables used during the building process (for example cflags). You don&amp;#39;t want this to happen as it may contradict definitions from kconfig.&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t want to introduce yet another variable so I reused cmake_build_type with &amp;quot;Z&amp;quot; prefix to build chose configuration. Since these are unknown to cmake it won&amp;#39;t add anything specific by itself.&lt;/p&gt;
&lt;p&gt;(At the moment I tend to think that it might have been better to introduce the new variable to have more flexibility and avoid confusion.)&lt;/p&gt;
&lt;p&gt;-Amanda H.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/256297?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 02:38:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3192651-7702-4f43-81f9-87f6f12d9781</guid><dc:creator>variant</dc:creator><description>&lt;p&gt;Thanks Amanda.&lt;/p&gt;
&lt;p&gt;1. I understand your reply, and it makes perfect sense.&amp;nbsp; I&amp;#39;m trying this out on the central_uart sample, but I&amp;#39;m not seeing any affect yet in the build output.&amp;nbsp; I&amp;#39;ll double check my steps tomorrow and provide more details if I am still unsuccessful.&lt;/p&gt;
&lt;p&gt;As an aside, I think it would&amp;nbsp;helpful in the section&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#maintaining-cmakelist-txt-in-ses"&gt;maintaining-cmakelist-txt-in-ses&lt;/a&gt;, where it says &amp;quot;&lt;span&gt;In the window that is displayed, you can define compilation options for the project&amp;quot;, that someone adds a note there that you can set the compiler optimization levels (which to me are still compilation options) in the conf file, as you explained.&amp;nbsp; &amp;nbsp;That is, that &amp;quot;window&amp;quot; they are talking about there is not the only place you can define compilation options. You can also do so in the conf files. Just a suggestion.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;2. You pointed to the same place that I pointed to.&amp;nbsp; I was just making a suggestion that that section could possibly be more helpful with the information I suggested to add.&lt;/p&gt;
&lt;p&gt;3. Thanks.&amp;nbsp; By the way, my discovery here was for the central_uart sample.&lt;/p&gt;
&lt;p&gt;4. I see.&amp;nbsp; So it seems that the Z (for Zephyr) is just a convention, as in ZDebug/ZRelease.&amp;nbsp; So in my own projects, would there be any hidden problem if I go unconventional (not that I would) and use names&amp;nbsp;app_debug.conf and app_release.conf instead of app_ZDebug.conf and app_ZRelease.conf, as long as I account for those names in the CMakeLists.txt?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/256192?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 13:09:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e95d9c30-210b-41ee-9367-a7c0200ebcb0</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
[quote user=""]For example, if we want the &lt;strong&gt;ZDebug &lt;/strong&gt;build to include compiler options like &amp;quot;-g -O0 -DDEBUG&amp;quot; but the &lt;strong&gt;ZRelease &lt;/strong&gt;build to instead include compiler options like &amp;quot;-O3 -DNDEBUG&amp;quot;, how do we do this?[/quote]
&lt;p&gt;You can&amp;nbsp;&lt;span&gt;edit prj.conf and add &amp;quot;&lt;code&gt;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_NO_OPTIMIZATIONS.html#cmdoption-arg-config-no-optimizations"&gt;NO_OPTIMIZATIONS&lt;/a&gt;=Y&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span&gt;&amp;quot; to set compiler optimizations as -O0 or &amp;quot;&lt;code&gt;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_DEBUG_OPTIMIZATIONS.html#cmdoption-arg-config-debug-optimizations"&gt;DEBUG_OPTIMIZATIONS&lt;/a&gt;=Y&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&amp;nbsp;to set the c&lt;span&gt;ompiler optimizations as -Og. Please see&amp;nbsp;&lt;span&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/choice_410.html#choice-410"&gt;&amp;lt;choice: Optimization level&amp;gt;&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I was hoping to see at least some optimization differences, or at least a &amp;quot;-DDEBUG&amp;quot; difference, between the two build outputs&amp;nbsp;to help me figure out&amp;nbsp;the&amp;nbsp;answer to this question.[/quote]
&lt;p&gt;&amp;nbsp;If you want to see the difference between compile optimization, you should see&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/choice_410.html#choice-410"&gt;&amp;lt;choice: Optimization level&amp;gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]2. In my opinion, the section&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#selecting-a-build-type-in-ses"&gt;selecting-a-build-type-in-ses&lt;/a&gt;&amp;nbsp;or the previous section&amp;nbsp;should indicate that the SES menus &amp;quot;&lt;em&gt;Build/Build Configuration&lt;/em&gt;&amp;quot; and &amp;quot;Build/&lt;em&gt;Set Active Build Configuration&lt;/em&gt;&amp;quot; are not applicable with this SDK. I originally was looking for ZDebug and ZRelease options to show up in those menus after following the instructions in the previous section.[/quote]
&lt;p&gt;See the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#selecting-a-build-type-in-ses"&gt;Selecting a build type in SES&lt;/a&gt;&amp;nbsp;section on how to build the project with the&amp;nbsp;app_ZDebug&amp;nbsp;.conf&amp;nbsp;and&amp;nbsp;app_ZRelease.conf.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]3. In the instruction on how to set the CONF_FILE variable for the build configs (see step 2 in &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#creating-build-type-files"&gt;Creating build type files&lt;/a&gt;), doesn&amp;#39;t&amp;nbsp;the path &amp;quot;&lt;strong&gt;${CMAKE_CURRENT_SOURCE_DIR}&lt;/strong&gt;&amp;quot; need to be in the CONF_FILE setting, as in:[/quote]
&lt;p&gt;I will report it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]4. Is there something special with the names &lt;strong&gt;ZDebug&lt;/strong&gt; and &lt;strong&gt;ZRelease&lt;/strong&gt; vs traditional build config names&amp;nbsp;&lt;strong&gt;Debug&lt;/strong&gt; and &lt;strong&gt;Release&lt;/strong&gt;?[/quote]
&lt;p&gt;&amp;nbsp;The&amp;nbsp;&lt;span&gt;nRF Desktop does not use a single&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;prj.conf&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;file. Configuration files are provided for different build types for each supported board as &lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/master/applications/nrf_desktop/configuration"&gt;here&lt;/a&gt;&amp;nbsp;as the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html#creating-build-type-files"&gt;Creating build type files&lt;/a&gt;&lt;/span&gt;&amp;nbsp;section described. If you take a look at&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/master/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840"&gt;configuration/nrf52840gmouse_nrf52840&lt;/a&gt;, you could see the files named with&amp;nbsp;&lt;code&gt;&lt;span&gt;&lt;span&gt;ZRelease&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;code&gt;&lt;span&gt;ZDebug&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span&gt;as&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#nrf-desktop-build-types"&gt;nRF Desktop build types&lt;/a&gt;&amp;nbsp;describe:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;code&gt;&lt;span&gt;&lt;span&gt;ZRelease&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&amp;nbsp;– Release version of the application with no debugging features.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;code&gt;&lt;span&gt;ZDebug&lt;/span&gt;&lt;/code&gt;&amp;nbsp;– Debug version of the application; the same as the&amp;nbsp;&lt;code&gt;&lt;span&gt;&lt;span&gt;ZRelease&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&amp;nbsp;build type, but with debug options enabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Comparing the&amp;nbsp;&lt;/span&gt;&lt;a title="app_ZDebug.conf" href="https://github.com/nrfconnect/sdk-nrf/blob/master/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_ZDebug.conf"&gt;app_ZDebug.conf&lt;/a&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;a title="app_ZRelease.conf" href="https://github.com/nrfconnect/sdk-nrf/blob/master/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_ZRelease.conf"&gt;app_ZRelease.conf&lt;/a&gt;&lt;span&gt;, you could see what debug options are enabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
[quote user=""]is there any additional meaning here for nRF usage in the SDK not described in that link?[/quote]
&lt;p&gt;&amp;nbsp;Please see&amp;nbsp;&lt;span&gt;build types are available for various boards in nRF Desktop in the&amp;nbsp;&lt;/span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#nrf-desktop-build-types"&gt;nRF Desktop build types&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]5. Is building with the command line, and perhaps just using SES for a debugger tool, the easier way to go with this SDK?[/quote]
&lt;p&gt;SES also can build the project. It depends on your habit.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES</title><link>https://devzone.nordicsemi.com/thread/255980?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2020 13:22:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1abcb826-6b53-461c-9b2e-5fae7a7d3ab2</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am working on your case and will reply next week.&lt;/p&gt;
&lt;p&gt;-Amanda H.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>