<?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>coding &#187; arm</title>
	<atom:link href="http://www.coding.com.br/tag/arm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coding.com.br</link>
	<description>have you coded today?</description>
	<lastBuildDate>Thu, 18 Aug 2011 17:29:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>BeagleBoard and Ubuntu 11.04 (beta 1) headless install</title>
		<link>http://www.coding.com.br/ubuntu/beagleboard-and-ubuntu-11-04-beta-1-headless-install/</link>
		<comments>http://www.coding.com.br/ubuntu/beagleboard-and-ubuntu-11-04-beta-1-headless-install/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 03:57:45 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[arm]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1660</guid>
		<description><![CDATA[Ubuntu OMAP team is doing a really good job by adding a headless installation of 11.04 release. I had a good impression trying on BeagleBoard (revC) and the process is straightforward (read the documentation) but I needed made a slight change at u-boot bootcmd env, so I decided share:
mmc init
mmc rescan 0
fatload mmc 0 0&#215;82000000 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Ubuntu <a href="https://wiki.ubuntu.com/ARM/OMAP" target="_blank">OMAP</a> team is doing a really good job by adding a <em><a href="https://wiki.ubuntu.com/ARM/OMAPHeadlessInstall" target="_blank">headless installation</a></em> of 11.04 <a href="http://cdimage.ubuntu.com/ubuntu-headless/releases/11.04/beta-1/" target="_blank">release</a>. I had a good impression trying on BeagleBoard (revC) and the process is straightforward (read the documentation)<em> but</em> I needed made a slight change at u-boot <em>bootcmd</em> env, so I decided share:</p>
<p style="padding-left: 30px;">mmc init<br />
<strong>mmc rescan 0</strong><br />
fatload mmc 0 0&#215;82000000 boot.scr<br />
source 0&#215;82000000</p>
<p>After install&#8230; I put a usb/ethernet dongle and got fully supported by APT syncing from <a href="http://ports.ubuntu.com" target="_blank">ports.ubuntu.com</a> <img src='http://www.coding.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p style="text-align: center;"><img class="aligncenter" title="BeagleBoard + USB/Ethernet dongle" src="http://farm5.static.flickr.com/4105/5612224154_5f56dcd14c.jpg" alt="My Beagle setup" width="500" height="375" /></p>
<p style="text-align: left;">I suggest try it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/ubuntu/beagleboard-and-ubuntu-11-04-beta-1-headless-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Buildroot toolchain for Nuttx</title>
		<link>http://www.coding.com.br/embarcado/installing-buildroot-toolchain-for-nuttx/</link>
		<comments>http://www.coding.com.br/embarcado/installing-buildroot-toolchain-for-nuttx/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 06:44:42 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[cortex-m3]]></category>
		<category><![CDATA[lpc1768]]></category>
		<category><![CDATA[nuttx]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1436</guid>
		<description><![CDATA[On my previous post I discussed some stats using Buildroot toolchain to build Nuttx. Today I&#8217;ll add the necessary steps to build on Ubuntu. Ubuntu is de-facto GNU/Linux distribution (although I&#8217;m Gentoo user) and many users, from different areas, uses it [they are not necessary command line experts] so I decided to publish my raw [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">On my <a href="http://www.coding.com.br/embarcado/compiler-for-nuttx/" target="_blank">previous</a> post I discussed some stats using Buildroot toolchain to build Nuttx. Today I&#8217;ll add the necessary steps to build on Ubuntu. Ubuntu is<em> de-facto</em> GNU/Linux distribution (although I&#8217;m Gentoo user) and many users, from different areas, uses it [they are not necessary command line experts] so I decided to publish my <em>raw</em> tutorial. If you are familiarized installing files from source-code you probably won&#8217;t need this&#8230;</p>
<h2>1. Dependencies</h2>
<p style="padding-left: 30px;">$ sudo apt-get install libncurses5-dev<br />
$ sudo apt-get install bison<br />
$ sudo apt-get install flex<br />
$ sudo apg-get install libgmp3-dev<br />
$ sudo apg-get install libmpc-dev<br />
$ sudo apg-get install libmpfr-dev<br />
$ sudo apg-get install binutils-dev</p>
<h2>2. Download</h2>
<p style="padding-left: 30px;">$ mkdir Nuttx<br />
$ cd Nuttx</p>
<p style="padding-left: 30px;">$ wget http://sourceforge.net/projects/nuttx/files/nuttx/nuttx-5.10/nuttx-5.10.tar.gz/download<br />
$ wget http://sourceforge.net/projects/nuttx/files/buildroot/buildroot-1.8/buildroot-1.8.tar.gz/download</p>
<p style="padding-left: 30px;">$ ls<br />
buildroot-1.8.tar.gz  nuttx-5.10.tar.gz</p>
<h2>3. Install</h2>
<p style="padding-left: 30px;">$ tar zxf buildroot-1.8.tar.gz<br />
$ tar zxf nuttx-5.10.tar.gz</p>
<p style="padding-left: 30px;">$ cd misc/<br />
$ ln -s ../nuttx-5.10 nuttx</p>
<p>You need define some Nuttx files before:</p>
<p style="padding-left: 30px;">$ cd nuttx/<br />
$ cd tools/<br />
$ ./configure.sh nucleus2g/nsh # or ./configure &lt;board-name&gt;<br />
$ cd -</p>
<p style="padding-left: 30px;">$ cd ../misc</p>
<p>I&#8217;m building a <em>toolchain</em> for arm cortex-m3 but check configs/ to other configuration files.</p>
<p style="padding-left: 30px;">$ cd buildroot-1.8/<br />
$ cp configs/cortexm3-defconfig-4.3.3 .<br />
$ mv cortexm3-defconfig-4.3.3 .config</p>
<p style="padding-left: 30px;">$ make menuconfig<br />
[If you don't have any changes, just click on 'exit' and save the configuration]</p>
<p style="padding-left: 30px;">$ make<br />
[will download and build all necessary files]</p>
<p style="padding-left: 30px;">$ cd build_arm_nofpu/staging_dir/bin<br />
$ export PATH=`pwd`:$PATH<br />
$ cd -</p>
<p style="padding-left: 30px;">$ cd ../nuttx<br />
[use normally]</p>
<p>I usually create an script to (re)define the $PATH for necessary building tools, something like:</p>
<p style="padding-left: 30px;">$ echo &#8220;export PATH=\&#8221;"$PATH&#8221;\&#8221;" &gt; compiler.sh</p>
<p style="padding-left: 30px;">
<p style="padding-left: 30px;">
<p style="padding-left: 30px;">
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/installing-buildroot-toolchain-for-nuttx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiler for Nuttx</title>
		<link>http://www.coding.com.br/embarcado/compiler-for-nuttx/</link>
		<comments>http://www.coding.com.br/embarcado/compiler-for-nuttx/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 21:09:41 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[cortex-m3]]></category>
		<category><![CDATA[lpc1768]]></category>
		<category><![CDATA[nuttx]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1414</guid>
		<description><![CDATA[I was following this thread on Nuttx maillist on recommended compiler to build Nuttx RTOS. As a matter of practicality I guess that many users use CodeSourcery arm-none-linux-gnueabi but today I decided test the code generated for Cortex-M3 (LPC1768) using the toolchain from Buildroot. As Greg Nutt said (text adapted):
They were configured using OABI [old arm ABI], but [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I was following this <a href="http://article.gmane.org/gmane.comp.embedded.nuttx/102" target="_blank">thread</a> on Nuttx maillist on recommended compiler to build <a href="http://nuttx.sf.net">Nuttx RTOS</a>. As a matter of practicality I guess that many users use CodeSourcery <em><a href="http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi.bin" target="_blank">arm-none-linux-gnueabi</a> </em>but today I decided test the code generated for Cortex-M3 (LPC1768) using the <em>toolchain</em> from <a href="http://sourceforge.net/projects/nuttx/files/buildroot/buildroot-1.8/" target="_blank">Buildroot</a>. As Greg Nutt said (text adapted):</p>
<blockquote><p><em>They were configured using OABI [old arm ABI], but I prefer them because (1) they are not EABI and reliably link code with -O3 or -Os, making it up to half the size, and (2) include nuttx &#8220;built in&#8221; &#8212; they really should be called arm-nuttx-gcc tools.</em></p></blockquote>
<p>Here my stats (<a href="http://www.coding.com.br/wp-content/uploads/2010/09/defconfig.txt" target="_blank">defconfig</a>):</p>
<p style="padding-left: 30px;">$ arm-none-eabi-size nutt<br />
text         data   bss       dec        hex      filename<br />
71000     324    2248   73572   11f64   nuttx</p>
<p style="padding-left: 30px;">$ arm-elf-size nuttx<br />
text         data    bss      dec         hex     filename<br />
56172     330    2248   58750    e57e   nuttx</p>
<p style="text-align: justify;">The final .bin has an <em>delta</em> of 16K. As I&#8217;m using one <a href="http://en.wikipedia.org/wiki/Wiggler_(JTAG)" target="_blank">parallel</a> JTAG (flash rates @ 0.2 KiB/S) this means almost <strong>1 minute</strong> reduction in each flash <a href="http://openocd.berlios.de/doc/html/Flash-Commands.html#Flash-Commands" target="_blank"><em>write_image</em></a>. If you check <a href="http://nuttx.cvs.sourceforge.net/viewvc/nuttx/nuttx/configs/nucleus2g/nsh/Make.defs?revision=1.2&amp;view=markup" target="_blank">Make.defs</a> note that MAXOPTIMIZATION for CodeSourcery isn&#8217;t using <em>optimize for size</em> option (-Os). As explained on config/&lt;board&gt;/<a href="http://nuttx.cvs.sourceforge.net/viewvc/nuttx/nuttx/configs/nucleus2g/README.txt?revision=1.6&amp;view=markuphttp://nuttx.cvs.sourceforge.net/viewvc/nuttx/nuttx/configs/nucleus2g/README.txt?revision=1.6&amp;view=markup" target="_blank">README.txt</a> it doesn&#8217;t work with this kind of optimization level [tested with 2009q1].</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/compiler-for-nuttx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Opcode stats</title>
		<link>http://www.coding.com.br/embarcado/opcode-stats/</link>
		<comments>http://www.coding.com.br/embarcado/opcode-stats/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 00:09:50 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1128</guid>
		<description><![CDATA[I was trying some GCC options and decided see how they affect assembly code generated. I&#8217;ve created a simple Python script that parses .s output and put in a human readable way. Suppose the classical Hello World program. The output will be something like:
$ python stats_opcodes.py file
For Cortex-m3 (check previous post):

At my laptop (x86):

 

Download the script here.
]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I was trying some GCC options and decided see how they affect assembly code generated. I&#8217;ve created a simple Python script that parses <em>.s</em> output and put in a human readable way. Suppose the classical <em>Hello World </em>program. The output will be something like:</p>
<p style="padding-left: 30px;">$ python stats_opcodes.py file</p>
<p>For Cortex-m3 (check <a href="http://www.coding.com.br/embarcado/cortex-m3-and-qemu/" target="_blank">previous</a> post):</p>
<p style="padding-left: 30px;"><img class="aligncenter size-full wp-image-1136" title="opcode-arm" src="http://www.coding.com.br/wp-content/uploads/2010/06/opcode-arm.png" alt="" width="304" height="194" /></p>
<p>At my laptop (x86):</p>
<p style="padding-left: 30px;"><img class="aligncenter size-full wp-image-1133" title="output" src="http://www.coding.com.br/wp-content/uploads/2010/06/opcodes1.png" alt="" width="306" height="194" /></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: small;"><span style="line-height: 19px; white-space: normal;"> </span></span></span></span></p>
<p style="text-align: center;">
<p>Download the script <a href="http://gist.github.com/raw/452170/db097f735c52ffd733d2060603c203982d53b79f/stats_opcode.py" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/opcode-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cortex-M3 and Qemu</title>
		<link>http://www.coding.com.br/embarcado/cortex-m3-and-qemu/</link>
		<comments>http://www.coding.com.br/embarcado/cortex-m3-and-qemu/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 15:08:10 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[cortex-m3]]></category>
		<category><![CDATA[qemu]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=1115</guid>
		<description><![CDATA[Just a small tip to test code generated for ARM Cortex-M3 using QEmu:
$ arm-none-eabi-gcc main.c -ggdb -mcpu=cortex-m3 -mthumb -T generic-m-hosted.ld
$ qemu-arm -cpu cortex-m3 ./a.out
You can download Code Sourcery toolchain here and QEmu here (also available from package management system of your favorite Linux distribution). Just unpack the toolchain associating the arm-201XqX/bin with your $PATH and run qemu.
]]></description>
			<content:encoded><![CDATA[<p>Just a small tip to test code generated for ARM Cortex-M3 using QEmu:</p>
<p><span style="color: #2040a0;">$ arm</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">none</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">eabi</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">gcc</span> <span style="color: #2040a0;">main</span>.<span style="color: #2040a0;">c</span> <span style="color: #4444ff;">-</span><span style="color: #2040a0;">ggdb</span> <span style="color: #4444ff;">-</span><span style="color: #2040a0;">mcpu</span><span style="color: #4444ff;">=</span><span style="color: #2040a0;">cortex</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">m3</span> <span style="color: #4444ff;">-</span><span style="color: #2040a0;">mthumb</span> <span style="color: #4444ff;">-</span><span style="color: #2040a0;">T</span> <span style="color: #2040a0;">generic</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">m</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">hosted</span>.<span style="color: #2040a0;">ld</span><br />
<span style="color: #2040a0;">$ qemu</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">arm</span> <span style="color: #4444ff;">-</span><span style="color: #2040a0;">cpu</span> <span style="color: #2040a0;">cortex</span><span style="color: #4444ff;">-</span><span style="color: #2040a0;">m3</span> ./<span style="color: #2040a0;">a</span>.<span style="color: #2040a0;">out</span></p>
<p style="text-align: justify;">You can download Code Sourcery toolchain <a href="http://www.codesourcery.com/sgpp/lite/arm/portal/release1294" target="_blank">here</a> and QEmu <a href="http://wiki.qemu.org/Download" target="_blank">here</a> (also available from package management system of your favorite Linux distribution). Just unpack the toolchain associating the arm-201XqX/bin with your $PATH and run qemu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/cortex-m3-and-qemu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stellaris EKK-LM3S9b96 Evaluation Kit (1)</title>
		<link>http://www.coding.com.br/embarcado/stellaris-ekk-lm3s9b96-evaluation-kit-1/</link>
		<comments>http://www.coding.com.br/embarcado/stellaris-ekk-lm3s9b96-evaluation-kit-1/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 03:15:21 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=864</guid>
		<description><![CDATA[O blog do Jê foi um dos canais brasileiros que anunciou o concurso promovido pela Texas Instruments e a revista Circuit Cellar. Como sempre tive curiosidade nos microcontroladores de 32bits da ARM resolvi me inscrever no concurso para receber o KIT. Com uma proposta semelhante (mas sem o concurso) a NXP, a um tempo atrás, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">O <a href="http://blogdoje.com.br/2010/01/29/texas-instruments-design-stellaris-2010-contest" target="_blank">blog do Jê</a> foi um dos canais brasileiros que anunciou o concurso promovido pela Texas Instruments e a revista Circuit Cellar. Como sempre tive curiosidade nos microcontroladores de 32bits da ARM resolvi me inscrever no concurso para <em>receber</em> o KIT. Com uma proposta semelhante (mas sem o concurso) a NXP, a um tempo atrás, distribuiu alguns microcontroladores da família LPC. Conheço muitos &#8220;hobbistas&#8221; que pediram as amostras mas assim que chegaram os custos para fazer uma placa (mesmo que um <em>design</em> simples para testar a funcionalidade) tornou o projeto inviável. A idéia do kit de desenvolvimento, na minha opinião, tende a popularizar melhor o uso (principalmente para quem gosta de fuçar).</p>
<p><a href="http://www.coding.com.br/wp-content/uploads/2010/04/4493235551_3214e1f7fd.jpg"><img class="aligncenter size-medium wp-image-865" title="Caixa com o kit" src="http://www.coding.com.br/wp-content/uploads/2010/04/4493235551_3214e1f7fd-300x225.jpg" alt="" width="300" height="225" /></a>Sinceramente já tinha esquecido da inscrição quando chegou na minha casa na semana passada&#8230; e só consegui fazer o <em>hands on</em> neste final de semana.</p>
<p style="text-align: center;"><img class="aligncenter" title="Itens dentro da caixa" src="http://www.coding.com.br/wp-content/uploads/2010/04/4493464217_41d7caa412.jpg" alt="" width="500" height="375" /></p>
<p style="text-align: justify;">Veio com todas o itens para você começar a desenvolver, a placa principal com a MCU fabricada pela <a href="http://www.luminarymicro.com/" target="_blank">Luminary</a> é a maior na foto, sendo a outra basicamente a interface USB com o computador (utiliza o chip da FTDI). Imagino que seja possível aproveitar em outros projetos. No kit há essencialmente:</p>
<ul>
<li>80-MHz LM3S9B96 MCU</li>
<li>Ethernet MAC+PHY</li>
<li>CAN</li>
<li>USB OTG,</li>
<li>SafeRTOS na ROM, com uma cópia limitada do Keil RealView Microcontroller Development Kit</li>
<li>cables (USB e rede)</li>
<li>CD com documentação e software</li>
<li>Pendrive de 256MB</li>
</ul>
<p style="text-align: justify;">Vou descrever aqui as novidades que for aprendendo. A meta é testar no final de semana o SafeRTOS.  Acredito que a presença do PHY Ethernet vai permitir implementações interessantes. Se você tiver alguma idéia sugira nos comentários.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/stellaris-ekk-lm3s9b96-evaluation-kit-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First prototype for Beagle Board box</title>
		<link>http://www.coding.com.br/embarcado/first-prototype-for-beagle-board-box/</link>
		<comments>http://www.coding.com.br/embarcado/first-prototype-for-beagle-board-box/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 15:14:51 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[embarcado]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[beagleboard]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=533</guid>
		<description><![CDATA[After drawing a sketch for BeagleBoard this week I coud try something real. The board fit perfectly inside the box.

The whole for DVI-D would be a little bigger, the way it is the user need stick the connector well to don&#8217;t loose image quality.

The entries for USB and MMC fits together in the same whole.  I put [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">After drawing a <a href="http://www.coding.com.br/embarcado/first-sketch-for-beagle-board-box/" target="_blank">sketch</a> for BeagleBoard this week I coud try something real. The board fit perfectly inside the box.</p>
<p><a href="http://www.coding.com.br/wp-content/uploads/2010/01/bb1.jpg"><img class="aligncenter size-full wp-image-705" title="Box for BeagleBoard" src="http://www.coding.com.br/wp-content/uploads/2010/01/bb1.jpg" alt="" width="500" height="375" /></a></p>
<p style="text-align: justify;">The whole for DVI-D would be a little bigger, the way it is the user need stick the connector well to don&#8217;t loose image quality.</p>
<p><a href="http://www.coding.com.br/wp-content/uploads/2010/01/bb2.jpg"><img class="aligncenter size-full wp-image-706" title="Box for BeagleBoard" src="http://www.coding.com.br/wp-content/uploads/2010/01/bb2.jpg" alt="" width="500" height="375" /></a></p>
<p style="text-align: justify;">The entries for USB and MMC fits together in the same whole.  I put RS232 output because it&#8217;s a prototype, if you are developing something for an <em>end-user</em> you don&#8217;t need that. The box in my tests don&#8217;t heated</p>
<p style="text-align: center;"><a href="http://www.coding.com.br/wp-content/uploads/2010/01/bb3.jpg"><img class="aligncenter size-full wp-image-707" title="Box for BeagleBoard" src="http://www.coding.com.br/wp-content/uploads/2010/01/bb3.jpg" alt="" width="500" height="375" /></a></p>
<p style="text-align: justify;">I&#8217;m using this box to show a &#8220;general purpose&#8221; computer to others. Inside the memory card I had some GNU/Linux distributions like: Angstron, Ubuntu and Gentoo. But Symbian and Maemo are in the roadmap. Other tests include running <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary" target="_blank">linus-git</a> kernel done with CodeSourcery toolchain (2009q1 and 2009q3) and playing with armv7a instructions.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Check more photos on <a title="More photos for BeagleBoard Box" href="http://www.flickr.com/photos/maluta/sets/72157622039150085/detail/" target="_blank">Flickr!</a></p>
<p style="text-align: left;">
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/embarcado/first-prototype-for-beagle-board-box/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Byte Order</title>
		<link>http://www.coding.com.br/programacao/byte-order/</link>
		<comments>http://www.coding.com.br/programacao/byte-order/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 22:03:58 +0000</pubDate>
		<dc:creator>Tiago Maluta</dc:creator>
				<category><![CDATA[programação]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[intel]]></category>

		<guid isPermaLink="false">http://www.coding.com.br/?p=162</guid>
		<description><![CDATA[In the book about Linux Kernel Programming the author Robert Love demonstrated a trick to check your hardware endianness.

int x = 1;
if &#40;*&#40;char *&#41;&#38;x == 1&#41;
/* little endian */
else
/* big endian */

Using GCC you can use -mbig-endian or -mlittle-endian to generate appropriate endianess. Remember to check man pages section on your architecture (i.e: i386 and [...]]]></description>
			<content:encoded><![CDATA[<p>In the book about <em>Linux Kernel Programming</em> the author<em> Robert Love</em> demonstrated a trick to check your hardware <em>endianness</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> x <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>x <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #808080; font-style: italic;">/* little endian */</span>
<span style="color: #b1b100;">else</span>
<span style="color: #808080; font-style: italic;">/* big endian */</span></pre></div></div>

<p style="text-align: justify;">Using <a href="http://gcc.gnu.org">GCC</a> you can use <strong>-mbig-endian </strong>or <strong>-mlittle-endian</strong> to generate appropriate endianess. Remember to check man pages section on your architecture (i.e: i386 and x86-64 <span style="text-decoration: underline;">don&#8217;t</span> implement this option whilst IA-64 and ARM yes)</p>
<p style="text-align: justify;">One interesting point regards on byte swapping. Suppose that you have a file that starts with 0x<span style="color: #ff0000;">aabb</span><span style="color: #000080;">ccdd</span> referring to little endian and 0x<span style="color: #000080;">ddcc</span><span style="color: #ff0000;">bbaa</span> referring to big endian (note that I took these values and order arbitrarily). In order to use one kind of byte order in your code we need check what endianness your file was generated and if necessary rectify. This C++ code exemplifies.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> Endian <span style="color: #008000;">&#123;</span>
&nbsp;
     <span style="color: #0000ff;">int</span> _byteSwapped<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
&nbsp;
     Endian<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">long</span> dw<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>0xaabbccddL <span style="color: #000080;">==</span> dw<span style="color: #008000;">&#41;</span> _byteSwapped <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>0xddccbbaaL <span style="color: #000080;">==</span> dw<span style="color: #008000;">&#41;</span>  _byteSwapped <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> 
        <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">throw</span> <span style="color: #FF0000;">&quot;error&quot;</span><span style="color: #008080;">;</span>
&nbsp;
     <span style="color: #008000;">&#125;</span>
&nbsp;
     <span style="color: #0000ff;">long</span> rectify<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">long</span> dw<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">const</span> <span style="color: #008000;">&#123;</span>
&nbsp;
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>_byteSwapped<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">return</span> dw<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">char</span> result<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;</span>dw<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#93;</span>,<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;</span>dw<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #008000;">&#93;</span>,<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;</span>dw<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span>,<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;</span>dw<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
        <span style="color: #0000ff;">return</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">long</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span> result<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
     <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Another way to do byte swapping is using an macro. The following example swap two bytes:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#define SwapTwoBytes(data) ( (((data) &gt;&gt; 8) &amp; 0x00FF) | (((data) &lt;&lt; 8) &amp; 0xFF00) )</span></pre></div></div>

<p style="text-align: justify;">One of the best practices is provide one software that will work correctly no matter which processor Endian-architecture the code is executed on, eliminating the need to rewrite the code. Intel has a interesting <a href="http://www.intel.com/design/intarch/papers/endian.pdf">paper</a> on Converting Endian-specific to Endian-neutral Code (pg. 15-16).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.coding.com.br/programacao/byte-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
