<?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>Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51289/buttonless-dfu-service-does-not-start-when-nrf_log_enabled-is-set-0</link><description>Hi all, 
 I have a very strange problem with the Buttonless DFU service. For my project we have two different builds, one debug and one &amp;quot;release&amp;quot; build. The debug build sets the following SDK config defines to 1, and the release build sets them to 0.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Aug 2019 08:32:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51289/buttonless-dfu-service-does-not-start-when-nrf_log_enabled-is-set-0" /><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206784?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 08:32:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1f284f6-6054-4f23-b536-2a88b555e824</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;After checking the makefile, it seems to be the case. The build_rules are compiled with other preprocessor flags and therefore result in enabling the log, causing the application to fail. Thanks for your time and help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206492?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2019 06:00:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edeac8fc-1a8e-4e78-8e6d-51f5b8cb8ac3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Looking at the old case linked to in the OP I see you are building a &amp;quot;sdk&amp;quot; library of common files first. Is it rebuilt with the same flags? It seems clear that this has something to do with the build system at least.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206373?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:17:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73ae9190-a877-436a-95c3-e35223249a87</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;NRF_LOG_ENABLED is defined below as following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED ENABLE_LOGGING
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;We have only changed the defined value with the defined variable ENABLE_LOGGING&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206370?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f67c0c09-f994-445c-9d68-1bbaf644998d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Is&amp;nbsp;&lt;span&gt;NRF_LOG_ENABLED defined somewhere, or have you renamed it to&amp;nbsp;ENABLE_LOGGING?&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="68658" url="~/f/nordic-q-a/51289/buttonless-dfu-service-does-not-start-when-nrf_log_enabled-is-set-0/206361"]Also, I have noticed that if we do not init dfu service, then the application works perfectly. Shouldn&amp;#39;t the application crash elsewhere in the code if that was the case?[/quote]
&lt;p&gt;&lt;span&gt;I agree, and I&amp;#39;m&amp;nbsp;not sure I can&amp;#39;t explain why. I have tried to replicate the problem here by enabling logging while having all backends disabled, etc but with no luck so far.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206361?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 12:03:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:491c3da7-59aa-4dc9-a0ac-e0f7324c830d</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;Enable_logging shouldn&amp;#39;t be redefined elsewhere since it is only defined in sdk_config.h and the makefile when compiling it as release. This is how the application is written currently:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*******Makefile******/

build_release: _app
	ENABLE_LOGGING=0 BUILD_TYPE=app TARGET=nrf52 ...
	
ifeq ($(ENABLE_LOGGING),)
$(info ENABLE_LOGGING not defined, using default ENABLE_LOGGING=1.)
else
$(info ENABLE_LOGGING=$(ENABLE_LOGGING))
CFLAGS += -DENABLE_LOGGING=$(ENABLE_LOGGING)
endif

/******Makefile*******/

/******sdk_config.h*******/

#ifndef ENABLE_LOGGING
#define ENABLE_LOGGING 1
#endif

/*****sdk_config.h*******/&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also, I have noticed that if we do not init dfu service, then the application works perfectly. Shouldn&amp;#39;t the application crash elsewhere in the code if that was the case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206235?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 07:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f52736a7-1fff-4e57-b044-4fd2a33aa505</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Could it possible that Enable_logging gets redefined in your code? log_skip() will not be built if&amp;nbsp;&amp;nbsp;NRF_LOG_ENABLED==0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206223?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 06:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f62d4e9e-1fcc-4f75-88b1-df92d4fce601</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;We are currently using SDK version 15.0. I have noticed that when we hard code the Enable_logging=0 flag in the sdk_config.h file, the application works fine, however, the application get stuck in log_skip() when changing the flag in the makefile.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206221?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 06:41:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9820c8bd-2c1f-4ddf-bf78-72e01351e52b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;There&amp;#39;s no hardfault, but the stack trace confirms that the program starts executing log_skip()&amp;nbsp;as you said, and log_skip() should not be invoked as long as&amp;nbsp;&lt;span&gt;NRF_LOG_ENABLED==0. What SDK version&amp;nbsp;are you on?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206089?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 11:50:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5432b923-fa0f-415a-bdd0-01080c0f0ba1</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;Hi again,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have run the commands you asked me to and got the following output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;r0             0x1	1
r1             0x2000fe58	536936024
r2             0x200055dc	536892892
r3             0x2000fe58	536936024
r4             0x2000ffd0	536936400
r5             0x3a030	237616
r6             0x7e000	516096
r7             0x2000fe48	536936008
r8             0x0	0
r9             0x0	0
r10            0x20000000	536870912
r11            0x0	0
r12            0x20006da4	536898980
sp             0x2000fe48	0x2000fe48
lr             0x32d7d	208253
pc             0x32d76	0x32d76 &amp;lt;log_skip+58&amp;gt;
xpsr           0x1000000	16777216
msp            0x2000fe48	536936008
psp            0x0	0
primask        0x0	0
basepri        0x0	0
faultmask      0x0	0
control        0x0	0
(gdb) bt
#0  0x00032d76 in log_skip ()
    at /xx/xx/xx/xx/sdk_files/components/libraries/experimental_log/src/nrf_log_frontend.c:360
#1  0x00032f52 in buf_prealloc (content_len=1, p_wr_idx=0x2000fec8, std=true)
    at /xx/xx/xx/xx/sdk_files/components/libraries/experimental_log/src/nrf_log_frontend.c:464
#2  0x0003303a in std_n (severity_mid=3, 
    p_str=0x3a3ec &amp;quot;Setting vector table to bootloader: 0x%08x&amp;quot;, 
    args=0x2000fef4, nargs=1)
    at /xx/xx/xx/xx/sdk_files/components/libraries/experimental_log/src/nrf_log_frontend.c:585
#3  0x000330e8 in nrf_log_frontend_std_1 (severity_mid=3, 
    p_str=0x3a3ec &amp;quot;Setting vector table to bootloader: 0x%08x&amp;quot;, val0=466944)
    at /xx/xx/xx/xx/sdk_files/components/libraries/experimental_log/src/nrf_log_frontend.c:615
#4  0x00032b4c in nrf_dfu_svci_vector_table_set ()
    at /xx/xx/xx/xx/sdk_files/components/libraries/bootloader/dfu/nrf_dfu_svci.c:56
#5  0x0002c26e in ble_dfu_buttonless_async_svci_init ()
    at /xx/xx/xx/xx/sdk_files/components/ble/ble_services/ble_dfu/ble_dfu_bonded.c:210
#6  0x00026b9e in dfu_service_init () at dfu.c:125
#7  0x00026798 in main () at main.c:319&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206072?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 10:49:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fe55829-4aca-46aa-b8c8-4603c56f2ae6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Hadi,&lt;/p&gt;
&lt;p&gt;Do you do any logging in the hardfault handler? Can you run &amp;quot;info registers&amp;quot; and &amp;quot;bt&amp;quot;&amp;nbsp; in GDB to check where the program is stuck?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/206065?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 10:29:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af1b8956-16de-4866-a75b-7b56c74968c5</guid><dc:creator>Hadi Deknache</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;I am Anton&amp;#39;s colleague, I have tried to debug the application through gdb and notice that the application seems to be stuck in a function that is called log_skip().&lt;/p&gt;
&lt;p&gt;I get the following message when I halt the application to check: Program received signal SIGTRAP, Trace, breakpoint trap. Log_skip().&lt;/p&gt;
&lt;p&gt;I have set a breakpoint in main but seem that it never reaches main when nrf_log is disabled, however, when I enable nrf_log this error never occurs.&lt;/p&gt;
&lt;p&gt;Any idea why the application is stuck in log_skip, is it triggered by a Hardfault?&lt;/p&gt;
&lt;p&gt;/Hadi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/205856?ContentTypeID=1</link><pubDate>Fri, 23 Aug 2019 11:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:872da1cd-e76f-4ad3-9604-4948686f461e</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for the tips. I disabled logging in the &amp;quot;debug&amp;quot; build and it kept working. So there is something in our release build that causes the application not function properly.&amp;nbsp; From what I can see all we do in our release build is that we set an additional preprocessor flag that removes the logs, see below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ifeq ($(ENABLE_LOGGING),)
$(info ENABLE_LOGGING not defined, using default ENABLE_LOGGING=1.)
else
$(info ENABLE_LOGGING=$(ENABLE_LOGGING))
CFLAGS += -DENABLE_LOGGING=$(ENABLE_LOGGING)
endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Anyways, I think we will have to investigate further our side. Thank you so far.&lt;/p&gt;
&lt;p&gt;Edit: the preprocessor flag which you can see above being set is then being used in the sdk_config.h file.&lt;br /&gt;&lt;br /&gt;/ Anton&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/205737?ContentTypeID=1</link><pubDate>Fri, 23 Aug 2019 05:45:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bedf74b8-4bd0-4bf7-b08d-c0ed53d7caec</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for the clarification. It sounds like we would need to debug the application to figure out why the program hangs when you select DFU mode. Have you tried to disable logging in the &amp;#39;debug&amp;#39; target to see if it has the same effect? I guess it could be related to other differences such as compiler optimization as well.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/205652?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2019 13:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95f4d3a8-9498-4e51-9908-24c672a12c25</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Here is the log from the bootloader:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Inside main
&amp;lt;debug&amp;gt; app: In nrf_bootloader_init
&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate
&amp;lt;info&amp;gt; app: No firmware to activate.
&amp;lt;debug&amp;gt; app: Enter nrf_dfu_app_is_valid
&amp;lt;debug&amp;gt; app: Return true. App was valid
&amp;lt;debug&amp;gt; app: Running nrf_bootloader_app_start with address: 0x00001000
&amp;lt;debug&amp;gt; app: Disabling interrupts. NVIC-&amp;gt;ICER[0]: 0x0
&amp;lt;debug&amp;gt; app: running irq table set
&amp;lt;debug&amp;gt; app: After running irq table set&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/205622?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2019 13:00:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc237d64-71dc-47c1-9467-2b5e23627674</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Yes everytime we flash we re-generate the settings page.&lt;/p&gt;
&lt;p&gt;I know that the bootloader starts the application because we have different &amp;quot;modes&amp;quot; in the application, 2 of them does not use the DFU service. When I put the nRF52832 in one of the two other modes that does not use the DFU service I can see the advertisement and I can connect.&lt;/p&gt;
&lt;p&gt;/ Anton&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU service does not start when NRF_LOG_ENABLED is set 0</title><link>https://devzone.nordicsemi.com/thread/205618?ContentTypeID=1</link><pubDate>Thu, 22 Aug 2019 12:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4afd3bd3-e170-4be5-b35e-99ec9dc0e8e0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Maybe I&amp;#39;m way off but I wonder if it could be caused by an invalid CRC value in your bl settings page which would cause the bootloader to enter DFU mode. Is this page being re-generated each time you compile the app? As you may know, the settings page includes a CRC checksum value of the app image which must match the&amp;nbsp;CRC of the actual app image stored in flash. The bootloader will not &amp;quot;jump&amp;quot; to the application if there&amp;#39;s a mismatch. Does your device appear to be stuck in DFU mode?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>