Friday, December 04, 2009

OMAPZoom tutorial hour!!

So omapzoom folks have a tutorial hour now, some really cool topics get caught up here.. this week:

· Android on OMAP Overview and Resources

· DSP Bridge Overview

· OpenEmbedded Overview


it is a webex (works on most OSes including a linux PC) + teleconf -> large number of access numbers from around the world
more information here. the OMAP tutorial hour (including the previous presentations - which by the way explains kernel process from TI) are available here.

Thursday, November 19, 2009

Smart Reflex what is it?


Googling around, I found this beautiful article that gives excellent explanation of how Adaptive Voltage behaves in the system.

by the way, this is going to be part of my rewrite of smart reflex driver to make the voltage infrastructure a lot more cleaner and easy to use.
General flow I am thinking is as follows(will change ofcourse):
voltage driver
|------------> No SR PMICs implementation thru regulator framework perhaps.
\-------> Smart reflex driver
|----> PMIC interface (for class 0 devices)
|-----------------------------------\
\-----> Voltage processor driver -> Voltage controller driver
Ofcourse things might change as I move on with the implementation (I need to think a little more on this), but once I am done, you should be able to see it here

Wednesday, October 14, 2009

few new things I see on linux-omap kernel community

After a long while of staying off linux-omap, been watching it rather closely recently.. here are some interesting stuff I saw this month:
  • Power Management: Operating points and general PM strategy for handling for various silicons here
  • Silicon Feature support for OMAP3 here
  • New silicon support: OMAP35xx and 36xx support being introduced.
  • Discussion on memory and cache issue here
  • ETM, ETM support here
  • few new PMIC - 6030 and 5031
  • hints of wl1251 support getting upstream
  • IO_ADDRESS is dead use io_remap like the rest of the world
  • spring cleaning of omap850/730 series
and of course a bunch of stuff I have missed posting here such as move to 2.6.32-rc4 by Tony and Kevin, both pushing out patches to mainline etc.....

some interesting posts

High time I "ported" my posts from facebook back here..so here it goes
Some really bad code stories:

  • shared by rob clark - how bad can some code go??
http://thedailywtf.com/Articles/The-Shenanigans-Handler.aspx

  • Aint this cool:
http://arstechnica.com/web/news/2009/09/horrifically-bad-software-demos-become-performance-art.ars

Techno Curios:
  • Tired of fullspeed, highspeed, lowspeed?? how about superspeed?? tired of acronymns already??
http://www.pcworld.com/article/172757/wheres_usb_30.html

  • Search for my cheap oscilloscope goes on:
http://www.micahcarrick.com/06-06-2006/pc-sound-card-oscilloscope-linux.html
http://www.fpga4fun.com/digitalscope.html

Hacks 'nd bytes:
  • PS3 back with Hulu..
http://www.ypass.net/blog/2009/06/got-a-ps3-want-hulu-back-easy-enough/

timing diagrams

drawtime

This is kinda a cool app that runs on ubuntu to draw timing diagrams as follows:
Example(from the drawtime website):
CS1 = 1, OE = 1, ADDR = X, DATA = Z.

CS1 = 0, OE = 0, ADDR = "".
OE -tOE> DATA = "";
CS1 -tCS1> DATA;
ADDR -tACC> DATA.

OE = 1, CS1 = 1, ADDR = X.
CS1 -tH> DATA = Z;
OE -tH> DATA;
ADDR -tH> DATA.

and you can now generate all those cool waveforms without having to worry about did you get the lines right etc..

more such cool stuff here

Saturday, September 19, 2009

Flashlite and Valgrind for OMAP3!!

Looking through the beagleboard facebook group,
Saw two interesting points:
For all the Beagleboard fans out there, we’ve created an evaluation version of Flash Lite 3. This is a fully functional version of Flash Lite that times out in 3 minutes. It is built on Angstrom Linux distribution and requires X. Please email me if you are looking for more information or are interested in having one. I should mention that OMAP 3530 (ARM Cortex A8) is a powerful CPU and seems to handle graphics as well as video very well."

How to build Valgrind for Beagleboard
1) Get Valgrind source code from SVN using revision 9648 and 1888 for VEX
svn co -r 9648 svn://svn.valgrind.org/val
grind/trunk
cd VEX
svn update -r 1888

2) Download the patch here http://bugsfiles.kde.org/attachment.cgi?id=32348

3) Apply the patch into the source code
cd valgrind
patch -p1 < [path to the patch]

4) Run autogen.sh to run autotools

5) Configure the source code
./configure --host=arm-angstrom-linux-gnueabi

The patch still has some bugs such as CPU instruction alignment you can 'cat /proc/cpu/alignment' to find out if the kernel is configured to fix unaligned accesses, and you can enable it by executing 'echo 2 > /proc/cpu/alignment' but it's enough to use for simple application.
Have fun with Valgrind :-)


The above quotes are straight from Facebook posts itself..

Saturday, September 12, 2009

CELF 2009 - France (ELC-Embedded Linux Conference)

here are the sessions in the conference: http://www.embeddedlinuxconference.com/elc_europe09/sessions.html

Includes Sascha and my personal fav - u-boot v2.

Thursday, September 10, 2009

And then Finally TI U-Boot tree!!

Finally.... here it is!!! patches for u-boot to be send straight to u-boot mailing list.

Monday, August 31, 2009

Free DSP codecs!!!

Wow.. a blast of new sites for omapzoom..

And then I see this on the new omapzoom google groups!!!
* MPEG4 Video Dec
* H263 Video Dec
* JPEG Dec
* JPEG Enc
* AAC Dec
https://gforge.ti.com/gf/project/openmax/frs/?action=index
And you also now have a wiki for omap

Sunday, August 16, 2009

Plato! trace-visualize-debug-filter code path!

Got this link from a colleague - kinda useful if you would like to use it for your own purposes.. quote from the site:
PLATO is a tool for displaying and analyzing software traces from an application being debugged. It connects to TTIF (libttif.so, included) which provides a lower overhead replacement for printf(), so as to minimize the chance that timing related bugs disappear when you enable debug traces, and also some binary trace APIs. PLATO can be running on a separate PC from the application being debugged, making it suited for embedded development. PLATO will decode/filter/display/visualize the traces

Friday, August 14, 2009

towards a integrated infrastructure for feature + errata handling in kernel

I have a confession to make: I am fanatic about clean code. I like it simple and I like it elegant.

Few days back, I had a chat on linux omap mailing list on what I'd dream to see instead of a half a dozen cpu_has_feature_XYZ() APIs in the system.. The thought is more of this form:
  • Some sort of infrastructure which is common to all silicons,platforms exist which provides method to register the tuple (silicon_rev_id | ip_module_rev_id, feature_errata_id)
  • Specific drivers such as DMA, I2C, McBSP, PRCM etc.. on registration provides to the system the an array of tuples for that device.
  • Platform on bootup provides the platform_data to the driver, which allows the driver to start, but now, it can also detect cpu_rev and can grap it's own IP Module rev from it's own register.. -> that is provided to the infrastructure

  • Every time there is a need to check to enable/disable feature/errata, all the code needs to do is:
if (is_enabled(dev, OMAP3_ISP) ) {
do my stuff;
}

is'nt that cleaner than
if (cpu_is_3430() && (cpu_rev >= OMAP3430_ES3P1) ) {
do my stuff;
}
or
if (cpu_is_3430() && (omap_features & OMAP_HAS_ISP) {
do my stuff;
}
  • Now what ever we do here can easily be displayed by the subsystem by exposing a cat /sys/devices/... /features or even club it with cat /proc/cpuinfo if that is what people want -> you can do it anytime anywhere if you retain just the data you need... ;)
  • No need to store the entire database of features in the infrastructure for ever, we can save memory by making the original array init_data and copying it into a list which is easier to search for the infrastructure..

Now, this infrastructure can also be readily used for external peripherals outside the chip - like camera sensors, RFBI displays etc.. come to think of this, it kinda looks the way how I2C board_info is handled in some ways.. hmmm...

Now, only thing I need is get some time to do this, as Kevin seems interested in the original patch.. couple of fortnights to go before i get some personal time to hack some *real* code.. ;) but what the heck.. if there is anyone out there who has the time and interest to do this.. go ahead and do it..

Thursday, August 13, 2009

Replace CAmELcASiNg with lower_casing

Finally irritated with a bunch of CaMELcASinG, decided to write a small script albeit not too clean or optimized for the job of a search and destroy
Since it is weird to write my own c interpreter to find the right targets to replace, I use output of ctags to generate tags file. if you are using kernel, you could just do a make tags to get the same output file.

#!/bin/bash
# Silly little script to replace CaMELCaSInG to lower_casing
# Half a zillion thoughts later,
# why not use ctags which has c interpreter already to do
# function identification for us?
if [ ! -r 'tags' ]; then
echo "Sorry.. no tags file!"
exit 1
fi
if [ ! -r "$1" ]; then
echo "I need a directory or a file for replacing.."
exit 2
fi
DIR_FILE=`echo "$1"|sed -e "s/\//\\\//g"`
# tags have the following notation in field 4 (tab seperated)
# e - enum value
# d - define
# f - function
# F - File itself
# g - enum type
# m - structure parameter
# p - prototype
# r - kconfig define(refered)
# s - structure type
# t - typedefined variable
# v - variable
# x - extern defined variable
# we can choose to have different rules:
# rename rule i am going to follow:
# Any define -> convert camelcase to lower_case_define->convert to caps
# Any function, enum,struct param,prototype,struct type, typedef var,extern def ->
# camel_case to lower_case_define
# All files will be made unix file only (no point in dos + unix mixtures..)

#**
#* @brief - changes camel casing to ones with smaller case
#*
camel_to_norm(){
echo $1|tr '\_' '+' |sed 's/\([A-Z]\)/_\l\1/g' | sed 's/^_\([a-z]\)/\1/g' |\
tr 'A-Z' 'a-z' | sed "s/\([a-z][a-z]\+\)/-\1-/g"|tr -d '_'|\
tr '-' '_'|sed -e "s/_$//g"|sed -e "s/^_//g" | tr '+' '_' |\
sed -e "s/__*/_/g"|sed -e "s/_\([0-9][0-9]*\)/\1/g"|\
sed -e "s/^[a-z]\_\([a-z][a-z]\+\)/\1/g"


}

#**
#* @brief - all_to_upper - Moves all to upper case
#*
all_to_upper(){
camel_to_norm $1 | tr 'a-z' 'A-Z'
}

#**
#* @brief generate_list - will generate list of symbols from tags matching
#*
generate_list() {
cut -d' ' -f1,4 $TMPFILE|grep "$1\$"|cut -d' ' -f1|sort|uniq
}

#**
#* @brief find_files - finds list of files from tag file matching usage
#*
find_files(){
cut -d' ' -f1,2 $TMPFILE|grep "^$1"|cut -d' ' -f2|sort|uniq
}
TMPFILE=/tmp/cleaner.$$.tmp
TMPFILE1=/tmp/cleaner.$$.1.tmp
# grab the output for only the ones we want..
grep "$DIR_FILE" tags |grep -v "^\!"|sed -e "s/\/\^.*\"/REPLACE_1/g">$TMPFILE

replace_pattern(){
echo "=====>Search and replace for pattern $1 with $2"
# Convert the functions back to smaller case and replace them in the files
for token in `generate_list "[$1]"`
do
if [ $2 -eq "1" ]; then
new=`camel_to_norm $token`
else
new=`all_to_upper $token`
fi
if [ "$new" != "$token" ]; then
echo "==>Replacing $token with $low"
for file in `find_files $low`
do
echo "->replacing $token to $new in file $file"
cp $file $TMPFILE1
dos2unix $TMPFILE1
sed -e "s/\(W*\)$token\(\W*\)/\1$new\2/g" $TMPFILE1>$file
done
else
echo "==>not replacing $token"
fi
done
}
echo "================= Replacing Defines ==============="
replace_pattern d 2
echo "================= Replacing Functions ==============="
replace_pattern efgmpstvx 1
rm -f $TMPFILE $TMPFILE1

usage:
Replace file_or_directory.


Note, we could definitely customize this by adding prefix or in cases where code originates from windoze environment, removing dw_ dl_ etc.. that is pretty easy to do once you pick on tags and know what to do for output ;)

Monday, August 10, 2009

omap PM in elinux.org!

Kevin (PM) has put some cool stuff up on elinux page. may want to check it out..

Wednesday, August 05, 2009

Cool your laptop - linux governor

Check this script out:
for i in /sys/devices/system/cpu/cpu[0-9]; do echo $i `cat $i/cpufreq/scaling_governor`; done

and see here for a description and this for a bit of history

Birds of the kernel feathers come together

Been feeling guilty of not blogging the last few months.. anyways, here is something of interest.
For all those interested, see here

LinuxCon takes place on Sept 21-23 -> registration is running if you like to take part in. there is also bunch of parallel conferences happening. see the list here

what would really be interesting for OMAP is the linux plumber's conf and Han's new V4l2 plan

Be there if you would like to see a new architecture for OMAP3 and beyond taken care in new spec of V4l2...

Friday, June 12, 2009

few scripts

here is something i just saw -> kinda nice handy scripts useful..
Example A-7. behead: Removing mail and news message headers
Example A-8. ftpget: Downloading files via ftp

Saturday, June 06, 2009

news from my linked in group(opengl/PM/MMC Boot)

beagleboard.org has already a pretty active community in linkedin.. the following news items were picked up from the groups' Cloumnist update ( ;) thank you.. great job by the way):

GL to GLES converter announced

http://code.google.com/p/gl-wes-v2/ Good for Pandora, the OMAP3 based gaming platform Recommend

TI's OMAP3 application processors address the need for low power without sacrificing performance. Static power management idles a system in a power-efficient state until processing is required, while active power management adjusts More »

White paper: Power-management techniques for OMAP35x

Link: http://focus.ti.com/general/docs/gencontent.tsp?contentId=47536

Beagle board MMC boot myths

From: E-R: RSS Columnists | June 04, 2009

Booting a Beagle board from an MMC/SD is easier than what people tell you At the time of this writing, most documentation that you can find on the web about the Beagle board will tell you that you need to take special preparation st More »

Link: http://free-electrons.com/blog/beagle-mmc-boot/


Wednesday, May 27, 2009

quick HOWTO: Configure Ubuntu 8.10 for VPN access

Thanks to Sergio Aguirre a quick HOWTO: Configure Ubuntu 8.10 for VPN access (for Cisco vpn)

Basic Requirements:
Make sure you have the latest patches and updates for Ubuntu 8.10:


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vpnc network-manager-vpnc

Configuration:
1. Go to System > Preferences > Network Configuration
2. Select VPN tab
3. Click on Add button at the right side of the list
4. choose a vpn connection type: Cisco compatible vpn(vpnc)
5. click on create
6. Enter the following configuration (Other than the specified, leave everything else unchecked):
Connection name: CorporateName
Connect automatically: enable the checkbox if you would like it to..
Gateway: VPN GATEWAY
Group name: VPN GROUP
User password: my_user_id
Group password: myPassword
User name:
5. Click on 'OK'

Enabling/disabling VPN access:
1. Left click on network icon in upper bar (next to the clock)
2. Go to VPN connections
3. Select CorporateName for enabling, or Disconnect for disabling.

Tuesday, May 26, 2009

Linux Aware debugging with CCS!

yes, we have heard of openOCD, Lauterbach, yet till date, I personally have'nt been able to use CCS to debug linux.. This post gives an interesting saga for those interested
Warning: it is a little lengthy post, so as of the time of posting:
Summary - CCS4 has support for linux kernel aware debugging, and unfortunately there is a small glitch of support of kernels 2.6.26 and above - the ccs team is working on a fix at this point.. hopefully we will have a full soln soon.. Thanks to John in deligently following up on this..

Setting up Email forwarding System for GIT

The post is a derivative of the omapzoom wiki page. Disclaimer: my mastery of the wiki tags are dismal.. apologies... some day i hope to have time to post it here

Many new developers have been stumped when they need to use git-send-email in corporate environment – usually, if not as a norm, ms exchange servers form the backbone of such an email server system. This page was written based on one of such requirements.

To get started, we shall consider common scenarios:
a) Setting up a mail forwarding system with postfix on ubuntu
b) Setting up a mail forwarding system on a fedora machine
c) Using msmtp for using gmail
a. to send a patch using a gmail ID
b. to send a patch using your corporate ID but through gmail

Postfix on Ubuntu – mail forwarding
For setting up postfix, you need:
a) A mail relay server which will allow your machine to talk to it -> speak to your IT representatives/ other developers sitting next to you
b) Super user privileges on the machine you are working on.

Step 1: Check if the required packages are present
$ dpkg --get-selections grep postfix
postfix install

Step2: If postfix is already installed and not properly configured, uninstall the same:
$ sudo apt-get purge postfix

Do you want to continue Y/n?? y
(Reading database ... 260051 files and directories currently installed.)
Removing mailutils ...
Purging configuration files for mailutils ...
Removing postfix ...
* Stopping Postfix Mail Transport Agent postfix OK?
Purging configuration files for postfix ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Step3: Reinstall postfix:
$ sudo apt-get install postfix

When you install postfix, we go through a few screens as follows:

a) postfix gives a bit of help information -> read through it -> esp the idea of a “Satellite System” – this is what we will be using here.



b) postfix now asks you about what type of mail server do you wish to setup here -> say you want a “Satellite system”
c) now postfix will ask you for your machine’s domain name -> give the name of the machine you are using -> note, this is not the same as the relay server we will be using.
d) Post fix now asks for your email relay server information -> provide the complete machine information here

Postfix on Fedora – mail forwarding
Please refer 'Postfix Pre-Installation Steps', 'Installing Postfix on Fedora Linux' and 'Starting Postfix on Fedora Linux' sections of this link

Note: Before moving on to the 'Starting Postfix on Fedora Linux' section of the link, open /etc/postfix/main.cf file and edit the following parameters only

myhostname = (Enter your hostname here)
relayhost = (Put the appropriate server here for your location)
Using msmtp as the email forwarding system for gmail

Note: If you successfully configured postfix you dont need to configure msmtp.
Step 1: You now need to make a choice -> if you would like to configure your gmail account to send emails on behalf of your corporate mail ID, you need to configure gmail for the same - else skip this step ;)
a) go to gmail.com and log in with your user id and password
b) click on settings:
c) Select accounts

d) Click on “Add another email address you own”
e) A pop up appears: Fill up the required information and click on Send verification

f) Look in your mail account you added for the confirmation number:
g) Provide this to the pop up window
h) Set up gmail settings to always reply to the same email id which send the email as follows:
That is it. You can now send email from your gmail account as if it were send by your corporate account.

Step 2: Installing msmtp is as simple as “sudo apt-get install msmtp” or “sudo yum install msmtp” as required for your distro.. worst case you can build and install it yourself from http://msmtp.sourceforge.net/

Step 3: You now need to configure msmtp -> create a ~/.msmtprc file with permissions for 400 (user readonly).. as follows:
# Example for a user configuration file
# Set default values for all
following accounts.
defaults
tls on
# The ca-bundle.crt is the file
with CA certificates for Fedora Core 6.
# for other distros you might have
to dig it up from somewhere else.
# On Ubuntu
/etc/ssl/certs/ca-certificates.crt should be used, for example.
# My
shortcut has been to use ‘locate ca-bundle.crt’ and use which ever one I think
is good ;)
tls_trust_file /etc/pki/tls/certs/ca-bundle.crt
logfile
~/.msmtp.log
# My email service
account gmail
host smtp.gmail.com
port 587
#NOTE: if you are using your corporate email ID and have
configured gmail -> provide that below
from some.user.name@gmail.com
auth on
#The following IS your gmail ID and password
user
some.user.name@gmail.com
password my-secret
# Set a default account
account default : gmail

The example here is for a Gmail account, but can easily be changed to use the local SMTP server as well.

Step 4: Now, by giving the full path name to the msmtp program as smtp server to git-send-email, you can send the patches through gmail or some other smtp account with TLS and/or user authentication.
git-send-email --smtp-server /usr/bin/msmtp
An alternative to setting --smtp-server each time is to set the global sendemail.smtpserver value.
git-config --global sendemail.smtpserver /usr/bin/msmtp
Another option is to configure a local smtp server on your machine, using a well-known SMTP server as smarthost. Then, all applications using localhost as a mail server (e.g. /usr/bin/mail) will work.

NOTE: On OS X with macports, msmtp can be installed with 'sudo port install msmtp', and '/usr/share/curl/curl-ca-bundle.crt' should work for tls_trust_file.
And your email forwarding system is setup:)

Monday, May 25, 2009

TI's e2e portal

TI has a engineer to engineer forum here: http://e2e.ti.com/ forums this allows folks to:
a) Get a direct and quick answer for a technical question
b) lookup and search for old solutions which might help current problems one might face.
Some of the interesting forums are:
Code Composer Studio
OMAP Application Processor
Power Management IC such as TWL5030 TPS derivatives

it even allows you to have a email notification and bunch of usual stuff..

gst dsp - an alternative to openmax IL

Felipe C recently published gst-dsp

Source: http://github.com/felipec/gst-dsp/tree/master
Webpage: http://code.google.com/p/gst-dsp/

This is an alternative to the gstreamer plugins of gstreamer on TI Davinci and OMAP and openmax for OMAP

gstreamer for TI Davinci and OMAP builds on top of dsplink while openMAX for OMAP builds on top of dspbridge -> interestingly gst-dsp builds on top of dspbridge. Try and do comment.. and dont forget to send your patches ;).. I have'nt had much chance to dig much into this new code yet -> but it sure looks sleek and full of potential

usb3 transciever

This news article was interesting.. hmm... how long before we see the first products in the market in the world of wireless devices?? munching time ;)

Wednesday, May 06, 2009

OMAP power management simplified(?)

Background:
Excerpts from the thread here
A detailed presentation done by Richard Woodruff can be found here

To start this discussion, think what OMAP really is.. OMAP is made of multiple small parts inside it (peripherals) - each peripheral can be individually shut off or switched on as need be.

OPP or Operating Points:
In fact OMAP could also be used like a car gear, if you need higher processing power, switch to a different "operating point". Each of these operating points is a set of voltage and frequencies that each peripherals and OMAP functions at -> usually the main peripherals of interest from a speed perspective are ARM and DSP, but like a car, when you speed up, you will consume more power..

[BUT unlike a car, during operation, OMAP's carbon footprint is pretty tiny]

Suspend/Resume:
Since OMAP is also made up of various peripherals, you can switch off many of these peripherals when not in use, in fact you can have many levels of "switch off" = retention and off modes are general terms for which I cannot think of exact equivalents in real world except, maybe - hibernation and suspend in a PC.. In off mode, OMAP is essentially down consuming pretty few uWatts of power or less, but the SDRAM contents are retained - so when you wake back up from off mode, you can "restore" your state precisely where you left it in a matter of few uSec or so.. retention you shut lesser parts of OMAP off, so when you wakeup, you would wakeup even faster (compared to offmode), yet, you wont incur the cost of keeping OMAP running continuously..

[In case you are thinking: why not support hibernation in OMAP linux kernel? unlike a desktop or a laptop PC where you have umpteen amount of disk space, in a typical embedded sytem, you probably have a few megabytes of flash memory for non volatile storage.. that kinda limits what you can put in it.. ofcourse, we can think of compressing the SDRAM contents when we store etc.. but I have'nt heard of anyone doing it (yet)..]

Summary:
time to wakeup: retention < offmode < < << cold boot
power consumption: complete power off < offmode < retention < < < < omap running

Configuration Header: No more x-loader for NAND boot!!

[discussion thread here]

Few days back looking at OMAP3430 Public TRM I found the section 26.4.8.2(page 3427), it was exciting to see what possibilities lay here.. a little more digging later and few hours of coding later, figured out that by adding a certain data as a prefix to the real image, we can boot u-boot or for that matter any image straight from NAND flash into sdram.. essentially this is what x-loader does, only that OMAP3430 ROMCode already has that feature..

What exactly is Configuration Header(CH)?
CH is a set of register values to the critical OMAP registers that define how the clocks, sdram controller, gpmc controller, mmc controllers are configured.. it is more like an array of register values - you fill them up with the correct values, and store the load address you would like the resultant image to load up, bingo, we have the image booting off that location.. There are few of these structures that are defined in the TRM which has a detailed description on the real sequence of operation..

What does Configuration Header save us?
Time :)! Traditional NAND boot has always been:
  • ROMCode takes x-loader from NAND, put it in SRAM and boot it.
  • x-loader goes ahead and configures clock, sdram etc.. then proceeds to load u-boot from NAND to SDRAM and execute it
Instead we can now reduce this sequence to a single sequence:
  • ROMCode takes u-boot from NAND, put it in SDRAM and boots it.
Infact, my measurement with my digital wristwatch showed a 2 second saving of bootdelay! okay, my measurement is not exactly accurate, but it gives an approximation ;)

Aaah.. I am excited with Configuration Header and want to use it.. How do I do it?
You are in luck :).. my recent commit to omap u-boot-utils has the required code for signing a u-boot to use configuration header in a GP device.. there is even a sample.cfg file with the settings that worked for me on beagleboard :)..

Do a "gpsign -c conf/sample.cfg -f u-boot.bin" will generate a u-boot.bin.ift file. flash this image using h/w ecc (the "nandecc hw" command in u-boot) to offset 0x0 in nand and reset the board.. viola, it should boot straight into u-boot skipping the x-loader step :)

Apologies that I do not (at the time of this post) have a prebuilt omap-uboot-utils binaries, but hope to do it for v3.0 tag in the future, esp if folks have some further fixes or improvements -> for the time being it requires a git pull and a host machine build :(..

Caveat: there is somesort of a 128KiB limitation on MLO file signed like this for MMC Card with FAT filesystem, so I generally use x-loader still in MMC boot..

By the way, this feature is not available in the previous OMAP2 or OMAP1 devices..

Tuesday, April 28, 2009

love imap for a short while

saw this script and literally fell in love with it ;).. just changed the interpreter to /usr/bin/python,
./imap.py -a -e --server "IMAPSERVER:993" -u "MyID" -f "INBOX/OPENSOURCE/Linux-OMAP" and bingo give my password and it saves the entire folder as INBOX.OPENSOURCE.Linux-OMAP.mbox -> search in vi for ^From: and bingo you can copy entire patch files for git am to use.. ;)

meanwhile you can easily split the mbox to maildir (multiple files) using mbox2maildir

[Update] I thought it was a good idea, instead of trusting msexchange wordwrapping everything around... I am pretty darn irritated and switched to using mutt instead :(.. except I am DUMB.. i could have used the 'e' and saved what i see where ever i wanted it to be... :(... mutt is pretty darn easy!! all i needed to do was setup a ~/.muttrc as follows:

set realname='Name'
set from="Name <MAILID@SOME.COM>"
set imap_user="ID"
set imap_pass=Password

set folder="{IMAPSERVER:993/ssl}"
set mbox="=INBOX/OPENSOURCE/Linux-OMAP"
set postponed="=postponed"
set record="=Sent Items"
set spoolfile="=INBOX/OPENSOURCE/Linux-OMAP"
set mailcap_path="~/.mailcap"
set sendmail="/usr/sbin/sendmail -oem -oi"


and it is done.. mutt worked with my mail transmitter configured using postfix ;)

Friday, April 24, 2009

Synergy cool swapping b/w desktops

I have a windows laptop and a ubuntu desktop sitting next to each other and i would like to use my keyboard and mouse accross both without switching accross... here is the solution: SYNERGY!!!

step 1 - ubuntu:
sudo apt-get install synergy
vim ~/.synergy.conf
section: screens
winlaptop:
linuxserver:
end
section: links
winlaptop:
right = linuxserver
linuxserver:
left = winlaptop
end

Winlaptop is the name of my windows machine -> ipconfig /all should show the HOSTNAME for the same. linuxlaptop is the name of my machine without all the .x.y.z suffix.. Note the left and right depends on where your laptop and desktop sits.. suite which ever you want.. you can have multiple boxes if you like too... just sync them up in the config above..

next you need to get synergy start up when your login happens, you can do it multiple ways -> the one i did was to setup a short cut in my desktop for use when i want it.. - the short cut is to "synergys --config synergy.conf"

Now on windows, go here and download the exe. once you install, setup the "Use another computer's shared keyboard and mouse (client): " as linuxlaptop (full domain name)..

Start the server on linux and then click on start on windows and voila, switching your machines is as simple as turning your head.... for the lazy characters ;)..

mail reply styles

> it is interesting why you write at the end of the email?
> is this an email style?
There are three styles of email replies that I follow:
a) Follow bottom posting -> this is used by most linux opensource community: http://www.arm.linux.org.uk/mailinglists/etiquette.php#e3
b) For internal emails with respect to a topic, I retain top posting - since it can get forwarded to others who have no clue about the previous discussions, as bottom posting will remove the previous mail context.
c) Mix of both - esp in internal email discussions -> this is when there is multiple responses -> in which case, I copy the contents of the email and paste it again in body of my reply to it. This allows:
i) for people interested in the discussion to get the exact context of my reply without having to refer to the mailchain below to remember what they said..
ii) for people who get the email forwarded to get a context of the email by reading the previous chain..

general style I follow for opensource emails is:

> Original email
> some info
My reply
> some other info
My reply with a link [1]
Regards,
Nishanth Menon
Ref:
[1] url to the webpage I refered to

The above format allows for people using Braille or mail to text readers to not listen to conversion of http://someotherpalce/asdasd/asdasdasda.... while listening to the context.. I am just being nice ;)..

Thursday, April 09, 2009

simpler alternative to minicom

Tired of setting up and switching ports in minicom and want something simple? welcome to picocom

setup a script such as ~/bin/ttyUSB0
picocom -f n -p n -b 115200 -i -r -l /dev/ttyUSB0

and next time, just run ttyUSB0 and viola u have a terminal.. ctrl+a followed by ctrl+q quits..

mtd partitions in u-boot

With the recent merge of mtdparts patch for beagleboard u-boot

Texas Instruments X-Loader 1.4.2 (Jan 30 2009 - 19:16:17)
Loading u-boot.bin from nand


U-Boot 2009.03-00325-gf75a729 (Apr 09 2009 - 13:36:05)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
DRAM: 256 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Board revision C
Die ID #0a8600030000000004013f780600a00e
OMAP3 beagleboard.org #

you can now do cool things without having to remember the offsets of which partition was where.... (lets say you want to copy the kernel to nand flash)

Step1: setup the partitions

OMAP3 beagleboard.org # mtdparts default

Step 2: erase the nand flash for kernel partition

OMAP3 beagleboard.org # nand erase kernel

NAND erase: device 0 offset 0x280000, size 0x400000
Erasing at 0x660000 -- 100% complete.
OK

Step 3: copy the kernel from RAM to the kernel partition in nand flash:

OMAP3 beagleboard.org # nand write 0x80000000 kernel

NAND write: device 0 offset 0x280000, size 0x400000
4194304 bytes written: OK

and you are done..
lets say you want to copy the kernel from flash back to ram....
OMAP3 beagleboard.org # nand read 0x80000000 kernel

NAND read: device 0 offset 0x280000, size 0x400000
4194304 bytes read: OK


oh and if you want to checkout what are the available partitions, then:
OMAP3 beagleboard.org # mtdparts

device nand0 , # parts = 5
#: name size offset mask_flags
0: x-loader 0x00080000 0x00000000 0
1: u-boot 0x001e0000 0x00080000 0
2: u-boot-env 0x00020000 0x00260000 0
3: kernel 0x00400000 0x00280000 0
4: fs 0x0f980000 0x00680000 0

active partition: nand0,0 - (x-loader) 0x00080000 @ 0x00000000

defaults:
mtdids : nand0=nand
mtdparts: mtdparts=nand:512k(x-loader),1920k(u-boot),128k(u-boot-env),4m(kernel),-(fs)

See http://www.denx.de/wiki/DULG/UBootCmdGroupFlash#UBootCmdFlMtdparts for more info

Tuesday, April 07, 2009

OMAP3 TI DSP Bridge

The following instructions are for 2.6.28 linux omap pm branch + tidspbridge
Few links:
* http://gitorious.org/projects/tidspbridge/repos/mainline - TIDSP Bridge codebase
* http://patchwork.kernel.org/project/linux-omap/list/?q=DSP - pending patches on linux-omap mailing list
* http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=summary - kevin's tree for Power management

Steps:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
cd linux-omap-pm
git checkout -b pm-2.6.28 --track origin/pm-2.6.28
git checkout -b tidspbridge
git pull git://gitorious.org/tidspbridge/mainline.git tidspbridge-pm-2.6.28

make omap_3430sdp_defconfig

for powermanagement:
make CONFIG_OMAP_PM_SRF=y
CONFIG_MPU_BRIDGE=m or y which ever is your preference..
enable BRIDGE_DVFS as y
make uImage;make modules

and bingo you should have arch/arm/mach-omap2/dspbridge.ko and arch/arm/mach-omap2/dspbridge.ko if you have dspbridge as a a module ;)...

insmod dspbridge.ko
insmod bridgedriver.ko shm_size=0x400000 phys_mempool_base=0 base_img=baseimage.dof should have the bridge driver running with a baseimage..

[Update: As Ragha mentioned in his comment, the other way would be to set up a reserved memory using mem=XYZM and allocate the remaining memory as statically allocated memory to the bridge driver -> there is a linux-omap post somewhere which I need to dig up for details :( ]

(okay, i need to figure out where baseimage.dof or other dofs can be got from.. but checkout the pointers felipe says here: http://elinux.org/BeagleBoard/DSP_Howto)

Wednesday, February 11, 2009

stupid little alarm program (bash script)

almost missing office hour due to jetlag is not a nice idea.. hence wrote this nonsense little script, which would stream a shoutcast stream while waiting to kick me up screaming..
Now, why should I suffer alone? :D..
#!/bin/bash
#Choose your favourite stations from shoutcast.com (net radio)
LINK="http://yp.shoutcast.com/sbin/tunein-station.pls?id=6063"
if [ $# -eq 0 ]; then
echo "usage $0 wakeup_duration"
echo "wakeup_duration: wakeup after how long? 6 hours, 1 hour, 20 mins etc. or even 5am tomorrow.."
exit 1
fi
NOW_SEC=$(date +%s)
WAKEUP_SEC=$(date +%s --date="$*")
if [ $? -ne 0 ]; then
echo "oopss.. i dont think date understands $*"
exit 2
fi
if [ $NOW_SEC -gt $WAKEUP_SEC ]; then
SLEEP_SEC=$(( $NOW_SEC - $WAKEUP_SEC))
echo "Do you wish to wakeup $SLEEP_SEC seconds previously??.."
echo "Sorry cant help you with that.. :("
exit 3
fi
SLEEP_SEC=$(( $WAKEUP_SEC - $NOW_SEC))
echo "NOW=$NOW_SEC WAKE=$WAKEUP_SEC DIFF=$SLEEP_SEC"
echo wakeup at `date --date="$*"`

#Trap CTRL+C and cleanup - set mute back..
trap cleanup 1 2 3 4 5 6
cleanup()
{
echo "Caught Signal from user- muting myself"
amixer -c 0 -- sset Master playback 0%
amixer -c 0 -- sset Master mute
amixer -c 0 set PCM 0%
exit 1
}

# unmute all
amixer -c 0 -- sset Master unmute
# Set my music volume
amixer -c 0 -- sset Master playback 30%
amixer -c 0 set PCM 100%
totem "$LINK" &
sleep $SLEEP_SEC
killall totem

# Set my announce volume
amixer -c 0 -- sset Master playback 100%
amixer -c 0 set PCM 100%
i=0
# have I Really GONE BONKERS?
while [ $i -ne 5000 ]
do
echo "Attempt $i - CTRL+C to stop me screaming"
# You may want your favorite statement here..
echo '(SayText "Nishanth, wakeup dude.. time to go to office..")'|festival
i=`expr $i + 1`
done

Now, dont blame me if this wakes you up... or hate me for writing this silly lil script.. (needs festival, totem, plugins for totem, internet connection and a really sleepy mind..

Tuesday, February 03, 2009

NAND not booting on a new OMAP3 board? check this list out

The following check list was compiled based on a discussion here
a) Did you check if the device id of the device is in TRM under
supported devices? -> ROM Code should support this device if it should ever boot..
b) Did you read your CTRL_STATUS register and verify the SYSBOOT boot sequence in TRM -> is NAND in the sequence and nothing else preventing it from being hit?
c) what is the status of your EMU0-1 JTAG pins are they both high or in tristate condition during OMAP boot? -> the wrong setting would prevent boot sequence from being executed
d) is it on CS0? -> well OMAP boots out of CS0
e) Do you have an 8 bit or a 16 bit NAND? is your config file in
x-loader, u-boot handling this correctly? -> accessing wrong width is not very helpful.. ;)
f) Did you sign x-loader.bin.ift with signGP.c? Try this in x-loader
directory: grep _start System.map|cut -d' ' -f1|xargs signGP x-load.bin -> x-loader loads up at the address we tell it to, few variants of x-loaders seem to use different base addresses.. just to be sure..sign the x-loader correctly
g) Finally did you use nandecc hw for flashing x-loader.bin.ift? - well.. that is the only ECC formatting that OMAP ROM Code understands..
h) what is the result of nand dump 0? the OOB area? - this verifies the ECC organization
i) you could in theory write a very small piece of assembly to shut down watchdog timer, and basically loop for ever -> flash this instead of x-loader then once the board boots up, connect with JTAG and see if your infinite loop is running in SRAM.. if so, you have your flashing correct, but mebbe x-loader is goofing up somewhere..
-> this is just my fav way of debug..

Sunday, February 01, 2009

OMAP support in U-boot-v1

Finally! After months of effort by many, mostly Dirk driving hard, we have omap3 support in:
a) beagleboard
b) overo
c) evm
d) pandora
e) zoom1.

This should ideally make omapzoom git based u-boot redundant. Lets see if this happens in the upcoming days.. v2009.02 will have official support :).. Hip Hip Hooraah!!

Friday, January 30, 2009

beagleboard recovery take 2

[2013-03-06 update]:
after a few years of letting things rot, I just managed to pick up my old binaries and gave it a dry run:
https://github.com/nmenon/beagle-recover has the original working binaries since the google groups link no longer work. NOTE: I HAVE NOT TRIED WITH ANY OF THE LATEST SOURCES. I do not have plans to do so in the future as well  - an quick try indicated things are broke :(

[Original post]

http://groups.google.com/group/beagleboard/web/beagle_recover.tar.bz2 has the recovery package ready to go for ubuntu 8.04 32bit OS: download this, run sudo ./recover_beagle.sh - as shown in the video... Steps summary:
1. first shutdown the board.
2. run 'sudo recover_beagle.sh /dev/ttyUSB0' in a terminal -> you need
super user permissions(sudo permissions) to run this script.
3. Keep the pushbutton S1pressed while powering on the board -> there
are two white push button switches, use the one closer to the edge of
the board
NOTE: if your nand is completely erased, the above step wont be
needed, but what the heck, use it for preventing all kind of cases
where you have an MMC card/partly corrupted nand etc..
4. Once the terminal starts downloading, you can remove ur finger off
the S1 switch ;)..
5. wait a bit for files to reach and be flashed :).. the script should
exit happily once it is done.

With u-boot-v1 in mainline arm repo, here is take two of the same.. this time with a script and a non-Oscar winning video:


complete discussion and thread here: http://groups.google.com/group/beagleboard/t/e193478766224281

copied here for details:

On my ubuntu 8.04 32bit OS PC, here are the steps I did.

------------- Build Steps ----------------
$git clone git://gitorious.org/x-load-omap3/mainline.git xloader
$git clone git://git.denx.de/u-boot-arm.git
$git clone git://git.denx.de/u-boot-v2.git
$git clone git://github.com/nmenon/omap-u-boot-utils.git


$alias mymake='make -j2 CROSS_COMPILE=arm-none-linux-gnueabi- V=1 ARCH=arm'
$cd x-loader
$mymake omap3530beagle_config;mymake
$wget "http://beagleboard.googlecode.com/files/signGP.c"
$gcc -o signGP signGP.c
$./signGP x-load.bin 0x40200800
$cd ../u-boot-v2/
$mymake omap3530_beagle_per_uart_defconfig; mymake
$cd ../u-boot-arm
$mymake omap3_beagle_config;mymake
$cd ../omap-u-boot-utils
$make;make usb
$mkdir -p ../beagle_recover/target_files;cd ../beagle_recover

$cp ../omap-u-boot-utils/pusb ../omap-u-boot-utils/pserial
../omap-u-boot-utils/ukermit ../omap-u-boot-utils/ucmd .
$cp ../u-boot-arm/u-boot.bin target_files/u-boot-v1.bin
$cp ../u-boot-v2/uboot.bin target_files/u-boot-v2.bin
$cp ../xloader/x-load.bin.ift target_files/x-load.bin.ift

------------- Flashing Steps ----------------
$TTY=/dev/ttyS0
$sudo ./pusb -f ./target_files/u-boot-v2.bin
Connected just the USB cable to the board with the user switch S1 pressed.
$./ucmd -p $TTY -c "loadb -f /dev/ram0" -e "bps..."
$./ukermit -p $TTY -f target_files/u-boot-v1.bin
$./ucmd -p $TTY -c "go 0x80000000" -e "serial";./ucmd -p $TTY -c "help" -e "#"
$./ucmd -p $TTY -c "nand erase" -e "#"
$./ucmd -p $TTY -c "nand write.i 80000000 80000 80000" -e "#"
$./ucmd -p $TTY -c "loadb 80000000" -e "bps..."
$./ukermit -p $TTY -f target_files/x-load.bin.ift
$./ucmd -p $TTY -c "nandecc hw" -e "#"
$./ucmd -p $TTY -c "nand write.i 80000000 0 80000" -e "#"


The following step is optional if you want to remove the autoboot.
$ ./ucmd -p $TTY -c "setenv bootcmd;nandecc sw;saveenv" -e "#"


The attached tarball contain prebuilt images, and you can also use a
script recover_beagle.sh which is part of the tgz attached.

Wednesday, January 28, 2009

Grr at code.google.com uploads

After using a bunch of time getting firefox to upload from my ubuntu 8.10 box to here, I got an util which told me to use my code.google.com password instead of my google passwd.. Grrrr...
anyway, couple of my sleep hours later, u-boot utils rev 0.2 "Jumpin' Monkey" is uploaded (the code name was made up as i typed ;))

Wednesday, January 21, 2009

is nand ecc correction logic sane enough?

for some time now, I have gone with the belief that the nand ecc imlementation such as this which I helped write good enough for nand devices, but Vimal Singh pointed me to these two articles:
http://lists.infradead.org/pipermail/linux-mtd/2008-August/022611.html
http://lists.infradead.org/pipermail/linux-mtd/2008-August/022613.html

Essentially:
If we do just old_ecc^new_ecc to detect/correct ecc errors - the logic handles the case of bit flip error at 63rd bit(as e.g.) faultily. I was completely unaware of this weakness of the algo.. thanks Vimal for pointing me here..

I have plans of setting up a bit of code to verify this (essentially hack up the current drivers by overriding the read path ;) ).. will post if I can proove(I suspect this would be the case) this is the case with gpmc..

Tuesday, January 20, 2009

Changes in Linux OMAP

Tony Lindgren, Linux OMAP maintainer announced that source.mvista.com linux omap copy would not be used anymore.. It has been more than three years since the discussion on hosting the kernel tree at mvista site.. Thank you mvista for hosting all our pulls to date.. from now on look here (actually it was there since 2006, though I will miss doing "linux omap git" on google).

Wednesday, January 14, 2009

omap peripheral boot - what the heck is it?

Kinda got a few questions on how omap uboot utils works.. so here is my attempt to try and summarize what omap3 TRM says(for details TRM is the best place to go - yes, it is beautifully written ;) ):
ARM is a useless unless we have some software to run on it, so OMAP has a special piece of ROM code which gets the initial control of things. Now, ROM code is capable of:
a) booting off a memory device such as NOR, NAND, OneNAND, MMC etc.. kind of devices.
b) booting off a peripheral such as UART, USB etc..
Before anyone asks, yep ROMCode is a software code within OMAP. And, yep, and yeah it's got all kind of drivers for devices it supports, and further yeah, it is a tiny optimized code and finally NO - you cant modify it since it is Read Only Memory.

Now, in the world of OMAP s/w guys, (a) is called memory boot and (b) is called peripheral boot.. Now, how does ROM Code know what kind of device you have and which mode you want to boot from? This is called the SYSBOOT(again read the TRM for details). in short, SYSBOOT tells OMAP ROM Code, ok dude.. now please boot from USB cable, if that fails - try UART, then MMC1 else try NAND, else assume the user(me) is really confused and just get stuck in a loop.

How does peripheral boot work?
It is rather simple if you look at it: when OMAP wakesup in USB/UART mode, it shouts out "hey I am awake"(not literally) by throwing out what is called ASIC ID. The guy on the other end of the cable keeps watching the link(UART/USB) for this message and responds with a predetermined command back saying - "Oh great Rom Code, please recieve and execute the file I am sending you next.. it's file size is xyz"(again not literally, but you get the picture).. in the case of USB, well USB Gadget is what OMAP acts as (you can check the TRM for the exact class and USB descriptors it throws out) - MUSB is used in OMAP3. Now, ROMCode will wait for a short duration of times for slow pokes like me to respond back.

Now, If I dont send a file request to it within a predetermined time(details in TRM), it switches to the next boot device.

The file which is downloaded is put in SRAM and executed.

Well that is the short story.. pusb and pserial essentially explain the above in code.. Hope it helped..