<?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>Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65819/updating-start-address-to-nrf52840-dk-via-code</link><description>Hello to everyone, I have a nrf52840 dk device running Zephyr RTOS. I have flash an app to the start address 0x00 and a second app to 0x2000 address. While I am pressing a button from the first app I can jump to second app which runs ok. My question is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Sep 2020 06:50:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65819/updating-start-address-to-nrf52840-dk-via-code" /><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/270454?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 06:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0812b43c-1d3f-4434-b27c-4a755f53d9dc</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I tested some different values and saw that when I placed the image at location&amp;nbsp;0x4080 (which is dividable by 128), it worked fine, but when I placed the image at&amp;nbsp;0x4040 (which is dividable by 64), it failed.&lt;/p&gt;
&lt;p&gt;This is because the vector table has to be aligned according to some specific rules, check them out &lt;a href="https://www.keil.com/support/man/docs/armclang_intro/armclang_intro_wll1505913605671.htm"&gt;here&lt;/a&gt;. You can see that the vector table must align to a minimum of 128 bytes.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/270328?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 12:12:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65b09f6e-e424-410c-9223-65dc6561441f</guid><dc:creator>Nikos Karamolegkos</dc:creator><description>&lt;p&gt;Hmmm as I can understand when mod(CONFIG_FLASH_LOAD_OFFSET, 1024) = 0 is ok. But why?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/270326?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 12:07:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa152ca2-bb60-449e-912f-88b24158df67</guid><dc:creator>Nikos Karamolegkos</dc:creator><description>&lt;p&gt;Update: when I use CONFIG_FLASH_LOAD_OFFSET=0x5000 for the second app the program works fine. When I am using CONFIG_FLASH_LOAD_OFFSET=0x61a8 which is larger than 0x5000 I have problem. I am trying to understand if the problem is on the jump mechanism (taken from MCUboot) or it is relevant to something else (i.e. the size?).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/270288?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 09:32:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cf16126-6615-4c3f-95b9-9385760434db</guid><dc:creator>Nikos Karamolegkos</dc:creator><description>&lt;p&gt;My project is nothing special. I am using zephyr and change CONFIG_FLASH_LOAD_OFFSET to the hello world (second app). The custom bootloader is flash with CONFIG_FLASH_LOAD_OFFSET=0x0 and after booting tries to jump to the second app.&amp;nbsp; If I use for the second app the CONFIG_FLASH_LOAD_OFFSET=0x20000 or CONFIG_FLASH_LOAD_OFFSET=0x0000C000 (address of slot1 partition of MCUboot) works fine. If I use something like 0x4e20 which is some bytes after the end of my custom bootloader the jump is not working. I don&amp;#39;t know. I am looking to .dts file. Can this be a zephyr issue? I just want to make sure that the device allow the implementation of this idea&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/270286?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 09:26:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c8e122f-95ea-44fa-8406-b40f1b8680da</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure why this. But it would be interesting to play around with your project, and get some help internally how to go about this.&lt;/p&gt;
&lt;p&gt;Could you upload the project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/269985?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2020 06:18:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41d6f12a-c57b-4de2-980e-d99310aac63e</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;When the case is verified it gets removed from my queue and I&amp;#39;m not able to see your responses afterwards. However, I stumbled upon it now and will look into it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/269685?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2020 13:53:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0cb10c5-da73-46b8-9c99-a24f5be7f195</guid><dc:creator>Nikos Karamolegkos</dc:creator><description>&lt;p&gt;I am trying to impement the idea we discuss with the custom bootloader. But when I flash the second app to an address smaller than 0x20000 I can not jump to this address. For example my bootloader is flashed in 0x0 address with size 0x4abf and the app is flashed in address 0x4e20. The device is like resetting. Any ideas on that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/269362?ContentTypeID=1</link><pubDate>Mon, 14 Sep 2020 12:10:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afa9fe98-4715-4f42-ac4b-50001ba9b435</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I have to correct myself. The code execution will not always start at adress 0, but the VTOR register will always be 0x00 at reset. Thus your vector table should be placed at address 0x00. After setting the MSP based on address 0x00 it will set the PC based on the value stored in the reset vector at address 0x04. However, this value can be set to e.g. 0x2000, but this is not a safe solution and your device can easily get bricked.&lt;/p&gt;
&lt;p&gt;I would recommend you to go for the solution I suggested (your workaround), using a custom bootlader.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/269338?ContentTypeID=1</link><pubDate>Mon, 14 Sep 2020 10:22:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa3815d0-8f0f-4317-a924-6f376cb34a08</guid><dc:creator>Nikos Karamolegkos</dc:creator><description>&lt;p&gt;hmm. Your proposal was my workaround. Now, is the solution. Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating start address to nrf52840 dk via code</title><link>https://devzone.nordicsemi.com/thread/269330?ContentTypeID=1</link><pubDate>Mon, 14 Sep 2020 09:50:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a8b084b-2ae8-46c3-bba6-2e865919cbfe</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;&lt;strong&gt;EDIT:&amp;nbsp;&lt;/strong&gt;Added strikethrough on an incorrect statement. See the other replies for more clarification.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;The code execution will always start at address 0, this is hardcoded and you can not change this&lt;/span&gt;. You would need a custom bootloader at address 0x00 to boot into&amp;nbsp;your desired address and update VTOR to point to the associated Vector Table. You could look at MCUBoot and see how it&amp;#39;s done there.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>