<?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>Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6708/most-recent-fully-functional-gcc-example-code</link><description>Hi, 
 I am trying to get even a basic ARM GCC example set up using the provided toolchain code, and am having a rough go at it. 
 First, what is the most recent, working, full example of how to set up ARM GCC to compile and deploy to a nRF51 DK? I have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 26 Apr 2015 00:38:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6708/most-recent-fully-functional-gcc-example-code" /><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23535?ContentTypeID=1</link><pubDate>Sun, 26 Apr 2015 00:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2dcb6f41-438c-4dd8-9e15-2a8664b42d33</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;To be fair to the author of the other nrfjprog,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;loadbin is documented only to work on bin files and loadfile is the correct jlink command for loading bin, mot, hex and srec, so loadfile is correct. I suspect that loadbin was changed to be the same as loadfile long ago and the docs never updated.&lt;/li&gt;
&lt;li&gt;nrf51 is the most generic device name to use but nrf51822 works as do a large number of others. In fact segger only lists the very long names like nrf51822_xxAC.&lt;/li&gt;
&lt;li&gt;loadbin isn&amp;#39;t very good at reporting failure in some cases and JLinkExe is even worse at propagating errors out of the exe as a status code (although I think I saw Segger say recently they were going to fix that, or had in most cases)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So actually it seems to me that nrfjprog should have worked. I&amp;#39;d suspect that the chip needed the --erase-all option to get it into programmable mode at all, now it is, it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23534?ContentTypeID=1</link><pubDate>Sat, 25 Apr 2015 18:17:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b16f502-0027-441e-aeb3-b7feaf84a349</guid><dc:creator>chalecampb</dc:creator><description>&lt;p&gt;OK, this is great, exactly the response I needed!&lt;/p&gt;
&lt;p&gt;So, it turns out that I had done something similar in grabbing an nrfjprog variant from the internet. Unfortunately it was nrfjprog-in-name-only, there were a few other problems with it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The makefiles called -program, but the fake nrfjprog implemented -flash&lt;/li&gt;
&lt;li&gt;The fake nrfjprog called loadfile, not loadbin. loadfile didn&amp;#39;t work, even though the hex seemed to be correct.&lt;/li&gt;
&lt;li&gt;The options for JLink used -device nrf51822, not -device nrf51, so when I switched everything to match, it worked great.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The symptom was, everything was 0xff. I am not sure why loadfile and loadbin would both say O.K. when they were failing to load. The expected output for loadbin should be&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;J-Link&amp;gt;loadbin _build/nrf51822_xxac.bin 0
Halting CPU for downloading file.
Downloading file [_build/nrf51822_xxac.bin]...Info: J-Link: Flash download: Flash download into internal flash skipped. Flash contents already match
Info: J-Link: Flash download: Total time needed: 0.597s (Prepare: 0.514s, Compare: 0.032s, Erase: 0.000s, Program: 0.000s, Verify: 0.000s, Restore: 0.051s)
O.K.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I will check out the rknrfgo program, it&amp;#39;s probably a bit more reliable. Hope this helps someone else!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23532?ContentTypeID=1</link><pubDate>Sat, 25 Apr 2015 02:24:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eda4ce9b-c8c2-442f-8394-ac0cdd0884fa</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;That is what I meant.  not using Softdevice.  The problem you are having is very similar to the problem I mentioned.  When you run a Blink Blank on a blank chip, it&amp;#39;s fine.  If you run the Blinky blank on a chip already have Softdevice burned in.  The jtag is unable to write you blinky lot location zero but it thinks that the write was successful and crash with register dump all FF.  This problem is not only with Jlink but also with OpenOCD.  After using nRFGo to perform an erase all, blinky blank works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23536?ContentTypeID=1</link><pubDate>Sat, 25 Apr 2015 02:13:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ab5f397-578d-4df1-985e-564c0061aae2</guid><dc:creator>bluevanilla</dc:creator><description>&lt;p&gt;You can follow &lt;a href="https://devzone.nordicsemi.com/tutorials/7/development-with-gcc-and-eclipse/"&gt;https://devzone.nordicsemi.com/tutorials/7/development-with-gcc-and-eclipse/&lt;/a&gt; to set up your mac dev environment.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want that, the basic things you need are &lt;a href="https://launchpad.net/gcc-arm-embedded/+download"&gt;GNU Tools for ARM Embedded Processors&lt;/a&gt; (you probably want to put it in /usr/local/bin) and RKNRFGO (to flash your board).&lt;/p&gt;
&lt;p&gt;You seem like you installed gcc arm and changed makefile correctly I assume. Then you cd to &amp;quot;/nRF51_SDK_8.0.0_5fc2c3a/examples/peripheral/blinky/pca10028/blank/armgcc&amp;quot; and make.
Use RKNRFGO to download .hex to the board without soft device.&lt;/p&gt;
&lt;p&gt;This works for me. Sorry if I am not solving your question directly. But those are the steps that took me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23533?ContentTypeID=1</link><pubDate>Sat, 25 Apr 2015 02:07:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80398177-5efd-4fe4-a514-f45e79ab6fd1</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;1), 2) and 3) look right. Just to confirm you&amp;#39;re in the &amp;#39;blinky/pca10028/blank/armgcc&amp;#39; subdirectory and not the s110 one or the other board, sure you are but may as well check everything. I just built that example, I get a 3684 byte hex file. And that works on my DK, it&amp;#39;s blinking right now.&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;
&lt;p&gt;make flash is broken if you&amp;#39;re on OSX partly because nrfjprog doesn&amp;#39;t exist on OSX, what are you actually running here, OSX or something under parallels. (you can use &lt;a href="https://sourceforge.net/projects/rknrfgo/"&gt;this&lt;/a&gt; if you like, it&amp;#39;s a homebrew not-really-look-alike version of nrfjprog plus a gui which runs on OSX)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;is the code actually on the chip?&lt;/p&gt;
&lt;p&gt;mem 0 128&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;in JLinkExe. I get this (first few lines)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;00000000 = 00 80 00 20 15 03 00 00 5D 03 00 00 5F 03 00 00 
00000010 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which makes sense. 0x20008000 for the stack pointer, reset handler at 0x00000314&lt;/p&gt;
&lt;ol start="6"&gt;
&lt;li&gt;
&lt;p&gt;CycleCnt won&amp;#39;t change, the nrf51 doesn&amp;#39;t have a cycle counter on it, the rest of the registers make no sense at all unless you don&amp;#39;t actually have code on the chip. In fact that looks really like you have 0xff everywhere, PC at 0xFFFFFFFE, SP at 0xFFFFFFD8 (starts at 0xffffffff, gets aligned to 8 bytes on the exception and then has 32 bytes pushed --&amp;gt; 0xFFFFFFD8).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I don&amp;#39;t know where you read that but that advice is garbage, I&amp;#39;d ignore that.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Couple other things, are you running JLinkExe with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-if swd -device nrf51
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before programming try the flash wipe sequence which is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;r
sleep 500
w4 4001e504 2
w4 4001e50c 1
r
w4 4001e504 1
sleep 1000
r
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;no need for the sleeps if you&amp;#39;re typing from the command line.&lt;/p&gt;
&lt;p&gt;what else - you can single step with JLinkExe if you have lots of patience, it&amp;#39;s fine for a blinky example, not hard to follow along.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23531?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2015 20:35:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4414bada-f389-468d-91dc-dfca372b131f</guid><dc:creator>chalecampb</dc:creator><description>&lt;p&gt;Like I said, I am not using a SoftDevice. Good thought, though, I have run into that issue in other contexts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Most recent, fully functional, GCC example code?</title><link>https://devzone.nordicsemi.com/thread/23530?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2015 19:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d7964eb-eb72-41f3-b08d-19414f6a50ea</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;When the chip has Softdevice flashed in, it won&amp;#39;t work directly due to protection.  You need to do full erase before you can debug any program that does not use Softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>