<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Embedded Freaks..</title>
	<atom:link href="http://embeddedfreak.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedfreak.wordpress.com</link>
	<description>Daily embedded life tips and trick</description>
	<lastBuildDate>Thu, 05 Jan 2012 07:51:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='embeddedfreak.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Embedded Freaks..</title>
		<link>http://embeddedfreak.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://embeddedfreak.wordpress.com/osd.xml" title="Embedded Freaks.." />
	<atom:link rel='hub' href='http://embeddedfreak.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Moving Out</title>
		<link>http://embeddedfreak.wordpress.com/2011/03/24/moving-out/</link>
		<comments>http://embeddedfreak.wordpress.com/2011/03/24/moving-out/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 00:00:09 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=717</guid>
		<description><![CDATA[You might notice that some of the code that is posted in this blog cannot be downloaded anymore, or it leads to a dead link. The code used to be hosted in 4shared, a free web storage, until I lost the account because I didn&#8217;t login for few months (I was at holiday abroad, in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=717&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You might notice that some of the code that is posted in this blog cannot be downloaded anymore, or it leads to a dead link. The code used to be hosted in <a href="http://www.4shared.com/">4shared</a>, a free web storage, until I lost the account because I didn&#8217;t login for few months (I was at holiday abroad, in the middle of the sea without any internet access, when they sent me email to login or my account would be deleted).</p>
<p>I feel quite disappointed, and finally, I decided to buy my own hosting space to make sure that my code is archived better. Currently, I&#8217;m on my way to upload my backup into new site. Hopefully, I can find all of the code snippets that I posted in this blog in my DVD backup.</p>
<p>Anyway, I also want to thank you for visiting or subscribing Embedded Freak so far. I hope my blog will still be interested enough for you. If you&#8217;re looking for embedded freak&#8217;s new website, it&#8217;ll be hosted in <a title="New Embedded Freak Website" href="http://embeddedfreak.materee.com/">http://embeddedfreak.materee.com</a></p>
<p>I&#8217;ll post the latest news of the server migration once it&#8217;s done.</p>
<p>Thank you</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/717/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=717&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2011/03/24/moving-out/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Disko &#8216;Firststeps&#8217; Tutorial in LPC3250</title>
		<link>http://embeddedfreak.wordpress.com/2010/12/02/disko-firststeps-tutorial-in-lpc3250/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/12/02/disko-firststeps-tutorial-in-lpc3250/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 18:12:26 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[arm926ej-s]]></category>
		<category><![CDATA[embedded-linux]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=687</guid>
		<description><![CDATA[Going through with Disko tutorial at 2AM..=) So, here&#8217;s what I got so far. Disko provides simple tutorial to kickstart your Disko project. You can download it using git: Inside the &#8216;disko-tutorials&#8217; directory, go to &#8216;firststeps&#8217; directory, and cross compile it with: Now copy all of firststeps directory to your target directory (or to SD-Card), [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=687&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Going through with Disko tutorial at 2AM..=) So, here&#8217;s what I got so far.</p>
<p>Disko provides simple tutorial to kickstart your Disko project. You can download it using git:</p>
<p><pre class="brush: cpp;">
# git clone git://www.diskohq.org/disko-tutorials.git
</pre></p>
<p><span style="font-family:Consolas, Monaco, 'Courier New', Courier, monospace;line-height:18px;font-size:12px;white-space:pre;">Inside the &#8216;disko-tutorials&#8217; directory, go to &#8216;firststeps&#8217; directory, and cross compile it with:</span></p>
<p><pre class="brush: cpp;">
# CXX=arm-none-linux-gnueabi-g++ CXXFLAGS=-mcpu=arm926ej-s \
  PKG_CONFIG_PATH=$HOST_DIR/lib/pkgconfig make
</pre></p>
<p>Now copy all of firststeps directory to your target directory (or to SD-Card), and copy all the library dependencies (as described in <a title="Testing 'Disko-Demos' in LPC3250" href="http://embeddedfreak.wordpress.com/2010/11/26/testing-disko-demos-in-lpc3250/">my last post</a>, &#8216;Preparing Root Filesystem&#8217; section). Then run it..(Don&#8217;t forget to change the diskorc.xml before running the program)</p>
<p>Here&#8217;s some pics and videos of the &#8216;Firststeps&#8217; tutorial in PHY3250 board<span id="more-687"></span></p>
<div id="attachment_699" class="wp-caption aligncenter" style="width: 810px"><a href="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_01.jpg"><img class="size-full wp-image-699" title="Disko_Tutorial_01" src="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_01.jpg" alt="Disko Firststeps Tutorial 01" width="800" height="600" /></a><p class="wp-caption-text">Disko Firststeps Tutorial 01</p></div>
<div id="attachment_700" class="wp-caption aligncenter" style="width: 810px"><a href="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_02.jpg"><img class="size-full wp-image-700" title="Disko_Tutorial_02" src="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_02.jpg" alt="" width="800" height="600" /></a><p class="wp-caption-text">Disko &#039;Firststeps&#039; Tutorial 02</p></div>
<span style="text-align:center; display: block;"><a href="http://embeddedfreak.wordpress.com/2010/12/02/disko-firststeps-tutorial-in-lpc3250/"><img src="http://img.youtube.com/vi/IpPbbDZPOJs/2.jpg" alt="" /></a></span>
<div id="attachment_702" class="wp-caption aligncenter" style="width: 610px"><a href="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_04.jpg"><img class="size-full wp-image-702" title="Disko_Tutorial_04" src="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_04.jpg" alt="Disko 'Firststeps' Tutorial 04" width="600" height="800" /></a><p class="wp-caption-text">Disko &#039;Firststeps&#039; Tutorial 04</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/687/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/687/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/687/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=687&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/12/02/disko-firststeps-tutorial-in-lpc3250/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_01.jpg" medium="image">
			<media:title type="html">Disko_Tutorial_01</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_02.jpg" medium="image">
			<media:title type="html">Disko_Tutorial_02</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/12/disko_tutorial_04.jpg" medium="image">
			<media:title type="html">Disko_Tutorial_04</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing &#8216;Disko-Demos&#8217; in LPC3250</title>
		<link>http://embeddedfreak.wordpress.com/2010/11/26/testing-disko-demos-in-lpc3250/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/11/26/testing-disko-demos-in-lpc3250/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 08:48:43 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[arm926ej-s]]></category>
		<category><![CDATA[embedded-linux]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=648</guid>
		<description><![CDATA[LPC3250 is NXP&#8217;s ARM926EJ-S SoC-based MCU. It comes with extra peripherals for user interface (LCD-32bits, touchscreen, SDRAM controller), designed mainly for industrial HMI (Human-Machine Interface) or simple embedded application that requires graphical user interface. Hence, it doesn&#8217;t have any fancy video / audio co-processors like TI OMAP series. I&#8217;m running this test based on PHYCORE-LPC3250 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=648&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>LPC3250 is NXP&#8217;s ARM926EJ-S SoC-based MCU. It comes with extra peripherals for user interface (LCD-32bits, touchscreen, SDRAM controller), designed mainly for industrial HMI (Human-Machine Interface) or simple embedded application that requires graphical user interface. Hence, it doesn&#8217;t have any fancy video / audio co-processors like TI OMAP series.</p>
<p>I&#8217;m running this test based on <a href="http://www.phytec.com/products/rdk/ARM-XScale/phyCORE-ARM9-LPC3250.html">PHYCORE-LPC3250</a> at 208Mhz. The bootloaders (NXP S1L along with uboot) and linux kernel installation is provided in <a href="http://www.lpclinux.com/LPC32xx/LPC32x0Main">lpclinux.com</a>.</p>
<p>To update your PHYCORE-LPC3250 S1L (new S1L is provided to ease LPC3250 board porting and adding more features), see <a href="http://www.lpclinux.com/LPC32xx/LPC32x0BoardPHY3250bootloadersrestore">this page</a>. You won&#8217;t mess around with kernel&#8217;s source code or the bootloader. Hence, it&#8217;s better to burn everything into NAND flash.To burn the U-Boot in PHYCORE-LPC3250&#8242;s  flash, see <a href="http://www.lpclinux.com/LPC32xx/LPC32x0BoardFDI3250ubootinstall#Future_Designs_LPC3250_board_AN1">this page</a>. To burn the Linux kernel into PHYCORE-LPC3250&#8242;s  flash, see <a href="http://www.lpclinux.com/LPC32xx/LPC32x0LinuxKernelDeployNAND">this page</a>.</p>
<p>My suggestion is to add NFS server in your PC host, because modifying the root filesystem while debugging the Disko application is quite a troublesome if you use SD-Card (see my <a title="Setting Host Infrastructure for Embedded Linux Development" href="http://embeddedfreak.wordpress.com/2008/12/09/setting-host-infrastructure-for-embedded-linux-development/">last post</a> for it). However, just to run this demo, you can download your root filesystem into SD-Card and deploy it in your board.</p>
<p>Ok, that&#8217;s enough for the small talk..now I&#8217;m going to talk big =P..kidding..<span id="more-648"></span></p>
<h4>Preparing Disko</h4>
<p>The first thing is compile the libraries and Disko framework (<a title="Cross Compiling Disko for ARM926EJ-S SoC" href="http://embeddedfreak.wordpress.com/2010/11/19/cross-compiling-disko-for-arm926ej-s-soc/">here</a>).</p>
<p>The issue with Disko-1.7.0 is that the library keeps referring to $HOST_DIR, even though it has been copied to target board. I&#8217;m adding this patch to hardcode the target&#8217;s resource root directory.</p>
<p><pre class="brush: cpp;">

--- disko-1.7.0/src/mmsinfo/mmsinfo.cpp	2010-04-27 22:22:16.000000000 +0800
+++ disko-fix-1.7.0/src/mmsinfo/mmsinfo.cpp	2010-11-26 16:18:17.958657687 +0800
@@ -33,5 +33,5 @@
 #include &quot;mmsinfo/mmsinfo.h&quot;
 const char *getPrefix() {
-	return DISKO_PREFIX;
+	return &quot;&quot;;
 }
</pre></p>
<p>Save the patch as &#8216;disko-cross_target.patch&#8217;. Apply the patches in the disko&#8217;s build directory, then re-compile and install disko</p>
<p><pre class="brush: cpp;">
# cd $BUILD_DIR/disko-1.7.0
# patch -p1 &lt; disko-cross_target.patch
# CXX=arm-none-linux-gnueabi-g++ CXXFLAGS=&quot;-mcpu=arm926ej-s&quot; \
	PKG_CONFIG_PATH=$HOST_DIR/lib/pkgconfig \
	scons graphics=fbdev prefix=$HOST_DIR cross=true install
</pre></p>
<h4>Preparing Disko-Demos</h4>
<p>See my <a title="Cross-Compiling 'Disko-Demos' for ARM926EJ-S" href="http://embeddedfreak.wordpress.com/2010/11/25/cross-compiling-disko-demos-for-arm926ej-s/">previous post</a>..</p>
<h4>Preparing Root Filesystem</h4>
<p>Basically, it&#8217;s the same steps as in <a title="Creating Simple Root Filesystem for Embedded Linux" href="http://embeddedfreak.wordpress.com/2008/12/18/creating-simple-root-filesystem-for-embedded-linux/">previous post</a>, but there&#8217;s some additional steps that&#8217;re needed to be added. First, download, compile, and install the busybox into $TARGET_DIR</p>
<p><pre class="brush: cpp;">
# tar xvjf busybox-1.18.0.tar.bz2
# cd busybox-1.18.0
# CFLAGS=&quot;-mcpu=arm926ej-s&quot; make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
.....add in the utilities that you need..I'm using the standard utilities..
# CFLAGS=&quot;-mcpu=arm926ej-s&quot; make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
# CFLAGS=&quot;-mcpu=arm926ej-s&quot; make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- CONFIG_PREFIX=$TARGET_DIR install
</pre></p>
<p>Then install the busybox&#8217;s library dependencies</p>
<p><pre class="brush: cpp;">
# arm-none-linux-gnueabi-readelf -d busybox

Dynamic section at offset 0xdb0cc contains 25 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0xc0a0
 0x0000000d (FINI)                       0xbd5fc
 0x00000019 (INIT_ARRAY)                 0xeb0c0
 ...
# mkdir $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libm.so.6 $TARGET_DIR/lib/
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libc.so.6 $TARGET_DIR/lib/
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/ld-linux.so.3 $TARGET_DIR/lib/
</pre></p>
<p>After that, also install the &#8216;disko-demos&#8217; library dependencies.</p>
<p><pre class="brush: cpp;">
# arm-none-linux-gnueabi-readelf -d $TARGET_DIR/bin/demo

Dynamic section at offset 0x2d028 contains 37 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libdisko.so]
 0x00000001 (NEEDED)                     Shared library: [libxml2.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsigc-2.0.so.0]
 0x00000001 (NEEDED)                     Shared library: [libpng14.so.14]
 0x00000001 (NEEDED)                     Shared library: [libfreetype.so.6]
 0x00000001 (NEEDED)                     Shared library: [libcurl.so.4]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsqlite3.so.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x0000000c (INIT)                       0xea0c
 ................
# cp $HOST_DIR/lib/libdisko.so $TARGET_DIR/lib
# cp $HOST_DIR/lib/libxml2.so.2 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libsigc-2.0.so.0 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libpng14.so.14 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libfreetype.so.6 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libcurl.so.4 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libsqlite3.so.0 $TARGET_DIR/lib
.....Not in the list, but libpng depends on it
# cp $HOST_DIR/lib/libz.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libdl.so.2 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libgcc_s.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libpthread.so.0 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/librt.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6 $TARGET_DIR/lib
</pre></p>
<p>Copy also the XML files for Disko GUI&#8217;s configuration</p>
<p><pre class="brush: cpp;">
# cp -R $HOST_DIR/share/disko $TARGET_DIR/share
</pre></p>
<p>The next step is installing the device mount point, so that our applications can communicate with the device drivers.</p>
<p><pre class="brush: cpp;">
# mkdir $TARGET_DIR/dev
...Minimum standard device files to run Linux
# sudo mknod $TARGET_DIR/dev/console c 5 1
# sudo mknod $TARGET_DIR/dev/null c 1 3
# sudo mknod $TARGET_DIR/dev/zero c 1 5
...Need device file for SD-Card partition #1, because the rootfs is stored there
# sudo mknod $TARGET_DIR/dev/mmcblk0p1 b 179 1
...Serial console for boot..
# sudo mknod $TARGET_DIR/dev/ttyS0 c 4 64
...Framebuffer...
# sudo mknod $TARGET_DIR/dev/fb0 c 29 0
...Touchscreen
# mkdir $TARGET_DIR/dev/input
# sudo mknod $TARGET_DIR/dev/input/event0 c 13 64
...Virtual terminals..needed by Disko
# sudo mknod $TARGET_DIR/dev/tty0 c 4 0
# sudo mknod $TARGET_DIR/dev/tty2 c 4 2
</pre></p>
<p>Then, prepare the Linux&#8217;s system init files</p>
<p><pre class="brush: cpp;">
# vi $TARGET_DIR/etc/inittab
::sysinit:/etc/init.d/rcS
::askfirst:/bin/sh
# mkdir TARGET_DIR/etc/init.d
# vi $TARGET_DIR/etc/init.d/rcS
/bin/mount -t proc proc /proc
echo &quot;Welcome to Disko-Demos for LPC3250&quot;
# chmod +x $TARGET_DIR/etc/init.d/rcS
# mkdir $TARGET_DIR/proc
</pre></p>
<p>Phewww&#8230;.that was long isn&#8217;t it ??</p>
<h4>Configuring Disko</h4>
<p>The disko config is stored in &#8216;$TARGET_DIR/etc/diskorc.xml&#8217;. To run it on PHYCORE-LPC3250, you need these changes:</p>
<p><pre class="brush: cpp;">
&lt;graphics&gt;
    &lt;parameter name=&quot;fullscreen&quot; value=&quot;true&quot;/&gt;
    &lt;!-- PHY3250 LCD is 240x320 @16bpp --&gt;
    &lt;parameter name=&quot;xres&quot; value=&quot;240&quot;/&gt;
    &lt;parameter name=&quot;yres&quot; value=&quot;320&quot;/&gt;
    &lt;parameter name=&quot;backend&quot; value=&quot;fbdev&quot; /&gt;
    &lt;parameter name=&quot;outputtype&quot; value=&quot;stdfb&quot;/&gt;
    &lt;parameter name=&quot;videolayerid&quot; value=&quot;0&quot;/&gt;
    &lt;parameter name=&quot;videolayerpixelformat&quot; value=&quot;RGB16&quot; /&gt;
    .....
    &lt;parameter name=&quot;graphicslayerid&quot; value=&quot;0&quot;/&gt;
    &lt;parameter name=&quot;graphicslayerpixelformat&quot; value=&quot;RGB16&quot;/&gt;
    .....
    &lt;parameter name=&quot;touchrect.w&quot; value=&quot;240&quot;/&gt;
    &lt;parameter name=&quot;touchrect.h&quot; value=&quot;320&quot;/&gt;
    &lt;parameter name=&quot;pointer&quot; value=&quot;true&quot;/&gt;
    .....
    &lt;parameter name=&quot;extendedaccel&quot; value=&quot;false&quot;/&gt;
    &lt;parameter name=&quot;allocmethod&quot; value=&quot;malloc&quot;/&gt;
    &lt;parameter name=&quot;hideapplication&quot; value=&quot;false&quot;/&gt;
&lt;/graphics&gt;
</pre></p>
<h4>Running Disko-Demos</h4>
<p>Well, that&#8217;s it..If you have NFS-based system, just enable the $TARGET_DIR as NFS exported directory, and access it from your PHY3250. If you use SD-Card, copy these files into your SD-Card, plug into PHY3250, and boot.<br />
Once you boot, and reach the shell, run Disko-Demos with:</p>
<p><pre class="brush: cpp;">
# ./bin/demo&amp;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/648/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/648/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/648/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=648&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/11/26/testing-disko-demos-in-lpc3250/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Cross-Compiling &#8216;Disko-Demos&#8217; for ARM926EJ-S</title>
		<link>http://embeddedfreak.wordpress.com/2010/11/25/cross-compiling-disko-demos-for-arm926ej-s/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/11/25/cross-compiling-disko-demos-for-arm926ej-s/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 02:04:39 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[arm926ej-s]]></category>
		<category><![CDATA[embedded-linux]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=636</guid>
		<description><![CDATA[Yes..here we go again with disko-demos application to demonstrate Disko&#8217;s capability (See how it looks like for other platforms here, here, and here). Let&#8217;s build the &#8216;disko-demos&#8217; using our cross-compiled libraries. First download the &#8216;disko-demos&#8217; application from disko&#8217;s GIT repository: Then create this Makefile to make your cross-compiling lifestyle easier (otherwise, there&#8217;ll be too much things to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=636&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes..here we go again with disko-demos application to demonstrate Disko&#8217;s capability (See how it looks like for other platforms <a href="http://www.youtube.com/watch?v=F5ZKzDp1or0">here</a>, <a href="http://www.youtube.com/watch?v=43tlG7VACr0&amp;feature=mfu_in_order&amp;list=UL">here</a>, and <a href="http://www.youtube.com/watch?v=bkocSSL9S5c&amp;feature=BF&amp;list=UL08lgc_Bfa8Y&amp;index=5">here</a>). Let&#8217;s build the &#8216;disko-demos&#8217; using our cross-compiled libraries.</p>
<p>First download the &#8216;disko-demos&#8217; application from disko&#8217;s GIT repository:</p>
<p><pre class="brush: cpp;">
# git clone git://git.diskohq.com/disko-demos.git
</pre></p>
<p><span id="more-636"></span>Then create this Makefile to make your cross-compiling lifestyle easier (otherwise, there&#8217;ll be too much things to type)</p>
<p><pre class="brush: cpp;">
# The top directory that contains all of the cross-libraries and tools
TOP_DIR    = $(HOME)/workspace/vicdist
# The directory that contains cross-libraries
HOST_DIR   = $(TOP_DIR)/host
# The installation directory..to be deployed in rootfs
TARGET_DIR = $(TOP_DIR)/target

CROSS_COMPILE ?= $(HOME)/workspace/codesourcery/bin/arm-none-linux-gnueabi-
CXX            = $(CROSS_COMPILE)g++
CXXFLAGS       = -mcpu=arm926ej-s
SCONS          = $(TOP_DIR)/bin/scons

disko-demos:
	CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig \
	LDFLAGS=&quot;-Wl,-rpath-link=$(HOST_DIR)/lib&quot; \
	$(SCONS) prefix=$(TARGET_DIR) install

clean:
	CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig \
	LDFLAGS=&quot;-static -Wl,-rpath-link=$(HOST_DIR)/lib&quot; \
	$(SCONS) -c
</pre></p>
<p>The &#8216;LDFLAGS=-Wl,-rpath=link=$(HOST_DIR)/lib&#8217; is needed to tell the linker where it can find the dynamic libraries that disko framework depends on.</p>
<p>Then you can compile with</p>
<p><pre class="brush: cpp;">
# make
</pre></p>
<p>The result is installed in $TARGET_DIR. The &#8216;Disko-Demos&#8217; is installed in $TARGET_DIR/bin/demo. Let&#8217;s see what&#8217;s the dynamic libraries that it depends:</p>
<p><pre class="brush: cpp;">
# arm-none-linux-gnueabi-readelf -d bin/demo |more

Dynamic section at offset 0x2d028 contains 37 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libdisko.so]
 0x00000001 (NEEDED)                     Shared library: [libxml2.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsigc-2.0.so.0]
 0x00000001 (NEEDED)                     Shared library: [libpng14.so.14]
 0x00000001 (NEEDED)                     Shared library: [libfreetype.so.6]
 0x00000001 (NEEDED)                     Shared library: [libcurl.so.4]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsqlite3.so.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x0000000c (INIT)                       0xea0c
 0x0000000d (FINI)                       0x2ef2c
 .......
</pre></p>
<p>Ok..So now we can copy the &#8216;bin/demo&#8217; into rootfs, and copy the dependency shared-libraries into rootfs/lib directory.</p>
<p>Now&#8230;let&#8217;s hope that it works&#8230;**crossing fingers**</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/636/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=636&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/11/25/cross-compiling-disko-demos-for-arm926ej-s/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Cross Compiling OpenSSL-1.0.0b for ARM926EJ-S</title>
		<link>http://embeddedfreak.wordpress.com/2010/11/23/cross-compiling-openssl-1-0-0b-for-arm926ej-s/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/11/23/cross-compiling-openssl-1-0-0b-for-arm926ej-s/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 14:30:35 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[embedded-linux]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=627</guid>
		<description><![CDATA[Well, I forgot to put OpenSSL into my Disko cross compilation (here). Hence, I need to download the latest OpenSSL and cross compile it too. OpenSSL uses different configuration script (not the standard autoconf script..), and run by Perl. After working almost one night non-stop, I finally figure out how to configure OpenSSL-1.0.0b for cross [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=627&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, I forgot to put OpenSSL into my Disko cross compilation (<a href="http://embeddedfreak.wordpress.com/2010/11/19/cross-compiling-disko-for-arm926ej-s-soc/">here</a>). Hence, I need to download the latest OpenSSL and cross compile it too.</p>
<p>OpenSSL uses different configuration script (not the standard autoconf script..), and run by Perl. After working almost one night non-stop, I finally figure out how to configure OpenSSL-1.0.0b for cross compilation</p>
<p><pre class="brush: cpp;">

# tar xvjf openssl-1.0.0b.tar.gz

# cd openssl-1.0.0b

# ./Configure --prefix=$(HOST_DIR) zlib-dynamic &quot;linux-arm926ej-s&quot;:&quot;arm-none-linux-gnueabi-gcc:-DTERMIO -O3 -Wall -I../../host/include::-D_REENTRANT::-L../../host/lib -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR::bn_asm.o armv4-mont.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::void:dlfcn:linux-shared:-fPIC::.so.1.0.0&quot;:arm-none-linux-gnueabi-ranlib::

# make

# make install

</pre></p>
<p>No sed, no awk, no regex to change the Configure script. Just change the $CC according to your cross-compiler-gcc and $CROSS_RANLIB with your cross-compiler-ranlib. The $(HOST_DIR)/include and $(HOST_DIR)/lib must have ARM&#8217;s zlib library and header files.</p>
<p>Now I need to update my Disko cross compile Makefile script..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/627/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/627/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/627/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=627&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/11/23/cross-compiling-openssl-1-0-0b-for-arm926ej-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Understanding NXP LPCxxxx Series Timer</title>
		<link>http://embeddedfreak.wordpress.com/2010/11/22/understanding-nxp-lpcxxxx-series-timer/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/11/22/understanding-nxp-lpcxxxx-series-timer/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 02:24:08 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[Cortex-M]]></category>
		<category><![CDATA[embedded-tips]]></category>
		<category><![CDATA[ARM]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=620</guid>
		<description><![CDATA[Not very sure about how the NXP LPCxxxx timer works ? Well, so do I =) But after working with few of LPCxxxx series, I finally can get a good view of how the Timer works. Here&#8217;s a block diagram of how the Timer works (at least in LPC23xx, LPC24xx, LPC31xx, LPC32xx, LPC111x, LPC176x) Note how each [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=620&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not very sure about how the NXP LPCxxxx timer works ? Well, so do I =)</p>
<p>But after working with few of LPCxxxx series, I finally can get a good view of how the Timer works. Here&#8217;s a block diagram of how the Timer works (at least in LPC23xx, LPC24xx, LPC31xx, LPC32xx, LPC111x, LPC176x)</p>
<div id="attachment_621" class="wp-caption aligncenter" style="width: 683px"><a href="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_timer.png"><img class="size-full wp-image-621" title="LPCxxxx_Timer" src="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_timer.png" alt="" width="673" height="389" /></a><p class="wp-caption-text">LPCxxxx Timer Diagram</p></div>
<p><span id="more-620"></span>Note how each registers (CCR, CRx, MATx, MCR, etc) are matched to the block diagram functions.</p>
<p>In new LPCxxxx MCUs, the PWM (single edged PWM) is mux-ed with EMR functions. Hence, NXP added PWMC register to control which block (PWM or EMR) that controls the MATx pins.</p>
<div id="attachment_622" class="wp-caption aligncenter" style="width: 279px"><a href="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwmc.png"><img class="size-full wp-image-622" title="LPCxxxx_PWMC" src="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwmc.png" alt="" width="269" height="156" /></a><p class="wp-caption-text">LPCxxxx PWMC Register</p></div>
<p>So, how does the PWM block differs from EMR block ? Well, in PWM block, when TC = 0, the MATx pin will always toggled to LOW (VSS). In EMR block, it&#8217;s not.</p>
<p>Here&#8217;s some illustration of PWM using EMR:</p>
<div id="attachment_623" class="wp-caption aligncenter" style="width: 635px"><a href="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_emr.png"><img class="size-full wp-image-623" title="LPCxxxx_PWM_w_EMR" src="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_emr.png" alt="" width="625" height="353" /></a><p class="wp-caption-text">LPCxxxx PWM with EMR block</p></div>
<p>Here&#8217;s illustration of PWM using PWM block:</p>
<div id="attachment_624" class="wp-caption aligncenter" style="width: 602px"><a href="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_pwm.png"><img class="size-full wp-image-624" title="LPCxxxx_PWM_w_PWM" src="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_pwm.png" alt="" width="592" height="385" /></a><p class="wp-caption-text">LPCxxxx PWM with PWM block</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/620/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/620/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=620&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/11/22/understanding-nxp-lpcxxxx-series-timer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_timer.png" medium="image">
			<media:title type="html">LPCxxxx_Timer</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwmc.png" medium="image">
			<media:title type="html">LPCxxxx_PWMC</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_emr.png" medium="image">
			<media:title type="html">LPCxxxx_PWM_w_EMR</media:title>
		</media:content>

		<media:content url="http://embeddedfreak.files.wordpress.com/2010/11/lpcxxxx_pwm_w_pwm.png" medium="image">
			<media:title type="html">LPCxxxx_PWM_w_PWM</media:title>
		</media:content>
	</item>
		<item>
		<title>Cross Compiling Disko for ARM926EJ-S SoC</title>
		<link>http://embeddedfreak.wordpress.com/2010/11/19/cross-compiling-disko-for-arm926ej-s-soc/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/11/19/cross-compiling-disko-for-arm926ej-s-soc/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 13:50:59 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[ARM9]]></category>
		<category><![CDATA[embedded-linux]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=611</guid>
		<description><![CDATA[Disko is GUI toolkit for embedded linux devices. Here&#8217;s what they said about themselves: Disko is an LGPL-licensed user interface (UI) application framework for the fast and simple development of flexible applications on Embedded Linux systems – with a particular focus on interactive user interfaces. It is high-performance and easy to learn, and due to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=611&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Disko is GUI toolkit for embedded linux devices. Here&#8217;s what they said about themselves:</p>
<blockquote><p>Disko is an LGPL-licensed user interface (UI) application framework for the fast and simple development of flexible applications on Embedded Linux systems – with a particular focus on interactive user interfaces. It is high-performance and easy to learn, and due to its architecture is well suited to creating complex applications. Disko is a product of BerLinux Solutions GmbH.</p></blockquote>
<p>Their website can be found <a title="Disko Framework" href="http://www.diskohq.com/">here</a>. It seems like it&#8217;s a nice GUI framework for embedded device. I&#8217;ve been trying to cross compile GTK-directFB without any luck, but Disko, along with its dependencies are very easy to be cross compiled.</p>
<p>To cross compile Disko, along with its dependencies, I&#8217;ve made a Makefile (to automate the compilation). Here&#8217;s the Disko cross-compile Makefile<br />
<span id="more-611"></span></p>
<p><pre class="brush: cpp;">

# Disko package cross-compile for ARM926EJ-S
# ver 20101203_1050
#
# You will need extra tools (other than cross-toolchain) in your PC to run this Makefile:
# - pkg-config
# - pyhton
# - perl
# - SCons

TOP_DIR    = $(shell pwd)
BUILD_DIR  = $(TOP_DIR)/build
SOURCE_DIR = $(TOP_DIR)/source
HOST_DIR   = $(TOP_DIR)/host

KERNEL_HEADER   = $(HOST_DIR)/include

CURL_PACKAGE    = curl-7.21.1.tar.gz
DISKO_PACKAGE   = disko_1.7.0.tar.gz
FREETYPE_PACKAGE= freetype-2.4.3.tar.gz
OPENSSL_PACKAGE = openssl-1.0.0b.tar.gz
LIBSIGC_PACKAGE = libsigc++-2.2.8.tar.gz
LIBPNG_PACKAGE  = libpng-1.4.4.tar.gz
LIBXML2_PACKAGE = libxml2-sources-2.7.8.tar.gz
SQLITE_PACKAGE  = sqlite-amalgamation-3.7.3.tar.gz
ZLIB_PACKAGE    = zlib-1.2.5.tar.gz

CROSS_COMPILE ?= $(HOME)/workspace/codesourcery/bin/arm-none-linux-gnueabi-
AR             = $(CROSS_COMPILE)ar
CC             = $(CROSS_COMPILE)gcc
CXX            = $(CROSS_COMPILE)g++
LD             = $(CROSS_COMPILE)g++
NM             = $(CROSS_COMPILE)nm
RANLIB         = $(CROSS_COMPILE)ranlib
CFLAGS         = -mcpu=arm926ej-s
CXXFLAGS       = -mcpu=arm926ej-s
TAR            = /bin/tar
SCONS          = $(TOP_DIR)/bin/scons

all: freetype libsigc sqlite zlib openssl curl libpng libxml2 disko

# libcurl depends on zlib and openssl
curl:
	$(TAR) xvzf $(SOURCE_DIR)/$(CURL_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(CURL_PACKAGE))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi \
	--disable-http --disable-ftp --disable-file --disable-ldap --disable-rtsp \
	--disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 \
	--disable-imap --disable-smtp --disable-sspi --disable-crypto-auth --disable-cookies \
	--without-ldap-lib --without-lber-lib --without-krb4 --without-spnego \
	--without-gssapi --with-ssl --with-zlib=$(HOST_DIR) \
	--without-gnutls --without-polarssl --without-nss --without-ca-bundle \
	--without-libssh2 --without-librtmp --without-libidn &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

# disko depends libcurl, freetype, libpng, libsigc, libxml2, sqlite
disko:
	$(TAR) xvzf $(SOURCE_DIR)/$(DISKO_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(subst _,-,$(firstword $(subst .tar., ,$(DISKO_PACKAGE)))) &amp;&amp; \
	CXX=$(CXX) CXXFLAGS=&quot;$(CXXFLAGS) -I$(KERNEL_HEADER)&quot; \
	PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig \
	$(SCONS) graphics=fbdev prefix=$(HOST_DIR) cross=true install

freetype:
	$(TAR) xvzf $(SOURCE_DIR)/$(FREETYPE_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(FREETYPE_PACKAGE))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

# OpenSSL depends on zlib
openssl:
	$(TAR) xvzf $(SOURCE_DIR)/$(OPENSSL_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(OPENSSL_PACKAGE))) &amp;&amp; \
	AR=$(AR) NM=$(NM) \
	./Configure --prefix=$(HOST_DIR) zlib-dynamic &quot;linux-arm926ej-s&quot;:&quot;$(CC):$(CFLAGS) -DTERMIO -O3 -Wall -I$(HOST_DIR)/include::-D_REENTRANT::-L$(HOST_DIR)/lib -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR::bn_asm.o armv4-mont.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::void:dlfcn:linux-shared:-fPIC::.so.1.0.0&quot;:$(RANLIB):: &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

# libpng depends on zlib
libpng:
	$(TAR) xvzf $(SOURCE_DIR)/$(LIBPNG_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(LIBPNG_PACKAGE))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS) -I$(HOST_DIR)/include&quot; \
	CPPFLAGS=&quot;-I$(HOST_DIR)/include&quot; \
	LDFLAGS=&quot;-L$(HOST_DIR)/lib&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

libsigc:
	$(TAR) xvzf $(SOURCE_DIR)/$(LIBSIGC_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(LIBSIGC_PACKAGE))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	CXX=$(CXX) CXXFLAGS=&quot;$(CXXFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

#libxml2 depends on zlib
libxml2:
	$(TAR) xvzf $(SOURCE_DIR)/$(LIBXML2_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(subst -sources,,$(firstword $(subst .tar., ,$(LIBXML2_PACKAGE)))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi \
	--without-python --without-readline --with-zlib=$(HOST_DIR) &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

sqlite:
	$(TAR) xvzf $(SOURCE_DIR)/$(SQLITE_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(subst -amalgamation,,$(firstword $(subst .tar., ,$(SQLITE_PACKAGE)))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	CXX=$(CXX) CXXFLAGS=&quot;$(CXXFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) --with-gnu-ld --host=arm-none-linux-gnueabi &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

zlib:
	$(TAR) xvzf $(SOURCE_DIR)/$(ZLIB_PACKAGE) -C $(BUILD_DIR)
	cd $(BUILD_DIR)/$(firstword $(subst .tar., ,$(ZLIB_PACKAGE))) &amp;&amp; \
	CC=$(CC) CFLAGS=&quot;$(CFLAGS)&quot; \
	AR=$(AR) RANLIB=$(RANLIB) \
	./configure --prefix=$(HOST_DIR) &amp;&amp; \
	$(MAKE) &amp;&amp; \
	$(MAKE) install

</pre></p>
<p>To use the Makefile, first, install your target board&#8217;s kernel header in the $HOST_DIR. This is example for PHY3250 board.</p>
<p><pre class="brush: cpp;">
# make ARCH=arm CROSS_COMPILE=$HOME/workspace/codesourcery/bin/arm-none-eabi- \
    INSTALL_HDR_PATH=$HOST_DIR phy3250_defconfig
# make ARCH=arm CROSS_COMPILE=$HOME/workspace/codesourcery/bin/arm-none-eabi- \
    INSTALL_HDR_PATH=$HOST_DIR headers_install
</pre></p>
<p>Now, if you are unlucky with the kernel, it may complains about redefinition of getline() (See the description and patch <a href="https://patchwork.kernel.org/patch/11166/">here</a>). Hence, you need to patch it with this:</p>
<p><pre class="brush: cpp;">
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 552025e..977e682 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -206,7 +206,7 @@ static void             done(void);
 static void             error(const char *);
 static int              findsym(const char *);
 static void             flushline(bool);
-static Linetype         getline(void);
+static Linetype         parseline(void);
 static Linetype         ifeval(const char **);
 static void             ignoreoff(void);
 static void             ignoreon(void);
@@ -512,7 +512,7 @@ process(void)

        for (;;) {
                linenum++;
-               lineval = getline();
+               lineval = parseline();
                trans_table[ifstate[depth]][lineval]();
                debug(&quot;process %s -&gt; %s depth %d&quot;,
                    linetype_name[lineval],
@@ -526,7 +526,7 @@ process(void)
  * help from skipcomment().
  */
 static Linetype
-getline(void)
+parseline(void)
 {
        const char *cp;
        int cursym;
</pre></p>
<p>Save the patch as getline.patch, and patch the kernel, before running the headers_install.</p>
<p><pre class="brush: cpp;">
# patch -p1 &lt; getline.patch
# make ARCH=arm CROSS_COMPILE=$HOME/workspace/codesourcery/bin/arm-none-eabi- \
    INSTALL_HDR_PATH=$HOST_DIR phy3250_defconfig
# make ARCH=arm CROSS_COMPILE=$HOME/workspace/codesourcery/bin/arm-none-eabi- \
    INSTALL_HDR_PATH=$HOST_DIR headers_install
</pre></p>
<p>Then, build the directory structures, and put the Makefile in the top directory</p>
<p><pre class="brush: cpp;">
# mkdir convick convict/host convict/source convict/build
# vi convick/Makefile
----&gt;insert the Makefile above
</pre></p>
<p>Then download the source code files into &#8216;source&#8217; directory:</p>
<ul>
<li>curl-7.21.1.tar.gz</li>
<li>disko_1.7.0.tar.gz</li>
<li>freetype-2.4.3.tar.gz</li>
<li>openssl-1.0.0b.tar.gz</li>
<li>libsigc++-2.2.8.tar.gz</li>
<li>libpng-1.4.4.tar.gz</li>
<li>libxml2-sources-2.7.8.tar.gz</li>
<li>sqlite-amalgamation-3.7.3.tar.gz</li>
<li>zlib-1.2.5.tar.gz</li>
</ul>
<p>Then just type &#8216;make&#8217; to compile everything</p>
<p><pre class="brush: cpp;">
# make -C convict
</pre></p>
<p>The header files and libraries will be put into &#8216;convict/host&#8217; directory. Note that the Disko will be based on kernel&#8217;s framebuffer (make sure your kernel supports framebuffer device as well). Also, the libcurl is, well, almost non-functional since I don&#8217;t need network capability for my project.</p>
<p>The next step is combine it with the bootloader, kernel, and busybox to create most simplest GUI-based embedded linux that&#8217;s available.</p>
<p>Will keep this post updated till then.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/611/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/611/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=611&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/11/19/cross-compiling-disko-for-arm926ej-s-soc/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Tail-Chaining ARM Cortex-M0 Interrupts</title>
		<link>http://embeddedfreak.wordpress.com/2010/10/19/tail-chaining-arm-cortex-m0-interrupts/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/10/19/tail-chaining-arm-cortex-m0-interrupts/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 10:08:45 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[Cortex-M]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=599</guid>
		<description><![CDATA[Building ARM Cortex-M0 bootloader seems like a bit more difficult that what I&#8217;ve imagined. Here&#8217;s the first challenge: the ARM Cortex-M0 interrupt vector table is not relocate-able. Hence, if we put our bootloader into ARM Cortex-M0, we need to find some way to chain the bootloader&#8217;s interrupt vector to user&#8217;s interrupt vector. Here&#8217;s how I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=599&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Building ARM Cortex-M0 bootloader seems like a bit more difficult that what I&#8217;ve imagined.</p>
<p>Here&#8217;s the first challenge: the ARM Cortex-M0 interrupt vector table is not relocate-able. Hence, if we put our bootloader into ARM Cortex-M0, we need to find some way to chain the bootloader&#8217;s interrupt vector to user&#8217;s interrupt vector.</p>
<p><span id="more-599"></span>Here&#8217;s how I did it:</p>
<p>First of all, point all the interrupt vectors into single default handler, except for the Reset handler and MSP, which will always point to bootloader&#8217;s Reset handler and MSP. The reason is that all of the interrupts in bootloader, except for the Reset Handler, only needs to do one thing: fetch the user&#8217;s interrupt handler address and jump to that address.</p>
<p><pre class="brush: cpp;">
#define ALIAS(f) __attribute__ ((alias (#f)))

extern void _vStackTop(void);
extern void ResetISR(void);
static void NMI_Handler(void) ALIAS(NormalIntDefaultHandler);
static void HardFault_Handler(void) ALIAS(NormalIntDefaultHandler);
static void SVCall_Handler(void) ALIAS(NormalIntDefaultHandler);
static void PendSV_Handler(void) ALIAS(NormalIntDefaultHandler);
static void SysTick_Handler(void) ALIAS(NormalIntDefaultHandler);
static void CAN_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void SSP1_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void I2C_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void TIMER16_0_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void TIMER16_1_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void TIMER32_0_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void TIMER32_1_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void SSP0_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void UART_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void ADC_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void WDT_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void BOD_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void PIOINT3_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void PIOINT2_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void PIOINT1_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void PIOINT0_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
static void WAKEUP_IRQHandler(void) ALIAS(NormalIntDefaultHandler);
</pre></p>
<p>Then, define the &#8216;default interrupt handler&#8217; as &#8216;naked&#8217; (without function prolog), to save the stack and cpu cycle when handling interrupt.</p>
<p><pre class="brush: cpp;">
static void NormalIntDefaultHandler(void) __attribute__((naked));
</pre></p>
<p>Inside the &#8216;default interrupt handler&#8217;, get the interrupt vector no, and its address offset in interrupt vector table. Then jump to user&#8217;s interrupt vector table offset. Some warning here is that, we need to make sure that the compiler will only use: r0-r3 and r12. The reason is that those registers are used for scratch registers (and it&#8217;s saved into stack automatically during start of interrupt by NVIC). Hence, it&#8217;s save for us to operate using the registers.</p>
<p><pre class="brush: cpp;">
void NormalIntDefaultHandler(void) {
	/* Note: Only use scratch registers: r0, r1, r2, r3
	 */
	register void *user_program_offset asm(&quot;r2&quot;) = (void *) USER_PROGRAM_OFFSET;

	asm (
			&quot;.syntax unified    \n\t&quot;
			/* Get current IRQ no from PSR */
			&quot;MRS    r0, PSR     \n\t&quot;
			/* Mask the interrupt number only */
			&quot;MOVS   r1, #0x3F   \n\t&quot;
			&quot;ANDS   r0, r1      \n\t&quot;
			/* Irq address position = IRQ No * 4 */
			&quot;LSLS   r0, r0, #2  \n\t&quot;
			/* Fetch the user vector offset */
			&quot;LDR    r0, [r0, r2]\n\t&quot;
			/* Jump to user interrupt vector */
			&quot;BX     r0          \n\t&quot;
			: /* output */
			: /* input */
			: /* clobbered reg */&quot;r0&quot;,&quot;r1&quot;,&quot;r2&quot;
	);

}
</pre></p>
<p>The &#8220;.syntax unified&#8221; instruction is needed to enable Thumb-2 specific instruction set.</p>
<p>Ok..I guess we can tail chain the ARM Cortex-M0 interrupts now..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/599/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/599/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/599/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=599&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/10/19/tail-chaining-arm-cortex-m0-interrupts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiling Nut/OS-4.9.9 with CodeSourcery GCC</title>
		<link>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-codesourcery-gcc/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-codesourcery-gcc/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 11:08:53 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=595</guid>
		<description><![CDATA[The Nut/OS-4.9.9 needs Yagarto GCC to compile for ARM7 series, while I&#8217;m using CodeSourcery GCC. Here&#8217;s some patch to fix the compilation<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=595&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Nut/OS-4.9.9 needs Yagarto GCC to compile for ARM7 series, while I&#8217;m using CodeSourcery GCC. Here&#8217;s some patch to fix the compilation</p>
<p><span id="more-595"></span></p>
<p><pre class="brush: cpp;">
diff -Naur ethernut-4.9.9/nut/Makevars.arm-gcc ethernut-nutconf_bug-4.9.9/nut/Makevars.arm-gcc
--- ethernut-4.9.9/nut/Makevars.arm-gcc	2009-08-13 23:31:41.000000000 +0800
+++ ethernut-nutconf_bug-4.9.9/nut/Makevars.arm-gcc	2010-09-28 18:07:14.788549190 +0800
@@ -39,7 +39,7 @@
 include $(top_srcdir)/Makevars.gcc

 # Set target specific variables.
-TRGT       = arm-elf-
+TRGT       = $(HOME)/workspace/codesourcery/bin/arm-none-eabi-
 MCFLAGS    = -mcpu=$(MCU)
 CFLAGS_MCU = $(MCFLAGS) -mthumb-interwork
 CXXFLAGS_MCU = $(CFLAGS_MCU)

diff -Naur ethernut-4.9.9/nut/os/osdebug.c ethernut-nutconf_bug-4.9.9/nut/os/osdebug.c
--- ethernut-4.9.9/nut/os/osdebug.c	2010-04-15 01:59:11.000000000 +0800
+++ ethernut-nutconf_bug-4.9.9/nut/os/osdebug.c	2010-09-28 18:22:36.868665145 +0800
@@ -116,7 +116,7 @@
 void NutDumpThreadQueue(FILE * stream, NUTTHREADINFO * tdp)
 {
 #ifdef ARCH_32BIT
-    static prog_char fmt[] = &quot;%08lX %-8s %4u %s %08lX %08lX %08lX %9lu %s\n&quot;;
+    static prog_char fmt[] = &quot;%08X %-8s %4u %s %08X %08X %08X %9u %s\n&quot;;
 #else
     static prog_char fmt[] = &quot;%04X %-8s %4u %s %04X %04X %04X %5u %s\n&quot;;
 #endif
@@ -156,8 +156,8 @@
 {

 #ifdef ARCH_32BIT
-    static prog_char fmt1[] = &quot;%08lX %-8s %4u %s %08lX %08lX %08lX %9lu %s&quot;;
-    static prog_char fmt2[] = &quot; %08lX&quot;;
+    static prog_char fmt1[] = &quot;%08X %-8s %4u %s %08X %08X %08X %9u %s&quot;;
+    static prog_char fmt2[] = &quot; %08X&quot;;
 #else
     static prog_char fmt1[] = &quot;%04X %-8s %4u %s %04X %04X %04X %5u %s&quot;;
     static prog_char fmt2[] = &quot; %04X&quot;;
@@ -209,9 +209,9 @@
     static prog_char tname[] = &quot;NutEventTimeout&quot;;
 #ifdef ARCH_32BIT
     static prog_char theader[] = &quot;Address  Ticks  Left Callback\n&quot;;
-    static prog_char fmt1[] = &quot;%08lX%6lu%6lu &quot;;
+    static prog_char fmt1[] = &quot;%08X%6lu%6lu &quot;;
     static prog_char fmt2[] = &quot;%09lX&quot;;
-    static prog_char fmt3[] = &quot;(%08lX)\n&quot;;
+    static prog_char fmt3[] = &quot;(%08X)\n&quot;;
 #else
     static prog_char theader[] = &quot;Addr Ticks  Left Callback\n&quot;;
     static prog_char fmt1[] = &quot;%04X%6lu%6lu &quot;;
@@ -263,9 +263,9 @@
 {

 #ifdef ARCH_32BIT
-    static prog_char fmt1[] = &quot;%08lx %9ld\n&quot;;
-    static prog_char fmt2[] = &quot;%lu counted, but %lu reported\n&quot;;
-    static prog_char fmt3[] = &quot;%lu bytes free\n&quot;;
+    static prog_char fmt1[] = &quot;%08x %9d\n&quot;;
+    static prog_char fmt2[] = &quot;%u counted, but %u reported\n&quot;;
+    static prog_char fmt3[] = &quot;%u bytes free\n&quot;;
 #else
     static prog_char fmt1[] = &quot;%04x %5d\n&quot;;
     static prog_char fmt2[] = &quot;%u counted, but %u reported\n&quot;;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/595/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/595/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/595/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=595&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-codesourcery-gcc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiling Nutconf for Nut/OS-4.9.9 with wxWidget-2.8</title>
		<link>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-wxwidget-2-8/</link>
		<comments>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-wxwidget-2-8/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 10:54:29 +0000</pubDate>
		<dc:creator>kunilkuda</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://embeddedfreak.wordpress.com/?p=588</guid>
		<description><![CDATA[It seems like the Nut/OS-4.9.9 nutconf has some compiling issue with wxWidget-2.8 (the default Ubuntu Lucid wxWidget). Here&#8217;s some patch to fix the &#8216;nutconf&#8217; compilation<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=588&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It seems like the <a href="http://sourceforge.net/projects/ethernut/files/ethernut/4.9.9%20beta/ethernut-4.9.9.tar.bz2/download">Nut/OS-4.9.9 </a>nutconf has some compiling issue with wxWidget-2.8 (the default Ubuntu Lucid wxWidget). Here&#8217;s some patch to fix the &#8216;nutconf&#8217; compilation</p>
<p><span id="more-588"></span></p>
<p><pre class="brush: cpp;">
diff -Naur ethernut-4.9.9/nut/tools/nutconf/nutconfdoc.cpp ethernut-nutconf_bug-4.9.9/nut/tools/nutconf/nutconfdoc.cpp
--- ethernut-4.9.9/nut/tools/nutconf/nutconfdoc.cpp	2010-04-15 01:54:55.000000000 +0800
+++ ethernut-nutconf_bug-4.9.9/nut/tools/nutconf/nutconfdoc.cpp	2010-09-28 17:54:22.056471424 +0800
@@ -280,9 +280,11 @@
                     }
                 }
                 if (value) {
-					wxString escapedValue( value );
-					escapedValue.Replace(wxT(&quot;\&quot;&quot;), wxT(&quot;\\\&quot;&quot;)); // escape (&quot;) to (\&quot;);
-                    fprintf(fp, &quot;%s = \&quot;%s\&quot;\n&quot;, opts-&gt;nco_name, escapedValue.c_str());
+                    wxString escapedValue = wxString::FromAscii( value );
+                    escapedValue.Replace(wxT(&quot;\&quot;&quot;), wxT(&quot;\\\&quot;&quot;)); // escape (&quot;) to (\&quot;);
+                    //fprintf(fp, &quot;%s = \&quot;%s\&quot;\n&quot;, opts-&gt;nco_name, escapedValue.c_str());
+                    fprintf(fp, &quot;%s = \&quot;%s\&quot;\n&quot;, opts-&gt;nco_name, (const char*) escapedValue.mb_str(wxConvUTF8));
+
                     free(value);
                 }
             }
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/embeddedfreak.wordpress.com/588/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/embeddedfreak.wordpress.com/588/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/embeddedfreak.wordpress.com/588/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=embeddedfreak.wordpress.com&amp;blog=1740165&amp;post=588&amp;subd=embeddedfreak&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://embeddedfreak.wordpress.com/2010/09/28/compiling-nutos-4-9-9-with-wxwidget-2-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/13b3ee554fe96a750148b9819d734843?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">kunilkuda</media:title>
		</media:content>
	</item>
	</channel>
</rss>
