<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Memos From the Cube</title>
	<atom:link href="http://fourwalledcubicle.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://fourwalledcubicle.com/blog</link>
	<description>Blog for Dean Camera</description>
	<lastBuildDate>Sun, 05 May 2013 12:28:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Extension Extravaganza</title>
		<link>http://fourwalledcubicle.com/blog/2013/05/extension-extravaganza/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/05/extension-extravaganza/#comments</comments>
		<pubDate>Sun, 05 May 2013 11:19:52 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[Misc.]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1221</guid>
		<description><![CDATA[Recently, the final build of Atmel Studio 6.1 (the production ready one) was released, bringing with it some interesting new features. It also brought along some internal changes to the way the ASF extension works, which LUFA depends on, requiring me to build a new version of my extension. I thought this was a good [...]]]></description>
				<content:encoded><![CDATA[<p>Recently, the final build of <a href="http://www.atmel.com/tools/ATMELSTUDIO.aspx">Atmel Studio 6.1</a> (the production ready one) was released, bringing with it some interesting new features. It also brought along some internal changes to the way the ASF extension works, which LUFA depends on, requiring me to build a new version of my extension. I thought this was a good opportunity to get back into the PC side of programming for a little while, so I pulled out my copy of Visual Studio, fired it up, and got to work. Well, tried to, as things have <b>really</b> changed since I developed with Visual Basic and WinForms. Damn you, XAML!</p>
<h3>LUFA Extension</h3>
<p><b><a href="http://gallery.atmel.com/Products/Details/47ba24a4-d17b-4fed-b244-f5998b3d789d">Atmel Gallery Link</a></b></p>
<p>The new LUFA release is much improved; one of the major issues I saw with the previous version was the overwhelming amount of <i>&#8220;now what?&#8221;</i> feedback from users. First impressions are very important, so if users install your product and receive no feedback on how to use it, they aren&#8217;t going to be a happy chappy. To combat this I&#8217;ve added an integration binary to the extension which presents a new first-run Getting Started page, which covers the fundamentals of how to create examples, add/remove LUFA modules and access the documentation:</p>
<p><a rel="lightbox_as_ext" href="http://www.fourwalledcubicle.com/img/Blog/LUFA_AS_GettingStarted.jpg"><img src="http://www.fourwalledcubicle.com/img/Blog/LUFA_AS_GettingStarted.jpg" width="400" height="430" class="aligncenter" /></a></p>
<p>Yes, I know my CSS and HTML skills are non-existent, so I kept it simple. Actually, it turns out the integrated web browser in Visual Studio 2010 is a modified IE7 engine, so any sort of fancy tricks wouldn&#8217;t work well anyway. I like the new page, and it&#8217;s got good feedback so far, so mission accomplished I think. You&#8217;ll see this on fresh installs of LUFA or &#8211; if you had the somewhat broken release I originally pushed &#8211; <i>every darn time you add or remove any extension</i>. Sorry about that, I blame poor Atmel Studio SDK docs and insufficient testing on my part.</p>
<p>Also new are the bootloaders, as the new ASF changes means I can finally add them to the extension without having to make one example for every single device and bootloader combination. Unfortunately I&#8217;ve still had to class them by target memory size, but it&#8217;s miles better than the alternative and much more friendly than command line compiling. They&#8217;re all included in the new release, as example projects.</p>
<p>Finally comes the help. I&#8217;ve previously wired up the module help to the online documentation, so that you can use the <em>ASF Explorer</em> window of Atmel Studio to view the documentation for a particular module. However, that&#8217;s not ideal, so the new release also comes with an integrated version of the manual inside the regular Atmel Studio Help functionality. You&#8217;ll be prompted to install it the first time the extension is installed (I&#8217;m not paying for a darn signing certificate, so users need to click a few confirmations instead) and once added the full LUFA manual will be available, including F1 look-up on (most) LUFA constants, variables, functions, enums and the like.</p>
<p>Making the integrated help was a task in itself &#8211; special thanks to my friend Morten, who&#8217;s authored the <a href="http://sourceforge.net/tracker/?func=detail&#038;aid=3610290&#038;group_id=21935&#038;atid=373750" title="DocBook HV1 Transform Proposal">Docbook to HV1 transform</a> needed to make it work. Over the last few weeks I&#8217;ve learned <b>far</b> more about XSLT than any many ought to, but it&#8217;s all worth it. The end result isn&#8217;t perfect, but it&#8217;s as good as automatically converted <i>Doxygen XML->DocBook->HV1</i> is going to get.</p>
<h3>Data Size Viewer Extension</h3>
<p><b><a href="http://gallery.atmel.com/Products/Details/5e4919d2-38f0-4f66-994c-f55b5f6c8b1a">Atmel Gallery Link</a></b></p>
<p><a rel="lightbox_as_ext" href="http://www.fourwalledcubicle.com/img/Blog/AS_Ext_DataSizeViewer.jpg"><img src="http://www.fourwalledcubicle.com/img/Blog/AS_Ext_DataSizeViewer.jpg" width="400" height="242" class="aligncenter" /></a></p>
<p>Second on my list of new Atmel Studio extensions is the Data Size Viewer, created in collaborated with the aforementioned Morten. This implements a basic working version of something I&#8217;ve wanted to see integrated into Atmel Studio for a long time, so I went ahead and made it myself. When installed, this will add a new tool window that will display the symbols (variables, functions, etc.) from the compiled ELF binary in a project, and their corresponding sizes within the compiled binary. Sorting this list can answer the question of <i>&#8220;where the hell did all my FLASH and RAM go?&#8221;</i> in an easier manner than manually reading through the LSS file, and symbols can be double-clicked to jump to their definitions in your source code. It&#8217;s a basic extension, but one I already find myself using quite a bit.</p>
<h3>Build Taskbar Overlay Extension</h3>
<p><b><a href="http://gallery.atmel.com/Products/Details/4c94b4c2-cfe1-4bea-8621-b0c9be600176">Atmel Gallery Link</a></b></p>
<p><a rel="lightbox_as_ext" href="http://www.fourwalledcubicle.com/img/Blog/AS_Ext_Overlay.png"><img src="http://www.fourwalledcubicle.com/img/Blog/AS_Ext_Overlay.png" class="aligncenter" /></a></p>
<p>Ok, this one&#8217;s just a bit of eye-candy. However, at work it&#8217;s not uncommon for me to start a project build that will take several minutes to complete &#8211; the Windows ports of the AVR32 and ARM toolchains aren&#8217;t the speediest of things &#8211; and it&#8217;s nice to be able to minimize the program and do other things in the meantime. On Windows 7 machines this will add a small icon overlay to the Atmel Studio icon in the taskbar, showing when a build is in progress (clock icon), completed successfully (green tick icon) or failed (red cross icon).</p>
<h3>Virtual Debug Channel Extension</h3>
<p>Actually, this one&#8217;s a failed experiment, although I had a prototype working. Using nothing but a debugger I was able to print messages out from a running XMEGA inside Atmel Studio in a special build output window, using a tiny extension I wrote late Friday night. This works by shoving the data into a global array in the target, then using an inline assembly breakpoint instruction to signal my Atmel Studio extension to pick up the data, write it to the output window, and resume execution.</p>
<p>While it worked, I&#8217;m afraid it&#8217;s just not a good solution, since breakpoints cause the entire context (including watched variables, open debug windows, etc.) to be refreshed each time which is really, really slow. Perhaps in the future something better could be implemented by the real Atmel Tools team, perhaps using data breakpoints.</p>
<p>That&#8217;s it for now. If you have extension requests let me know; I&#8217;m always looking for new side projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/05/extension-extravaganza/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ve got the magic in me&#8230;</title>
		<link>http://fourwalledcubicle.com/blog/2013/03/magic/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/03/magic/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 12:25:46 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1209</guid>
		<description><![CDATA[Well, given that a number of people wanted ATMEGA32U4 and smaller support for my Mass Storage class bootloader, I&#8217;ve gone ahead and implemented the linker gymnastics required to make it work. A warning: it&#8217;s pretty ugly since I had to split the text segment into a secondary &#8220;Aux&#8221; bootloader space to make it fit on [...]]]></description>
				<content:encoded><![CDATA[<p>Well, given that a number of people wanted ATMEGA32U4 and smaller support for my <a href="http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/" title="Memos from the Cube - The new, new LUFA bootloader">Mass Storage class bootloader</a>, I&#8217;ve gone ahead and implemented the linker gymnastics required to make it work. A warning: it&#8217;s pretty ugly since I had to split the text segment into a secondary &#8220;Aux&#8221; bootloader space to make it fit on the smaller devices, but <a href="https://github.com/abcminiuser/lufa/commit/eef8bd7efd6dc839b5bb0a6aa5237721e8deb03e" title="LUFA GIT - Commit to add small device support to MS bootloader">that&#8217;s just details</a>. I&#8217;ve uploaded binaries of all the bootloaders to <a href="http://fourwalledcubicle.com/files/LUFA/Bootloaders/" title="LUFA Bootloader Binaries">this location</a>, including one for the Arduino Leonardo (ground IO13 on start-up to enter the bootloader).</p>
<p>I&#8217;ve also gone ahead and <a href="https://github.com/abcminiuser/lufa/commit/f690f29b34948fdb8f0bfa39d468be8875cc0989" title="LUFA GIT - Commit to add EEPROM support to MS bootloader">added EEPROM support</a> to it, so the bootloader now exposes two virtual files, <b>FLASH.BIN</b> and <b>EEPROM.BIN</b>. Magic! Special thanks to Matt over at <a href="http://www.opendous.org" title="Opendous Inc. Website">Opendous Inc.</a> for his assistance with getting Linux support of the bootloader working, since my initial release had a few issues with write offsets.</p>
<p>Now, recently with the release of the <a href="http://gallery.atmel.com/Products/Details/d17b5661-f03d-497e-b718-04784d4b766a" title="LUFA VSIX Extension for Atmel Studio">LUFA VSIX extension</a> to the Atmel Gallery for Atmel Studio 6.1, I&#8217;m getting increasing pressure to release ported demos for the XMEGA architecture, even if the backend implementation has a few <a href="http://fourwalledcubicle.com/files/LUFA/Doc/130303/html/_page__known_issues.html" title="LUFA 120303 Known Issues List">known issues</a>. A little while back I started work on porting things over in a separate branch (called &#8220;XMEGA-Demo-Ports&#8221;, for those playing at home) which you can try out inside AS6.1 using <a href="https://groups.google.com/group/lufa-support/browse_thread/thread/ab9e0cdbdbf4276b" title="Instructions for custom LUFA branches in Atmel Studio">these instructions</a>, or standalone if you just check out the <a href="http://www.lufa-lib.org/svn" title="LUFA SVN">SVN</a>/<a href="http://www.lufa-lib.org/git" title="LUFA GIT">GIT</a>.</p>
<p>Right now I&#8217;m weighing up the XMEGA demo port branch, and I need a public opinion poll; given that the cross-architecture demo code is a little more complicated (since it needs <code>#ifdef</code> checks for architecture detection and hardware detection) I&#8217;m not totally convinced this is the right direction. On the plus side, the new ported demos can be compiled as-is for both XMEGA and AVR8 with no user-changes, and can be compiled for boards that lack some of the UI hardware the current demos expect (such as buttons and joysticks). An example of a ported XMEGA demo for a Device Mouse can be found <a href="https://github.com/abcminiuser/lufa-lib/blob/master/branches/XMEGA-Demo-Ports/Demos/Device/ClassDriver/Mouse/Mouse.c" title="Cross Architecture LUFA Mouse demo">here</a> &#8211; contrast with the AVR8-only demo <a href="https://github.com/abcminiuser/lufa-lib/blob/master/trunk/Demos/Device/ClassDriver/Mouse/Mouse.c" title="AVR8 Architecture LUFA Mouse demo">here</a>. Note the addition of the <code>#if ARCH=...</code> and <code>#if defined(BOARD_HAS_...)</code> checks.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/03/magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The new, new LUFA bootloader</title>
		<link>http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/#comments</comments>
		<pubDate>Sun, 10 Mar 2013 13:01:11 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1196</guid>
		<description><![CDATA[Three blog posts in one week, after being so tardy in the last few months. Things are looking up! After my last post detailing my latest and greatest abomination to the world of embedded engineering, Markus asked if I had considered making a Mass Storage class bootloader. Those are fairly common in the embedded world [...]]]></description>
				<content:encoded><![CDATA[<p>Three blog posts in one week, after being so tardy in the last few months. Things are looking up!</p>
<p>After my last post detailing my <a title="Memos from the Cube - The new LUFA bootloader" href="http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/">latest and greatest abomination</a> to the world of embedded engineering, <a title="Blog comment from Markus" href="http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/#comment-3656">Markus asked</a> if I had considered making a Mass Storage class bootloader. Those are fairly common in the embedded world &#8212; the idea is that the device shows up like a normal disk drive, and you can reprogram it by dragging-and-dropping a new binary file to an emulated filesystem.</p>
<p>I had thought about this in the past, however somehow I never quite got around to looking into it properly. The FAT specification is one I&#8217;ve never really looked into before now, preferring instead to use the well known, proven <a title="ELMChan's FATFS library" href="http://elm-chan.org/fsw/ff/00index_e.html">FATFS library</a> in my projects. Actually, I admit I previously thought it impractical on the USB AVRs, as for some reason I had it in my head that the file system had to be buffered in RAM before the new firmware was extracted and copied to FLASH. Revisiting this made me realize what a world class fool I am (hold your nods of agreement, please) when it hit me that I could just map the virtual filesystem to physical FLASH blocks.</p>
<p>As a result, I now have this working:</p>
<p style="text-align: center;"><a href="http://www.fourwalledcubicle.com/img/Blog/MSBootloader.jpg" rel="lightbox"><img class="aligncenter" alt="Mass Storage Bootloader" src="http://www.fourwalledcubicle.com/img/Blog/MSBootloader.jpg" width="445" height="196" /></a></p>
<p>Which allows you to reprogram the AVR via a BIN file by overwriting the existing FIRMWARE.BIN file (which, when read, returns a binary image of the current FLASH contents). The emulated FAT code was actually surprisingly straightforward to write once I started reading some <a title="FAT16 Tutorial" href="http://www.tavi.co.uk/phobos/fat.html">decent overviews on the subject</a>, although I spent far longer than I care to admit (ok, ok, five hours) going back and forth over my code looking for a flaw, before finding out that the host OS was thinking my (valid) FAT16 partition was a FAT12 partition and becoming confused. That was the real piece of information I missed that is absolutely crucial; it&#8217;s the sector size and count that determines which of FAT12 and FAT16 the host interprets your partition size as, and not the obvious filesystem identifier string. Damn.</p>
<p>Actually, now that I know just how awful FAT is, I&#8217;m horrified to realize I used to store all my data on it in the 1990&#8242;s under Windows 95 and later Windows 98. It&#8217;s a terrible (if simple) filesystem where a single bit of corruption in the right place can cause horrendous data loss. I&#8217;ve no idea why Microsoft wants to patent it, since it&#8217;s&#8230;well&#8230;terrible. Objectively so.</p>
<p>Right now the new bootloader code is <a href="https://github.com/abcminiuser/lufa/tree/master/Bootloaders/MassStorage" title="Mass Storage Class Bootloader code">available on GitHub</a>, if you have a device that is supported (currently just the 128KB and 64kB USB AVRs, since I need an 8KB bootloader section). Paul Stoffrogen&#8217;s <a title="Paul's Twitter Reply - MS Class Bootloader" href="https://twitter.com/PaulStoffregen/status/310435474282012672">made the great suggestion</a> of remapping some of the routines to a custom section located just before the bootloader section in order to make it work on smaller devices, but I want to gauge the public opinion first. If you would really like to see a Mass Storage class bootloader on the ATMEGA32U4 or smaller devices, let me know.</p>
<p>In other news, my friend Morten and I went to see the local NTNU university last week, so he could give me a tour. I&#8217;ve <a title="NTNU Photos" href="https://picasaweb.google.com/108771026244030052455/NTNUMarch102013">put some photos up here</a>, however one that stands out:</p>
<p style="text-align: center;"><a href="https://picasaweb.google.com/108771026244030052455/NTNUMarch102013#5853674692344141090"><img class="aligncenter" alt="" src="https://lh4.googleusercontent.com/-KBUjRA3xEz4/UTxuHlvd1SI/AAAAAAAAAn0/0MvvJCuNC5k/s1024/IMG_20130223_160444.jpg" width="491" height="369" /></a></p>
<p>The room to the bottom-left of the main door is the <a href="https://www.google.com/search?q=omega+verksted&#038;ie=utf-8&#038;oe=utf-8&#038;aq=t&#038;rls=org.mozilla:en-US:unofficial&#038;client=firefox-nightly" title="Omega Verksted Website">Omega Verksted</a>; the crazy place where Alf-Egil Bogen and Vegard Wollan designed the first AVR, the AT90S1200.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/03/the-new-new-lufa-bootloader/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The new LUFA bootloader</title>
		<link>http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 19:42:05 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1187</guid>
		<description><![CDATA[So I&#8217;ve been feeling a little down lately, saddened by my lack of enthusiasm for developing new projects. Stuck in a rut, that sort of thing. A few weeks ago I thought I&#8217;d try something simple, new and fun to rekindle my love of developing &#8212; and who doesn&#8217;t love a good joke? A long, [...]]]></description>
				<content:encoded><![CDATA[<p>So I&#8217;ve been feeling a little down lately, saddened by my lack of enthusiasm for developing new projects. Stuck in a rut, that sort of thing. A few weeks ago I thought I&#8217;d try something simple, new and fun to rekindle my love of developing &#8212; and who doesn&#8217;t love a good joke?</p>
<p>A long, long time ago I was thinking about Bootloaders for LUFA. Right now there&#8217;s three in the current LUFA distribution:</p>
<ul>
<li>A <b>DFU class bootloader</b>, compatible with <a href="http://www.atmel.com/tools/flip.aspx" title="Atmel FLIP Programming Software">Atmel&#8217;s FLIP</a> software, or the open source <a href="http://dfu-programmer.sourceforge.net/" title="Open Source DFU Programmer Project">dfu-programmer</a> code. Fits into 4KB, robust, EEPROM programming support and popular. On the downside, you need special host software and drivers.</li>
<li>A <b>HID class bootloader</b>, compatible with a modified version of Paul&#8217;s excellent cross-platform <a href="http://www.pjrc.com/teensy/loader_cli.html" title="PJRC TeensyLoader CLI Software">TeensyLoader command line utility</a>. Fits into just 2KB on some devices, requires no non-standard drivers but it doesn&#8217;t really do EEPROM (unless you count <a href="https://github.com/abcminiuser/lufa/tree/master/LUFA/Build/HID_EEPROM_Loader" title="HID EEPROM Loader Shim Application">my hack to sort of, kind of do it</a>).</li>
<li>A <b>CDC class bootloader</b>, compatible with <a href="http://www.nongnu.org/avrdude/" title="AVRDUDE Open Source Programmer Project">AVRDUDE</a> as it implements the fairly popular AVR910 protocol. This is the one appropriated (and modified) by Arduino for their <a href="http://arduino.cc/en/Main/arduinoBoardLeonardo" title="Arduino Leonardo">Leonardo board</a>, and the one everyone else seems most eager to use in their own creations. Sadly due to Windows being Windows it needs a special driver file which requires a paid signing certificate as of Windows 8 to function.</li>
</ul>
<p>But a while back, I had plans for a forth. A crazy, crazy idea: bootloading&#8230;over MIDI. Actually, MIDI bootloading turned out to be a <a href="https://github.com/pichenettes/avr-midi-bootloader" title="AVR MIDI Bootloader">rather old idea</a>, and one that&#8217;s actually popular in a number of commercial instruments, using MIDI SYSEX commands. My idea was to encode the data as a series of note commands with hard-coded delays &#8212; that way the end-user could reprogram a board by literally just playing a MIDI file sent from the manufacturer, with no device-to-host feedback being required (thus no special host software). No drivers needed either, since all modern operating systems include them just like they do for a number of other standard classes.</p>
<p>Unfortunately, revisiting this the other week I was left disappointed; it seems Windows 7 simply <a href="https://www.google.com/search?q=windows+7+midi+output+device" title="Windows 7 MIDI Output Device search">doesn&#8217;t do proper MIDI mapping to hardware MIDI devices any more</a>, and I&#8217;m not the first one to be disappointed by it. Of course you can use dedicated software for it, but that would take away from the simplicity of the implementation. Bang goes that idea.</p>
<p>However, as OK Go say, <a href="https://www.youtube.com/watch?v=ur-y7oOto14" title="OK Go - All is Not Lost">All is Not Lost</a>. I had another idea up my sleeve; none of than the humble <b>Printer class</b>. Yes, I&#8217;m being totally serious. Let&#8217;s skip ahead a bit and start with the end result:</p>
<p><a rel="lightbox_printerbootloader" href="http://www.fourwalledcubicle.com/img/Blog/PrinterBootloader.jpg"><img src="http://www.fourwalledcubicle.com/img/Blog/PrinterBootloader.jpg" width="523" height="410" alt="Printer Bootloader shown in Windows 7." class="aligncenter"/></a></p>
<p>That might look like just a humble printer from the 1980&#8242;s, but in actual fact you&#8217;re looking at what might just be the first bootloader-over-USB-printer-class in the world. Need to reprogram a device? Just &#8220;print&#8221; a new HEX file to it. Whee.</p>
<p>That&#8217;s not to say the journey was easy; first I had to re-visit the <a href="http://www.usb.org/developers/devclass_docs/usbprint11.pdf" title="USB Printer Class Specification">specifications for the USB Printer class</a>. It&#8217;s actually a deceptively simple specification, if only because it&#8217;s just like the Mass Storage one: a thin wrapper defining a generic data transport and a few error feedback mechanisms, and a &#8220;data sent is implementation defined&#8221; style catch-all. That&#8217;s fairly common in the USB world for class specifications &#8211; in many cases it&#8217;s only the transport that&#8217;s covered, and the actual encapsulated data is just whatever the hell the host and client agree to send to each other. In the real world, that can mean PostScript, Epson Command Language, pre-rasterized images, who knows.</p>
<p>So, first I had to make the host see a USB printer device. That&#8217;s just a matter of setting the Device Descriptor&#8217;s Class, Subclass and Protocol fields, plus a basic implementation of the status and error reporting control requests. I really, really didn&#8217;t want to mess with custom printer drivers, so originally I just use my own custom <a href="http://www.undocprint.org/formats/communication_protocols/ieee_1284" title="Undocumented Printing - IEEE 1284">IEEE 1284 description string</a>, and forced the driver manually under Windows to one of the basic generic PostScript drivers it has inbuilt, since that&#8217;s a well known standard printer language.</p>
<p>Let me tell you; PostScript is NOT for the faint-hearted. I was hoping to see something vaguely structured with the plain text of the printed source visible so I could pick it out, but alas the received data was just a mountain &#8211; seriously, several kilobytes worth &#8211; of pure PostScript craziness with no obvious payload in sight. Luckily thanks to receipt printers and ye-olde daisy-wheel printers of yesteryear, Windows also ships with a <a href="http://www.frogmorecs.com/arts/using-the-generic-driver" title="Windows Generic Text-Only Printer Driver">&#8220;Generic Text-Only&#8221; printer driver</a> that does away with all the crazy and just outputs exactly whatever text you print with no formatting at all. Success!</p>
<p>Well, partially &#8211; with the new driver, I could get a completely plain text representation of whatever I printer from the host (pictures didn&#8217;t work, obviously). However, I still wanted the drivers to be plug-and-play, since I wanted the end-result to be as streamlined as possible. After a bit of searching, I ended up finding the answer buried on (embarrassingly) a <a href="http://www.microchip.com/forums/fb.ashx?m=491831" title="Microchip Forums - Generic Printer Driver">Microchip support forum post</a>. Plugging in the magic IEEE 1284 identification string now gave me an automatically installing printer under Windows 7 with the desired generic text only driver.</p>
<p>But, what to do now? Should I invent a crazy command format, and have users &#8220;print&#8221; it to the bootloader? Is there a better way? Of course there is:</p>
<p><a rel="lightbox_printerbootloader" href="http://www.fourwalledcubicle.com/img/Blog/HEXFile.jpg"><img src="http://www.fourwalledcubicle.com/img/Blog/HEXFile.jpg" width="397" height="584" alt="Intel HEX format data, generated from a compiled application." class="aligncenter"/></a></p>
<p>Yup, good old <a href="https://en.wikipedia.org/wiki/Intel_HEX" title="Wikipedia - Intel HEX Format">Intel HEX</a>. In the AVR world (and in most embedded engineering circles) HEX files are king, and the file format is simple enough that making a parser for it isn&#8217;t too difficult. It&#8217;s also the native output format for most AVR build scripts and tools, and the one users are more familiar with.</p>
<p>I admit, the <a href="https://github.com/abcminiuser/lufa/tree/master/Bootloaders/Printer" title="LUFA Printer Class Bootloader">end result parser isn&#8217;t the prettiest code I&#8217;ve ever written</a>, but it is (arguably) the most amusing. You&#8217;ve heard it here first folks; the world&#8217;s first AVR bootloader where you just compile, then print your HEX file in Notepad. On Linux, you can just cat the HEX file to the low level <tt>LPR</tt> printing subsystem to re-flash your board.</p>
<p>Sometimes the best jokes are the ones that turn out to have a somewhat practical use.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>LUFA 130303 Released!</title>
		<link>http://fourwalledcubicle.com/blog/2013/03/lufa-130303-released/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/03/lufa-130303-released/#comments</comments>
		<pubDate>Sun, 03 Mar 2013 11:14:34 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1182</guid>
		<description><![CDATA[Some of you might be expecting something a little different here &#8211; I mentioned on my Twitter feed of my plans to write up my current tiny side-project (no hints here, either read the feed or be patient and all will be revealed) however I&#8217;m still trying to track down a small bug in it, [...]]]></description>
				<content:encoded><![CDATA[<p>Some of you might be expecting something a little different here &#8211; I mentioned on my Twitter feed of my plans to write up my current tiny side-project (no hints here, either read the feed or be patient and all will be revealed) however I&#8217;m still trying to track down a small bug in it, so I thought I&#8217;d delay the post about it for now. Instead I bring good news; a new LUFA release!</p>
<p>This one is far, far overdue, but what with my month-long holiday back home, my recent move to a <a href="https://picasaweb.google.com/108771026244030052455/NewApartmentFebruary102013" title="Photos of new apartment.">new apartment</a> up in the mountains things got a bit behind. Actually, I was waiting for something else before I pulled the trigger; the release of the <a href="http://www.atmel.com/tools/atmelstudio.aspx" title="Atmel Studio downloads">public Atmel Studio 6.1 beta</a>.</p>
<p>The AS6.1 beta has a lot of the usual backend and front-end fixes, support for new devices&#8230;yadda yadda, you know the drill. However, it also brings support for something called the &#8211; well, uh, I&#8217;m not sure exactly, since it&#8217;s changed names internally half a dozen times &#8211; but I&#8217;ll call it the XDK since that&#8217;s the last monkier I heard for it. The XDK allows developers to package up your Atmel Studio 6.1 projects into dedicated extensions, so you can distribute them on the Atmel Gallery. It&#8217;s a little limited for now with plans for future expansion, but the important thing is that it&#8217;s given me the infrastructure I needed to finally offer a native <a href="http://gallery.atmel.com/Products/Details/d9b2f208-0721-4ce1-838d-8029c2a0259b" title="LUFA Atmel Studio Extension">LUFA extension</a>.</p>
<p>That means no more crazy <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__exporting_library.html" title="LUFA Exporting and Importing">manual exporting and importing</a> of the LUFA core, or trying to figure out what project options need to be set &#8211; all the demos and projects, as well as base templates, are made available as example projects, just like ASF. Configuration of the modules is done through the ASF wizard as well, so changing your board, device and adding/removing LUFA code modules can all be done through the GUI. It&#8217;s not perfect yet, but it&#8217;s a start, and I&#8217;d love for some public feedback from the new release package.</p>
<p>In any case, I&#8217;m not going through with a normal two week beta cycle for LUFA-130303, since the trunk code has been stable for some time now and pretty much continuously tested by myself and the community over the last few months. As a result, I feel very confident in going ahead with a full stable release immediately.</p>
<p>The Changelog for the new release is available <a href="http://fourwalledcubicle.com/files/LUFA/Doc/130303/html/_page__change_log.html" title="LUFA 130303 Changelog">here</a>, and the new release downloads can be found <a href="http://www.fourwalledcubicle.com/LUFA.php" title="LUFA Project Page">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/03/lufa-130303-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Travel, Trains and Tiny Robots</title>
		<link>http://fourwalledcubicle.com/blog/2013/01/travel-trains-and-tiny-robots/</link>
		<comments>http://fourwalledcubicle.com/blog/2013/01/travel-trains-and-tiny-robots/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 15:42:33 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[Atmel Employment]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Misc.]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[University]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1168</guid>
		<description><![CDATA[So yeah, this blog thing. I guess in retrospect I shouldn&#8217;t have neglected it as long as I have, but in my defense, I&#8217;ve been darn busy these last few months. Late last year our team&#8217;s responsibilities changed from ASF development (that&#8217;s the giant framework inside Atmel Studio, also available as a standalone download) to [...]]]></description>
				<content:encoded><![CDATA[<p>So yeah, this blog thing. I guess in retrospect I shouldn&#8217;t have neglected it as long as I have, but in my defense, I&#8217;ve been darn busy these last few months.</p>
<p>Late last year our team&#8217;s responsibilities changed from ASF development (that&#8217;s the <a href="http://www.atmel.com/asf" title="Atmel ASF Main Page">giant framework</a> inside Atmel Studio, also available as a standalone download) to NPI work &#8211; the &#8220;N&#8221; and &#8220;P&#8221; of which stand for &#8220;New&#8221; and &#8220;Product&#8221;, and I assume the &#8220;I&#8221; means &#8220;Introduction&#8221; &#8211; and that&#8217;s caused some massive shifted gears in my brain while the rest of me tries to catch up. It&#8217;s interesting work, and fun too since I get to <del>argue</del> discuss nitty-gritty details with my co-workers and really make a difference. At least, that&#8217;s how it seems now, but I guess ultimately time will tell.</p>
<h1>Customer Visit</h1>
<p>In September last year I was put on a difficult customer support case. One of those really nasty ones: <i>&#8220;we stopped production because of a x% failure rate in y% devices, after around Z hours of use.&#8221;</i> Several weeks, some lab testing and a veritable ton of code inspection later I was suddenly thrown into a brand new situation; the in-person Customer Support Visit (cue dramatic music). Sometimes you need to roll up your sleeves (actually, first I needed to obtain some branded Atmel shirts, so I would had sleeves to roll up) and get on-site to diagnose the really difficult problems.</p>
<p>Within 24 hours of the request from the customer my travel plans were approved, my flights booked and my hotels reserved, and I was on my way over to Scotland. To say I was nervous was an understatement; while I don&#8217;t mind traveling, I&#8217;m not known for my confidence in new and scary situations. Still my boss and my co-workers did a bang-up job in keeping my spirits up and my lunch down, and before long I was settling in on-site and seeing what I could do to help.</p>
<p>My dad used to travel quite a bit for his work, and I always remember him saying that business trips are boring, since all you get to see are airports and factories. Boy, was he right. I can now say I&#8217;ve been to Scotland, but the only sites I really got to see were the airport, three (!) hotels and a hospital-like customer site. I did see a &#8220;Postman Pat&#8221; style mail van which was quite endearing:</p>
<p align="center"><a title="Scottish Mail Van" href="http://www.fourwalledcubicle.com/img/Blog/PostmanPat.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/PostmanPat.jpg" width="430" height="323" /></a></p>
<p>But other than that it was just hotel:</p>
<p align="center"><a title="Scottish Hotel" href="http://www.fourwalledcubicle.com/img/Blog/ScotlandHotel1.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/ScotlandHotel1.jpg" width="430" height="323" /></a></p>
<p>After hotel:</p>
<p align="center"><a title="Scottish Hotel" href="http://www.fourwalledcubicle.com/img/Blog/ScotlandHotel2.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/ScotlandHotel2.jpg" width="430" height="323" /></a></p>
<p>Although in the latter case, I did get to sit on the world&#8217;s largest cushion:</p>
<p align="center"><a title="The world's largest freaking cushion. Impractical for all purposes." href="http://www.fourwalledcubicle.com/img/Blog/WorldsLargestCushion.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/WorldsLargestCushion.jpg" width="323" height="430" /></a></p>
<p>And try a local drink called &#8220;Irn Bru&#8221;, which I assume is Scottish for &#8220;Flurecent Orange Creamy Soda&#8221;.</p>
<p align="center"><a title="Scotland's &lt;i&gt;other&lt;/i&gt; national drink." href="http://www.fourwalledcubicle.com/img/Blog/IronBru.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/IronBru.jpg" width="430" height="323" /></a></p>
<p>And I also tried Haggis. Worryingly, it tasted <i>exactly</i> like the filling of an Australian meat pie. All in all, it was a great learning experience, and I got to see how a real-world factory works from PCB production right down to final assembly and packaging.</p>
<h1>Visit Home</h1>
<p>Right after my customer visit I was on to more traveling; this time, back to familiar places. I was selected to be a support engineer for the Australian &#8220;Tech on Tour&#8221; training sessions held in Sydney and my home town of Melbourne in November last year. This is the first year I am aware of that Atmel&#8217;s run first-party training sessions, so it was a fantastically happy coincidence as I was then able to take a holiday off for Christmas directly afterwards.</p>
<p align="center"><a title="My Atmel Tech on Tour Staff Badge." href="http://www.fourwalledcubicle.com/img/Blog/AusTechOnTour.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/AusTechOnTour.jpg" width="430" height="323" /></a></p>
<p>The ToT trainings went quite well, minus a few minor hiccups like the conference room Wifi falling over in the first 10 minutes (Melbourne) and the air conditioning being unable to cope with 20 people and 20 computers (Sydney). This was another great first experience for me as I got to interact directly with customers, helping them with issues and listening to feedback for my team. While in University I toyed with the idea of becoming a lecturer rather than a engineer in the field, so this was a chance to experience a bit of that without the drastic career change.</p>
<p>I was thrilled to see my fellow AVRFreaks friends in Melbourne again and I finally got to meet the (in?)famous John Samperi over in the Sydney training, who was must less grouchy in person that I was expecting (kidding John!). The Sydney event was completed with one of the attendees asking me to sign his JTAG-ICE3. I guess that means I&#8217;m finally popular &#8211; take that, highschool.</p>
<p>While home I got to eat good food again (finally!):</p>
<p align="center"><a title="This is why I came home. On of the reasons, anyway." href="http://www.fourwalledcubicle.com/img/Blog/DecentAusFood.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/DecentAusFood.jpg" width="430" height="323" /></a></p>
<p>Spend Christmas with family:</p>
<p align="center"><a title="More food, and people." href="http://www.fourwalledcubicle.com/img/Blog/Christmas2012.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/Christmas2012.jpg" width="323" height="430" /></a></p>
<p>And ride on the largest miniature railway in the Southern Hemisphere (not pictured: me):</p>
<p align="center"><a title="Not pictured: me. Or anyone else I know - but this is a nice shot anyway." href="http://www.fourwalledcubicle.com/img/Blog/MiniatureRailway.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/MiniatureRailway.jpg" width="430" height="323" /></a></p>
<p>All of which was good fun. While at home I also spent a little time helping out a friend with his LEAP robot:</p>
<p align="center"><a title="A FPGA drives the whole thing. A mobile phone camera provides (very slow) remote image viewing from the robot's perspective." href="http://www.fourwalledcubicle.com/img/Blog/LEAPRobot.jpg" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://www.fourwalledcubicle.com/img/Blog/LEAPRobot.jpg" width="430" height="323" /></a></p>
<p>Which he was building for our old University to be used as a marketing tool. I was tasked with making an Android frontend for it, so that users could control it via Bluetooth from their mobile phone. I kinda like Android development now that I&#8217;ve had a little more exposure to it, so perhaps I&#8217;ll explore it a bit more in the future.</p>
<h1>Back in Trondheim</h1>
<p>I was more than a little bit sad to leave Melbourne again, not only because I was once again leaving my family behind, but this time also my girlfriend. Living alone comes with an adjustment; the largest one is trying to find a new apartment (the building I am currently renting is being sold). That comes with a set of new challenges, although so far I&#8217;m coping fairly well.</p>
<p>Stay tuned for an update on LUFA soon, since we&#8217;re overdue for a release. I leave you now with a sneak preview of what I&#8217;ve been working on over the last few weeks:</p>
<p align="center"><a title="LUFA - soon to be a native Atmel Studio extension." href="http://pbs.twimg.com/media/BA9xwLrCUAAiQky.png:large" rel="lightbox|ttrt"><img class="alignnone" alt="" src="http://pbs.twimg.com/media/BA9xwLrCUAAiQky.png:large" width="430" height="323" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2013/01/travel-trains-and-tiny-robots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LUFA and the Arduino Leonardo</title>
		<link>http://fourwalledcubicle.com/blog/2012/08/lufa-and-the-arduino-leonardo/</link>
		<comments>http://fourwalledcubicle.com/blog/2012/08/lufa-and-the-arduino-leonardo/#comments</comments>
		<pubDate>Mon, 20 Aug 2012 16:03:49 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1149</guid>
		<description><![CDATA[Just a quick update, because I know I&#8217;m going to get email on this otherwise. If you&#8217;re looking to use LUFA on the Arduino Leonardo board, here&#8217;s what you have to do. Firstly, you need the current trunk version of LUFA &#8211; not the latest release. Not only does the latest trunk have board hardware [...]]]></description>
				<content:encoded><![CDATA[<p>Just a quick update, because I <i>know</i> I&#8217;m going to get email on this otherwise. If you&#8217;re looking to use LUFA on the Arduino Leonardo board, here&#8217;s what you have to do.</p>
<p>Firstly, you need the current <b>trunk</b> version of LUFA &#8211; not the latest release. Not only does the latest trunk have board hardware definitions that the current release lacks, but it also contains a (preliminary) compatibility fix to the core to make it work with the Leonardo bootloader. Special thanks to Simon Inns for both his debugging help and the donation of an Arduino Leonardo board so that I can continue my development efforts with it. You can <a href="http://www.lufa-lib.org/latest-archive">download the latest LUFA trunk here</a>.</p>
<p>Secondly (Windows only), you&#8217;ll need to have downloaded the Arduino 1.0 IDE from the Arduino website. You&#8217;ll need this for two reasons; firstly, you&#8217;ll need the driver INF file it contains in the <i>arduino-1.0\drivers</i> directory, and secondly, you&#8217;ll need the Windows build of the AVRDUDE application that it includes in the <i>arduino-1.0\hardware\tools\avr\bin</i>. You need to add the latter to your system PATH variable so that you can run it from any folder from the command line. You can <a href="http://arduino.cc/en/Main/Software">download the Arduino 1.0 IDE from here</a>.</p>
<p>Thirdly, you&#8217;ll need to alter the project makefile that you want to compile. The relevant makefile magic here is:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="make" style="font-family:monospace;">MCU          <span style="color: #004400;">=</span> atmega32u4 <span style="color: #339900; font-style: italic;"># Change this</span>
BOARD        <span style="color: #004400;">=</span> LEONARDO <span style="color: #339900; font-style: italic;"># And this</span>
F_CPU        <span style="color: #004400;">=</span> <span style="color: #CC2200;">16000000</span> <span style="color: #339900; font-style: italic;"># And finally this</span>
&nbsp;
AVRDUDE_PROGRAMMER <span style="color: #004400;">=</span> avr109 <span style="color: #339900; font-style: italic;"># Add this</span>
AVRDUDE_PORT <span style="color: #004400;">=</span> COM32 <span style="color: #339900; font-style: italic;"># And this too (use your correct COM port)</span></pre></td></tr></table></div>

<p>Those are the only lines that need to be changed from the standard LUFA makefile template. Note that on my system the bootloader appears as COM32, but on your system this will no doubt be different, so alter the <b>AVRDUDE_PORT</b> line to suit your own environment. If you use Linux, this line will most likely be <i>/dev/ttyACM0</i> or another similarly named virtual USB TTY device.</p>
<p>That&#8217;s it &#8211; with the small changes to the project makefiles, you can then download a new application by <b>pressing the reset button on the board, and running <i>make avrdude</i> from the command line</b> shortly afterwards (while the L LED is still fading in an out to signal the bootloader is running).</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2012/08/lufa-and-the-arduino-leonardo/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>LUFA 120730 Released!</title>
		<link>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-released/</link>
		<comments>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-released/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 18:29:10 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1144</guid>
		<description><![CDATA[It&#8217;s been a whole two weeks, and surprisingly there weren&#8217;t any real &#8220;you&#8217;ve done screwed up&#8221; emails sent to me about any horrible show-stoppers in the beta release, so I&#8217;m now calling the latest trunk stable and tagging it today as the LUFA 120730 release as planned. This release has been one of the more [...]]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a whole two weeks, and surprisingly there weren&#8217;t any real &#8220;you&#8217;ve done screwed up&#8221; emails sent to me about any horrible show-stoppers in the beta release, so I&#8217;m now calling the latest trunk stable and tagging it today as the LUFA 120730 release as planned.</p>
<p>This release has been one of the more tumultuous ones, as it&#8217;s the first made while I&#8217;ve had a full time job. In it I&#8217;ve tried to incorporate some of the new techniques I&#8217;m learning towards maintaining large software projects, but it&#8217;s also been significantly hampered by my lack of enthusiasm overall towards coding after a long day of, well, coding. I&#8217;m not saying I&#8217;m giving up by any means, but I&#8217;ve had to downgrade my overly enthusiastic future timelines to reflect reality a little. Lessons learned.</p>
<p>So, this release seems relatively short in the <a title="LUFA 120730 Changelog" href="http://fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__change_log.html">changelog area</a>, but that&#8217;s somewhat deceptive as some of the changes are either back-end that don&#8217;t need changelog entries, or covered under a single line umbrella entry. There&#8217;s a new set of build tests (still not unit tests on real hardware I&#8217;m afraid, but the current smoke tests and static analysis still help) as well as the totally revamped build system, which paves the way slowly to a mufti-architecture future. The core now &#8220;kinda&#8221; works on the XMEGA platforms &#8212; <em>but it is still not complete nor fully tested</em> &#8212; and for once the limiting factor is revamping the board system (a comparatively simple, yet tedious task) and not the build system, demos or core. That&#8217;s a good thing. I&#8217;ve also reorganized the documentation to put the more useful bits right in the sidebar once again, to style it a little better, and to add new important documentation like a list of known issues for each supported architecture.</p>
<p>With this release I&#8217;m also moving the official GIT mirror from <a title="Legacy LUFA GitHub mirror" href="https://github.com/abcminiuser/lufa-lib/">this GitHub entry</a> to <a title="LUFA GitHub mirror" href="https://github.com/abcminiuser/lufa">this one instead</a>. I will continue to maintain the old repository mirror and you can still use that if you wish, but the new entry doesn&#8217;t suffer from the wrongly imported SVN repository issue that the older one has, which means simpler forks and smaller downloads. Also, automated <a title="LUFA release tags" href="https://github.com/abcminiuser/lufa/tags">tags are now actually a thing</a>.</p>
<p>Thank you to the LUFA community for helping out, contributing and above all putting up with my relatively slow progress as of late. I realize people deserve better, thus I will attempt to redouble my efforts as much as I can in the future.</p>
<p><b>Without further ado:</b><br />
<a title="LUFA 120730 Release" href="http://lufa-lib.googlecode.com/files/LUFA-120730.zip">LUFA 120730 Release Download</a><br />
<a title="LUFA 120730 Prebuilt Documentation" href="http://www.fourwalledcubicle.com/files/LUFA/Doc/LUFA-120730-Documentation.zip">LUFA 120730 Prebuilt Documentation Download</a><br />
<a title="LUFA 120730 Online Documentation" href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/">LUFA 120730 Online Documentation Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LUFA 120730 BETA Released!</title>
		<link>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-beta-released/</link>
		<comments>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-beta-released/#comments</comments>
		<pubDate>Mon, 16 Jul 2012 17:39:26 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1138</guid>
		<description><![CDATA[Well, this evening I finally caved, and packaged up the current LUFA trunk as a new 120730-BETA release. It&#8217;s been too long since the last release darnit, and since an increasing number of support threads on the LUFA list are resolved with &#8220;download the latest trunk&#8221;, I thought now&#8217;s as good a time as any [...]]]></description>
				<content:encoded><![CDATA[<p>Well, this evening I finally caved, and packaged up the current LUFA trunk as a new 120730-BETA release. It&#8217;s been too long since the last release darnit, and since an increasing number of support threads on the LUFA list are resolved with &#8220;download the latest trunk&#8221;, I thought now&#8217;s as good a time as any for the next release cycle. Without further ado, the appropriate links:</p>
<p><a href="http://lufa-lib.googlecode.com/files/LUFA-120730-BETA.zip">LUFA 120730 BETA Download</a><br />
<a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/LUFA-120730-BETA-Documentation.zip">LUFA 120730 BETA Prebuilt Documentation</a><br />
<a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/">LUFA 120730 BETA Online Documentation</a><br />
<a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__change_log.html">LUFA 120730 Changelog</a></p>
<p>Please download and test during the next two weeks, so that any unknown issues can be uncovered and patched before the full release is made. This release contains may bug fixes and new features, including some additional board drivers, a new &#8220;<i>SerialToLCD</i>&#8221; user project contributed by Simon Foster, the new LUFA build system, and fixes to the known broken demos and applications. Once again, thanks also to the great LUFA community!</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2012/07/lufa-120730-beta-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recent LUFA changes</title>
		<link>http://fourwalledcubicle.com/blog/2012/07/recent-lufa-changes/</link>
		<comments>http://fourwalledcubicle.com/blog/2012/07/recent-lufa-changes/#comments</comments>
		<pubDate>Sat, 14 Jul 2012 14:44:33 +0000</pubDate>
		<dc:creator>Dean Camera</dc:creator>
				<category><![CDATA[Atmel Employment]]></category>
		<category><![CDATA[LUFA (Formerly MyUSB) Library]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://fourwalledcubicle.com/blog/?p=1126</guid>
		<description><![CDATA[Yikes, time runeth away once again. Not much has happened in the last few weeks, except my probation period ending, making me an official full-time Atmel employee now, and my reluctant starring in a new set of pilot videos: Since it&#8217;s been so darn long since I posted about something technical that I thought I&#8217;d [...]]]></description>
				<content:encoded><![CDATA[<p>Yikes, time runeth away once again. Not much has happened in the last few weeks, except my probation period ending, making me an official full-time Atmel employee now, and my reluctant starring in a new set of pilot videos:</p>
<p><iframe width="480" height="270" src="http://www.youtube.com/embed/32CkOkpOcSc" frameborder="0" allowfullscreen></iframe></p>
<p>Since it&#8217;s been so darn long since I posted about something technical that I thought I&#8217;d try doing that today.</p>
<p><br/></p>
<p>So, I&#8217;ll admit it, I&#8217;ve been putting off proper LUFA development over the past few weeks, since the next step in my quest to refactor things to the point where multi-architecture demos can become a reality requires an awful lot of work. And not fun work either, mechanical &#8220;<em>I would script this if it was practical</em>&#8221; type of mechanical work. That&#8217;s not to say I&#8217;ve been sitting around idle, it just means I&#8217;ve been focusing my time learning some fun new things and performing other refactoring tasks (in addition to support and bug fixing). So here&#8217;s what I&#8217;ve been up to.</p>
<h3>The LUFA Board System:</h3>
<p>A problem lies in the current board driver system: currently each board has a folder full of individual hardware driver header files, with the actual driver code implemented as inline C functions for speed and size reasons. in the user application, you set your <strong><code>BOARD={Something}</code></strong> value in your project makefile, include the relevant <code>&lt;LUFA/Drivers/Board/XXXX.h&gt;</code> driver in your code and away you go. If the application is recompiled with a different BOARD setting, the driver dispatch header automatically picks the appropriate driver, or defers to a <code>&lt;Board/XXXX.h&gt;</code> header in your application directory. Wonderful.</p>
<p>Or at least, wonderful if you are using a board that has the same features as the USBKEY board I develop with, since that&#8217;s how I design the UI for the demos that ship with LUFA. If you use a different board without a Joystick for example and try to compile the Keyboard demo, you&#8217;ll get an error about not being able to find a Buttons.h and Joystick.h driver. Fixing this requires manual tweaking of the demos, which isn&#8217;t very nice to newcomers.</p>
<p>So, the plan I&#8217;ve come up with is to replace the current board system, leading me into the gigantic ball of apathy that you&#8217;ve all seen over the last month. This requires the creation of a new per-board board.h header file to act as the new board driver header, which will be include in all user projects. This header file will in turn include all the board specific drivers, but also include a new <code>Board_Init()</code> function to automatically initialize all the board hardware.</p>
<p>Doing this will allow all the user applications to just include the one board driver header file, rather than having to pick-and-choose the individual driver headers. It will also mean cleaner initialization code, but most importantly it will mean compile time detection in the user code of the board driver features. With this new system I will be able to change the demos to detect if a joystick, buttons or other hardware is available and automatically provide some sort of demo UI to suit the board being targeted. No more compile errors.</p>
<p>I&#8217;m tossing up whether to press ahead with a new LUFA release in the meantime or to wait until I find enough time to undertake this &#8211; does anyone have any thoughts on this?</p>
<h3>The LUFA Documentation:</h3>
<p>So, with the <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=20120712153019.GA37106%40stack.nl&#038;forum_name=doxygen-announce" title="Doxygen 1.8.1 release news post">new release of Doxygen 1.8.1</a> I&#8217;ve done a bit of spurcing up of the LUFA documentation. I&#8217;ve gone and re-tweaked my small customizations to the standard theme &#8211; I can&#8217;t do visual design at all, but I found something I liked a bit more than the defaults &#8211; and fixed up the documentation index. In the <a href="http://fourwalledcubicle.com/files/LUFA/Doc/120219/html/" title="LUFA 120219 Documentation">previous 120209 documentation</a> a lot of the helpful pages were shoved in a &#8220;Related Pages&#8221; node due to a Doxygen bug, which is no more in the new release. To commemorate that, I&#8217;ve cleaned up the ordering and structure a bit to make things a bit easier to read. I&#8217;ve uploaded a temporary export of <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/" title="LUFA-next Documentation">what the new documentation will look like</a>, where you can see the new index page list.</p>
<p>In addition, I&#8217;ve added some new pages listing <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__known_issues.html">known issues</a> I need to fix up, <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__build_system.html">the new LUFA build system</a> (more on that in a moment), added more information giving <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__compiling_apps.html">the prerequisites for building on both Windows and Linux platforms</a> and showing <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__exporting_library.html">one way that you can export the library core</a> for importing and use in Atmel Studio 6 projects.</p>
<p>No groundbreaking changes, but any improvements are always a good thing, and I think this is one small step towards making the project as a whole a little more accessible to new developers.</p>
<h3>The LUFA Build System:</h3>
<p>I finally got completely fed up with the current build system &#8211; having a gigantic 600+ line makefile in every application directory was killing me due to the maintenance requirements, and frustrating users due to the apparent complexity. The LUFA makefiles were built from the public domain template found in the old obsolete <a href="http://www.sax.de/~joerg/mfile/" title="MFile project homepage">MFile project</a> subcomponent of the now obsolete <a href="http://winavr.sourceforge.net/" title="WinAVR project homepage">WinAVR project</a> with a few additional tweaks to make them useful for LUFA based projects. However, inside each of these giant makefiles was a huge amount of repeated &#8220;magic&#8221; rules that most people will never touch, and a select few variables that need to be adjusted for different build targets. Other problems were crazy error messages if things went wrong in some way, untracked dependencies causing odd build behaviours if multiple make targets were invoked at the same time, and output files generated from stale object files in some cases.</p>
<p>To combat this, I&#8217;ve created my own &#8211; yes, I&#8217;ll wait a moment for you to finish cringing &#8211; build system for LUFA. This is actually just a set of loosely coupled makefile modules, which can be included in the application makefile to obtain additional functionality. I think this is the best solution, as it allows me to edit the modules all in one place, and have the changes propagate automatically out to all the library applications. It also means I can fix up all the problems in the above, so the new modules have proper dependency tracking, and give sane error messages when things go wrong.</p>
<p><a href="https://code.google.com/p/lufa-lib/source/browse/trunk/Demos/Device/ClassDriver/Keyboard/makefile?r=2400">Here&#8217;s an example of what a typical project makefile looks like</a>, contrasted to <a href="https://code.google.com/p/lufa-lib/source/browse/trunk/Demos/Device/ClassDriver/Keyboard/makefile?r=2263">what we have in the current 120219 release</a>. It&#8217;s a big change, and I really think it&#8217;s a great improvement. You can now get some nice build help by running <code>make help</code> from any makefile that uses the CORE LUFA build system module, listing all the available targets and other relevant information. There&#8217;s also the aforementioned <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__build_system.html" title="LUFA build system documentation">new chapter of the manual</a> with detailed documentation on how to use it. Of course, the manual has also been updated to <a href="http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__configuring_apps.html#Sec_AppConfigParams">give an application makefile template</a> and explain the new makefile variables.</p>
<p>I&#8217;m quite proud of this, and I&#8217;ve learned an awful lot of the ins-and-outs of GNU Make while on my quest to build it. I&#8217;ve been considering opening up the build system into a separate public-domain project so that it can be adopted everywhere, rather than the crazy makefile template everyone is currently using.</p>
<h3>New LUFA Git Mirror:</h3>
<p>When I first made the <a href="https://github.com/abcminiuser/lufa-lib/" title="LUFA Public Git mirror">LUFA Git repository mirror</a>, I made a bit of a boo-boo, as I forgot the &#8220;<code>--stdlayout</code>&#8221; switch when creating the initial GIT-SVN import. That has resulted in the current GIT mirror containing a literal import of the LUFA SVN repository layout, with tags and branches being located in the sole master branch of the GIT tree, something I didn&#8217;t notice until it was too late to try to change it.</p>
<p>After a couple of different people emailed me about it over the last few months &#8211; including one very helpful one from a LUFA fan with some great insights into how best to fix it &#8211; I&#8217;ve gone ahead and <a href="https://github.com/abcminiuser/lufa/" title="New LUFA public Git mirror">made a second public Git mirror</a> with the imported layout corrected. This new repository will be switched over to become the official mirror soon once I&#8217;m satisfied nothing has broken, with the existing mirror still being deprecated but still maintained for those who depend on it. The new GIT mirror has the tags properly added as read Git tags, and this now results in downloads of the <a href="www.lufa-lib.org/latest-archive" title="Latest archived ZIP or TAR of LUFA HEAD">current HEAD of LUFA</a> being around 5mb rather than the >30mb it used to be.</p>
<p><br/></p>
<p>So that&#8217;s the latest LUFA news.</p>
]]></content:encoded>
			<wfw:commentRss>http://fourwalledcubicle.com/blog/2012/07/recent-lufa-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
