<?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>Building and debugging a monolithic bin/hex/elf/out</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17712/building-and-debugging-a-monolithic-bin-hex-elf-out</link><description>It would be useful in debugging to be able to fire up gdb and point it at a single binary so that I can step through code in both the bootloader and the application. The mergehex tool from Nordic makes it easy to merge soft device, bootloader and application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Nov 2016 00:37:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17712/building-and-debugging-a-monolithic-bin-hex-elf-out" /><item><title>RE: Building and debugging a monolithic bin/hex/elf/out</title><link>https://devzone.nordicsemi.com/thread/68132?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2016 00:37:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27c4d623-fa02-4e44-9e74-a5563f97c001</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;OK, I&amp;#39;ll stick to the .out file, forget the .elf file, run gdb against the application .out file and then use add-symbol-file to add the bootloader .out file. Will leave -flto out of my application build, but I see you&amp;#39;ve got it turned on for the armgcc debug build of the bootloader in SDK 12.1.0 btw.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building and debugging a monolithic bin/hex/elf/out</title><link>https://devzone.nordicsemi.com/thread/68131?ContentTypeID=1</link><pubDate>Wed, 16 Nov 2016 13:26:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b1f4201-655a-49ff-8eb6-4548de6af012</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Shouldn&amp;#39;t be a problem to use .out instead of .elf, we use it for all of our GCC examples. However, you may want to disable link time optimization (remove -flto flag in Makefile). I my experience it does not always work well with debugging (maybe dependent on toolchain version).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building and debugging a monolithic bin/hex/elf/out</title><link>https://devzone.nordicsemi.com/thread/68130?ContentTypeID=1</link><pubDate>Tue, 15 Nov 2016 08:00:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f297a79-5543-4385-bc1c-966f45254107</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Yep, done that. Actually, I just realised the Makefile for the bootloader from the SDK does NOT build an .elf file at all yet. Just .bin, .out and .hex. And the .out file it builds is not debuggable, even in the _debug build. First of all, how do I modify Makefile.common to link an .elf file? Here&amp;#39;s how it links the .out file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Link object files
%.out:
	@echo Linking target: $@
	$(NO_ECHO)$(CC) -Wl,-Map=$(@:.out=.map) $(LDFLAGS) $^ $(LIB_FILES) -lm -o $@
	-@echo &amp;#39;&amp;#39;
	$(NO_ECHO)$(SIZE) $@
	-@echo &amp;#39;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building and debugging a monolithic bin/hex/elf/out</title><link>https://devzone.nordicsemi.com/thread/68129?ContentTypeID=1</link><pubDate>Mon, 14 Nov 2016 12:42:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57a51c34-47d3-43f2-b65d-8cf819a03056</guid><dc:creator>Thomas Stenersen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;First of all make sure you build your project (and bootloader) with &lt;code&gt;-g&lt;/code&gt; for adding the debug symbols to the &lt;code&gt;.elf&lt;/code&gt; file.
Next, take a look at the gdb command &lt;code&gt;add-symbol-file&lt;/code&gt; &lt;a href="https://sourceware.org/gdb/current/onlinedocs/gdb/Files.html#index-add_002dsymbol_002dfile-1172"&gt;https://sourceware.org/gdb/current/onlinedocs/gdb/Files.html#index-add_002dsymbol_002dfile-1172&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>