KTM - Kria Transputer Machine
The KTM is nothing else (from the hardware perspective) than a [Kria KV260 Vision AI Starter Kit] from
Claus Meder did most of the work for the KTM. His VHDL Transputer implementation is very mature and stable.
From where I know this? I have tested it extensively! For his FPU design he had the opportunity to look at Gavin Crate's VBC emulator. Thank you here too.
The following instructions are based on the Ubuntu Desktop 22.04 LTS image for the Kria SOM and a newer boot firmware (2022.1_update3_BOOT.BIN).
We assume also a full updated base system before we start.
The instructions for creating the microSD card, connecting the cables (power, usb, network) and accessing the board are well documented and are therefore omitted here.
Many steps can be written more elegantly and conveniently. This is not my intention. People should consciously make changes and not just call a script. Nevertheless, please let me know if something is wrong or awkward. I'm a Linux rookie.
I wasn't satisfied with the fan control either, so I modified my board. Here are some pictures: Rework-1 Rework-2 Rework-3. This thermal solution have approx. 4K/W junction-air resistance. The SOM total power consumption is ~4W idle and ~5W under load. Similarities in color choices may be intentional.
To get an impression of the speed see: The "Hello World" Benchmark
It's also possible to use the Ubuntu Server 22.04 LTS version from the Kria K24 SOM. Then the following packages are required/mandatory.
sudo apt install zip sudo apt install build-essential
What do you get at the end
ubuntu@kria:~$ rspy -m # Part rt Link0 Link1 Link2 Link3 RAM@cycle 0 T805G230 HOST 1-0 2-2 ... 4K@1,16380K@2; 1 T805G230 0-1 2-0 3-1 ... 4K@1,16380K@2; 2 T805G230 1-1 3-0 0-2 ... 4K@1,16380K@2; 3 T805G230 2-1 1-2 ... ... 4K@1,16380K@2; ... ubuntu@kria:~$ icc icc : INMOS toolset C compiler INMOS C compiler Version 2.01.10 (built at 01:08:56 Jun 25 1991) ...
Usefull adoptions
If you have an SDXC MicroSD card V30/A2/U3 or faster
# The following change may also increased your read speed from 15MB/s to 58MB/s cd /usr/lib/firmware/$(uname -r)/device-tree/xilinx sudo dtc -I dtb -O dts -o kria.dts smk-k26-revA-sck-kv-g-revB.dtb sudo nano kria.dts # find no-1-8-v; -> #no-1-8-v; sudo mv smk-k26-revA-sck-kv-g-revB.dtb smk-k26-revA-sck-kv-g-revB.dtb.orig sudo dtc -O dtb -I dts -o smk-k26-revA-sck-kv-g-revB.dtb kria.dts sudo flash-kernel sudo reboot now sudo dmesg | grep "mmc" # mmc1: new ultra high speed SDR104 SDXC card at address 5048 sudo hdparm --direct -t /dev/mmcblk1 # Timing O_DIRECT disk reads: 178 MB in 3.03 seconds = 58.78 MB/sec
If you don't need the tracker stuff
sudo systemctl --global mask tracker-miner-fs-3.service sudo systemctl --global mask tracker-xdg-portal-3.service
Copying the software
# download from bin.transputer.net mkdir ~/bin.t.net cd ~/bin.t.net wget -r -np -nd -nv http://bin.transputer.net/bin2/linux/aarch64/ wget -r -np -nd -nv http://bin.transputer.net/drv2/linux/aarch64/ rm index.html* robots.txt* # put .ko into the right place sudo chmod 644 *.ko sudo cp *.ko /lib/modules/$(uname -r)/kernel/drivers/uio/ rm *.ko # put .so into the right place sudo chmod 644 *.so.1.* d=/usr/local/lib/aarch64-linux-gnu/ sudo mkdir -p $d sudo cp *.so.* $d for name in *.so.*; do sudo ln -s $d$name $d${name%.so.*}.so.1; done unset d rm *.so.1.* # put programs into the right place sudo chmod 755 * sudo mv * /usr/local/bin/ ls -l /usr/local/bin/ # set the environment # add entry to /etc/environment # LD_LIBRARY_PATH="/usr/local/lib/aarch64-linux-gnu" sudo nano /etc/environment # cleanup cd ~ rmdir ~/bin.t.net
Configure the system
# edit kernel cmdline (add "cpuidle.off=1" when connecting with Vivado) # LINUX_KERNEL_CMDLINE="quiet splash mem=3840M" # LINUX_KERNEL_CMDLINE_DEFAULTS="" sudo nano /etc/default/flash-kernel sudo flash-kernel sudo reboot now # download PL mkdir ~/kria.t.net cd ~/kria.t.net/ wget -r -np -nd -nv http://bin.transputer.net/kria/ rm index.html* robots.txt* # prepare PL pushd /usr/lib/firmware/xilinx sudo mkdir kv260-Transputer sudo cp k26-starter-kits/shell.json kv260-Transputer/ sudo mv ~/kria.t.net/Kria* kv260-Transputer/ ls -l kv260-Transputer/ popd # cleanup cd ~ rmdir ~/kria.t.net
Prepare the system
# loading the PL sudo xmutil unloadapp sudo xmutil loadapp kv260-Transputer # loading the driver sudo insmod /lib/modules/$(uname -r)/kernel/drivers/uio/uio_linkaxl.ko sudo chmod 666 /dev/uio4
Test it
export TRANSPUTER='linkaxl.so.1@/dev/uio4' export LINKIO_SYSTEM_CONTROL_DELAY=5 linktest rspy rspy -l -e -f -t -m poke -r 0x80000001 42 peek 0x80000000 -n 8
Load the firmware at startup
# replace k26-starter-kits with # kv260-Transputer sudo nano /etc/dfx-mgrd/default_firmware
Load the driver automatically
# add entry to /etc/modules # uio_linkaxl sudo nano /etc/modules sudo depmod # new entry to /etc/udev/rules.d/50-linkaxl-conf.rules # SUBSYSTEMS=="uio", ATTR{name}=="linkaxl", MODE="0666" sudo nano /etc/udev/rules.d/50-linkaxl-conf.rules
Download the INMOS toolset
cd ~ wget -np -nd -nv http://bin.transputer.net/zip/d72uni.kria.zip d=/opt/inmos/d72uni sudo mkdir -p $d sudo unzip d72uni.kria.zip -d $d rm d72uni.kria.zip for name in $d/itools/*.btl; do sudo chmod +x ${name%.btl}; done unset d
Configure the INMOS toolset
# create /etc/profile.d/inmos-toolset.sh # # shellcheck shell=sh # export ISEARCH=/opt/inmos/d72uni/libs/ # export ISERVER=$(which iserver) # export ITERM=/opt/inmos/d72uni/iterms/sun.itm # export IBOARDSIZE='#1000000' # export IDEBUGSIZE='#1000000' # export PATH=/opt/inmos/d72uni/itools:$PATH # export TRANSPUTER='linkaxl.so.1@/dev/uio4' # export LINKIO_SYSTEM_CONTROL_DELAY=5 sudo nano /etc/profile.d/inmos-toolset.sh source /etc/profile.d/inmos-toolset.sh
Running the INMOS toolset
# create hello.c # #include <stdio.h> # int main( void ) { # printf( "Hello World!\n" ); # return 0; # } nano hello.c icc hello.c -t9 ilink hello.tco -f startup.lnk -t9 icollect hello.lku -t -o hello.btl $ISERVER -sb hello.btl
Get the INMOS toolset examples
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # !!! still under construction !!! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! git clone https://bitbucket.org/transputer/examples.c.git git clone https://bitbucket.org/transputer/examples.occ.git
What to do when a new kernel has been installed
You have to copy the uio_linkaxl.ko driver and the MicroSD speed will be switched back. See the steps above.