<?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>bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15888/bootloader-issues-using-gcc</link><description>Hi 
 I have been using the DFU for quite a while. I adapted the boot loader to my hardware and compiled it using Keil.
All my other code is written in another environment using gcc, so I wanted to be able to do the boot loader in that same environment</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Aug 2016 13:43:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15888/bootloader-issues-using-gcc" /><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60606?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 13:43:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65bdac80-db10-4b9b-a9ed-ec029cb67a58</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I just tried to test with the example made by Bjørn in the thread, worked fine for me (after copy back the bsp folder that accidentally erased in the example). I would suggest you to track back what you modified.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60608?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 12:06:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b621f1ce-a2d2-4ffe-b023-81752b566284</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;I added the ld and the makefile from which I started in my original question. The makefile is just for reference, I myself am not using make, I am using qmake via QtCreator. However, I checked the execution of the compilation and linking and objcopy  and such, so the execution seems to be ok.
The .ld file I got from &lt;a href="https://devzone.nordicsemi.com/question/74719/is-the-sdk11-boot-loader-be-compatible-with-sdk72-applications/"&gt;this post&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60607?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 11:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa6b3ed9-5a46-43d9-bd73-20349c007f08</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@wim: Please send your .ld configuration (also your makefile), seems that there could be smth wrong with the configuration for FLASH.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60605?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 09:26:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7357c4e-6f4e-4d50-9630-8b73fa18c183</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;ok, i will give it a try, but still out of curiosity: the error message that I get, does this suggest that my code is too big?
and another question: can I combine the 8.1 bootloader with a 7.3 soft device and and SDK7.2 application?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60604?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 08:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d10a495e-f463-4e49-ab3e-4b6cffa2a162</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Wim,&lt;/p&gt;
&lt;p&gt;Sorry I forgot that you need to remove NOLOAD. NOLOAD marks that this section should not be loaded with anything and result that you don&amp;#39;t write the BANK_VALID_APP into it.&lt;/p&gt;
&lt;p&gt;I tried here with SDK v8.1 and it worked fine for me (after removing NOLOAD). I attached the hex in my answer. If you open you can find the word at the 0x3FC00 address was written 0x01.&lt;/p&gt;
&lt;p&gt;I would suggest you to download a fresh copy of the SDK v8.1 and test with that before you move back to you bootloader in SDK v7.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60603?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 13:40:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae2532aa-2b2b-48a7-a2e1-92f25722b918</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;tried that but that did not seem to change anything. (I guess because it is not declared as a constant?)
I am now comparing some things between my code and the SDK8.1
I noticed that in my linker script, there is a difference in the definition of .Bootloadersettings.&lt;/p&gt;
&lt;p&gt;in version 7.2 I have:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   /* Ensures the bootloader settings are placed at the last flash page. */
  .bootloaderSettings(NOLOAD) :
  {

  } &amp;gt; BOOTLOADER_SETTINGS
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In version 8.1 this is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     /* Ensures the bootloader settings are placed at the last flash page. */
  .bootloaderSettings :
  {
	
  } &amp;gt; BOOTLOADER_SETTINGS
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am not familiar with the syntax of a gcc link script. What does the &amp;quot;(NOLOAD)&amp;quot; do?
Tried to remove it but then I get an error during linking:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;section .bootloaderSettings loaded at [000000000003fc00,000000000003ffff] overlaps section .data loaded at [000000000003fbe8,000000000003fc4f]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also, in my hex file, there seems to be data in the BOOTLOADER settings flash page, here is an extract from the hex file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:10FBE800FFFF00000500000000000000000000000A
:10FBF80000000000000000000000000000000000FD
:10FC08000000000000000000D8FB03000000000016
:10FC180000000000000000000000000000000000DC
:10FC280000000000000000000000000000000000CC
:10FC380000000000000000000000000000000000BC
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where does that data come from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60602?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 13:33:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69fc24ec-3c3d-47ca-a43e-c02f4a8ab267</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@wim: Please follow the bootloader_settings.c file in SDK v8.1&lt;/p&gt;
&lt;p&gt;if you want to pre-set a value in flash, I think you can try:&lt;/p&gt;
&lt;p&gt;uint8_t m_boot_settings[CODE_PAGE_SIZE] &lt;strong&gt;attribute&lt;/strong&gt; ((section(&amp;quot;.bootloaderSettings&amp;quot;))) = {BANK_VALID_APP};&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60601?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 13:15:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2ce7c13-6c5e-4e8c-a90d-59008bf6853f</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;Triggered about your remark about the BANK_INVALID_APP, found my edit in the Keil project :
I added something to this line in bootloader_settings_arm.c:
const uint8_t  m_boot_settings[CODE_PAGE_SIZE] &lt;strong&gt;attribute&lt;/strong&gt;((at(BOOTLOADER_SETTINGS_ADDRESS))) &lt;strong&gt;attribute&lt;/strong&gt;((used)) = {BANK_VALID_APP};&lt;/p&gt;
&lt;p&gt;Not sure how to do this in the GCC equivalent. In my GCC project, I have following line in bootloader_settings.c:
&lt;strong&gt;attribute&lt;/strong&gt; ((section(&amp;quot;.bootloaderSettings&amp;quot;))) uint8_t m_boot_settings[CODE_PAGE_SIZE];&lt;/p&gt;
&lt;p&gt;What will cause a default of 0x01?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60600?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 13:14:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bdbadba-1a77-42f1-aaab-dacb2d60754d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Wim: by default we will not write anything to this. And it will be 0xFF by default.
You can have a look at the bootloader_settings.c. It&amp;#39;s where we write to UICR and use &lt;strong&gt;attribute&lt;/strong&gt; so that we can choose to write to some address in the flash in compile time.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to switch to SDK v8.1, you still can follow what we do in the bootloader (especially the file bootloader_settings.c) to support gcc in SDK v8.1 and use that in your bootloader. They are pretty similar.&lt;/p&gt;
&lt;p&gt;Usually the bootloader setting will be stored using bootloader_settings_save(), you may want to add a breakpoint there or print out a trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60599?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 12:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0762b50-ff34-48a6-af17-f5bf040267fa</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Well for some reason, in my Keil project, this bit seems to be set during compilation: I see 0x01 on position 0x3FC00. But in my gcc project, I do not see it.
I vaguely remember changing something in the past to the Keil project, but cannot really recall what exactly.&lt;/p&gt;
&lt;p&gt;Why I am using the SDK7.2.0 version, is because I do not want to move my application to the SDK8.1. And it seems to work now, except for this 1 bit. I did the edit manually and that works just fine.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Please double check to find why &amp;quot;that flash location was already written to 0&amp;quot;, this should not happen, it should be 0xFF = BANK_INVALID_APP.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Where should I check this? Is this some initialization value somewhere?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60598?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 12:21:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90c0b4f8-0fa4-4c05-845c-9a70b4333b25</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi wim,&lt;/p&gt;
&lt;p&gt;How did you modify the bootloader for compiling with gcc ?&lt;/p&gt;
&lt;p&gt;1 . If you want to increase the size of the bootloader you can follow &lt;a href="https://devzone.nordicsemi.com/question/18039/bootloader-debugging/?answer=18051#post-id-18051"&gt;this guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;2 . Please clarify this part:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I cannot start my program after programming boot loader, soft device and application hex files using a JlinkExe script, I need to program the application using the DFU; with the Keil version that was not necessary;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;With the original bootloader in the SDK, doesn&amp;#39;t matter which toolchain you used to compile and program, the bootloader will still mark the application as invalid until you use DFU to update the bootloader.&lt;/p&gt;
&lt;p&gt;You can have a look at question E in this FAQ to know how to manually change the bootloader setting to tell the bootloader the valid application is flashed.&lt;/p&gt;
&lt;p&gt;Please double check to find why &amp;quot;that flash location was already written to 0&amp;quot;, this should not happen, it should be 0xFF = BANK_INVALID_APP.&lt;/p&gt;
&lt;p&gt;My suggestion is to use the bootloader from SDK v8.1 or later, gcc is fully supported from that version.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6076.nrf51422_5F00_xxac.hex"&gt;nrf51422_xxac.hex&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60597?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 09:59:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2780d73-20f4-4ca8-ac1e-0424fd530fc2</guid><dc:creator>wim</dc:creator><description>&lt;p&gt;i have it on yes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader issues using gcc</title><link>https://devzone.nordicsemi.com/thread/60596?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2016 08:52:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f944d12-83ed-46bd-a693-9393b2342a77</guid><dc:creator>shibshab</dc:creator><description>&lt;p&gt;Have you enabled Link Time Optimization? There is a known issue on some version of arm-none-eabi-gcc, but the latest should be safe with LTO.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>