<?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>SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17747/svc-and-fault-handling-not-passed-to-application</link><description>First step of trying to integrate S132 to a small OS is failing completely. 
 When I use SVC the system ends up in hanging in hard fault. 
 The SoD handler ends up trying to read branch address from location 0xa891be2c - which causes the hardfault.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Nov 2016 11:13:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17747/svc-and-fault-handling-not-passed-to-application" /><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68320?ContentTypeID=1</link><pubDate>Tue, 22 Nov 2016 11:13:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d6183c9-ab64-4de4-9eb0-9ce29d2a4074</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;Caused by a known IAR debugger issue:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/6257/nrf51822-softdevice-cant-work-properly-with-iar/?answer=6276#post-id-6276"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68318?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 16:20:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88d056cc-7be1-4f39-a4e1-d0dfcd2f0525</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,that does not sound good to me.
I would really like to get your setup, so that i exclude this to be possibility of softdevice bug. If you are not comfortable posting your code here, then you can post in &lt;a href="https://www.nordicsemi.com/eng/supportcase/create"&gt;MyPage&lt;/a&gt; where no one else but Nordic support team can see your code and we will be bound by NDA not to share your code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68319?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 15:28:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6092e4b3-9fb9-4768-a42c-76c7393448b0</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;When I break right at Reset_Handler i get:
0x20000000 = 0xa801be00
0x20000004 = 0xf0009900&lt;/p&gt;
&lt;p&gt;I have downloaded the Softdevice using nRFgo Studio. I have not (yet) investigated anything concerning MBR or OTA.&lt;/p&gt;
&lt;p&gt;If you want to examine this at your site I would be happy to zip project and send/upload it to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68317?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 13:36:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b49f69a4-fdda-48ec-8ffe-7332ac44a7db</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Location 0x20000000 is initialized in MBR reset handler and 0x20000004 is initialized by softdevice reset handler. So they should have been initialized before your OS gets to execute its first instruction in reset handler. Instead of running upto main, can you put a breakpoint in your OS reset handler and see if they are corrupt already there? If so, then i would really really like to reproduce this here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68316?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 13:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:deaf70e6-94fd-45b2-ba9a-affe4bbb23b2</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;They are not touched by my OS. If I set the debugger to &amp;quot;run to main&amp;quot; starting my debugging sessions at C main entry, the values are already corrupt. That is why I added the &amp;quot;Softdevice initialization hack&amp;quot; between the call to &amp;quot;SystemInit&amp;quot; and &amp;quot;__iar_program_start&amp;quot;.&lt;/p&gt;
&lt;p&gt;Who is supposed to initialize these two locations - the softdevice or the app?&lt;/p&gt;
&lt;p&gt;Note that I am not linking against any Nordic library components - so if I AM supposed to initialize these I wil just remove the work &amp;quot;hack&amp;quot; from comment :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68315?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2016 12:26:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bdf5b811-2b3d-415b-9731-8c5dfa247743</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;at 0x20000000 you have MBR vector forwarding address which is 0x1000 where the softdevice is located in flash. at 0x20000004 it is softdevice vector forwarding address which is the starting address of your of you OS (application) in flash.  As the names suggest you need these for interrupt forwarding to any place within the flash as these are need to perform OTA DFU .&lt;/p&gt;
&lt;p&gt;Not sure how you managed to corrupt them, but it seems that there is some bug hiding somewhere in your implementation. Can you please dig into you code and see which part of your OS touched 0x20000000 and 0x20000004 just to be sure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68314?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 12:40:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bc8c46d-f5d5-41b4-b803-768e130fb69a</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;I have the softdevice running now and doing BLE advertisements - all fine. I have added the following hack to startup code to initialize locations 0x20000000 and 0x20000004 to the same values the blinky app has on entering C main:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	; Softdevice initialization hack
	MOV		R0, #0x20000000
	MOV		R1, #0x1000
	STR		R1, [R0],#0x04
	MOV     R1, #0x1f000
	STR		R1, [R0]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I just wonder if there is an explanation to why this is necessary.&lt;/p&gt;
&lt;p&gt;I have started the project from scratch.&lt;/p&gt;
&lt;p&gt;I am using IAR EWARM 7.80.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68313?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2016 18:14:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42093b66-ed94-458b-9c81-b4f64a489a60</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I just saw your post &lt;a href="https://devzone.nordicsemi.com/question/102544/memory-protection-unit-problem/"&gt;here&lt;/a&gt;. You are doing a lot more than i thought. You linker script is little cryptic for me&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68312?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2016 08:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ce48146-519a-48bf-93bc-6b0ac889ed53</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;The softdevice is version 3.0.0 (from SDK 12.1.0).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Here is my linker script - it has extra defines for being able to lock memory for a scheduled process:

    /*###ICF### Section handled by ICF editor, don&amp;#39;t touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile=&amp;quot;$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_1.xml&amp;quot; */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x0001f000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_IROM1_start__ = 0x0001f000;
define symbol __ICFEDIT_region_IROM1_end__   = 0x0007FFFF;
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
define symbol __ICFEDIT_region_IROM2_end__   = 0x0;
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
define symbol __ICFEDIT_region_EROM1_end__   = 0x0;
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
define symbol __ICFEDIT_region_EROM2_end__   = 0x0;
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
define symbol __ICFEDIT_region_EROM3_end__   = 0x0;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x20002128;
define symbol __ICFEDIT_region_IRAM1_end__   = 0x2000FFFF;
define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
define symbol __ICFEDIT_region_IRAM2_end__   = 0x0;
define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM1_end__   = 0x0;
define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM2_end__   = 0x0;
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM3_end__   = 0x0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__   = 0x200;
/**** End of ICF editor section. ###ICF###*/

define memory mem with size = 4G;
define region IROM_region   =   mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
                              | mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
define region EROM_region   =   mem:[from __ICFEDIT_region_EROM1_start__ to __ICFEDIT_region_EROM1_end__]
                              | mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
                              | mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
define region IRAM_region   =   mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
                              | mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
define region ERAM_region   =   mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
                              | mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
                              | mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];


define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { readwrite };
do not initialize  { section .noinit };

// Code item definitions for memory protection
// ITEM: bsp_os
define block bsp_os_code with alignment = 0x2000, size = 0x2000 { 	section .bsp_os_code,
																section .bsp_os_rodata,
																section .bsp_utils_code,
																section .bsp_utils_rodata,
																object strlen.o,
																object ABImemset.o, 
																object ABImemcpy_unaligned.o,
																object strcpy_unaligned.o
															};															
															
define block bsp_os_data_upro with alignment = 0x200, size = 0x0200 { section .bsp_os_data, section .bsp_os_bss };
define block bsp_os_data_uprw with alignment = 0x400, size = 0x0400 { section .bsp_utils_data, section .bsp_utils_bss, section .bsp_uprw_data };

// ITEM: services_test
define block services_test_code with alignment = 0x0200, size = 0x0200 { section .services_test_code, section .services_test_rodata  };
define block services_test_data with alignment = 0x0100, size = 0x0100 { section .services_test_data, section .services_test_bss };
define block services_test2_code with alignment = 0x0100, size = 0x0100 { section .services_test2_code, section .services_test2_rodata  };
define block services_test2_data with alignment = 0x0100, size = 0x0100 { section .services_test2_data, section .services_test2_bss };

// ITEM: services_communication
define block services_communication_code with alignment = 0x0200, size = 0x0200 { section .services_communication_code, section .services_communication_rodata  };
define block services_communication_data with alignment = 0x0100, size = 0x0100 { section .services_communication_data, section .services_communication_bss };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in IROM_region  { readonly,
						block bsp_os_code,
						block services_test_code, 
						block services_test2_code,
						block services_communication_code
						};
						
place in EROM_region  { readonly section application_specific_ro };
place in IRAM_region  { readwrite,
						block CSTACK,
						block HEAP,
						block bsp_os_data_upro,
						block bsp_os_data_uprw,
						block services_test_data,
						block services_test2_data,
						block services_communication_data
						};
						
place in ERAM_region  { readwrite section application_specific_rw };
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68311?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 16:28:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6d5ddd1-d82e-4a53-afd7-e83511c339ba</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;what project settings for IRAM and IROM are you using? and what is the softdevice version, please check your linker scripts if any for the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68309?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 13:46:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76dff987-dd22-460d-af59-60b73b23d78c</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;It is the SVC handler of the softdevice that reads the wrong memory. In the blinky project, locations 0x20000000 and 0x20000004 is initialized when the software enters the application main. In my project it is not. If I initializes these two addresses at the beginning of application the handler works fine with SVC below 0x10 being forwarded to me. I suspect the problem is in my project settings and not code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68310?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 13:12:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5003bf69-a641-4394-abb5-cb5e98f97f0b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you have to first figure out why your SVC handler is trying to read wrong memory. I am assuming SoD means softdevice, and the SVC handler that hangs is inside the OS you are trying to port.&lt;/p&gt;
&lt;p&gt;Check if wrong stack pointer is selected for some reason. Which softdevice version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVC and fault handling not passed to application</title><link>https://devzone.nordicsemi.com/thread/68308?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2016 13:37:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fc7b3f6-9c17-4399-9f92-995f71c30761</guid><dc:creator>tkorsdal</dc:creator><description>&lt;p&gt;Added the following in beginning of main:
*( ( uint32_t *)0x20000000 ) = 0x00001000;
*( ( uint32_t *)0x20000004 ) = 0x0001f000;&lt;/p&gt;
&lt;p&gt;And then it works.
What is the proper way to this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>