Strikes Again


January 2011

Keil’s ARM-MDK (Realview) compiler on linux

This little book with help familiarize anyone who cares to know how to use Keil’s Realview compiler tools on linux.

At first though this may seem very pointless as CodeSourcery Lite is capable of everything Realview is, however if you have very large projects or a lot of time invested in an project then it only makes since to stick with what the project started with. I am currently reviewing all the available integrated development environments that linux has to offer (theirs a LOT) and will tack on a chapter five on how to use the Realview tools with a new IDE. So far CodeLite is showing quite a bit of promise however their are some linking issues I must deal with either via pushing a change to the projects svn or a makefile hack. I have not decided which method to use just yet.

For anyone that is interested I will be migrating my toolchain over to GNU for all my newer projects. Windows stabbed me in the back one to many times so I rolled it in a carpet and tossed it in the Neva river.

So around full circle if I wish to use CodeSourcery then why not take a look at Rowley CrossWorks again as they use CodeSorcery as the underlying toolchain.



Download the project files here:



Pulseaudio & Jack on Ubuntu/Mint

What is Jack? Well its a pretty useful program if you have a lot of audio input devices (musicians) or several output devices (audiophiles). It also has a nice cross connect setup where you can map each speaker to a source on the system and you can merge them as well. This actually solved one of my *nix issues I had that Pulse was not detecting that I had 5.1 setup and I was only using my front speakers but now with Jack everything is working great!

I have written a very simple shell script that will stop your current pulse audio output module and use the jack module instead. The script also provides a way back to your original setup so you do not need to doanything on the command line when you want to use Jack for any application. This script has several “sleep 10s” commands as Pulse does take a few seconds to die and start up. If you want some extra few seconds you can modify these values or be more patient.

 #! /bin/sh USER_PULSEFILE=~/.pulse/ case "$1" in start) echo "Killing current Pulse Audio process..." pkill pulseaudio sleep 10s echo "Restart Pulse Audio process as a daemon..." pulseaudio -nDF $USER_PULSEFILE echo "Wait for the daemon to start..." sleep 10s ;;  modules) echo "Killing current Pulse Audio process..." pkill pulseaudio sleep 10s echo "Restart Pulse Audio process as a daemon..." pulseaudio -D echo "Wait for the daemon to start..." sleep 10s echo "Loading the Jack modules..." pacmd load-module module-jack-sink channels=2 pacmd load-module module-jack-source channels=1 ;;  stop) echo "Killing current Pulse Audio process..." pkill pulseaudio sleep 10s echo "Restart Pulse Audio process..." pulseaudio -D ;;    *) echo "Usage: pulsejack {start|modules|stop}" >&2 exit 1 ;;esac exit 0

save this script via your favorite text editor to your .pulse directory and call it pulsejack. 

eg. Copy the above script and open a terminal and type:

cat > ~/.pulse/pulsejack << "EOF"  *ENTER**Right click > paste*EOF  *ENTER* 


Then you will need to make a copy of the default script and remove the udev module as it gets in the way with static modules.

cp /etc/pulse/ ~/.pulse/


Open in your favorite editor and comment out the module-udev-detect and if statements like below. Also add the module-jack-sink and source.



While you are in ~/.pulse/ make a client.conf file and put autospan = no in it or type whats below. This will make sure Pulse does not automatically restart when we run our script.

echo "autospawn = no" > ~/.pulse/client.conf


Next you need to actually install Jack and its related parts. A simple apt-get will do what we want. qjackctl is the Jack control panel and does a fantastic job and allows you to do the source/output patching like I mentioned above.

sudo apt-get install jackd pulseaudio-module-jack qjackctl


This next step may be optional but I read that it helps out Jack if you have a lot of data moving around the audio system. YMMV but I recommended you do these commands just to be safe. The limits.conf file is used by a hardware management daemon that kills apps when they hog to many resources.

sudo addgroup <username> audiosudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'sudo su -c 'echo @audio - nice -10 >> /etc/security/limits.conf'sudo su -c 'echo @audio - memlock unlimited >> /etc/security/limits.conf'



Thats it! You could not run everything by hand if you wanted or you can setup qjackctl to handle the shell stuff for you. To do that open qjackctl and goto “Setup > Options” and set the run and stop scripts up like I have below



Now push the start button and your audio manager will show Jack as the default output device!


Audio Spectrum Analysis Tools

Well I was poking around the linux repos looking for a program that I can use as a tone generator for some of my electronics projects when I stumbled upon this wonderful program:




This little program not only has a tone generator with noise and sweep capabilities but its a handy little tool to do fourier analysis and general spectral analysis. The program is currently only avalible for *nix based machines but the source is provided so I am sure a windows compile can be done (provided the sound API is standard…)

Check out this interesting screenshot:




Thats one crazy complex signal to create the matrix scrolling letters effect! Those HAM radio events can get crazy. To step it up a notch somebody put out a QR-Code (A 3D UPC) over the radio waves:




Anyways Baudline is a great program so far however their is a few issues to note. If you are using a standard distro such as Mint or Ubuntu then you will not be running the required Jack audio daemon that baudline requires to have access to the sound hardware. Their are how-to’s on the web but they all require much more work than a simple little init script can provide and they do not require system changes! I will post my script in the next post. Once you get things up and running one thing to note is that you can not play back anything with stdout in the output devices window or you will crash. You also can not record from Jack unless you actually have an input source or baudline will crash. Their are still some bugs but their easy enough to work around.


Basic usage info:

To run Baudline you need to start it via the command line or else you will not have any input or output devices in the selection windows. To run with all options enabled like I do run this command

./baudline_jack -stdin -stdout

That simple command will let you pipe files in from the command line (such as from an audio recording) this is also mandatory if you wish to use the tone generator as by default it can not output directly to the Jack output device. You must first select stdout in the tone generator window and then record the signal then play it back via Jack. Its not actually a big deal as 99% of the time you want to make sure what signal you’r going to output is correct first.

Here is a screenshot of my setup:


Blog at

Up ↑