<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17048932</id><updated>2011-07-07T16:31:15.455-04:00</updated><title type='text'>ihp 120 Project (yr: 2005)</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ihpos.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17048932.post-113089181389417129</id><published>2005-11-01T19:23:00.000-05:00</published><updated>2005-11-01T19:36:53.923-05:00</updated><title type='text'>Pong</title><content type='html'>I fixed a heck of a lot of bugs, implemented timing, interrupts/exceptions, randomness and added some non alphanumeric characters. In the process, I made a fun little pong demo (controls are up/down on nav toggle for player1, rew/ffw on remote for player2 and play to toggle backlight). Here are a few screenshots from that:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Title Screen:&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/pong_MG_1607.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5301/1634/320/pong_MG_1607.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How many points should we play to?&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/pong_MG_1608.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5301/1634/320/pong_MG_1608.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Game Itself:&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/pong_MG_1620.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5301/1634/320/pong_MG_1620.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-113089181389417129?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/113089181389417129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/113089181389417129'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/11/pong.html' title='Pong'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112994985131055021</id><published>2005-10-21T22:42:00.000-04:00</published><updated>2005-10-21T22:57:31.316-04:00</updated><title type='text'>Interactivity!</title><content type='html'>After I got text output working, I wrote a ultoa and itoa routine and some code to output conversions of all ADC channels. From this, I can read values that will help me interprit the various button presses. I noticed that the play and hold buttons on both the remote and main player didn't result in an ADC change, but found GPIOs that corresponded to them. So I think I will try to write a pong game soon as a demo, but I will probably need to get timing working first. Well anyways, here's an image of my tool, with descriptions of the different readouts (click image to see bigger):&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/tool.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/tool.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I found a site that hosts files like these, so if anyones interested you can download it &lt;a href="http://fileanchor.com/6896-d"&gt;here&lt;/a&gt; (compatible with the rockbox bootloader). I hope to setup a sourceforge page shortly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112994985131055021?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112994985131055021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112994985131055021'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/10/interactivity.html' title='Interactivity!'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112990755017060280</id><published>2005-10-21T10:49:00.001-04:00</published><updated>2009-09-08T10:05:06.178-04:00</updated><title type='text'>Hacks</title><content type='html'>The code I have added over the past couple of weeks has basically been a big collection of hacks that I plan to get rid of eventually but should speed up development. First, I coded a basic malloc routine, based on the first fit algorithm. I plan to switch this to a buddy allocator in the future. I figured that I wouldn't need to free memory yet, as there is 32 MB available, so I did not implement the free function yet... I may just wait until i write the new allocator to do that. I decided I wanted to handle button presses, so I learned about the Analog Digital Converter (ADC) which the buttons are wired to and wrote some code that should read from it. The issue that turned up is that I can't really detect button presses if I don't know what resistances to check for. So i decided that I needed some output of the resitances, which means that I need fonts. So I wrote a plugin for GIMP that outputs an image as one of my image_data structures in some generated c code. So to put the image into my code, I only need to compile the generated c file and use the symbol name. So what I did to get a font going is type a long string of letters and numbers in a monospaced font into an image, save it using my GIMP plugin, and then write a routine to blit the correct section of that image for each character. I plan to get real fonts going in the future, but I wanted some sort of quick output for the time being.&lt;br /&gt;&lt;br /&gt;Then I proceded to test out my letter blitting routine by drawing letters vertically:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/_MG_1581.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/_MG_1581.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And then also my string drawing function:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/_MG_1585.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/_MG_1585.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112990755017060280?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112990755017060280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112990755017060280'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/10/hacks.html' title='Hacks'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112855140351238326</id><published>2005-10-05T18:26:00.000-04:00</published><updated>2005-10-05T18:30:03.520-04:00</updated><title type='text'>IDE &amp; Memory Management</title><content type='html'>So I wrote a temporary memory management implementation, using the first-fit algorithm.  I am planning on implementing the buddy system or possibly something newer later on.  I only needed a temporary fix so I could continue.&lt;br /&gt;&lt;br /&gt;I was able to initialize the IDE interface, but I'm having difficulties finding examples of uses of it in the disassembly.  Also, the m5249 docs don't seem to have much info.  Hopefully I will be able to figure this out soon so I can interface with it and then write disk io functions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112855140351238326?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112855140351238326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112855140351238326'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/10/ide-memory-management.html' title='IDE &amp; Memory Management'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112826682274434360</id><published>2005-10-02T11:25:00.000-04:00</published><updated>2005-10-02T11:47:40.430-04:00</updated><title type='text'>Working LCD Driver</title><content type='html'>So I got my LCD driver to fully work this morning. Some bits of it are sketchily set up though due to no memory management. Heres a pic of what it looks like now (drawing from a buffer):&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/IMG_14321.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/IMG_14321.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;So I guess the only thing left to do with the driver (which I will put off for now) is to create a partial update function that only updates a region of the display (when the whole display is updated, there is a visible tear which can hopefully be fixed through partial updates).&lt;br /&gt;&lt;br /&gt;I'm not exactly sure what I should do next.  I guess the possibilities are: memory management, hard disk access, graphics api, kernel &amp; threading.  I think that text output would be a good thing to have.  For this (unless I come up with a better way) I would need to have bitmap font loading from the harddisk and likely memory management stuff as well.  So i think that I should get the memory thing done with and then hard drive accessing and then bitmap blitting / fonts.  Since I'm not very familar with the implementation of thread schedualing, having text output would probably speed up development in that area significantly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112826682274434360?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112826682274434360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112826682274434360'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/10/working-lcd-driver.html' title='Working LCD Driver'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112812072007005732</id><published>2005-09-30T18:49:00.000-04:00</published><updated>2005-09-30T18:56:46.913-04:00</updated><title type='text'>Display Oddities</title><content type='html'>I've been messing with LCD output a bit. At first when I tried to clear the screen, I just ended up with a set of vertical lines, as if it skipped every other pixel in drawing:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/lines.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/lines.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So I decided to reinitialize the display. I wrote some bad init code from the start, so i had to mess with it a while, but then I redid it and ended up with &lt;span style="font-weight: bold;"&gt;blue&lt;/span&gt;! even though &lt;span style="font-weight: bold;"&gt;Its not a color display&lt;/span&gt;!  I will try to find out if it is a bad thing for the display to have color on it - and whether more colors are possible.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/blue.jpg"&gt;&lt;img style="cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/blue.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112812072007005732?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112812072007005732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112812072007005732'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/display-oddities.html' title='Display Oddities'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112801812370850834</id><published>2005-09-29T14:07:00.000-04:00</published><updated>2005-09-29T14:22:03.760-04:00</updated><title type='text'>LCD Accessed</title><content type='html'>I figured out how to access the LCD today. I read the disassembly for some code that accessed CS1 (where the LCD is hooked up) and found patterns that matched up with those in the LCD &lt;a href="http://www.andilcd.de/en/download/controller/andilcd_congraf_sheet_en_s1d15e06.pdf"&gt;user manual&lt;/a&gt;. Basically heres how it works:&lt;br /&gt;&lt;br /&gt;GPIO1 Bit #3 (8 / -9 when or'd or and'd) corresponds to A0 on the LCD.&lt;br /&gt;The memory address range set in the initialization (which is set simply through MBAR+$8c -&gt; MBAR+%94 if i remember correctly -- look through the original firmware to find it) is used for the data byte.&lt;br /&gt;&lt;br /&gt;So it seems for most commands you set A0 to off, set the data byte to the command name, set A0 to on and then set the data bytes to the data you want used by the command).&lt;br /&gt;&lt;br /&gt;Since I am familiar with how it works, I should now be able to write an LCD driver and graphics API - though I only need text output so i can write the kernel. I will play around with it a bit first before I write the API though. I'm not really sure how I will design the API yet, as I may want to include bitmap scaling and other things and also may want to have separate application display contexts. I will try to find out quickly if there is a built in mechanism to the LCD for writing characters, as that would make debugging much easier.&lt;br /&gt;&lt;br /&gt;Well, here are the lovely pixels I drew:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/IMG_1401.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/IMG_1401.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112801812370850834?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112801812370850834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112801812370850834'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/lcd-accessed.html' title='LCD Accessed'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112795365015336039</id><published>2005-09-28T20:24:00.000-04:00</published><updated>2005-09-28T20:41:46.940-04:00</updated><title type='text'>Backlight Flashing Images</title><content type='html'>Before I work on accessing the lcd display and writing a driver for it, I thought I'd post my work in its current state -- a flashing backlight that litterally looks like a strobe light. Its kinda hard to tell from the pics, but visuals are fun anyways.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/iboff.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/iboff.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5301/1634/1600/ibon2.gif"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/5301/1634/320/ibon2.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The general code for this is as follows:&lt;br /&gt;&lt;br /&gt;First you need to initialize the MBAR (Module Base Address Register). Heres my code to do so (with MBAR and MBAR2 already defined):&lt;br /&gt;&lt;br /&gt;#if MBAR &amp; 1&lt;br /&gt;#define MBAR_SET MBAR&lt;br /&gt;#else&lt;br /&gt;#define MBAR_SET MBAR+1&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;#if MBAR2 &amp;amp; 1&lt;br /&gt;#define MBAR2_SET MBAR2&lt;br /&gt;#else&lt;br /&gt;#define MBAR2_SET MBAR2+1&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;move.l #MBAR_SET, %d0&lt;br /&gt;movec.l %d0, %mbar&lt;br /&gt;&lt;br /&gt;move.l #MBAR2_SET, %d0&lt;br /&gt;movec.l %d0, %mbar2&lt;br /&gt;&lt;br /&gt;Next, you can enable and turn on and off the light with some simple c code:&lt;br /&gt;#define GPIO1_OUT *((int *)(MBAR2 + 0x000000B4))&lt;br /&gt;#define GPIO1_ENABLE *((int *)(MBAR2 + 0x000000B8))&lt;br /&gt;&lt;br /&gt;To enable the light:&lt;br /&gt;GPIO1_ENABLE |=  0x00020000;&lt;br /&gt;&lt;br /&gt;To turn it on:&lt;br /&gt;GPIO1_OUT &amp;= 0xFFFDFFFF;&lt;br /&gt;&lt;br /&gt;To turn it off:&lt;br /&gt;GPIO1_OUT |=  0x00020000;&lt;br /&gt;&lt;br /&gt;I am really surprised, because if you set a bit &gt; than the 16th bit in c with binary or, gcc optimizes it to bitset while if its less than 16, it is a binary or with a word. I didn't expect it do be this smart.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112795365015336039?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112795365015336039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112795365015336039'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/backlight-flashing-images.html' title='Backlight Flashing Images'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112795154509005438</id><published>2005-09-28T19:40:00.000-04:00</published><updated>2005-09-28T19:52:25.093-04:00</updated><title type='text'>Bugs, bugs and more bugs</title><content type='html'>So, whenever I made any changes to my c code, seemingly unpredictable things would happen.  I'll tell you what I learned and the final solution.&lt;br /&gt;&lt;br /&gt;At first I thought it may have been a compiler issue.  Using -Wa,-m5249 (specifies as should assemble for the m5249 coldfire processor) , I got an error that there was some bad assembly code -- generated code.  So it seemed that the compiler was generating bad asm. I tried to do option -m5249 to no avail -- it didn't have that architecture available.  I found a very useful list of options if you do m68k-elf-gcc --target-help . -m5200 was kinda-sorta in the list with -m5249 so i tried that and it seems to be working. Hopefully m5249 is a derivative of the m520x architecture.&lt;br /&gt;&lt;br /&gt;In this process, I found fomit-frame-pointer to cut down on some assembly which doesn't look to do much.  I don't know if I am schedualing my own demise by setting this though.&lt;br /&gt;&lt;br /&gt;These didn't fix my troubles, so i ran back to my handy 92 MiB dissassembly and looked through the initialization code.  I noticed that the stack pointer was being set to a location on SRAM0 (the 32k one). I tried to set this to that location, but unfortunately used relative addressing. Apparently the instructions look identical except for a # before the symbol name. I noticed the difference by reading the dissassembly of my own code and noticing that some move.l's ended in c while others ended in 9's.  Apparently c is absolute and 9 is relative, meaning that bit 3 determines relative / absolute. So after I got the relative / absolute situation worked out, I got it to work.&lt;br /&gt;&lt;br /&gt;So I guess the moral is to not setup a stack pointer that will write over your code when its used.  I can't believe I could figure this out, because the symptoms were really very random.&lt;br /&gt;&lt;br /&gt;I have my code flash the backlight like crazy right now. It is completely seizure-tastic.  You really can't look away when it is doing that.  I hope to figure out how to get the lcd working soon so I can actually get some decent feedback.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112795154509005438?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112795154509005438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112795154509005438'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/bugs-bugs-and-more-bugs.html' title='Bugs, bugs and more bugs'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112775903905545742</id><published>2005-09-26T14:14:00.000-04:00</published><updated>2005-09-26T14:23:59.060-04:00</updated><title type='text'>MBARS</title><content type='html'>I was wrong. It looks like only the pepherials (sp) are set by chip select. Everything else looks to have their own address range setting register ("mask" in the freescale coldfire user manual).  The MBAR (Module Base Address Register) and MBAR2 registers set the base address for the SIM (System Integration Module) registers. The SIM is quote&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"The SIM provides overall control of the internal and external buses and serves as the interface between the ColdFire core processor and the internal peripherals or external devices."&lt;/blockquote&gt;That sounds like what I'm looking for. So now that I have the MBAR set up, I can access the I2C controlling registers such as the MBCR (MBAR_ADDR + 0x0288 I believe) and other registers.&lt;br /&gt;&lt;br /&gt;So i guess the plan is this:&lt;br /&gt;#define the I2C control registers like:&lt;br /&gt;#define MBCR *(MBAR_ADDR + 0x0288)&lt;br /&gt;and then i should (hopefully) be able to access them like so:&lt;br /&gt;MBCR = value;&lt;br /&gt;which gets translated into:&lt;br /&gt;*(MBAR_ADDR + 0x0288) = value;&lt;br /&gt;obviously by the preprocessor.&lt;br /&gt;&lt;br /&gt;After I have access to the I2C bus, I will have to try to figure out a way to access the lcd which will be the hard part (not that I none of this was hard)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112775903905545742?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112775903905545742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112775903905545742'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/mbars.html' title='MBARS'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112775030403329433</id><published>2005-09-26T11:47:00.000-04:00</published><updated>2005-09-26T11:58:24.036-04:00</updated><title type='text'>Chip Selects</title><content type='html'>After reading through the Coldfire manuals, it looks like the memory addresses like 0x31000000 are mapped by these things called chip selects. Apparently you can set the address range for memory and even peripherals.&lt;br /&gt;&lt;br /&gt;The LCD screen is connected to the Coldfire chip via a I2C / GPIO bus.  I tried starting the bus as master, but gcc yelled at me because it didn't like me referencing the register by name. There must be some sort of register addressing system perhaps by some base address set up with tthe chip select.  If there is one, then it may be possible to set registers via memory address ranges in c. For example, if there is a register &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; with address &lt;span style="font-style: italic;"&gt;A&lt;/span&gt; then you could set it simply via *A = value;&lt;br /&gt;&lt;br /&gt;So i guess i should figure out how to access the LCD bus properly and then figure out how to interface with the device.  I have absolutely no idea how I will be able to test this though.  Hopefully I can find a way to get some sort of useful output out of the box soon - otherwise I may have to give up the project because I won't be able to do much more.&lt;br /&gt;&lt;br /&gt;Another thing to consider: setting up the chip selects may require supervisor mode.  Hopefully the bootloader I'm using didn't take that privelege away.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112775030403329433?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112775030403329433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112775030403329433'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/chip-selects.html' title='Chip Selects'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112751978483701800</id><published>2005-09-23T19:44:00.000-04:00</published><updated>2005-09-23T19:56:24.840-04:00</updated><title type='text'>C Code Only</title><content type='html'>I figured out a way to load into my main() in c without any assembly using only my linker script.  Right now it boots into the firmware using inline asm inside of my main().&lt;br /&gt;&lt;br /&gt;Next steps:&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;Find a way to get a form of output.  Right now my output has been binary (true / false). If something I'm testing works, it boots into the firmware, otherwise it does nothing. This isn't very helpful in alot of cases.  I may consider buying the serial BDM link so that I can get more info, as I will need the cable eventually anyways.&lt;/li&gt;   &lt;li&gt;Write the kernel.  This will likely be time consuming, much more so if I can't get meaningful output from the box.&lt;/li&gt; &lt;/ul&gt; Related to the kernel, there are two issues that I need to figure out how to resolve:&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;I need to be able to run a thread for a set number of instructions in user mode and get back to supervisor mode afterwards.  I need it to jump back to my supervisor instructions if an exception is raised.&lt;/li&gt;   &lt;li&gt;I need to find a way for a thread in user mode to interact with supervisor instructions.  For example, from what I read it looks like LCD drawing, button presses, and basically every other type of IO needs to be done in supervisor mode.  So if I have user mode threads, they need to be able to access these functionalities.&lt;/li&gt; &lt;/ul&gt; So I have a lot of work ahead of myself. I will try to find out the best way to post files to my blog.  I really don't have a good network setup so running a server at my home is unrealistic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112751978483701800?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112751978483701800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112751978483701800'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/c-code-only.html' title='C Code Only'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112750916845110638</id><published>2005-09-23T16:43:00.000-04:00</published><updated>2005-09-24T13:33:11.703-04:00</updated><title type='text'>First Running Code</title><content type='html'>After four days of wrestling with the bootloader and figuring out how it loads code. I got code to run through the Rockbox bootloader! Right now i just am using some assembly that loads the regular iriver firmware on boot. So if it works, the firmware loads. If it fails, it freezes and a paper clip is needed to reset it.&lt;br /&gt;&lt;br /&gt;The bootloader loading mechanism is actually rather simple when you figure it out. I had to deal with linker scripts that wouldn't do what I want and frequent disassembling and hex editing to get it to work. I will describe it because it hasn't been documented anywhere else.&lt;br /&gt;&lt;br /&gt;The general file structure of your code needs to look like this if you want it to run:&lt;br /&gt;[4 bytes (chksum)][4 bytes(model name)][4 bytes("end of stack")][4 bytes(address of starting instruction)][many bytes(actual code)]&lt;br /&gt;The chksum is computed by adding every byte from the "end of stack" byte onwards to a long.&lt;br /&gt;&lt;br /&gt;This code is loaded into memory at 0x31000000 (first memory location of SDRAM), so all of your references to variables and symbols need to be setup so that is the base address instead of 0x00000000. This can be done with a linker script (an lds file).&lt;br /&gt;&lt;br /&gt;I'm going to try to figure out if its possible to cut out the assembly altogether in the linking process -- whether it is necessary to have some assembly in order to start code with the bootloader or if it can be skipped. I hope to be able to clean it up a bit tonite and have a simple version up, but my sister is being a pain and not letting me use what is currently our only Windows box to copy code onto the player (for whatever reason Ubuntu Breezy won't let me put stuff on the player -- and Vista build 5219 isn't dual boot friendly)&lt;br /&gt;&lt;br /&gt;The tool chain I'm using consists of binutils and gcc, compiled with --target=m68k-elf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112750916845110638?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112750916845110638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112750916845110638'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/first-running-code.html' title='First Running Code'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17048932.post-112749601129292606</id><published>2005-09-23T13:12:00.000-04:00</published><updated>2005-09-23T13:46:45.503-04:00</updated><title type='text'>Project Introduction</title><content type='html'>&lt;span style="font-weight: bold;font-family:times new roman;" &gt;GOALS:&lt;br /&gt;&lt;/span&gt; &lt;ul&gt;   &lt;li&gt;&lt;span style="font-family:times new roman;"&gt;To create a functional operating system and application platform for the &lt;a href="http://www.iriveramerica.com/support/hd/h100.aspx"&gt;iRiver iHP-120 (H120)&lt;/a&gt; MP3 Player.&lt;/span&gt;&lt;/li&gt;   &lt;li&gt;&lt;span style="font-family:times new roman;"&gt;To learn more about system architecture and operating system fundamentals&lt;/span&gt;&lt;span class="down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/li&gt;   &lt;li&gt;&lt;span style="font-family:times new roman;"&gt;The develop skills in reverse engineering&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;span style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;PLAN:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;ol&gt;   &lt;li&gt;Develop an operating system for the iHP-120, using the &lt;a href="http://www.rockbox.org/twiki/bin/view/Main/IriverBoot"&gt;Rockbox bootloader&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Purchase a BDM debugger (it costs $150 which is why i am hesitant to make the firmware before the OS) and create my own bootloader and firmware&lt;/li&gt;   &lt;li&gt;Develop applications for the OS and create a usable interface&lt;br /&gt;  &lt;/li&gt; &lt;li&gt;Create a pretty website for future work&lt;br /&gt;  &lt;/li&gt;  &lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17048932-112749601129292606?l=ihpos.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112749601129292606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17048932/posts/default/112749601129292606'/><link rel='alternate' type='text/html' href='http://ihpos.blogspot.com/2005/09/project-introduction.html' title='Project Introduction'/><author><name>Me</name><uri>http://www.blogger.com/profile/01371044225212029596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
