ZipitZ2 JTAG
Sweetlilmre has posted a nice writeup on how to perform the JTAG mod on a ZipitZ2. There is also an old writeup about the JTAG mod available here
Setting up Scratchbox2 to build software for zubuntu
Mozzwald's zubuntu being ubuntu based and thus debian based has alot of prebuilt software via the apt repositories but there are times when you just want to knock something up for yourself or build something that isn't in the repositoires or even rebuild something that is but isn't ZipitZ2 friendly.
You can install and use gcc on the ZipitZ2 but it isn't something I recommend unless you have alot of patience and are a bit of a masochist. However there is another way that leverages the power of your desktop, Scratchbox2. Scratchbox2 is a toolkit for building cross compiling SDK's, in fact it is the basis of the maemo sdk for the nokia n7xx/8xx/9xx.There is one problem with Scratchbox2 though, there is little documentation and what little there is sucks.
Scratchbox2 has a few dependencies but if you are planning on using it on a ubuntu or debian host they are all (except one) available in the repositories.
The first thing to download is a toolchain for your target processor, in the case of the ZipitZ2 and zubuntu we need an ARM toolchain and the de facto standard for prebuilt ARM toolchains is CodeSourcery's G++ lite. Download the 2010q1 release. Although I prefer the CodeSourcery toolchain you might prefer the emdebian one or to build one yourself. After downloading the toolchain, in my case CodeSourcery's. Create a directory and extract the toolchain into it.
mkdir ZipitZ2 tar xjvf ../path/to/downloaded/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 ls arm-2010q1
Now we have to install Scratchbox2, if you are using ubuntu >= 9.10 it should already be in the ubuntu repositories, if not add the following likes to your /etc/apt/sources.list
deb http://maemo-sdk.garage.maemo.org/download/host ubuntu-jaunty free
and
sudo apt-get update
Once that is done or if Scratchbox2 is already in the repositories
sudo apt-get scratchbox2 sb2-qemu-arm
Scratchbox2 is now installed on your system and it's time to add a seed rootfs, at minimum this is just the lib, include and etc directories from your target device but in this case because we have the whole rootfs available and configured we might as well use it as it will give us a few abilities that we wouldn't have otherwise, such as the ability to use apt on the seed rootfs once it is installed.
There are several ways to do this, but the easiest would be to use the technique in my previous post Mounting a raw disk image. Once mounted create a directory inside the ZipitZ2 directory.
cd ~/ZipitZ2 mkdir zubuntu_rootfs
and copy the directories and files from the mounted image to zubuntu_rootfs, using mc or cp will do (will will need to do this as root or via sudo as we need to create /dev nodes and you might have permission problems if you don't. then change the owner and group of all the files and directories in zubuntu_rootfs.
cd ~/ZipitZ2/zubuntu_rootfs sudo chown -R user * sudo chgrp -R user *
And finally we now need to setup Scratchbox2 for our target device, so make sure you are in the rootfs directory and then run sb2-init.
cd ~/ZipitZ2/zubuntu_rootfssb2-init -c sb2-qemu-arm ZipitZ2 $HOME/ZipitZ2/arm-2010q1/bin/arm-none-linux-gnueabi-gcccd .. mkdir build cd build sb2 -eR apt-get update sb2 -eR apt-get upgrade
You are now ready to build software for the ZipitZ2 running mozzwald's zubuntu. To build stuff for your host use the normal commands, make, gcc.... if you are building for your target then prefix everything with sb2 i.e.
gcc hello.c -o hello
builds for your host
sb2 gcc hello.c -o hello
Builds for your target.
If you are building and need to use libraries or include files from your seed rootfs then you will need to use the -R (fakeroot) option of sb2 i.e.
sb2 -R gcc hello.c -o hello
and if you need to install a handbuilt library or other software into your seed rootfs then you'll need to use both the -R option and the -e (emulate) option i.e.
sb2 -eR make install
I have used this method to setup Scratchbox2 successfully and have used it to build both small dirty hacks and build my ZipitZ2 utilities for messing with gpio's and also really large software such as OpenCOBOL.
Mounting a raw disk image
I have recently started moving my ZipitZ2 development from a combination of aboriginal linux, buildroot and scratchbox1 to a combination of aboriginal linux, buildroot and scratchbox2 which means I need a way to seed the development rootfs with a working rootfs. Now I could manually move files from a ZipitZ2 to the scratchbox2 rootfs but that is error prone as I might miss a file or two or I might mess up permissions and setting up device nodes etc. is a right PITA.
The easiest thing to do is to use someone else's rootfs however they are normally distributed as a disk image with one or more partitions in the image which makes mounting them normally almost impossible a bit problematic especially with large disk images (this is not completely true any more if you are using a modern distro with the latest versions things like util-linux). However there is a nice linux program available (available in every linux distribution there is as it's an important command) called losetup that will let us use a disk image as if it is a disk.
We'll use mozzwald's ubuntu rootfs image as an example of how to mount a partition within a disk image. After downloading and untar'ing his rootfs image you need to mount the image as a disk using losetup
sudo losetup /dev/loop0 zubuntu-jaunty-basic-rc1_05172010.img
Once you have done that you can then treat the device /dev/loop0 as if it was a real disk, all the utilities and programs that manipulate disks in linux will work as expected. So what we now need to do is workout where the first partition (or any other partition we are insterested in) is located within the disk image. To do that we use fdisk.
sudo fdisk -lu /dev/loop0
we use the u option as we want to get the fdisk to talk in sectors and not cylinders.
To calculate the offset multiply the units (512) by the partition's start (243), which in this case gives us 124416. Detach the disk image from the loop device.
sudo losetup -d /dev/loop0
and then reattach the disk image to the loop device using the calculated offset.
sudo losetup -o 124416 /dev/loop0 zubuntu-jaunty-basic-rc1_05172010.img
and then mount the loop device as normal.
sudo mount /dev/loop0 /media/rootfs
and you are done and can copy the files from the disk image to wherever you want.
COBOL is not just for dinosaurs
COBOL has always given me a nice warm fuzzy feeling whenever i've been required to program in it. This is probably because it was the first language that I learnt that wasn't self taught (BASIC and Z80 assembler) and I liked the lecturers that we had at the college, one was very stuffy but the technicians and other 2 lecturers were great and had very warped senses of humour.
We were taught Ryan-MacFarland COBOL on Tandy Model3's with 48k, dual floppies, networking and a Corvus Wincester drive that sat quietly in the corner of the room trying to pretend that it didn't look remarkably like a refrigerator. (I still have a soft spot for TraSh-80 model 3s and 4s, so if anyone has one lying around unwanted and unused they know where to send it) . COBOL is probably made me what I am today programming-wise. A curmudgeonly grumpy old git, over 25 years later I still wake up with night sweats about finishing my course project on time (I ended up with a 95% and thus a distinction although I did cut it close as I kept getting banned from the computer lab for hacking the network so did most of the coding on coding sheets and then quickly typing it in and doing a couple of test runs when they let me back in until the next banning. It was actually a bit of a game as the techs, lecturers and I would often have a few pints riding on whether i could bypass whatever security they had installed that week -- oh fun days).
So a few weeks ago I was between projects for the ZipitZ2 and decided to see if I could run COBOL applications on it and started looking around on freshmeat.net and sourceforge.net and found two possibilities. The first one TinyCOBOL wasn't going to do me much good as it outputs IA32 assembler, but the other one, OpenCOBOL looked more promising as it outputs C source code and uses gcc as the compiler. After a bit of playing around with it and messing around with my ZipitZ2 development VM I managed to get a version that would produce executables that ran on a ZipitZ2 running Z2shell/IZ2S/IZ2Se/EZ2S which is good enough for what I personally want. But as alot of people seem to have moved away from the stock ZipitZ2 environment to mozzwald's Zubuntu which has gcc nativly running on the ZipitZ2 I decided to have a go at building the OpenCOBOL compiler to run on the ZipitZ2. After a few false starts setting up a new development vm for just OpenCOBOL and a couple of hours reading documentation I managed to build binaries of the OpenCOBOL compiler and libraries that pass all the tests in make check and seem to work as expected (at least inside my vm, I haven't tested actually on a ZipitZ2 running mozzwald's zubuntu as I don't currently have a ZipitZ2 configured to run that rootfs). You can find the tarball with the compiler, libs and conf files on this link. Extract and move to the right places and you should be able to write COBOL programs that will build and run on a ZipitZ2 running zubuntu. Because of the settings I used to build OpenCOBOL in theory it shoudl also work on any ARM based computer running Ubuntu as well although YMMV and also the same method of building OpenCOBOL should work for any Ubuntu distribution running on a processor that is supported by QEMU.
["COBOL Warriors" image Copyright © 2008 Robert Saczkowski. Banner courtesy of the GIMP, Copyright © 2010 Brian Tiffin and both are licensed under Creative Commons Attribution-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-sa/2.0/ ]
Aliosa27 is holding a Digital Yard Sale
I just had a peek over at Aliosa27's blog and noticed that he is having a digital yard sale. You might like to take a look. http://aliosa27.net/blog/?p=16. There are a couple of interesting Gateworks boards and some a couple of other bits and pieces.
Ultimate homebrew 6809 computer
I was never a big fan of the 6809 processor although it was a nice processor, much better than the yukky 6502 which I hated with a passion. I am a diehard Z80 fanboi through and through. I did have friends though that loved it and had computers like the dragon 32/64 and swore by it and flex was a very interesting OS from what I remember.
Matthew Sarnoff has built what he calls the Ultimate 6809 computer and who am I to disagree? It looks great. You can find the write up at http://www.msarnoff.org/projects/6809/
A cool coffee table
This is nearly a year old but a friend recently posted this on facebook and I think it looks great. Obviously the guy has too much time on his hands and a very large box of circuits boards
but If I had the woodworking skills, the room and the tools i'd make one. It would look great in the croft in the middle of nowhere that I want to one day retire to.
The original post is http://www.thenewsisbroken.com/blog/post/index/109/Latest-Project
4tH for the zipit
I've built 4tH for the zipit. I haven't modded the editor for the Zipits screensize yet as I just wanted to check that it built and ran correctly before making any changes. It seems to be running well so far and all the examples work (or at least the ones i've tried, which is about 90% of them).
4tH is a Forth Compiler and Interpreter that is almost fully ANSI Forth compatable and has been ported to MS-DOS/FreeDOS, Windows, Linux, OS X, AIX, BSD, BeOS, RISC-OS... and any programs you write will run on any of the ports with no recompiling.
My build runs on a Zipit running Z2Shell, IZ2s, IZ2Se and EZ2S, in other words any zipit that hasn't had it's kernel/initramfs or bootloader upgraded and can be downloaded here
Blassic (classic basic) for the Zipit
While i'm on a compiling kick I decided to have a go at compiling blassic (retro basic dialects, cpc, gwbasic, msbasic, sinclair basic...) again (i tried it about 8 months ago and it had problems). This time it built first time and seems to run quite well. There is of course no graphics, as it's still using svgalib which is pretty much dead, but if there is enough interest i'll have a go at adding some graphics support to it. The binary for z2shell/IZ2s/EZ2S is here
ByWater BASIC for the ZipitZ2
I've just built bwbasic for the zipit. So far with only cursory testing it seems to work quite well. You can download it from http://russelldavis.org/ZipitZ2/bwbasic4zipit.tar.gz. It's not too bad for knocking up the odd little program if you don't want to use ash/bash shellscript as it also will run linux commands as well as the normal basic keywords.
