<?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>JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11348/jlinkexe-hangs-in-makefile-but-not-in-terminal-on-mac-os</link><description>Here are the commands I use to upload a program to the device: 
 JLinkExe -device nrf51422_xxac -if swd -speed 4000 
loadbin filename.bin 0x18000 
r 
exit
 
 It works like a charm when entered from terminal, but when added to the Makefile, it hangs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Jan 2016 00:59:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11348/jlinkexe-hangs-in-makefile-but-not-in-terminal-on-mac-os" /><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42731?ContentTypeID=1</link><pubDate>Tue, 19 Jan 2016 00:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50aa0acb-c3bf-4365-8b72-d8cc14a5ce70</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Well I don&amp;#39;t know what your makefile looks like but after some more testing I pretty much can&amp;#39;t make this hang whether I pipe the commands into JLinkExe, or put them in a file and put that on the end, or use Autoconnect or don&amp;#39;t use Autoconnect (although Autoconnect is cleaner). This makefile for instance works with &lt;code&gt;make test&lt;/code&gt; or &lt;code&gt;make test2&lt;/code&gt;. Doesn&amp;#39;t hang, exits with a clean 0 exit.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;test: 
	echo &amp;quot;r\nh\nloadbin test.bin 0x00\nexit\n&amp;quot; |\
	JLinkExe -if swd -device nrf51 -speed 4000

xx: makefile
	echo r\\nh\\nloadbin test.bin 0x00\\nexit\\n &amp;gt;&amp;gt; xx

test2: xx
	JLinkExe -if swd -device nrf51 -speed 4000 xx

clean:
	rm -f xx
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42728?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 22:50:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2951d4c6-33c8-4e79-979e-59894c8dfe47</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;works for me - also working for me is using &amp;#39;q&amp;#39; at the end instead of &amp;#39;exit&amp;#39;, or &amp;#39;qc` which explicitly disconnects or putting the commands into a file and placing that filename on the end of the line instead of emitting them from the makefile. Still annoying they changed it however.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42727?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 20:16:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78dd0e54-a199-4e97-a2db-e0cd478942a3</guid><dc:creator>LukaszM</dc:creator><description>&lt;p&gt;Seems like it is connecting now but it still hangs (waits or a n input) unfortunately. The only difference is that it hangs on the last console log line: &amp;quot;Cortex-M0 identified.&amp;quot; instead of &amp;quot;Type &amp;quot;connect&amp;quot; to establish a target connection, &amp;#39;?&amp;#39; for help&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42730?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 02:03:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b13b5bc2-3dcc-405d-8fa9-84169cbe56bc</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes that works - just change the run line to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;JLinkExe -if swd -device nrf51 -speed 4000 -Autoconnect 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and it will work just as it did before - no need to muck around with Applescript.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42729?ContentTypeID=1</link><pubDate>Sun, 17 Jan 2016 01:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d11e9409-a8c2-4f9e-9fd0-7c3befdf6cd7</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Suggestion on the segger forums just to add&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;-AutoConnect 1 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to the command line - try that - I don&amp;#39;t have a board to hand right now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42726?ContentTypeID=1</link><pubDate>Sat, 16 Jan 2016 21:57:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c46c041-ec43-4e62-a428-0c175efeb44e</guid><dc:creator>LukaszM</dc:creator><description>&lt;p&gt;I managed to work around this by appliyin Apple script. I created upload.sh script file (had to have executable permissions, use &lt;code&gt;chmod +x&lt;/code&gt; if needed). Then Makefile invokes this script instead of JLinkExe commands directly.
Content of &lt;code&gt;upload.sh&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/sh 
osascript &amp;lt;&amp;lt;END 
tell application &amp;quot;Terminal&amp;quot;
    do script &amp;quot;JLinkExe  -device nrf51422_xxac -if swd -speed 4000\nloadbin filepath.bin 0x18000\nr\nexit\n$1&amp;quot;
end tell
END
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace &lt;code&gt;filepath.bin&lt;/code&gt; with full path where bin file is expected to be after compilation (_build subdirectory) or use environmental variables to set it for you (did not have time for this yet and will update my answer when I perfect it).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42725?ContentTypeID=1</link><pubDate>Sat, 16 Jan 2016 13:27:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd000a42-1ccc-4254-a714-9213984e8150</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;oh yes all my JLinks are doing it now - fortunately it doesn&amp;#39;t affect RKNRFGO or I would be annoyed. Seems that it no-longer automatically connects, you have to connect it yourself. Typing any command which requires a connection outputs a message about needing a connection but not being connected, and then it connects. That&amp;#39;s probably why it works from the terminal.&lt;/p&gt;
&lt;p&gt;You might be able to append a command onto the end of the command line, one which does nothing useful but forces the connect.&lt;/p&gt;
&lt;p&gt;Definitely should ask Segger about this one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: JLinkExe hangs in Makefile but not in terminal on Mac OS</title><link>https://devzone.nordicsemi.com/thread/42724?ContentTypeID=1</link><pubDate>Sat, 16 Jan 2016 11:31:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0c5beec-a5fc-47b0-a733-6b72f8cc1438</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well it doesn&amp;#39;t hang - it&amp;#39;s just waiting for input. It wants someone to type &amp;#39;connect&amp;#39;. I don&amp;#39;t know why however I did notice my JLink-Edu was doing that yesterday when I was running it from the command line which is rather annoying.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m assuming it&amp;#39;s something Segger put in the latest version of JLinkExe, possibly by mistake, but perhaps not. I&amp;#39;d head over to their forums and ask why JLink(Exe) is now asking for a connect command to be typed in even when switches are put on the original command.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why it&amp;#39;s not doing it when you type it by hand. I suspect they broke something. You could try a downgrade to 5.10&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>