<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/8729" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2013-11-16T11:38:17+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/8729</id>

		<entry>
		<author><name><![CDATA[matrixstorm]]></name></author>
		<updated>2013-11-16T11:38:17+02:00</updated>

		<published>2013-11-16T11:38:17+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26194#p26194</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26194#p26194"/>
		<title type="html"><![CDATA[Re: USBaspLoader 18-byte code reduction]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26194#p26194"><![CDATA[
Hi blargg.<br /><br />Perhaps you might want to try the revised USBaspLoader (<!-- m --><a class="postlink" href="https://github.com/baerwolf/USBaspLoader">https://github.com/baerwolf/USBaspLoader</a><!-- m -->) instead.<br /><br />With this USBaspLoader you have many new features (with individual enable/disable switches) and code-optimizaions.<br /><br />There are also many bugs fixed.<br /><br />If you want to try the most recent version of revised USBaspLoader please use the testing-branch (<!-- m --><a class="postlink" href="https://github.com/baerwolf/USBaspLoader/tree/testing">https://github.com/baerwolf/USBaspLoader/tree/testing</a><!-- m -->).<br /><br />Best regards,<br />    matrixstorm<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=7385">matrixstorm</a> — Sat Nov 16, 2013 11:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blargg]]></name></author>
		<updated>2013-11-16T04:27:59+02:00</updated>

		<published>2013-11-16T04:27:59+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26192#p26192</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26192#p26192"/>
		<title type="html"><![CDATA[USBaspLoader 18-byte code reduction]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=8729&amp;p=26192#p26192"><![CDATA[
I shaved 18 bytes off USBaspLoader without removing functionality (at least for avr-gcc 4.5.3). This is small but given that out of the box it's around 2028 bytes, very close to the 2048 limit, this might be critical to someone.<br /><br />One change involved eliminating the wdt_reset() call, which seems fine since 1) the wdt is disabled at the beginning of main(), b) it's not re-enabled anywhere I can see in this code or the usbdrv/ code, and c) it's not reset anywhere else in the code, so if say a fuse bit had it locked on all the time, the code wouldn't have worked to begin with.<br /><br />(I'm sending this to the maintainers too)<br /><br /><div class="codebox"><p>Code: </p><pre><code>--- USBaspLoader.2012-12-08/firmware/main.c<br />+++ USBaspLoader.2012-12-08-opt/firmware/main.c<br />@@ -265,7 +265,7 @@<br />     if(len &gt; bytesRemaining)<br />         len = bytesRemaining;<br />     bytesRemaining -= len;<br />-    for(i = 0; i &lt; len; i++){<br />+    for(i = len; i &gt; 0; i--){<br />         if(currentRequest &gt;= USBASP_FUNC_READEEPROM){<br />             *data = eeprom_read_byte((void *)currentAddress.w&#91;0&#93;);<br />         }else{<br />@@ -281,20 +281,15 @@<br /> <br /> static void initForUsbConnectivity(void)<br /> {<br />-uchar   i = 0;<br />-<br />     usbInit();<br />     /* enforce USB re-enumerate: */<br />     usbDeviceDisconnect();  /* do this while interrupts are disabled */<br />-    while(--i){         /* fake USB disconnect for &gt; 250 ms */<br />-        wdt_reset();<br />-        _delay_ms(1);<br />-    }<br />+    _delay_ms(251); /* fake USB disconnect for &gt; 250 ms */<br />     usbDeviceConnect();<br />     sei();<br /> }<br /> <br />-int __attribute__((noreturn)) main(void)<br />+int __attribute__((noreturn,OS_main)) main(void)<br /> {<br />     /* initialize  */<br />     wdt_disable();      /* main app may have enabled watchdog */<br />@@ -306,14 +301,13 @@<br />     GICR = (1 &lt;&lt; IVSEL); /* move interrupts to boot flash section */<br /> #endif<br />     if(bootLoaderCondition()){<br />-        uchar i = 0, j = 0;<br />+        unsigned i = 0;<br />         initForUsbConnectivity();<br />         do{<br />             usbPoll();<br /> #if BOOTLOADER_CAN_EXIT<br />             if(requestBootLoaderExit){<br />                 if(--i == 0){<br />-                    if(--j == 0)<br />                         break;<br />                 }<br />             }<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=20076">blargg</a> — Sat Nov 16, 2013 4:27 am</p><hr />
]]></content>
	</entry>
	</feed>
